$hintDelay		= 250; // in Milliseconds;
$hintHandler	= false;
$text			= false;
$request		= false;

function doSearch($input) {
	$text			= $input;
	$request		= $input.value;
	if ($hintHandler) { clearTimeout($hintHandler); }
	$hintHandler	= setTimeout("makeSearch()", $hintDelay);
//	$("#searchHint").removeClass('visible');
}

function makeSearch() {
	if ($request == $text.value) {
		var $url		= "/in_site/tools/ajax/browser.php?qs=" + $text.value;
		$.get($url, function($html) {
			if ($html) {
				$("#searchHint").html($html);
				// zaprocessim A tegi
				$("#searchHint A").each(function() {
					$(this).bind("click", function(e) {
						addToCart(this.id.substr(2), 1, e, $(this));
						$("#qs").focus();
						return false;
					});

					$(this).bind('mouseover',function(event) {
						$("#qs").focus();
						$(this).addClass('selected');
					});

					$(this).bind('mouseout',function(event) {
						$(this).removeClass('selected');
					});

			    });

				$("#searchHint").addClass('visible');
			} else {
				$("#searchHint").removeClass('visible');
			}
			$("#qs").focus();
		});
	}
	return false;
}



