// JavaScript Document
var xmlHttp

function getProperties(cid,townList,maxlp,minlp,bed,bath,ptype,sqft,lotAcres)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  domainHead=document.URL
domainHead=domainHead.substr(0,domainHead.indexOf(".ct-idx"))
domainHead=domainHead.substr(domainHead.indexOf("://")+3)
var url="http://"+domainHead+".ct-idx.com/idx/searchStyle10_getProps.php?cid="+cid+"&TOWN_LONG="+townList+"&maxLP="+maxlp+"&minlp="+minlp+"&bed="+bed+"&bath="+bath+"&ptype="+ptype+"&sqft="+sqft+"&lotAcres="+lotAcres;
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;
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
	//document.getElementById("codeBlock").innerHTML=document.getElementById("codeBlock").innerHTML+xmlHttp.responseText+"<br>";
	//alert(xmlHttp.responseText)
	response=xmlHttp.responseText
	var rRecords = new Array();
	arrayCount=0
	while (response.indexOf("~") > 0) {
		rRecords[arrayCount]=response.substring(0,response.indexOf("~"))
		response=response.substring(response.indexOf("~")+1)
		arrayCount=arrayCount+1
	}
	ListingsReturned = rRecords[0];
	totalReturns = rRecords[1];
	mapReadyReturns = rRecords[2];
	burl=rRecords[3];
	if ( rRecords[2] > 0){loadMap();}
	if (rRecords[2] == 0){
		document.getElementById("returnResponse").innerHTML='<font color="#ff0000">Your search returned no results. Please change your criteria and try again.</font>'
	}

}
}