function searchUpdateOn () {
document.getElementById('suggestBox').style.visibility='visible'
}

function searchUpdateOff () {
document.getElementById('suggestBox').style.visibility='hidden'
document.getElementById('suggestBox').style.border='0'
}

function searchUpdate () {
q = document.getElementById('q').value
var curleft = curtop = 0;
	var obj = document.getElementById('q');
	if (obj.offsetParent)
	{
		do
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		while (obj = obj.offsetParent);
		curtop = curtop + document.getElementById('q').offsetHeight;
		document.getElementById('suggestBox').style.top = curtop + 'px';
		document.getElementById('suggestBox').style.left = curleft + 'px';	
	}


	if (!q) {
	searchUpdateOff()
	} else {
	var http = new XMLHttpRequest();
	var url = "searchUpdate.php?q="+q+"";
	http.open("GET", url, true);
	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) {
			
			if (!http.responseText) {
			searchUpdateOff()
			} else {
			searchUpdateOn()
			document.getElementById('suggestBox').innerHTML=http.responseText;
			}
			
		}
	
	}
	http.send(null);
}


}

function searchBoxFade () {
setTimeout("searchUpdateOff()",500)
}

function replaceQ (ss) {
document.getElementById('q').value=ss	
}