function searchVehicles(num, gos, cid)
{
	var listHTML = '<table 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';

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

			var listHTML = '<table id="fs_tbl">\n';
			listHTML += '<tr><th class="ds">' + _text['NUMSIGN'] + '</th><th class="ds">' + _text['GOSNUM'] + '</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'] + '/#n' + result[i]['nid'] + '\')"\'" 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 style="color:black" href="/vehicle/' + result[i]['vid'] + '/#n' + result[i]['nid'] + '" onclick="return false"' + (result[i]['pcnt'] > 0 ? '' : ' class="nf"') + '>' + result[i]['num'] + '</a></td>\n';
   					listHTML += '<td class="n" nowrap="nowrap"><a style="color:black" href="/vehicle/' + result[i]['vid'] + '/#n' + result[i]['nid'] + '" onclick="return false"' + (result[i]['pcnt'] > 0 ? '' : ' class="nf"') + '>' + result[i]['gos'] + '</a></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap"><a style="color:black" href="/city/' + result[i]['cid'] + '/" onclick="return false">' + result[i]['cname'] + '</a></td>\n';
  					listHTML += '<td class="ds" nowrap="nowrap"><a style="color:black" href="/list.php?mid=' + result[i]['mid'] + '" onclick="return false">' + 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').style.display = 'none'; $('cars_list').innerHTML = '';", 50);
	}
}

ar1 = new Image();
ar1.src = '/img/ar1.gif';

function flip(rid)
{	var block = $('r'+rid);	if (block.style.display == 'none')
	{
		block.style.display = 'block';
		$('ar'+rid).src = ar1.src;
	}
	else
	{
		block.style.display = 'none';
		$('ar'+rid).src = '/img/ar0.gif';
	}
	return false;
}



