
function ajaxFunction()
{  
	
	
// Create the Ajax link
// ------------------------------------------
	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 AJAX!");		  return false; 	   
			}	  
		}    
	}
	
// ------------------------------------------


// return the output to the screen somehow
// ------------------------------------------
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText){
				document.getElementById('searchsuggest').className="show";
			}
			document.getElementById('searchsuggest').innerHTML='';
			document.getElementById('searchsuggest').innerHTML='<ul>' + xmlHttp.responseText + '</ul>';
		}
	}
	
	
	
// ------------------------------------------

// create the query
// ------------------------------------------
	if (document.getElementById('searchfield').value){
		
		query="searchajax.php";
		params="search=" + document.getElementById('searchfield').value;
		xmlHttp.open("GET",query+"?"+params,true);
		//xmlHttp.open("POST",query,true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(params);  
	}
	
}

// ------------------------------------------

function hidesearch (){
	if (document.getElementById('searchfield').value.length<3){
		document.getElementById('searchsuggest').className="hide";	
	}
}