var xmlHttp;

function emptyBox() {
	document.getElementById("txtHint").innerHTML = "Option 1: Type in the above search area to see the results here. <br /> Option 2: All articles are given below.";
	document.getElementById("txtSearch").focus();
	return;
}
		
function showHint(str) {
	if (str.length == 0) { 
		document.getElementById("txtHint").innerHTML = "Option 1: Type in the above search area to see the results here. <br /> Option 2: All articles are given below.";
		return;
	}
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url = "/body_pages/searcharticle_body.php";
	url = url + "?q=" + str.replace("%", "");
	url = url + "&sid=" + Math.random();
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
} 

function stateChanged() { 
	if (xmlHttp.readyState == 2) {
	document.getElementById("txtHint").innerHTML = "Processing, Please wait ...<br /><br /><img src=\"/images/progress_bar.gif\" alt=\"in progress\" title=\"processing, please wait\" />";
	//	document.getElementById("txtHint").innerHTML = "Processing...<br />Please wait...";
	}

	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { 
		document.getElementById("txtHint").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;
}
