
var xmlHttp
var propnum=1;var isIE=document.all?true:false;var showDiv=false;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 getFeaturedProperty()
{document.getElementById("featuredprop").innerHTML="Testing";}
function showFeaturedProp()
{setInterval("setProp()",5000);}
function setProp()
{getPrevFeaturedProp(propnum);var numprops=parseInt(document.getElementById("featuredpropnum").value);if(propnum>numprops)
{propnum=1;}
else
{propnum++;}}
function getPrevFeaturedProp(number)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var url="/includes/getFeaturedProp.php?prop=";url=url+number;url=url+"&rand="+Math.floor(Math.random()*10000000)
xmlHttp.onreadystatechange=stateSent;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function stateSent()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{document.getElementById("featuredprop").innerHTML=xmlHttp.responseText}}
function LoadFeatures()
{if(document.getElementById("featuredprop"))
{getFeaturedProperty();}}
function eCheck(str)
{var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;var ldot=str.indexOf(dot);if(str.indexOf(at)==-1){return false;}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false;}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false;}
if(str.indexOf(at,(lat+1))!=-1){return false;}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false;}
if(str.indexOf(dot,(lat+2))==-1){return false;}
if(str.indexOf(" ")!=-1){return false;}
return true;}
function addToShortlist(propref,event)
{xmlHttp=GetXmlHttpObject()
var eve;if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
if(isIE)
{eve=window.event;}
else
{eve=event;}
customToolTip(eve,'Property added to shortlist.');var url="/includes/addtoshortlist.php?prop=";url=url+propref;url=url+"&rand="+Math.floor(Math.random()*10000000)
xmlHttp.onreadystatechange=shortSent;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function removeFromShortlist(propref,event)
{xmlHttp=GetXmlHttpObject()
var eve;if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
if(isIE)
{eve=window.event;}
else
{eve=event;}
var url="/includes/removefromshortlist.php?";url=url+"prop="+propref;url=url+"&rand="+Math.floor(Math.random()*10000000)
xmlHttp.onreadystatechange=shortRemove;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function shortSent()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{}}
function shortRemove()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{window.location="/shortlist/";}}
function customToolTip(e,msg,left,top)
{try
{hideToolTip();}
catch(e)
{}
if(e==null)
{e=window.event;}
if(!left)
{left=0;}
if(!top)
{top=0;}
var footer="<br /><br /><a onClick=\"hideToolTip()\" style=\"cursor: pointer;\">Click to close</a>";var positions=getMousePosition(e);var myTip=document.createElement('div');myTip.style.backgroundColor='#FFFFFF';myTip.style.borderWidth='4px';myTip.style.borderStyle='solid';myTip.style.borderColor='#CCCCCC';myTip.style.color='black';myTip.style.padding='10px';myTip.style.width='300px';myTip.style.position='absolute';myTip.style.fontSize='14px';myTip.style.zIndex='5';myTip.style.top=((parseInt(top))+(positions[1]))+'px';myTip.style.left=(parseInt(positions[0])+parseInt(left))+'px';myTip.setAttribute('id','myDiv');myTip.setAttribute('onclick','hideToolTip()');myTip.innerHTML=msg+footer;if(!showDiv)
{document.body.appendChild(myTip);showDiv=true;}}
function hideToolTip()
{try
{var myTool=document.getElementById('myDiv');document.body.removeChild(myTool);showDiv=false;}
catch(err){}}
function getMousePosition(ev){var _x;var _y;if(!isIE){_x=ev.pageX-300;_y=ev.pageY;}
if(isIE){_x=(ev.clientX+document.body.scrollLeft+document.documentElement.scrollLeft)-350;_y=ev.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
posX=_x;posY=_y;var pos=Array(posX,posY);return pos;}