/*
+---------------------------------------------------------------------------------------------->
|   Suggestive Search v2.6 - Copyright 2009 - 2011 Site Smart Web Services - http://sitesmartuk.com
+---------------------------------------------------------------------------------------------->
*/

var xmlHttp

function suggestiveSearch(string){

	if (string.length == 0) { 
		 document.getElementById("suggestivesearch").innerHTML = "";
		 return
	}
	
	xmlHttp = GetXmlHttpObject()
	
	if (xmlHttp == null){
		alert ("Browser does not support HTTP Request")
		return
	} 
		
	var url="/suggestivesearch/suggestivesearch.inc.php"
	url=url+"?query="+string
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange = stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function stateChanged(){ 

	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
	 
		document.getElementById("suggestivesearch").style.display = 'block';
		document.getElementById("suggestivesearch").innerHTML = xmlHttp.responseText;
	
	} 

}

function GetXmlHttpObject() {

	var xmlHttp = null;

	try

 	{
 		xmlHttp = new XMLHttpRequest();
 	}

	catch (e)

 	{
 		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		 catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
 	}
	
	return xmlHttp;

}

