function initPage(legacy){addRoundedCorners();addRoundedLozenges();enableScrollingBoxes();}
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 pe(anchor,event,p,e,t,k,fid){if(document.getElementById('_pe_'+p)){return true;}
$.ajax({asynch:false,cache:false,data:'p='+p+'&e='+e+'&t='+t+'&k='+k+'&fid='+fid,processData:false,url:PP.resolveUrl('~/data/pe'),timeout:1000});return true;}
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 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);$('#recentSlider').animate({top:newTop});$('#recent_sale').removeClass('current');$('#recent_rent').removeClass('current');$('#recent_new').removeClass('current');$('#recent_'+(block==0?'sale':(block==1?'rent':'new'))).addClass('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);}