/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/
/*
google.load("jquery", "1.3.1");
google.setOnLoadCallback(function()
{
	// Safely inject CSS3 and give the search results a shadow
	var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
		'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
		'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);
	
	// Fade out the suggestions box when not active
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	 });
});
*/
//var timer_searching = false;
var search_num = 0;

function lookup(inputString) {

	if($('#inputString').val().length < 1) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		search_num++;
		var thissearch = search_num;
	
		var thecategorys = $('input#thecategorys').val();
		//console.info("Inputstr:" + thecategorys);
		$.post("fileadmin/www/hags.com/usa/php/hags_livesearch.php?cats="+escape(thecategorys), {queryString: ""+$('#inputString').val()+""}, function(data) { // Do an AJAX call		
			if(thissearch==search_num){
				$('#suggestions').fadeIn(); // Show the suggestions box
				$('#suggestions').html(data); // Fill the suggestions box
				Cufon.replace('.product_list_title, .header h1',{ fontFamily: 'stagsemibold'});
			}
		});
	}	
}
