/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/

$(document).ready(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();
	 });
	 
}
);
function lookup(inputString) {

var manufacturerID="";

	if(inputString.length == 0) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {

	
    if (document.getElementById('ManufacturerID') != null)
        manufacturerID = document.getElementById('ManufacturerID').options[document.getElementById('ManufacturerID').selectedIndex].value;

	 $('#imgInProgress').css('visibility','visible');
	$.ajax({
  url: "../PredictivSearch/PredictivSearch.ajax.aspx?SearchText="+inputString+"&ManufacturerId="+manufacturerID,
  type: "POST",
  success: function(result){ 
    //alert(result);
    $('#suggestions').fadeIn(); // Show the suggestions box
	$('#suggestions').html(result); // Fill the suggestions box
	$('#imgInProgress').css('visibility','hidden');
  }
});



	}
}
