function Timer(){this.obj=(arguments.length)?arguments[0]:window;return this;}
Timer.prototype.setInterval=function(func,msec){var i=Timer.getNew();var t=Timer.buildCall(this.obj,i,arguments);Timer.set[i].timer=window.setInterval(t,msec);return i;}
Timer.prototype.setTimeout=function(func,msec){var i=Timer.getNew();Timer.buildCall(this.obj,i,arguments);Timer.set[i].timer=window.setTimeout("Timer.callOnce("+i+");",msec);return i;}
Timer.prototype.clearInterval=function(i){if(!Timer.set[i]){return;}
window.clearInterval(Timer.set[i].timer);Timer.set[i]=null;}
Timer.prototype.clearTimeout=function(i){if(!Timer.set[i]){return;}
window.clearTimeout(Timer.set[i].timer);Timer.set[i]=null;}
Timer.set=new Array();Timer.buildCall=function(obj,i,args){var t="";Timer.set[i]=new Array();if(obj!=window){Timer.set[i].obj=obj;t="Timer.set["+i+"].obj.";}
t+=args[0]+"(";if(args.length>2){Timer.set[i][0]=args[2];t+="Timer.set["+i+"][0]";for(var j=1;(j+2)<args.length;j++){Timer.set[i][j]=args[j+2];t+=", Timer.set["+i+"]["+j+"]";}}
t+=");";Timer.set[i].call=t;return t;}
Timer.callOnce=function(i){if(!Timer.set[i]){return;}
eval(Timer.set[i].call);Timer.set[i]=null;}
Timer.getNew=function(){var i=0;while(Timer.set[i]){i++;}
return i;}
var LoadEventHandler=Class.create();LoadEventHandler.prototype={initialize:function(){},add:function(func){if(this.alreadyRun){func();}
else{this.addEvent(func);}},alreadyRun:false,_events:[],addEvent:function(func){this._events.push(func);},doEvents:function(){this.alreadyRun=true;var f=function(f){f();};this._events.each(f);}};var onLoadHandler=new LoadEventHandler();initializePage={};function clearDefault(el){if(el.defaultValue==el.value){el.value="";}}
function agent_slide(element){target=$(element.id+'_target');if((target.style)&&(target.style.display=='none')){Effect.SlideDown(target,{duration:0.3});element.parentNode.className='show_less';}
else{Effect.SlideUp(target,{duration:0.3});element.parentNode.className='show_more';}}
function slide(element,open_link,close_link){target=$(element.id+'_target');if((target.style)&&(target.style.display=='none')){Effect.SlideDown(target.id);if(close_link){element.innerHTML=close_link;}}
else{Effect.SlideUp(target.id);if(open_link){element.innerHTML=open_link;}}}
function blind(element,duration){target=$(element.id+'_target');if((target.style)&&(target.style.display=='none')){Effect.BlindDown(target.id,duration);}
else{Effect.BlindUp(target.id,duration);}}
function number_to_currency(nStr,precision){var multiplier=Math.pow(10,precision);nStr=Math.round(parseFloat(nStr)*multiplier)/multiplier;nStr+='';var x=nStr.split('.');var x1=x[0];var x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+','+'$2');}
return'$'+x1+x2;}
function complexParseFloat(string){var scrubbed=string.toString().gsub(/[^1234567890.]/,'');if(scrubbed=='')
scrubbed='0';return(parseFloat(scrubbed));}
function setCookie(name,value){document.cookie=name+'='+escape(value)+';';}
function getCookie(name){name+='=';start=document.cookie.indexOf(name);if(start!=-1){start+=name.length;end=document.cookie.indexOf(';',start);if(end==-1)end=document.cookie.length;return(unescape(document.cookie.substring(start,end)));}else{return null;}}
function setRssFeedUrl(url){var elements=$$("#map_rss_button option[value!='none']");for(i=0;i<elements.length;i++){if(!elements[i].getAttribute('base_href')&&elements[i].getAttribute('base_href')!='')
elements[i].setAttribute('base_href',elements[i].getAttribute('value'));if(elements[i].getAttribute('base_href')!='')
url=encodeURIComponent(url);elements[i].setAttribute('value',elements[i].getAttribute('base_href')+url);}}
Array.prototype.remove=function(s){for(i=0;i<this.length;i++){if(s==this[i])this.splice(i,1);}};DropDownController=Class.create();DropDownController.prototype={initialize:function(){document.body.onclick=this.onBodyClick.bind(this);this._justClicked=null;this._open_ele=null;},resetEle:function(){if(this._open_ele&&this._open_ele.visible()&&this._open_ele!=this._justClicked){this._open_ele.removeClassName('drop_down_selected');$(this._open_ele.id+'_target').removeClassName('drop_down_displayed');this._open_ele=null;}},onBodyClick:function(){this.resetEle()
this._justClicked=null;},onClick:function(ele){if(ele.className!='drop_down_selected'){this.resetEle();this.justClicked(ele);target=$(ele.id+'_target');Element.Methods.addClassName(ele,'drop_down_selected');Element.Methods.addClassName(target,'drop_down_displayed');target.style.top=Element.getHeight(ele)-(parseInt(ele.getStyle('borderBottomWidth')||0)+parseInt(ele.getStyle('borderTopWidth'))||1)+'px';}},justClicked:function(ele){this._justClicked=ele;this._open_ele=ele}}
function current_page(){var page=1;var current_page_span=$$('.results_pager .current')[0];if(current_page_span){page=current_page_span.innerHTML;}
return page;}
function jumpToNotes(){EstatelyEvent('Listing (active)','Jump to Notes');Effect.ScrollTo('saveanote');(function(){new Effect.Highlight('saveanote',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpTowalkscore(){EstatelyEvent('Listing (active)','Jump to Walkscore');Effect.ScrollTo('walkScore');(function(){new Effect.Highlight('walkScore_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpTomakeusbetter(){EstatelyEvent('Listing (active)','Jump to Make us Better');Effect.ScrollTo('makeusbetter');(function(){new Effect.Highlight('makeusbetter_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToscheduleshow(){EstatelyEvent('Listing (active)','Jump to Schedule showing');Effect.ScrollTo('scheduleshow');(function(){new Effect.Highlight('scheduleshow_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToComparehome(){EstatelyEvent('Listing (active)','Jump to Compare home');Effect.ScrollTo('Comparehome');(function(){new Effect.Highlight('Comparehome_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToAskquestion(){EstatelyEvent('Listing (active)','Jump to Ask Question');Effect.ScrollTo('askquestion');(function(){new Effect.Highlight('askquestion_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToEmailafriend(){EstatelyEvent('Listing (active)','Jump to Email a Friend');Effect.ScrollTo('emailafriend_sc');(function(){new Effect.Highlight('emailafriend_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpTopricealert(){EstatelyEvent('Listing (active)','Jump to price Alert');Effect.ScrollTo('scropricealert');(function(){new Effect.Highlight('pricealert_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToMortgage(){EstatelyEvent('Listing (active)','Jump to Mortgage Calculator');Effect.ScrollTo('callmortgage');(function(){new Effect.Highlight('mortgage_calculator_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToBrochure(){EstatelyEvent('Listing (active)','Jump to Brochure');Effect.ScrollTo('callbrochure');(function(){new Effect.Highlight('brochure_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpToopenhouse(){EstatelyEvent('Listing (active)','Jump to Open house');Effect.ScrollTo('callopenhouse');(function(){new Effect.Highlight('openhouse_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function jumpTomapdirection(){EstatelyEvent('Listing (active)','Jump to map direction');Effect.ScrollTo('callmapdirection');(function(){new Effect.Highlight('mapdirection_wrappper',{'endcolor':'#F1F4F8','duration':2.5});}).delay(1);}function mycallfun(val){changeMortgageInterestRate(val);registerListenersForInputs();setCookie('mortgage_interest_rate',val);updateSliders(); }

