var subnavHandler=Class.create({initialize:function(b){var c=$$("."+b+" li a");var a=document.location.toString().split("/").last();c.each(function(d){var e=d.href.split("/").last();if(e==a){d.addClassName("current")}})}});var QuicksearchDropDownHandler=Class.create({initialize:function(a){a.observe("focus",function(b){console.log(a);a.style.color="#555 !important"})}});var unWrap=Class.create({initialize:function(a,c){this.element=a;this.wrapper=c;var b=this.wrapper.parentNode;b.insert({bottom:this.element});b.replaceChild(this.element,this.wrapper)}});var PlaceClouds=Class.create({initialize:function(){this.ftWind=new Element("div",{id:"ftWind"});this.ftCloud=new Element("div",{id:"ftCloud"});this.ftWind.setStyle({display:"block",width:"20px",height:"77px",position:"absolute",top:"17px",left:"-19px",background:"url('/img/bg/footer-wind.png') no-repeat"});this.ftCloud.setStyle({display:"block",width:"46px",height:"151px",position:"absolute",top:"30px",right:"-46px",background:"url('/img/bg/footer-cloud.png') no-repeat"});$("ft").insert({bottom:this.ftWind});$("ft").insert({bottom:this.ftCloud})}});var AutoScroll=Class.create({initialize:function(b){var a=$$("."+b);this.addListeners(a);this.options={duration:1.5,transition:function(c){return(c==1)?1:-Math.pow(2,-10*c)+1}}},smoothScrollTo:function(c,b){c.stop();var a=b.href.split("#").last();new Effect.ScrollTo(a,this.options)},addListeners:function(d){var b;for(var c=0,a=d.length;c!=a;++c){b=d[c];b.observe("click",this.smoothScrollTo.bindAsEventListener(this,b))}}});var TextBoxesHandler=Class.create({initialize:function(a){this.textboxes=$$("."+a);this.addListeners()},onFocus:function(b,a){if(a.value==a.defaultValue){a.value="";a.style.color="#555"}},onBlur:function(b,a){if(a.value==""){a.value=a.defaultValue;a.style.color="#CCC"}},addListeners:function(){var b;for(var c=0,a=this.textboxes.length;c!=a;++c){b=this.textboxes[c];b.observe("focus",this.onFocus.bindAsEventListener(this,b));b.observe("blur",this.onBlur.bindAsEventListener(this,b))}}});var NavToggler=Class.create({initialize:function(a){this.toggle=a;this.subNav=this.toggle.next("ul");if(this.toggle.hasClassName("current")){this.subNav.style.display="block"}a.observe("click",this.init.bindAsEventListener(this,this.subNav))},init:function(c,b){var a={duration:0.3,delay:0};if(b.visible()){Effect.BlindUp(b,a)}else{Effect.BlindDown(b,a)}}});var ShowExtrasPanel=Class.create({initialize:function(a){this.trigger=a;a.observe("click",this.showExtrasPanel.bindAsEventListener(this))},showExtrasPanel:function(b){b.stop();var a=$("extras");if(a.visible()){Effect.Fade(a,{duration:0.2});this.trigger.style.backgroundPosition="left top"}else{Effect.Appear(a,{duration:0.4});this.trigger.style.backgroundPosition="left bottom"}}});var QuickSearchFX=Class.create({initialize:function(a){this.trigger=a;this.trigger.observe("click",this.execute.bindAsEventListener(this))},execute:function(c){c.stop();var e=$$("ul.radioFX li label");var b=$$("#quick-search fieldset input")[1];var h=e[0];var f=e[1];var l=e[2];var j=e[3];f.style.opacity="0";f.style.display="none";var m=$$("ul.radioFX li.toRent")[0].down(4);var d=$$("ul.radioFX li.forSale")[0].down(4);m.checked=false;d.checked=true;b.title="Search properties for sale";if(this.trigger==h){f.style.display="block";j.style.display="none";m.checked=true;d.checked=false;b.title="Search properties to rent";var a=[];a.push(new Effect.Morph(f,{style:{opacity:"1"}},{sync:true}));a.push(new Effect.Morph(j,{style:{opacity:"0"}},{sync:true}));var g={duration:0.4};new Effect.Parallel(a,g)}else{if(this.trigger==l){j.style.display="block";f.style.display="none";m.checked=false;d.checked=true;b.title="Search properties for sale";var i=[];i.push(new Effect.Morph(j,{style:{opacity:"1"}},{sync:true}));i.push(new Effect.Morph(f,{style:{opacity:"0"}},{sync:true}));var k={duration:0.4};new Effect.Parallel(i,k)}}}});var ProtoGrowl=Class.create({initialize:function(a){this.options=a;this.options.parent=$(document.body);if(this.options.timer==null){this.options.timer=5000}else{this.options.timer=this.options.timer*1000}if($("protogrowl")==null){this.showGrowlAlert()}else{new Effect.Fade($("protogrowl"),{duration:0.3,afterFinish:function(){$("protogrowl").remove();this.showGrowlAlert()}.bind(this)})}},showGrowlAlert:function(){var h=null;var b=null;var i='<div id="protogrowl"><table><tbody><tr><td class="top_left corners_up" /><td class="top" /><td class="top_right corners_up" /></tr><tr><td class="left" /><td id="protogrowlContent"></td><td class="right" /></tr><tr><td class="bottom_left corners_down" /><td class="bottom"></td><td class="bottom_right corners_down" /></tr></tbody></table></div>';var g=[];var f=[];var d={duration:"0.3",delay:"0.2"};this.options.parent.insert({bottom:i});h=$("protogrowl");b=$("protogrowlContent");b.update("<h2>"+this.options.title+"</h2><p>"+this.options.message+"</p>");h.setStyle({display:"block",padding:"20px",opacity:"0",position:"absolute",right:"10px",top:"10px",color:"#555",textAlign:"left",width:"400px"});var a={width:h.getWidth(),height:h.getHeight()};h.setStyle({top:-a.height+"px"});g.push(new Effect.Appear(h,{to:"0.9"},{sync:true}));g.push(new Effect.Morph(h,{style:{top:"10px"}},{sync:true}));new Effect.Parallel(g,d);function c(){f.push(new Effect.Fade(h,{sync:true}));f.push(new Effect.Morph(h,{style:{top:-a.height+"px"}},{sync:true}));var j={duration:"0.3",afterFinish:function(){h.remove()}};new Effect.Parallel(f,j)}if(this.options.persistent==null||this.options.persistent==false){setTimeout(c,this.options.timer)}else{var e=new Element("p");e.update('<a href="#" id="protogrowlClose">Close this alert</a>');b.insert({bottom:e});$("protogrowlClose").observe("click",c)}}});var SquareBox=Class.create({initialize:function(a){var c,b;this.parent=$$("form")[0];this.page={width:this.getPageDimensions().first(),height:this.getPageDimensions().last()};if($("SquareBox")==null){c=new Element("div",{id:"SquareBoxFader"});b='<div id="SquareBox"><table><tbody><tr><td class="top_left corners_up" /><td class="top" /><td class="top_right corners_up" /></tr><tr><td class="left" /><td id="SquareBoxContent"></td><td class="right" /></tr><tr><td class="bottom_left corners_down" /><td class="bottom"></td><td class="bottom_right corners_down" /></tr></tbody></table><a id="SquareBoxClose">Close</a></div>';this.parent.insert({bottom:c});this.parent.insert({bottom:b})}this.fader=$("SquareBoxFader");this.box=$("SquareBox");this.content=$("SquareBoxContent");this.close=$("SquareBoxClose");this.reset()},active:false,current:"",getPageDimensions:function(){var d,e,a,c,g,b,f;if(window.innerHeight&&window.scrollMaxY){e=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){e=document.body.scrollWidth;a=document.body.scrollHeight}else{e=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight}}}if(a<g){f=g}else{f=a}if(e<c){b=c}else{b=e}d=new Array(b,f);return d},reset:function(){this.fader.setStyle({position:"absolute",display:"none",width:"100%",height:this.page.height+"px",top:"0",left:"0",backgroundColor:"#000",zIndex:"9995"});this.box.setStyle({visibility:"hidden",display:"block",position:"absolute",top:"-9999px",left:"-9999px"})},check:function(a,b){a.stop();if(!this.active){this.show(b)}else{this.current.style.display="none";this.parent.insert({bottom:this.current});this.show(b)}},show:function(c){this.current=c;this.active=true;if($("flash")!==null){$("flash").hide()}this.content.update(c);if(c.style.display=="none"){c.style.display="block"}this.box.setStyle({visibility:"visible",display:"none",top:(document.viewport.getDimensions().height/2)+document.viewport.getScrollOffsets().top-(this.box.getHeight()/2)-100+"px",left:(document.viewport.getDimensions().width/2)-(this.box.getWidth()/2)+"px"});var b=[];var a={duration:0.3,delay:0};b.push(Effect.Appear(this.fader,{to:0.8,sync:true}));b.push(Effect.Appear(this.box,{sync:true}));new Effect.Parallel(b,a);[this.close,this.fader].invoke("observe","click",this.hide.bindAsEventListener(this,c))},hide:function(c,d){c.stop();var b=[];var a={duration:0.3,delay:0,afterFinish:function(){if($("flash")!==null){$("flash").show()}}.bind(this)};b.push(Effect.Fade(this.fader,{sync:true}));b.push(Effect.Fade(this.box,{sync:true}));new Effect.Parallel(b,a)},observe:function(e){var b,d;d=$$("."+e);for(var c=0,a=d.length;c!=a;++c){b=d[c];var f=$(b.href.split("#").last());b.observe("click",this.check.bindAsEventListener(this,f))}}});function showRetrievePasswordAfterPostback(){var a=$$(".user_password")[0];if(typeof a!="undefined"){a.observe("click",function(d){d.stop();new SquareBoxHide;var c=$("password-reminder");var b=setTimeout(function(){lightbox.show($("password-reminder"))},500)})}}var SquareBoxHide=Class.create({initialize:function(){this.squareBox=$("SquareBox");this.squareBoxClose=$("SquareBoxClose");this.squareBoxFader=$("SquareBoxFader");this.squareBoxContent=$("SquareBoxContent");this.currentPanel=this.squareBoxContent.down();var b=[];var a={duration:0.3,delay:0,afterFinish:function(){$$("form")[0].insert({bottom:this.currentPanel});this.currentPanel.style.display="none";new Effect.Fade(this.squareBoxFader,{duration:0.2});this.squareBox.setStyle({visibility:"hidden",display:"block",position:"absolute",top:"-9999px",left:"-9999px"});if($("flash")!==null){$("flash").show()}}.bind(this)};b.push(new Effect.Fade(this.squareBox,{sync:true}));new Effect.Parallel(b,a)}});var SquareBoxAlert=Class.create({initialize:function(){this.squareBox=$("SquareBox");$$("#SquareBox .textbox").each(function(a){a.style.background="#FFEFEF"});this.squareBox.down(".textbox").focus();new Effect.Shake(this.squareBox,{duration:0.5})}});var LoginOptionsHandler=Class.create({initialize:function(a){this.elements=a;this.forgotButton=$(this.elements.buttons.forgotPasswordButtonId);this.newMemberButton=$(this.elements.buttons.newMemberButtonId);this.forgotPanel=$(this.elements.panels.forgotPasswordPanelId);this.newMemberPanel=$(this.elements.panels.newMemberPanelId);this.addListeners()},handleButtonClick:function(a){a.stop();var b=Event.element(a);if(b===this.forgotButton){if(!this.forgotPanel.visible()){Effect.SlideDown(this.forgotPanel,{duration:0.3,delay:0})}else{Effect.SlideUp(this.forgotPanel,{duration:0.3,delay:0})}}else{if(b===this.newMemberButton){if(!this.newMemberPanel.visible()){Effect.SlideDown(this.newMemberPanel,{duration:0.3,delay:0})}else{Effect.SlideUp(this.newMemberPanel,{duration:0.3,delay:0})}}}},addListeners:function(){var a=[this.forgotButton,this.newMemberButton];a.invoke("observe","click",this.handleButtonClick.bindAsEventListener(this))}});var lightbox;document.observe("dom:loaded",function(){new PlaceClouds();new subnavHandler("subnav");new AutoScroll("pageScroller");new TextBoxesHandler("textbox");lightbox=new SquareBox();lightbox.observe("squareBox");if($$(".toggle")!==null){$$(".toggle").each(function(a){new NavToggler(a)})}if($$(".showExtras")!==null){$$(".showExtras").each(function(a){new ShowExtrasPanel(a)})}if($("quick-search")!==null){$$("ul.radioFX li label").each(function(a){new QuickSearchFX(a)});$$("#quick-search .dropdownlist").each(function(a){new QuicksearchDropDownHandler(a)})}});