var searchReq = getXmlHttpRequestObject();

function getXmlHttpRequestObject() {
  var xmlHttp;
  
  if (window.ActiveXObject) {
    try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.6.0"); return xmlHttp;} catch (e) {}
    try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.5.0"); return xmlHttp;} catch (e) {}
    try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0"); return xmlHttp;} catch (e) {}
    try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0"); return xmlHttp;} catch (e) {}
    try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); return xmlHttp;} catch (e) {}
    try {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); return xmlHttp;} catch (e) {}
  } else {
    try {xmlHttp = new XMLHttpRequest(); return xmlHttp;} catch (e) {}
  }
}

function searchSuggest() {
  if (searchReq.readyState == 4 || searchReq.readyState == 0) {
    var str = escape(document.getElementById('find').value);
    searchReq.open("GET", '../suggest.php?s=' + str, true);
    searchReq.onreadystatechange = handleSearchSuggest; 
    searchReq.send(null);
  }		
}

function handleSearchSuggest() {
  if (searchReq.readyState == 4) {
    var ss = document.getElementById('search_suggest')
    ss.innerHTML = searchReq.responseText;
  }
}

function clearSearchSuggest() {
  var ss = document.getElementById('search_suggest')
  ss.innerHTML = '';
}