
var xmlHttp;
var source, destination, caller;

var sources = new Array();
sources[0] = "searchOne";
sources[1] = "searchTwo";
//Custom version of the innerHTML.html script from the Asleson and Schutta book

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
    

function startRequest(inSource,inDestination,inCaller) {
			source=inSource;
			destination=inDestination;
			caller=inCaller;
            createXMLHttpRequest();
            xmlHttp.onreadystatechange = handleStateChange;
            xmlHttp.open("GET", source +"?searchInfo="+inCaller.value, true);
            xmlHttp.send(null);
}

function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            document.getElementById(destination).innerHTML = xmlHttp.responseText;
			if (xmlHttp.responseText == "")
				{
				document.getElementById(destination).style.display="none"
				}
			else
				{
				document.getElementById(destination).style.display="block"
				}
        }
    }
}