function searchVehicles(num, gos, cid)
{
	var listHTML = '<table class="list" id="fs_tbl"><tr><td class="d" colspan="4" 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['gos'] = gos;
	_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 class="list" id="fs_tbl">\n';
			if (result)
			{
				for (var i = 0; i < result.length; i++)
				{
					listHTML += '<tr class="s' + (parseInt(result[i]['state'])+10) + '" onmouseover="javascript:this.focus();this.className=\'s' + result[i]['state'] + '\'" onmouseout="javascript:this.className=\'s' + (parseInt(result[i]['state'])+10) + '\'">\n';
  					listHTML += '<td class="n" nowrap="nowrap"><a style="color:black" href="/vehicle.php?vid=' + result[i]['vid'] + '">' + result[i]['num'] + '</a></td>\n';
  					listHTML += '<td class="n" nowrap="nowrap"><a style="color:black" href="/vehicle.php?vid=' + result[i]['vid'] + '">' + result[i]['gos'] + '</a></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap"><a style="color:black" href="/city.php?cid=' + result[i]['cid'] + '">' + result[i]['cname'] + '</a></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap"><a style="color:black" href="/list.php?mid=' + result[i]['mid'] + '">' + result[i]['mname'] + '</a></td>\n';
	  				listHTML += '</tr>\n';
				}
			}
			else listHTML += '<tr><td class="d" colspan="4" 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);
	}
}
