var xmlhttp = createXmlHttpRequestObject();
function createXmlHttpRequestObject() 
{
  var xmlHttp;
  try
  {
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}
function process()
{
   var query = document.getElementById('searchfield').value;
   if(query!="")
   {
      document.getElementById('content').innerHTML = "<span id=\"search\">Searching...</span>";
        //This sets a variable with the URL (and query strings) to our PHP script
		var url	=	'/ajax/search.php/search/'+query;
      xmlhttp.open('GET', url, true);
      xmlhttp.onreadystatechange = function()
      {
         if(xmlhttp.readyState==4 && xmlhttp.status==200)
         {
            document.getElementById('content').innerHTML = xmlhttp.responseText + ' ';
         }
      };
      xmlhttp.send(null);
   }
}
