//********************************************
//this is shared for the city and country dropdowns
//********************************************

function com_show_dropdowns(str,str2)
{
	com_show_dropdown1(str, str2)
	com_show_dropdown2(str, str2)
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("com_county_dropdown").innerHTML=xmlHttp.responseText;
	}
	if (xmlHttp2.readyState==4)
	{ 
	document.getElementById("com_city_dropdown").innerHTML=xmlHttp2.responseText;
	}
}

//********************************************
//this is for the county name dropdown
//********************************************

var xmlHttp=GetXmlHttpObject();

function com_show_dropdown1(str, str2)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/get_counties.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return xmlHttp;
}

//********************************************
//this is for the city dropdown box
//********************************************

var xmlHttp2=GetXmlHttpObject2();

function com_show_dropdown2(str, str2)
{ 
	xmlHttp2=GetXmlHttpObject2();
	if (xmlHttp2==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/get_cities.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid=" + Math.random();
	xmlHttp2.onreadystatechange=stateChanged;
	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
}

function GetXmlHttpObject2()
{
	var xmlHttp2=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp2=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return xmlHttp2;
}

//********************************************
//this is for the home types  dropdown
//********************************************

var xmlHttp3=GetXmlHttpObject3();

function com_show_prod_dropdown()
{ 
xmlHttp3=GetXmlHttpObject3();
if (xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/get_hometypes.asp";
url=url+"?sid="+Math.random();
xmlHttp3.onreadystatechange=stateChanged3;
xmlHttp3.open("GET",url,true);
xmlHttp3.send(null);
}

function GetXmlHttpObject3()
{
var xmlHttp3=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp3;
}

function stateChanged3() 
{ 
if (xmlHttp3.readyState==4)
{ 
document.getElementById("com_prodtype_dropdown").innerHTML=xmlHttp3.responseText;
}
}

//********************************************
//this is for the builder name search dropdown
//********************************************

function createRequestObject() {

       var req;

       if(window.XMLHttpRequest){
          // Firefox, Safari, Opera...
          req = new XMLHttpRequest();
       } else if(window.ActiveXObject) {
          // Internet Explorer 5+
          req = new ActiveXObject("Microsoft.XMLHTTP");
       } else {
          // There is an error creating the object,
          // just as an old browser is being used.
          alert('Problem creating the XMLHttpRequest object');
       }

       return req;

}

// Make the XMLHttpRequest object
var http = createRequestObject();

function sendRequest(q,pub) {

       // Open PHP script for requests
       http.open('get', '/suggest.asp?q=' + q + '&pub=' + pub);
       http.onreadystatechange = handleResponse;
       http.send(null);

}

function handleResponse() {

	if(http.readyState == 4 && http.status == 200){

		// Text returned FROM the PHP script
		var response = http.responseText;

		if(response) {
			// UPDATE ajax content
			document.getElementById("searchResults").innerHTML = response;

		}

	}

}


//********************************************
//this is for the community name search dropdown
//********************************************

// Make the XMLHttpRequest object
var http2 = createRequestObject();

function sendRequest2(q2,pub) {

       // Open PHP script for requests
       http2.open('get', '/suggest2.asp?q2=' + q2 + '&pub=' + pub);
       http2.onreadystatechange = handleResponse2;
       http2.send(null);

}

function handleResponse2() {

	if(http2.readyState == 4 && http2.status == 200){

		// Text returned FROM the PHP script
		var response2 = http2.responseText;

		if(response2) {
			// UPDATE ajax content
			document.getElementById("searchResults2").innerHTML = response2;

		}

	}

}






//********************************************
//this is shared for the city and country dropdowns on Home Search
//********************************************

function hom_show_dropdowns(str,str2)
{
	hom_show_dropdown1(str, str2)
	hom_show_dropdown2(str, str2)
}

function hom_stateChanged() 
{ 
	if (hom_xmlHttp.readyState==4)
	{ 
	document.getElementById("hom_county_dropdown").innerHTML=hom_xmlHttp.responseText;
	}
	if (hom_xmlHttp2.readyState==4)
	{ 
	document.getElementById("hom_city_dropdown").innerHTML=hom_xmlHttp2.responseText;
	}
}

//********************************************
//this is for the county name dropdown  on Home Search
//********************************************

var hom_xmlHttp=hom_GetXmlHttpObject();

function hom_show_dropdown1(str, str2)
{ 
	hom_xmlHttp=hom_GetXmlHttpObject();
	if (hom_xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/get_counties_hom.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid="+Math.random();
	hom_xmlHttp.onreadystatechange=hom_stateChanged;
	hom_xmlHttp.open("GET",url,true);
	hom_xmlHttp.send(null);
}

function hom_GetXmlHttpObject()
{
	var hom_xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  hom_xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    hom_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    hom_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return hom_xmlHttp;
}

//********************************************
//this is for the city dropdown box  on Home Search
//********************************************

var hom_xmlHttp2=hom_GetXmlHttpObject2();

function hom_show_dropdown2(str, str2)
{ 
	hom_xmlHttp2=hom_GetXmlHttpObject2();
	if (hom_xmlHttp2==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/get_cities.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid=" + Math.random();
	hom_xmlHttp2.onreadystatechange=hom_stateChanged;
	hom_xmlHttp2.open("GET",url,true);
	hom_xmlHttp2.send(null);
}

function hom_GetXmlHttpObject2()
{
	var hom_xmlHttp2=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  hom_xmlHttp2=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    hom_xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    hom_xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return hom_xmlHttp2;
}

//********************************************
//this is for the home types dropdown  on Home Search
//********************************************

var hom_xmlHttp3=hom_GetXmlHttpObject3();

function hom_show_prod_dropdown()
{ 
hom_xmlHttp3=hom_GetXmlHttpObject3();
if (hom_xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/get_hometypes.asp";
url=url+"?sid="+Math.random();
hom_xmlHttp3.onreadystatechange=hom_stateChanged3;
hom_xmlHttp3.open("GET",url,true);
hom_xmlHttp3.send(null);
}

function hom_GetXmlHttpObject3()
{
var hom_xmlHttp3=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  hom_xmlHttp3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    hom_xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    hom_xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return hom_xmlHttp3;
}

function hom_stateChanged3() 
{ 
if (hom_xmlHttp3.readyState==4)
{ 
document.getElementById("hom_prodtype_dropdown").innerHTML=hom_xmlHttp3.responseText;
}
}

//********************************************
//this is for the school dropdowns
//********************************************

function sch_stateChanged() 
{ 
	if (sch_xmlHttp.readyState==4)
	{ 
	document.getElementById("sch_county_dropdown").innerHTML=sch_xmlHttp.responseText;
	}
}

var sch_xmlHttp=sch_GetXmlHttpObject();

function sch_show_dropdown(str)
{ 
	sch_xmlHttp=sch_GetXmlHttpObject();
	if (sch_xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/get_counties_sch.asp";
	url=url+"?pubid=" + str;
	url=url+"&sid="+Math.random();
	sch_xmlHttp.onreadystatechange=sch_stateChanged;
	sch_xmlHttp.open("GET",url,true);
	sch_xmlHttp.send(null);
}

function sch_GetXmlHttpObject()
{
	var sch_xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  sch_xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    sch_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    sch_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return sch_xmlHttp;
}





//********************************************
//********************************************
//********************************************
//
//this is for the advanced search section
//
//********************************************
//********************************************
//********************************************






//********************************************
//this is shared for the city and country dropdowns
//********************************************

function as_show_dropdowns(str,str2)
{
	as_show_dropdown1(str, str2)
	as_show_dropdown2(str, str2)
}

function as_stateChanged() 
{ 
	if (as_xmlHttp.readyState==4)
	{ 
	document.getElementById("as_county_dropdown").innerHTML=as_xmlHttp.responseText;
	}
	if (as_xmlHttp2.readyState==4)
	{ 
	document.getElementById("as_city_dropdown").innerHTML=as_xmlHttp2.responseText;
	}
}

//********************************************
//this is for the county name dropdown
//********************************************

var as_xmlHttp=as_GetXmlHttpObject();

function as_show_dropdown1(str, str2)
{ 
	as_xmlHttp=as_GetXmlHttpObject();
	if (as_xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/as_get_counties.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid="+Math.random();
	as_xmlHttp.onreadystatechange=as_stateChanged;
	as_xmlHttp.open("GET",url,true);
	as_xmlHttp.send(null);
}

function as_GetXmlHttpObject()
{
	var as_xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  as_xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    as_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    as_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return as_xmlHttp;
}

//********************************************
//this is for the city dropdown box
//********************************************

var as_xmlHttp2=as_GetXmlHttpObject2();

function as_show_dropdown2(str, str2)
{ 
	as_xmlHttp2=as_GetXmlHttpObject2();
	if (as_xmlHttp2==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/as_get_cities.asp";
	url=url+"?pubid=" + str;
	url=url+"&countyid=" + str2;
	url=url+"&sid=" + Math.random();
	as_xmlHttp2.onreadystatechange=as_stateChanged;
	as_xmlHttp2.open("GET",url,true);
	as_xmlHttp2.send(null);
}

function as_GetXmlHttpObject2()
{
	var as_xmlHttp2=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  as_xmlHttp2=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    as_xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    as_xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return as_xmlHttp2;
}

//********************************************
//this is for the home types  dropdown
//********************************************

var as_xmlHttp3=as_GetXmlHttpObject3();

function as_show_prod_dropdown()
{ 
as_xmlHttp3=as_GetXmlHttpObject3();
if (as_xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/as_hometypes.asp";
url=url+"?sid="+Math.random();
as_xmlHttp3.onreadystatechange=as_stateChanged3;
as_xmlHttp3.open("GET",url,true);
as_xmlHttp3.send(null);
}

function as_GetXmlHttpObject3()
{
var as_xmlHttp3=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  as_xmlHttp3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    as_xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    as_xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return as_xmlHttp3;
}

function as_stateChanged3() 
{ 
if (as_xmlHttp3.readyState==4)
{ 
document.getElementById("as_prodtype_dropdown").innerHTML=as_xmlHttp3.responseText;
}
}