var xmlhttp;

function refinesearch(formid,drop_loc,drop_diag){
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="panel_numhomes.php";

if(document.getElementById(drop_loc).value !== "_" || document.getElementById(drop_diag).value !== "_"){
	url=url+"?";
	var criteria = 0;
	if(document.getElementById(drop_loc).value !== "_"){
		url= url + "l=" + document.getElementById(drop_loc).value;
		criteria++;
	}
	if(document.getElementById(drop_diag).value !== "_"){
		if(criteria > 0){
			url=url+"&";
		}
		url= url + "d=" + document.getElementById(drop_diag).value;
		criteria++;
	}
}
if(criteria > 0){
url=url+"&sid="+Math.random();
} else{
url=url+"?sid="+Math.random();
}
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

}


function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("numhomes").innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}


function searchhomenow(){
	document.searchhomes.action = "search_results.php";
	document.searchhomes.submit();
	return true
}