function searchVehicles(num, type, cid)
{
	var listHTML = '<table class="list" id="fs_tbl"><tr><td class="d" colspan="3" nowrap="nowrap">' + _text['IX_WAIT'] + '</td></tr></table>\n';
	$('cars_list').innerHTML = listHTML;
	$('cars_list').style.display = 'block';

	var _arr = new Array();
	_arr['num']  = num;
	_arr['type'] = type;
	_arr['cid']  = cid;


	JsHttpRequest.query(
		'/ajax.php?ajax-action=index-qsearch',
		_arr,
		function (result, errors)
		{
			if (errors)
			{
				$('cars_list').innerHTML = '<strong style="color:red">Во время поиска произошла ошибка:</strong><br /><br />' + errors;
				$('cars_list').style.display = 'block';
			}

			var listHTML = '<table id="fs_tbl">\n';
			listHTML += '<tr><th class="ds">' + _text['NUMSIGN'] + '</th><th class="ds">' + _text['CITY'] + '</th><th class="ds">' + _text['MODEL'] + '</th></tr>\n';
			if (result)
			{
				for (var i = 0; i < result.length; i++)
				{
					listHTML += '<tr class="s' +  result[i]['state'] + '" style="cursor:pointer" onclick="window.open(\'/vehicle/' + result[i]['vid'] + '/\')"\'" onmouseover="this.focus(); this.className=\'s' + result[i]['state'] + '\'" onmouseout="this.className=\'s' + (parseInt(result[i]['state'])+10) + '\'">\n';
  					listHTML += '<td class="n" nowrap="nowrap"><a href="/vehicle/' + result[i]['vid'] + '/" onclick="return false"' + (result[i]['pcnt'] > 0 ? '' : ' class="nf"') + '>' + result[i]['num'] + '</a></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap"><b>' + result[i]['cname'] + '</b></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap">' + result[i]['mname'] + '</td>\n';
	  				listHTML += '</tr>\n';
				}
			}
			else listHTML += '<tr><td class="d" colspan="3" nowrap="nowrap">Ничего не найдено.</td></tr>\n';
			listHTML += '</table>\n';

			$('cars_list').innerHTML = listHTML;
		},
		false
	);

    return false;}

document.onclick = function(e)
{
	e = e || window.event;
	E = e.target || e.srcElement;
	if (E.id != 'fs_tbl')
	{		if ($('cars_list').style.display == 'block')
			setTimeout("$('cars_list').innerHTML = ''; $('cars_list').style.display = 'none';", 100);
	}
}



