var lasttimeout;
function searchsuggestions(delay){
	clearTimeout(lasttimeout);
	lasttimeout=setTimeout("dosearchsuggestions()", delay);
}
function dosearchsuggestions(){
	var searchbox=document.getElementById('t');
	var t=searchbox.value;
	
	var xmlHttp;
	try{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e){  // Internet Explorer  
		try	{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
//				alert("Your browser does not support our search suggestion function");      
				return false;      
			}
		}
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			var searchresultsbox=document.getElementById('searchresults');
			searchresultsbox.innerHTML=xmlHttp.responseText;
			searchresultsbox.style.visibility = 'visible';
			searchresultsbox.style.display = 'block'; 
		}
	}
//	alert("Making a request");
	xmlHttp.open("GET", "http://www.newhomesforsale.co.uk/includes/search_suggestions.php?q=" + t,true);
	xmlHttp.send(null);	
}

function closess(){
	var searchresultsbox=document.getElementById('searchresults');
	searchresultsbox.style.visibility = 'hidden';
	searchresultsbox.style.display = 'none'; 
	searchresultsbox.innerHTML="<p>Enter a phrase in the search box so that we can provide some suggestions</p>";
}