window.onclick = theClick;

function theClick(){
	document.getElementById("showSearchResults").style.visibility = "hidden";	
}

var xmlHttp
var srh_url="ajax/globalSearch.php?"; 
function getSearchResults(theSearch){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
		return;
	}
	document.getElementById("showSearchResults").style.visibility = "visible";
	var qstr;
	qstr ="theSearch="+theSearch;
	xmlHttp.onreadystatechange=globalResults;
	xmlHttp.open("POST",srh_url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send(qstr);
}
//Show results
function globalResults(){ 
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("showSearchResults").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function clearSearch(obj){
	if(obj.value == "Enter Search"){
		obj.value = "";	
	}
}
