
function initPage(legacy){addRoundedCorners();addRoundedLozenges();enableScrollingBoxes();if(!legacy){createHTMLDropDowns();}}
var scrollingDivs=[];function enableScrollingBoxes(){var div=document.body.getElementsByTagName('div');if(div){for(var i=0;i<div.length;i++){if(PP.Util.hasClass(div[i],'scrollingBox')){scrollingDivs[scrollingDivs.length]=div[i];}}}
setInterval(scrollingBoxes,250);}
function scrollingBoxes(){var top=PP.Util.getScrollY();for(var i=0;i<scrollingDivs.length;i++){if(!scrollingDivs[i].xstoppos&&PP.Util.getElementTop(scrollingDivs[i])<=top+20&&PP.Util.getDocumentWidth()>=970){scrollingDivs[i].style.position='fixed';scrollingDivs[i].style.top='20px';scrollingDivs[i].xstoppos=(top+20);}
if(scrollingDivs[i].xstoppos&&scrollingDivs[i].xstoppos>top+20){scrollingDivs[i].style.position='';scrollingDivs[i].style.top='';scrollingDivs[i].xstoppos=null;}}}
function addRoundedCorners(){addRoundedCornersByTagName('DIV');addRoundedCornersByTagName('LI');}
function addRoundedCornersByTagName(tagName){var div=document.body.getElementsByTagName(tagName);if(div){for(var i=0;i<div.length;i++){if(!div[i].xrbadded){var cls=div[i].className.split(" ");for(var j=0;j<cls.length;j++){if(cls[j].match('xrb\\d+$')){var spantl=document.createElement('span');spantl.className=cls[j]+'tl';div[i].appendChild(spantl);var spantr=document.createElement('span');spantr.className=cls[j]+'tr';div[i].appendChild(spantr);var spanbl=document.createElement('span');spanbl.className=cls[j]+'bl';div[i].appendChild(spanbl);var spanbr=document.createElement('span');spanbr.className=cls[j]+'br';div[i].appendChild(spanbr);}}
div[i].xrbadded=true;}}}}
function addRoundedLozenges(){addRoundedLozengesByTagName('SPAN');addRoundedLozengesByTagName('A');}
function addRoundedLozengesByTagName(tagName){var div=document.body.getElementsByTagName(tagName);if(div){for(var i=0;i<div.length;i++){var cls=div[i].className.split(" ");for(var j=0;j<cls.length;j++){if(cls[j].match('xlz\\d+$')){var spantl=document.createElement('span');spantl.className=cls[j]+'l';div[i].appendChild(spantl);var spantr=document.createElement('span');spantr.className=cls[j]+'r';div[i].appendChild(spantr);}}}}}
function openWelcome(height){PP.Animation.animate('welcomeText',null,null,null,height,250);var a=PP.getElementById('wtopen');if(a){a.style.display='none';}}
function closeWelcome(height){PP.Animation.animate('welcomeText',null,null,null,height,250);var a=PP.getElementById('wtopen');if(a){a.style.display='inline';}}
function slidingDivMove(outer,inner,move,prev,next){outer=PP.getElementById(outer);inner=PP.getElementById(inner);prev=PP.getElementById(prev);next=PP.getElementById(next);var oh=PP.Util.getElementHeight(outer);var ih=PP.Util.getElementHeight(inner);var page=inner.xpg;if(!page)page=0;var top=((page+move)*oh);if(top>ih||top<0){return;}
inner.xpg=page+move;inner.style.position='relative';inner.style.top='-'+top+'px';if(top==0)PP.Util.addClass(prev,'disabled');else PP.Util.removeClass(prev,'disabled');if((top+oh)>=ih)PP.Util.addClass(next,'disabled');else PP.Util.removeClass(next,'disabled');}
function enableNoTooltip(){var a=document.body.getElementsByTagName('a');if(a){for(i=0;i<a.length;i++){if(PP.Util.hasClass(a[i],'notooltip')){a[i].title='';}}}}
function otherEnquiry(cbx,txt,enq){if(cbx.checked){txt=PP.getElementById(txt);txt.style.display='';txt.value=enq;}
else{txt=PP.getElementById(txt);txt.style.display='none';txt.value='';}}
function liMouseOver(event,li){if(PP.Util.isValidMouseOverOutEvent(event,li)){PP.Util.addClass(li,'hover');}}
function liMouseOut(event,li){if(PP.Util.isValidMouseOverOutEvent(event,li)){PP.Util.removeClass(li,'hover');}}
function photosNp(dir){var slider=PP.getElementById('thumbSlider');var prev,next,current;var links=slider.getElementsByTagName('A');for(var i=0;i<links.length;i++){if(PP.Util.hasClass(links[i],'current')){current=links[i];if(links.length-1>i){next=links[i+1];}
else{next=links[0];}
if(i==0){prev=links[links.length-1];}
else{prev=links[i-1];}}}
if(dir>0){next.onclick();}
else if(dir<0){prev.onclick();}}
function photosSwitch(a,src,idx){var slider=PP.getElementById('thumbSlider');var wrapper=slider.parentNode;if(idx){PP.getElementById('currentImg').innerHTML=idx;}
if(PP.Util.getElementRight(a)>PP.Util.getElementRight(wrapper)){var diff=(PP.Util.getElementLeft(a)-PP.Util.getElementWidth(wrapper))/PP.Util.getElementWidth(wrapper);photosSlide(Math.ceil(diff));}
else if(PP.Util.getElementLeft(a)<PP.Util.getElementLeft(wrapper)){var diff=(PP.Util.getElementLeft(wrapper)-PP.Util.getElementLeft(a))/PP.Util.getElementWidth(wrapper);photosSlide(-(Math.ceil(diff)));}
var img=document.createElement('IMG');img.src=src;var wrapper=PP.getElementById('mainImg');PP.Util.addClass(wrapper,'loading');var inactive=slider.getElementsByTagName('A');for(var i=0;i<inactive.length;i++){PP.Util.removeClass(inactive[i],'current');}
PP.Util.addClass(a,'current');setTimeout(function(){photosDoSwitch(img);},10);}
function photosDoSwitch(img){if(img.complete){var currentWidth=img.width;var ratio=570/currentWidth;var newWidth=currentWidth*ratio;if(newWidth<currentWidth){img.width=newWidth;img.height=img.height*ratio;}
if(img.height<425){var pad=(425-img.height)/2;img.style.marginTop=pad+'px';img.style.marginBottom=pad+'px';}
var wrapper=PP.getElementById('mainImg');PP.Util.removeClass(wrapper,'loading');wrapper.innerHTML='';wrapper.appendChild(img);}
else{setTimeout(function(){photosDoSwitch(img);},10);}}
function photosSlide(dir,a){var slider=PP.getElementById('thumbSlider');var wrapper=slider.parentNode;if(slider){if(a)
a.blur();var current=slider.xCurrentPos;if(!current)current=0;current+=dir;var newLeft=(-((5*92)*current));if(newLeft>0){return false;}
if((-newLeft)>=PP.Util.getElementWidth(slider)){return false;}
slider.xCurrentPos=current;slider.style.position='absolute';PP.Animation.animate('thumbSlider',newLeft,0,null,null,300);if(newLeft>=0){PP.Util.addClass('thumPrev','inactive');PP.Util.addClass('thumPrev','previnactive');}
else{PP.Util.removeClass('thumPrev','inactive');PP.Util.removeClass('thumPrev','previnactive');}
if(((-newLeft)+(5*92))>=PP.Util.getElementWidth(slider)){PP.Util.addClass('thumNext','inactive');PP.Util.addClass('thumNext','nextinactive');}
else{PP.Util.removeClass('thumNext','inactive')
PP.Util.removeClass('thumNext','nextinactive');;}}
return false;}
function createHTMLDropDowns(){var tmp=document.getElementsByTagName("SELECT");var selects=[];for(var i=0;i<tmp.length;i++){selects[i]=tmp[i];}
for(var s=0;s<selects.length;s++){if(!PP.Util.hasClass(selects[s],'htmldd')){continue;}
var id=selects[s].id;var parent=selects[s].parentNode;var div=document.createElement('DIV');div.className=selects[s].className;div.id=id+'htmldd';parent.replaceChild(div,selects[s]);div.appendChild(selects[s]);selects[s].style.display='none';var current=document.createElement('A');current.className='cur';current.title=selects[s].title;PP.Util.attachEvent(current,'click',PP.Util.createClosure(null,function(e,moreArgs){htmlddToggle(moreArgs[0],e);},div));div.appendChild(current);var ol=document.createElement('OL');ol.style.minWidth=PP.Util.getElementWidth(div)+'px';ol.style.display='none';div.appendChild(ol);htmlddPopulateList(div);}}
function htmlddPopulateList(div){var selects=div.getElementsByTagName('SELECT')[0];var ol=div.getElementsByTagName('OL')[0];var current=div.getElementsByTagName('A')[0];current.innerHTML=selects.options[selects.selectedIndex].innerHTML;ol.innerHTML='';var options=selects.getElementsByTagName('OPTION');for(var o=0;o<options.length;o++){var li=document.createElement('LI');var a=document.createElement('A');li.appendChild(a);a.innerHTML=options[o].innerHTML;PP.Util.attachEvent(a,'click',PP.Util.createClosure(null,htmlddSelect,div,o,a));ol.appendChild(li);}}
var htmlddOpen=null;function htmlddToggle(event,e){if(!e&&htmlddOpen!=null){htmlddOpen.style.display='none';htmlddOpen=null;}
e=PP.getElementById(e);if(!e)return;var ol=e.getElementsByTagName('OL');if(ol[0].style.display=='none'){if(htmlddOpen!=null){htmlddOpen.style.display='none';htmlddOpen=null;}
ol[0].style.display='block';htmlddOpen=ol[0];}
else{ol[0].style.display='none';htmlddOpen=null;}
PP.Util.cancelEvent(event);return false;}
function htmlddSelect(e,selectedIndex,selected){e=PP.getElementById(e);if(!e)return;if(htmlddOpen!=null){htmlddOpen.style.display='none';htmlddOpen=null;}
var select=e.getElementsByTagName('SELECT');var anchor=e.getElementsByTagName('A');select[0].selectedIndex=selectedIndex;if(select[0].onchange){select[0].onchange();}
anchor[0].innerHTML=selected.innerHTML;}
PP.Util.attachEvent(document,'click',htmlddToggle);function pe(anchor,p,e,t,k,fid){if(PP.getElementById('_pe_'+p)){window.location=anchor.href;return false;}
var img=document.createElement('IMG');img.id='_pe_'+p;img.src="/data/pe?p="+p+"&e="+e+"&t="+t+"&k="+k+"&fid="+fid;document.body.appendChild(img);var int=setInterval(function(){if(img.complete){clearInterval(int);window.location=anchor.href;}},10);return false;}
function printProperty(id){window.open("/~print/"+id,"print","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,width=750,height=550");}
function switchTab(stab,spane){var a=document.getElementsByTagName('A');for(var i=0;i<a.length;i++){PP.Util.removeClass(a[i],'activetab');}
var div=document.getElementsByTagName('DIV');for(var i=0;i<div.length;i++){PP.Util.removeClass(div[i],'activepane');}
PP.Util.addClass(stab,'activetab');PP.Util.addClass(spane,'activepane');}
function toggleStatus(){var div=PP.getElementById('advStatus');if(!PP.Util.hasClass(div,"toggle")){PP.Animation.animate(div,null,null,null,80,100,null);PP.Util.addClass(div,"toggle");}
else{PP.Animation.animate(div,null,null,null,0,100,null);PP.Util.removeClass(div,"toggle");}}
function toggleStyle(){var div=PP.getElementById('advStyle');if(!PP.Util.hasClass(div,"toggle")){PP.Animation.animate(div,null,null,null,220,100,null);PP.Util.addClass(div,"toggle");}
else{PP.Animation.animate(div,null,null,null,0,100,null);PP.Util.removeClass(div,"toggle");}}
function showAgent(a){for(var i=1;;i++){var e=PP.getElementById('branch_'+i);if(!e)break;if(i==a)
e.style.display='block';else
e.style.display='none';}}
function selectJustAdded(block){var newTop=-(block*290);PP.Animation.animate('recentSlider',0,newTop,null,null,250,null);PP.Util.removeClass('recent_sale','current');PP.Util.removeClass('recent_rent','current');PP.Util.removeClass('recent_new','current');PP.Util.addClass('recent_'+(block==0?'sale':(block==1?'rent':'new')),'current');}
var currentContentBox=0;function slideContent(dir){var total=0;var nodeList=PP.getElementById('contentSlider').childNodes;for(i=0;i<nodeList.length;i++){if(nodeList[i].nodeName=='DIV'){total++;}}
PP.Util.removeClass('contentPrev','disabled');PP.Util.removeClass('contentNext','disabled');if((currentContentBox-dir)+1>0){PP.Util.addClass('contentPrev','disabled');}
if((currentContentBox-dir)-1<(-(total))+3){PP.Util.addClass('contentNext','disabled');}
if(currentContentBox-dir>0){return;}
if(currentContentBox-dir<(-(total))+3){return;}
currentContentBox-=dir;var newLeft=292*currentContentBox;PP.Animation.animate('contentSlider',newLeft,0,null,null,250,null);}