var xmlhttp;

function ReSearchList() {
  var GetURL;
  var BusName = document.getElementById("BusinessName").value;
  var BusType = document.getElementById("BusinessType").value;
  var City = document.getElementById("City").value;
  var Zip = document.getElementById("Zip").value;

  xmlhttp=null;

  GetURL = "/LocalBusiness/CreateList1.asp?BN=" + BusName + "&BT=" + BusType + "&City=" + City + "&Zip=" + Zip;

  if (window.XMLHttpRequest) {
    xmlhttp=new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (xmlhttp!=null) {
    xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("GET",GetURL,true);
    xmlhttp.send(null);
  }
  else {
    alert("Your browser does not support the XMLHTTP.");
  }
}

function state_Change() {
  if (xmlhttp.readyState==4) {
    if (xmlhttp.status==200) {
      document.getElementById("BusList").innerHTML = "";
      document.getElementById("BusList").innerHTML = xmlhttp.responseText;
    }
    else {
      alert("Problem retrieving data:" + xmlhttp.statusText);
    }
  }
}

function ShowBusiness(BusObj) {
  var BusHeadObj;
  var BusMainObj;
  var CloseButton;
  var BusInfoObj;

  BusMainObj = BusObj.parentNode.parentNode.parentNode.parentNode;
  CloseButton = BusMainObj.getElementsByTagName("div")[0];
  BusInfoObj = BusMainObj.getElementsByTagName("div")[1];
  BusHeadObj = BusMainObj.getElementsByTagName("table")[0];

  BusHeadObj.onmouseout = function() { this.style.backgroundColor = "#EAE9DC"; };
  CloseButton.style.display = "block";
  BusInfoObj.style.display = "block";
}

function CloseBus(CloseButton) {
  var BusHeadObj;
  var BusMainObj;
  var BusInfoObj;

  BusMainObj = CloseButton.parentNode.parentNode.parentNode.parentNode.parentNode;
  BusInfoObj = BusMainObj.getElementsByTagName("div")[1];
  BusHeadObj = BusMainObj.getElementsByTagName("table")[0];

  BusHeadObj.onmouseout = function() { this.style.backgroundColor = ""; };
  CloseButton.style.display = "none";
  BusInfoObj.style.display = "none";
}
