//jQuery(document).ready(function() {
//	initSearchBoxKeyDown();
//});

// CHROME HACK... 
function chromeInitSearchBoxKeyDown() { setTimeout("initSearchBoxKeyDown()", 500); }
var browserName=navigator.appName;
if (browserName=="Netscape") { //google chrome app.Name 
	chromeInitSearchBoxKeyDown();
} else {
	window.onload = window.initSearchBoxKeyDown; // helps with Opera
}
// END CHROME HACK

function initSearchBoxKeyDown()
{
	//If Keydown In Search Box
	jQuery("input[name=keywords]").keyup(function() {
		//If Search Box Value is Nothing
		if(jQuery("input[name=keywords]").val() == "") {
			//Hide the Div, No Search Query Is Given. 		
			jQuery("#resultsContainer").hide("blind");
			exit();
				
		} else {
			//Get the Result		
			getResults()
		}
	});
}

function clearInput(e){
	if(e.value=='Search Here...') e.value="";
} 


function getResults()
{
	if(jQuery("input[name=keywords]").val() == "") {
			
		//Hide the Div, No Search Query Is Given. 		
		
		jQuery("#resultsContainer").hide("blind");
		exit();
	}

	//Use instant_search.php to find result
	keywords = jQuery("input[name=keywords]").val();	
	jQuery.get(
		gjsvar_InstantSearchURL,
		{ query: keywords, type: "results" },
		function(data) {			
			//Insert HTML and Show The Div

			if (!jQuery("#resultsContainer").is(":visible")) {
				jQuery("#resultsContainer").show("blind");	
			}
	
			jQuery("#resultsContainer").html(data);
		}
	);
}

