var xmlHttp
var redirectValid = false;
function page_startup(){
	document.getElementById('resultSection').style.left = '220px';
	document.getElementById('resultSection').style.width = '700px';
	document.getElementById('searchForm').style.display = '';
}
function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
	}
	catch(e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function handleSearchUpdate(searchValue){
	var e=e||window.event;
	document.getElementById("results").innerHTML = "<div class='message'>Search In Progress.</div>";
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null){ //Handle Error
		alert ("Your browser does not support AJAX!");
		return;
	}
	//Create Url String
	var url = "schools.php?schoolSearch=" + searchValue
	/*if (e.keyCode == 13){
		url += "&submit=true";
		redirectValid = true;
	}
	else redirectValid = false;*/
	//Set Handler
	xmlHttp.onreadystatechange=updateResults;
	//Send Request
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function updateResults(){ 
	if (xmlHttp.readyState==4){ 
		document.getElementById("results").innerHTML = xmlHttp.responseText;
		if(redirectValid){
			try{
				rLocation = document.getElementById("redirect").innerText;
			}
			catch(Error){
				rLocation = document.getElementById("redirect").textContent;
			}
			document.location.href = rLocation;
		}
	}
}