var req;
var url="glossary_search.cfm?q=";
function Initialize() {
	try {
		req=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e) {
		try {
			req=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc) {
			req=null;
		}
	}

	if(!req&&typeof XMLHttpRequest!="undefined") {
		req=new XMLHttpRequest();
	}
}

function SendQuery(key) {
	Initialize();

	if(req!=null) {
		req.onreadystatechange = Process;
		if(key=='') {
			req.open("GET", url+'A', true);
		} else {
			req.open("GET", url+key, true);
		}
        req.send(null);
	} else {
		return false;
	}
	/*if(key=='none') {
		document.getElementById("autoget").innerHTML ="";
	}*/
}

function Process() {
	if (req.readyState == 4) {
        // only if "OK"
		if (req.status == 200) {
			if(req.responseText=="") {
				document.getElementById("autoget").innerHTML ="No results were found. Please try again.";
			} else {
				ShowDiv("autoget");
				document.getElementById("autoget").innerHTML =req.responseText;
			}
		} else {
			document.getElementById("autoget").innerHTML="A problem occured. Please try again.";
		}
	}
}

function ShowDiv(divid) {
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.visibility="visible";
}

function HideDiv(divid) {
   if (document.layers) document.layers[divid].visibility="hide";
   else document.getElementById(divid).style.visibility="hidden";
}

function BodyLoad() {
	document.form1.keyword.focus();
	document.form1.keyword.style.background="#ffe";
	document.form1.keyword.style.padding="3px";
	document.form1.keyword.style.border="solid 1px";
	SendQuery("A");
}

