var xmlHttp;

function search(text)
{
  br = 0;

  if (text.substring(0, 18) == "Type your keywords") {
    document.getElementById("txtDetails").innerHTML = "";
  } else {
    if (text.length >= 2) {
      try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
        br = 1;
      } 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;
          }
        }
      }

      xmlHttp.onreadystatechange=onSearch;
      xmlHttp.open("GET", "../php/search-assist.php?q=" + text + "&br=" + br, true);
      xmlHttp.send(null);
    } else {
      document.getElementById("txtDetails").innerHTML = "";
    }
  }
}

function onSearch() 
{ 
  if (xmlHttp.readyState==4)
  { 
    document.getElementById("txtDetails").innerHTML=xmlHttp.responseText;
  }
}