//
// B2BSeller Extensions Javascript Library | Triactive Media
//
$(document).ready(function() {
						   
	// Fade out the suggestions box when not active
	$(".ProductSearch_Input111").blur(function(){
		$('#suggestions').fadeOut();
	});


});

// 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);



 
 
// Search Suggestion
function lookup(inputString) {
	delay(function(){
		if(inputString.length == 0) {
			$('#suggestions').fadeOut(); 
		}
		else if (inputString.length > 1) {
			$.get("/customer/shodis/B2BSellerExtensions/handlers/SearchSuggestion.ashx", {q: ""+inputString+""}, function(data) { 													 
				$('#suggestions').fadeIn(); 
				$('#suggestions').html(data); 
			});
		}
	}, 250 );
}


// Delay Function
var delay = (function(){
	var timer = 0;
	return function(callback, ms){
		clearTimeout (timer);
		timer = setTimeout(callback, ms);
	};
})();
	

