/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)

//var google;
google.load("jquery", "1.3.2");
google.setOnLoadCallback(function()*/
(function($)
{
	
	// Safely inject CSS3 and give the search results a shadow
	var cssObj = { 'box-shadow' : '2px 2px 4px #666', // Added when CSS3 is standard
		'-webkit-box-shadow' : '2px 2px 4px #666', // Safari
		'-moz-box-shadow' : '2px 2px 4px #666'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);
	
	// Fade out the suggestions box when not active
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	 });
});

function lookup(inputString) {
	if(inputString.length < 3) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		/*$.post("../inc/search.html", {Input: ""+inputString+""}, 
		function(data) { // Do an AJAX call
			$('#suggestions').fadeIn(); // Show the suggestions box
			//document.write(data);
			$('#suggestions').html(data); // Fill the suggestions box
			if(data.length == 0) {
				$('#suggestions').fadeOut()
			}
		});*/
		
	/***************************/
			$('#suggestions').html("<p id='searchresults'><span class='wait-search'>&nbsp;</span><span class='searchheading'></span></p>");
		$.ajax({
			type : 'POST',
			url : '../inc/search.html',
			dataType : 'html',
			data : "Input="+inputString,
			success : function(data){
				$('#suggestions').html();
				$('#suggestions').fadeIn(function() {
				  if (! $.support.opacity) {
					this.style.removeAttribute('filter');
				  }
				});
				$('#suggestions').html(data);
				if(data.length == 0) {
					$('#suggestions').fadeOut(function() {
				  if (! $.support.opacity) {
					this.style.removeAttribute('filter');
				  }
				})
				}
			}
		});
	}
}


