
var xmlHttp
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
function showData(start,amount,where,order,dir,data)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var url="/includes/propsearch/getData.php"
url=url+"?start="+start
url=url+"&amount="+amount
url=url+"&where="+where
url=url+"&order="+order
url=url+"&dir="+dir
url=url+"&data="+data
url=url+"&rand="+Math.floor(Math.random()*10000000)
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
return true;}
function stateChanged()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{var temp=xmlHttp.responseText.split("$$$");document.getElementById("tabledata").innerHTML=temp[0];document.getElementById("tableinfo").innerHTML=temp[1];document.getElementById("sortmenu").innerHTML=temp[2];document.getElementById("pagelinks").innerHTML=temp[3];document.getElementById("pagelinks2").innerHTML=temp[3];}}
function stateSearch()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{var temp=xmlHttp.responseText;if(temp!="")
{showData(0,10,temp,'','');}
else
{showData(0,10,'','','');}}}
function customSearch(where,type)
{if(document.getElementById("newpropchck").checked&&document.getElementById("vtcheck").checked)
{showData('0','10',where+'==CREATEDDATE|>|2008-09-01==VIRTUALTOUR|>|2008-09-01','','',type);}
else
{if(document.getElementById("newpropchck").checked)
{showData('0','10',where+'==CREATEDDATE|>|2008-09-01','','',type);}
else
{if(document.getElementById("vtcheck").checked)
{showData('0','10',where+'==VIRTUALTOUR|>|2008-09-01','','',type);}
else
{showData('0','10',where,'','',type);}}}}
function doSearch()
{var startdate=document.getElementById("startdate").value;var area=document.getElementById("area").value;var holLength=document.getElementById("hollength").value;var pets=document.getElementById("pets").value;var smokes=document.getElementById("smokes").value;var sleeps=document.getElementById("sleeps").value;var DateError=false;var IsFound;if(startdate!="")
{var temp=startdate.split("-");if(isNaN(parseInt(temp[0])))
{DateError=true;}
if(isNaN(parseInt(temp[1])))
{DateError=true;}
if(isNaN(parseInt(temp[2])))
{DateError=true;}}
if(DateError==false)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var url="/includes/propsearch/getPropertySearch.php"
url=url+"?fromdate="+startdate
url=url+"&area="+area
url=url+"&pets="+pets
url=url+"&smokes="+smokes
url=url+"&sleeps="+sleeps
url=url+"&rand="+Math.floor(Math.random()*10000000)
xmlHttp.onreadystatechange=stateSearch
xmlHttp.open("GET",url,true)
xmlHttp.send(null)}
else
{alert("Incorrect date format, please make sure the date format is in 'dd/MM/yyyy'");}}
function getElementsByAttribute(oElm,strTagName,strAttributeName,strAttributeValue)
{var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);var arrReturnElements=new Array();var oAttributeValue=(typeof strAttributeValue!="undefined")?new RegExp("(^|\\s)"+strAttributeValue+"(\\s|$)"):null;var oCurrent;var oAttribute;for(var i=0;i<arrElements.length;i++)
{oCurrent=arrElements[i];oAttribute=oCurrent.getAttribute&&oCurrent.getAttribute(strAttributeName);if(typeof oAttribute=="string"&&oAttribute.length>0)
{if(typeof strAttributeValue=="undefined"||(oAttributeValue&&oAttributeValue.test(oAttribute)))
{arrReturnElements.push(oCurrent);}}}
return arrReturnElements;}