var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var d=0;d<a.length;d++){var c=a[d].string;var b=a[d].prop;this.versionSearchString=a[d].versionSearch||a[d].identity;if(c){if(c.indexOf(a[d].subString)!=-1){return a[d].identity}}else{if(b){return a[d].identity}}}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(b==-1){return}return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};var Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){},K:function(a){return a}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(a,c){for(var b in c){a[b]=c[b]}return a};Object.extend(Object,{inspect:function(b){try{if(b===undefined){return"undefined"}if(b===null){return"null"}return b.inspect?b.inspect():b.toString()}catch(a){if(a instanceof RangeError){return"..."}throw a}},keys:function(b){var a=[];for(var c in b){a.push(c)}return a},values:function(a){var c=[];for(var b in a){c.push(a[b])}return c},clone:function(a){return Object.extend({},a)}});Function.prototype.bind=function(){var a=this,b=$A(arguments),c=b.shift();return function(){return a.apply(c,b.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(c){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[(d||window.event)].concat(b).concat($A(arguments)))}};Object.extend(Number.prototype,{toColorPart:function(){var a=this.toString(16);if(this<16){return"0"+a}return a},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this}});var Try={these:function(){var f;for(var b=0,d=arguments.length;b<d;b++){var c=arguments[b];try{f=c();break}catch(a){}}return f}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this)}finally{this.currentlyExecuting=false}}}};String.interpret=function(a){return a==null?"":String(a)};Object.extend(String.prototype,{gsub:function(b,c){var d="",e=this,a;c=arguments.callee.prepareReplacement(c);while(e.length>0){if(a=e.match(b)){d+=e.slice(0,a.index);d+=String.interpret(c(a));e=e.slice(a.index+a[0].length)}else{d+=e,e=""}}return d},sub:function(b,c,a){c=this.gsub.prepareReplacement(c);a=a===undefined?1:a;return this.gsub(b,function(d){if(--a<0){return d[0]}return c(d)})},scan:function(b,a){this.gsub(b,a);return this},truncate:function(a,b){a=a||30;b=b===undefined?"...":b;return this.length>a?this.slice(0,a-b.length)+b:this},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var a=new RegExp(Prototype.ScriptFragment,"img");var b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(c){return(c.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=document.createElement("div");var b=document.createTextNode(this);a.appendChild(b);return a.innerHTML},unescapeHTML:function(){var a=document.createElement("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(c,e){if((e=e.split("="))[0]){var d=decodeURIComponent(e[0]);var f=e[1]?decodeURIComponent(e[1]):undefined;if(c[d]!==undefined){if(c[d].constructor!=Array){c[d]=[c[d]]}if(f){c[d].push(f)}}else{c[d]=f}}return c})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},camelize:function(){var d=this.split("-"),c=d.length;if(c==1){return d[0]}var a=this.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<c;b++){a+=d[b].charAt(0).toUpperCase()+d[b].substring(1)}return a},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.replace(/\\/g,"\\\\");if(b){return'"'+a.replace(/"/g,'\\"')+'"'}else{return"'"+a.replace(/'/g,"\\'")+"'"}}});String.prototype.gsub.prepareReplacement=function(a){if(typeof a=="function"){return a}var b=new Template(a);return function(c){return b.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(b,a){this.template=b.toString();this.pattern=a||Template.Pattern},evaluate:function(a){return this.template.gsub(this.pattern,function(c){var b=c[1];if(b=="\\"){return c[2]}return b+String.interpret(a[c[3]])})}};var $break=new Object();var $continue=new Object();var Enumerable={each:function(c){var b=0;try{this._each(function(f){try{c(f,b++)}catch(d){if(d!=$continue){throw d}}})}catch(a){if(a!=$break){throw a}}return this},eachSlice:function(d,c){var b=-d,e=[],a=this.toArray();while((b+=d)<a.length){e.push(a.slice(b,b+d))}return e.map(c)},all:function(a){var b=true;this.each(function(d,c){b=b&&!!(a||Prototype.K)(d,c);if(!b){throw $break}});return b},any:function(a){var b=false;this.each(function(d,c){if(b=!!(a||Prototype.K)(d,c)){throw $break}});return b},collect:function(a){var b=[];this.each(function(d,c){b.push((a||Prototype.K)(d,c))});return b},detect:function(a){var b;this.each(function(d,c){if(a(d,c)){b=d;throw $break}});return b},findAll:function(a){var b=[];this.each(function(d,c){if(a(d,c)){b.push(d)}});return b},grep:function(b,a){var c=[];this.each(function(f,d){var e=f.toString();if(e.match(b)){c.push((a||Prototype.K)(f,d))}});return c},include:function(b){var a=false;this.each(function(c){if(c==b){a=true;throw $break}});return a},inGroupsOf:function(b,a){a=a===undefined?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(b,a){this.each(function(d,c){b=a(b,d,c)});return b},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(c){return c[b].apply(c,a)})},max:function(a){var b;this.each(function(d,c){d=(a||Prototype.K)(d,c);if(b==undefined||d>=b){b=d}});return b},min:function(a){var b;this.each(function(d,c){d=(a||Prototype.K)(d,c);if(b==undefined||d<b){b=d}});return b},partition:function(b){var c=[],a=[];this.each(function(e,d){((b||Prototype.K)(e,d)?c:a).push(e)});return[c,a]},pluck:function(a){var b=[];this.each(function(d,c){b.push(d[a])});return b},reject:function(a){var b=[];this.each(function(d,c){if(!a(d,c)){b.push(d)}});return b},sortBy:function(a){return this.map(function(c,b){return{value:c,criteria:a(c,b)}}).sort(function(e,f){var c=e.criteria,d=f.criteria;return c<d?-1:c>d?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var c=Prototype.K,a=$A(arguments);if(typeof a.last()=="function"){c=a.pop()}var b=[this].concat(a).map($A);return this.map(function(e,d){return c(b.pluck(d))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(b){if(!b){return[]}if(b.toArray){return b.toArray()}else{var d=[];for(var a=0,c=b.length;a<c;a++){d.push(b[a])}return d}};Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,c=this.length;a<c;a++){b(this[a])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(a,b){return a.concat(b&&b.constructor==Array?b.flatten():[b])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},indexOf:function(c){for(var a=0,b=this.length;a<b;a++){if(this[a]==c){return a}}return -1},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(){return this.inject([],function(a,b){return a.include(b)?a:a.concat([b])})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"}});Array.prototype.toArray=Array.prototype.clone;function $w(a){a=a.strip();return a?a.split(/\s+/):[]}if(window.opera){Array.prototype.concat=function(){var a=[];for(var c=0,e=this.length;c<e;c++){a.push(this[c])}for(var c=0,e=arguments.length;c<e;c++){if(arguments[c].constructor==Array){for(var d=0,b=arguments[c].length;d<b;d++){a.push(arguments[c][d])}}else{a.push(arguments[c])}}return a}}var Hash=function(a){Object.extend(this,a||{})};Object.extend(Hash,{toQueryString:function(a){var b=[];this.prototype._each.call(a,function(c){if(!c.key){return}if(c.value&&c.value.constructor==Array){var d=c.value.compact();if(d.length<2){c.value=d.reduce()}else{key=encodeURIComponent(c.key);d.each(function(e){e=e!=undefined?encodeURIComponent(e):"";b.push(key+"="+encodeURIComponent(e))});return}}if(c.value==undefined){c[1]=""}b.push(c.map(encodeURIComponent).join("="))});return b.join("&")}});Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(a){for(var b in this){var d=this[b];if(d&&d==Hash.prototype[b]){continue}var c=[b,d];c.key=b;c.value=d;a(c)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(a){return $H(a).inject(this,function(b,c){b[c.key]=c.value;return b})},remove:function(){var c;for(var a=0,b=arguments.length;a<b;a++){var d=this[arguments[a]];if(d!==undefined){if(c===undefined){c=d}else{if(c.constructor!=Array){c=[c]}c.push(d)}}delete this[arguments[a]]}return c},toQueryString:function(){return Hash.toQueryString(this)},inspect:function(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"}});function $H(a){if(a&&a.constructor==Hash){return a}return new Hash(a)}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(c,a,b){this.start=c;this.end=a;this.exclusive=b},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,a,b){return new ObjectRange(c,a,b)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,c,d,b){this.each(function(g){if(typeof g[a]=="function"){try{g[a].apply(g,[c,d,b])}catch(f){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams()}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(b,a){this.transport=Ajax.getTransport();this.setOptions(a);this.request(b)},request:function(d){this.url=d;this.method=this.options.method;var c=this.options.parameters;if(!["get","post"].include(this.method)){c._method=this.method;this.method="post"}c=Hash.toQueryString(c);if(c&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){c+="&_="}if(this.method=="get"&&c){this.url+=(this.url.indexOf("?")>-1?"&":"?")+c}try{Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)}.bind(this),10)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var a=this.method=="post"?(this.options.postBody||c):null;this.transport.send(a);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(b){this.dispatchException(b)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var b={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){b["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){b.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var a=this.options.requestHeaders;if(typeof a.push=="function"){for(var c=0,d=a.length;c<d;c+=2){b[a[c]]=a[c+1]}}else{$H(a).each(function(f){b[f.key]=f.value})}}for(var e in b){this.transport.setRequestHeader(e,b[e])}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState:function(c){var d=Ajax.Request.Events[c];var f=this.transport,b=this.evalJSON();if(d=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(f,b)}catch(a){this.dispatchException(a)}if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()}}try{(this.options["on"+d]||Prototype.emptyFunction)(f,b);Ajax.Responders.dispatch("on"+d,this,f,b)}catch(a){this.dispatchException(a)}if(d=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},getHeader:function(b){try{return this.transport.getResponseHeader(b)}catch(a){return null}},evalJSON:function(){try{var json=this.getHeader("X-JSON");return json?eval("("+json+")"):null}catch(e){return null}},evalResponse:function(){try{return eval(this.transport.responseText)}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(a,d,c){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};this.transport=Ajax.getTransport();this.setOptions(c);var b=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(f,e){this.updateContent();b(f,e)}).bind(this);this.request(d)},updateContent:function(){var a=this.container[this.success()?"success":"failure"];var b=this.transport.responseText;if(!this.options.evalScripts){b=b.stripScripts()}if(a=$(a)){if(this.options.insertion){new this.options.insertion(a,b)}else{a.update(b)}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(a,c,b){this.setOptions(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(a){if(arguments.length>1){for(var c=0,b=[],d=arguments.length;c<d;c++){b.push($(arguments[c]))}return b}if(typeof a=="string"){a=document.getElementById(a)}return Element.extend(a)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(a,d){var f=[];var e=document.evaluate(a,$(d)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,c=e.snapshotLength;b<c;b++){f.push(e.snapshotItem(b))}return f}}document.getElementsByClassName=function(c,g){if(Prototype.BrowserFeatures.XPath){var j=".//*[contains(concat(' ', @class, ' '), ' "+c+" ')]";return document._getElementsByXPath(j,g)}else{var b=($(g)||document.body).getElementsByTagName("*");var d=[],a;for(var e=0,f=b.length;e<f;e++){a=b[e];if(Element.hasClassName(a,c)){d.push(Element.extend(a))}}return d}};if(!window.Element){var Element=new Object()}Element.extend=function(b){if(!b||_nativeExtensions||b.nodeType==3){return b}if(!b._extended&&b.tagName&&b!=window){var c=Object.clone(Element.Methods),a=Element.extend.cache;if(b.tagName=="FORM"){Object.extend(c,Form.Methods)}if(["INPUT","TEXTAREA","SELECT"].include(b.tagName)){Object.extend(c,Form.Element.Methods)}Object.extend(c,Element.Methods.Simulated);for(var d in c){var e=c[d];if(typeof e=="function"&&!(d in b)){b[d]=a.findOrStore(e)}}}b._extended=true;return b};Element.extend.cache={findOrStore:function(a){return this[a]=this[a]||function(){return a.apply(null,[this].concat($A(arguments)))}}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){if(a.style){$(a).style.display=""}return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(a,b){b=typeof b=="undefined"?"":b.toString();$(a).innerHTML=b.stripScripts();setTimeout(function(){b.evalScripts()},10);return a},replace:function(a,b){a=$(a);b=typeof b=="undefined"?"":b.toString();if(a.outerHTML){a.outerHTML=b.stripScripts()}else{var c=a.ownerDocument.createRange();c.selectNodeContents(a);a.parentNode.replaceChild(c.createContextualFragment(b.stripScripts()),a)}setTimeout(function(){b.evalScripts()},10);return a},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(d){var e=d.first(),c=d.last();var f=(a[e]||"").toString();if(f){b+=" "+c+"="+f.inspect(true)}});return b+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*"))},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(a,b){if(typeof b=="string"){b=new Selector(b)}return b.match($(a))},up:function(a,b,c){return Selector.findElement($(a).ancestors(),b,c)},down:function(a,b,c){return Selector.findElement($(a).descendants(),b,c)},previous:function(a,b,c){return Selector.findElement($(a).previousSiblings(),b,c)},next:function(a,b,c){return Selector.findElement($(a).nextSiblings(),b,c)},getElementsBySelector:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},getElementsByClassName:function(b,a){return document.getElementsByClassName(a,b)},readAttribute:function(b,c){b=$(b);if(document.all&&!window.opera){var d=Element._attributeTranslations;if(d.values[c]){return d.values[c](b,c)}if(d.names[c]){c=d.names[c]}var a=b.attributes[c];if(a){return a.nodeValue}}return b.getAttribute(c)},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(b,a){if(!(b=$(b))){return}var c=b.className;if(c.length==0){return false}if(c==a||c.match(new RegExp("(^|\\s)"+a+"(\\s|$)"))){return true}return false},addClassName:function(b,a){if(!(b=$(b))){return}Element.classNames(b).add(a);return b},removeClassName:function(b,a){if(!(b=$(b))){return}Element.classNames(b).remove(a);return b},toggleClassName:function(b,a){if(!(b=$(b))){return}Element.classNames(b)[b.hasClassName(a)?"remove":"add"](a);return b},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first()},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace:function(a){a=$(a);var c=a.firstChild;while(c){var b=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){a.removeChild(c)}c=b}return a},empty:function(a){return $(a).innerHTML.match(/^\s*$/)},descendantOf:function(b,a){b=$(b),a=$(a);while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Position.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);if(["float","cssFloat"].include(c)){c=(typeof b.style.styleFloat!="undefined"?"styleFloat":"cssFloat")}c=c.camelize();var d=b.style[c];if(!d){if(document.defaultView&&document.defaultView.getComputedStyle){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}else{if(b.currentStyle){d=b.currentStyle[c]}}}if((d=="auto")&&["width","height"].include(c)&&(b.getStyle("display")!="none")){d=b["offset"+c.capitalize()]+"px"}if(window.opera&&["left","top","right","bottom"].include(c)){if(Element.getStyle(b,"position")=="static"){d="auto"}}if(c=="opacity"){if(d){return parseFloat(d)}if(d=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(d[1]){return parseFloat(d[1])/100}}return 1}return d=="auto"?null:d},setStyle:function(a,c){a=$(a);for(var b in c){var d=c[b];if(b=="opacity"){if(d==1){d=(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1}}else{if(["float","cssFloat"].include(b)){b=(typeof a.style.styleFloat!="undefined")?"styleFloat":"cssFloat"}}a.style[b.camelize()]=d}return a},getDimensions:function(b){b=$(b);var a=$(b).getStyle("display");if(a!="none"&&a!=null){return{width:b.offsetWidth,height:b.offsetHeight}}var c=b.style;var g=c.visibility;var f=c.position;var d=c.display;c.visibility="hidden";c.position="absolute";c.display="block";var j=b.clientWidth;var e=b.clientHeight;c.display=d;c.position=f;c.visibility=g;return{width:j,height:e}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=a.style.overflow||"auto";if((Element.getStyle(a,"overflow")||"visible")!="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});Element._attributeTranslations={};Element._attributeTranslations.names={colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"};Element._attributeTranslations.values={_getAttr:function(b,a){return b.getAttribute(a,2)},_flag:function(b,a){return $(b).hasAttribute(a)?a:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){var b=a.getAttributeNode("title");return b.specified?b.nodeValue:null}};Object.extend(Element._attributeTranslations.values,{href:Element._attributeTranslations.values._getAttr,src:Element._attributeTranslations.values._getAttr,disabled:Element._attributeTranslations.values._flag,checked:Element._attributeTranslations.values._flag,readonly:Element._attributeTranslations.values._flag,multiple:Element._attributeTranslations.values._flag});Element.Methods.Simulated={hasAttribute:function(b,a){var c=Element._attributeTranslations;a=c.names[a]||a;return $(b).getAttributeNode(a).specified}};if(document.all&&!window.opera){Element.Methods.update=function(b,c){b=$(b);c=typeof c=="undefined"?"":c.toString();var d=b.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(d)){var a=document.createElement("div");switch(d){case"THEAD":case"TBODY":a.innerHTML="<table><tbody>"+c.stripScripts()+"</tbody></table>";depth=2;break;case"TR":a.innerHTML="<table><tbody><tr>"+c.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":a.innerHTML="<table><tbody><tr><td>"+c.stripScripts()+"</td></tr></tbody></table>";depth=4}$A(b.childNodes).each(function(e){b.removeChild(e)});depth.times(function(){a=a.firstChild});$A(a.childNodes).each(function(e){b.appendChild(e)})}else{b.innerHTML=c.stripScripts()}setTimeout(function(){c.evalScripts()},10);return b}}Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){["","Form","Input","TextArea","Select"].each(function(c){var a="HTML"+c+"Element";if(window[a]){return}var b=window[a]={};b.prototype=document.createElement(c?c.toLowerCase():"div").__proto__})}Element.addMethods=function(b){Object.extend(Element.Methods,b||{});function a(e,d,f){f=f||false;var c=Element.extend.cache;for(var g in e){var j=e[g];if(!f||!(g in d)){d[g]=c.findOrStore(j)}}}if(typeof HTMLElement!="undefined"){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true);a(Form.Methods,HTMLFormElement.prototype);[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(c){a(Form.Element.Methods,c.prototype)});_nativeExtensions=true}};var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(a){this.adjacency=a};Abstract.Insertion.prototype={initialize:function(c,a){this.element=$(c);this.content=a.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(b){var d=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(d)){this.insertContent(this.contentFromAnonymousTable())}else{throw b}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange()}this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){a.evalScripts()},10)},contentFromAnonymousTable:function(){var a=document.createElement("div");a.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(a.childNodes[0].childNodes[0].childNodes)}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element)}).bind(this))}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true)},insertContent:function(a){a.reverse(false).each((function(b){this.element.insertBefore(b,this.element.firstChild)}).bind(this))}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element)},insertContent:function(a){a.each((function(b){this.element.appendChild(b)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(a){this.params={classNames:[]};this.expression=a.toString().strip();this.parseExpression();this.compileMatcher()},parseExpression:function(){function a(j){throw"Parse error in selector: "+j}if(this.expression==""){a("empty expression")}var f=this.params,c=this.expression,d,e,b,g;while(d=c.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){f.attributes=f.attributes||[];f.attributes.push({name:d[2],operator:d[3],value:d[4]||d[5]||""});c=d[1]}if(c=="*"){return this.params.wildcard=true}while(d=c.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){e=d[1],b=d[2],g=d[3];switch(e){case"#":f.id=b;break;case".":f.classNames.push(b);break;case"":case undefined:f.tagName=b.toUpperCase();break;default:a(c.inspect())}c=g}if(c.length>0){a(c.inspect())}},buildMatchExpression:function(){var e=this.params,b=[],a;if(e.wildcard){b.push("true")}if(a=e.id){b.push('element.readAttribute("id") == '+a.inspect())}if(a=e.tagName){b.push("element.tagName.toUpperCase() == "+a.inspect())}if((a=e.classNames).length>0){for(var c=0,d=a.length;c<d;c++){b.push("element.hasClassName("+a[c].inspect()+")")}}if(a=e.attributes){a.each(function(f){var j="element.readAttribute("+f.name.inspect()+")";var g=function(k){return j+" && "+j+".split("+k.inspect()+")"};switch(f.operator){case"=":b.push(j+" == "+f.value.inspect());break;case"~=":b.push(g(" ")+".include("+f.value.inspect()+")");break;case"|=":b.push(g("-")+".first().toUpperCase() == "+f.value.toUpperCase().inspect());break;case"!=":b.push(j+" != "+f.value.inspect());break;case"":case undefined:b.push("element.hasAttribute("+f.name.inspect()+")");break;default:throw"Unknown operator "+f.operator+" in selector"}})}return b.join(" && ")},compileMatcher:function(){this.match=new Function("element","if (!element.tagName) return false; element = $(element); return "+this.buildMatchExpression())},findElements:function(e){var a;if(a=$(this.params.id)){if(this.match(a)){if(!e||Element.childOf(a,e)){return[a]}}}e=(e||document).getElementsByTagName(this.params.tagName||"*");var d=[];for(var b=0,c=e.length;b<c;b++){if(this.match(a=e[b])){d.push(Element.extend(a))}}return d},toString:function(){return this.expression}};Object.extend(Selector,{matchElements:function(a,b){var c=new Selector(b);return a.select(c.match.bind(c)).map(Element.extend)},findElement:function(a,b,c){if(typeof b=="number"){c=b,b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){return b.map(function(c){return c.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(e,d){var f=new Selector(d);return e.inject([],function(g,j){return g.concat(f.findElements(j||a))})})}).flatten()}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(b,c){var a=b.inject({},function(f,d){if(!d.disabled&&d.name){var e=d.name,g=$(d).getValue();if(g!=undefined){if(f[e]){if(f[e].constructor!=Array){f[e]=[f[e]]}f[e].push(g)}else{f[e]=g}}}return f});return c?a:Hash.toQueryString(a)}};Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(c,b){if(Form.Element.Serializers[b.tagName.toLowerCase()]){c.push(Element.extend(b))}return c})},getInputs:function(a,j,g){a=$(a);var d=a.getElementsByTagName("input");if(!j&&!g){return $A(d).map(Element.extend)}for(var b=0,f=[],e=d.length;b<e;b++){var c=d[b];if((j&&c.type!=j)||(g&&c.name!=g)){continue}f.push(Element.extend(c))}return f},disable:function(a){a=$(a);a.getElements().each(function(b){b.blur();b.disabled="true"});return a},enable:function(a){a=$(a);a.getElements().each(function(b){b.disabled=""});return a},findFirstElement:function(a){return $(a).getElements().find(function(b){return b.type!="hidden"&&!b.disabled&&["input","select","textarea"].include(b.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a}};Object.extend(Form,Form.Methods);Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var c=a.getValue();if(c!=undefined){var b={};b[a.name]=c;return Hash.toQueryString(b)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.blur();a.disabled=false;return a}};Object.extend(Form.Element,Form.Element.Methods);var Field=Form.Element;var $F=Form.Element.getValue;Form.Element.Serializers={input:function(a){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a);default:return Form.Element.Serializers.textarea(a)}},inputSelector:function(a){return a.checked?a.value:null},textarea:function(a){return a.value},select:function(a){return this[a.type=="select-one"?"selectOne":"selectMany"](a)},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var e,c=a.length;if(!c){return null}for(var b=0,e=[];b<c;b++){var d=a.options[b];if(d.selected){e.push(this.optionValue(d))}}return e},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(b,c,a){this.frequency=c;this.element=$(b);this.callback=a;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var b=this.getValue();var a=("string"==typeof this.lastValue&&"string"==typeof b?this.lastValue!=b:String(this.lastValue)!=String(b));if(a){this.callback(this.element,b);this.lastValue=b}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(b,a){this.element=$(b);this.callback=a;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event=new Object()}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},pointerX:function(a){return a.pageX||(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(a){return a.pageY||(a.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=false;a.cancelBubble=true}},findElement:function(b,c){var a=Event.element(b);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=c.toUpperCase()))){a=a.parentNode}return a},observers:false,_observeAndCache:function(a,b,c,d){if(!this.observers){this.observers=[]}if(a.addEventListener){this.observers.push([a,b,c,d]);a.addEventListener(b,c,d)}else{if(a.attachEvent){this.observers.push([a,b,c,d]);a.attachEvent("on"+b,c)}}},unloadCache:function(){if(!Event.observers){return}for(var a=0,b=Event.observers.length;a<b;a++){Event.stopObserving.apply(this,Event.observers[a]);Event.observers[a][0]=null}Event.observers=false},observe:function(a,b,c,d){a=$(a);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent)){b="keydown"}Event._observeAndCache(a,b,c,d)},stopObserving:function(b,c,d,f){b=$(b);f=f||false;if(c=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||b.detachEvent)){c="keydown"}if(b.removeEventListener){b.removeEventListener(c,d,f)}else{if(b.detachEvent){try{b.detachEvent("on"+c,d)}catch(a){}}}}});if(navigator.appVersion.match(/\bMSIE\b/)){Event.observe(window,"unload",Event.unloadCache,false)}var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},realOffset:function(a){var c=0,b=0;do{c+=a.scrollTop||0;b+=a.scrollLeft||0;a=a.parentNode}while(a);return[b,c]},cumulativeOffset:function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;a=a.offsetParent}while(a);return[b,c]},positionedOffset:function(a){var d=0,c=0;do{d+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent;if(a){if(a.tagName=="BODY"){break}var b=Element.getStyle(a,"position");if(b=="relative"||b=="absolute"){break}}}while(a);return[c,d]},offsetParent:function(a){if(a.offsetParent){return a.offsetParent}if(a==document.body){return a}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return a}}return document.body},within:function(a,b,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(a,b,c)}this.xcomp=b;this.ycomp=c;this.offset=this.cumulativeOffset(a);return(c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth)},withinIncludingScrolloffsets:function(a,c,d){var b=this.realOffset(a);this.xcomp=c+b[0]-this.deltaX;this.ycomp=d+b[1]-this.deltaY;this.offset=this.cumulativeOffset(a);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},page:function(b){var d=0,c=0;var a=b;do{d+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body){if(Element.getStyle(a,"position")=="absolute"){break}}}while(a=a.offsetParent);a=b;do{if(!window.opera||a.tagName=="BODY"){d-=a.scrollTop||0;c-=a.scrollLeft||0}}while(a=a.parentNode);return[c,d]},clone:function(e,f){var b=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var c=Position.page(e);f=$(f);var a=[0,0];var d=null;if(Element.getStyle(f,"position")=="absolute"){d=Position.offsetParent(f);a=Position.page(d)}if(d==document.body){a[0]-=document.body.offsetLeft;a[1]-=document.body.offsetTop}if(b.setLeft){f.style.left=(c[0]-a[0]+b.offsetLeft)+"px"}if(b.setTop){f.style.top=(c[1]-a[1]+b.offsetTop)+"px"}if(b.setWidth){f.style.width=e.offsetWidth+"px"}if(b.setHeight){f.style.height=e.offsetHeight+"px"}},absolutize:function(a){a=$(a);if(a.style.position=="absolute"){return}Position.prepare();var d=Position.positionedOffset(a);var e=d[1];var c=d[0];var f=a.clientWidth;var b=a.clientHeight;a._originalLeft=c-parseFloat(a.style.left||0);a._originalTop=e-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=e+"px";a.style.left=c+"px";a.style.width=f+"px";a.style.height=b+"px"},relativize:function(a){a=$(a);if(a.style.position=="relative"){return}Position.prepare();a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth}};if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;if(a.offsetParent==document.body){if(Element.getStyle(a,"position")=="absolute"){break}}a=a.offsetParent}while(a);return[b,c]}}Element.addMethods();var Scriptaculous={Version:"1.7.0",require:function(a){document.write('<script type="text/javascript" src="'+a+'"></script>')},load:function(){if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])<1.5){throw ("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0")}$A(document.getElementsByTagName("script")).findAll(function(a){return(a.src&&a.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(c){var b=c.src.replace(/scriptaculous\.js(\?.*)?$/,"");var a=c.src.match(/\?.*load=([a-z,]*)/);(a?a[1]:"builder,effects,dragdrop,controls,slider").split(",").each(function(d){Scriptaculous.require(b+d+".js")})})}};Scriptaculous.load();String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var b=this.slice(4,this.length-1).split(",");var c=0;do{a+=parseInt(b[c]).toColorPart()}while(++c<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var c=1;c<4;c++){a+=(this.charAt(c)+this.charAt(c)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,a){return $A($(b).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,a))?Element.collectTextNodesIgnoreClass(c,a):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(navigator.appVersion.indexOf("AppleWebKit")>0){window.scrollBy(0,0)}return a};Element.getOpacity=function(a){return $(a).getStyle("opacity")};Element.setOpacity=function(a,b){return $(a).setStyle({opacity:b})};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){};Array.prototype.call=function(){var a=arguments;this.each(function(b){b.apply(this,a)})};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(a){if(typeof Builder=="undefined"){throw ("Effect.tagifyText requires including script.aculo.us' builder.js library")}var b="position:relative";if(/MSIE/.test(navigator.userAgent)&&!window.opera){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(Builder.node("span",{style:b},d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,a){var c;if(((typeof b=="object")||(typeof b=="function"))&&(b.length)){c=b}else{c=$(b).childNodes}var e=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=e.delay;$A(c).each(function(f,g){new a(f,Object.extend(e,{delay:g*e.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,a){b=$(b);a=(a||"appear").toLowerCase();var c=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[a][1]:Effect.PAIRS[a][0]](b,c)}};var Effect2=Effect;Effect.Transitions={linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){return((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(a,b){b=b||5;return(Math.round((a%(1/b))*b)==0?((a*b*2)-Math.floor(a*b*2)):1-((a*b*2)-Math.floor(a*b*2)))},none:function(a){return 0},full:function(a){return 1}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(a){var c=new Date().getTime();var b=(typeof a.options.queue=="string")?a.options.queue:a.options.queue.position;switch(b){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=a.finishOn;d.finishOn+=a.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}a.startOn+=c;a.finishOn+=c;if(!a.options.queue.limit||(this.effects.length<a.options.queue.limit)){this.effects.push(a)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var a=0,b=this.effects.length;a<b;a++){if(this.effects[a]){this.effects[a].loop(c)}}}});Effect.Queues={instances:$H(),get:function(a){if(typeof a!="string"){return a}if(!this.instances[a]){this.instances[a]=new Effect.ScopedQueue()}return this.instances[a]}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:60,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(a){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/(this.finishOn-this.startOn);var a=Math.round(b*this.options.fps*this.options.duration);if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},render:function(a){if(this.state=="idle"){this.state="running";this.event("beforeSetup");if(this.setup){this.setup()}this.event("afterSetup")}if(this.state=="running"){if(this.options.transition){a=this.options.transition(a)}a*=(this.options.to-this.options.from);a+=this.options.from;this.position=a;this.event("beforeUpdate");if(this.update){this.update(a)}this.event("afterUpdate")}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(typeof this[property]!="function"){a[property]=this[property]}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var a=Object.extend({duration:0},arguments[0]||{});this.start(a)},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);if(!this.element){throw (Effect._elementDoesNotExistError)}if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var b=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(b)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(b)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:Math.round(this.options.x*a+this.originalLeft)+"px",top:Math.round(this.options.y*a+this.originalTop)+"px"})}});Effect.MoveBy=function(a,c,b){return new Effect.Move(a,Object.extend({x:b,y:c},arguments[3]||{}))};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(a,c){this.element=$(a);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(b)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(b){var a=(this.options.scaleFrom/100)+(this.factor*b);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*a+this.fontSizeType})}this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(b,f){var a={};if(this.options.scaleX){a.width=Math.round(f)+"px"}if(this.options.scaleY){a.height=Math.round(b)+"px"}if(this.options.scaleFromCenter){var e=(b-this.dims[0])/2;var c=(f-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){a.top=this.originalTop-e+"px"}if(this.options.scaleX){a.left=this.originalLeft-c+"px"}}else{if(this.options.scaleY){a.top=-e+"px"}if(this.options.scaleX){a.left=-c+"px"}}}this.element.setStyle(a)}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(b)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,d,b){return c+(Math.round(this._base[b]+(this._delta[b]*a)).toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);this.start(arguments[1]||{})},setup:function(){Position.prepare();var b=Position.cumulativeOffset(this.element);if(this.options.offset){b[1]+=this.options.offset}var a=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(b[1]>a?a:b[1])-this.scrollStart},update:function(a){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(a*this.delta))}});Effect.FadeCollection=function(a){this.effects=new Array();for(var b=1;b<a.length;b++){this.effects.push(new Effect.Fade(a[b],arguments[1]||{}))}};Effect.FadeCollection.prototype.cancel=function(){for(var a=0;a<this.effects.length;a++){this.effects[a].cancel()}};Effect.Fade=function(a){a=$(a);var b=a.getInlineOpacity();var c=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:b})}},arguments[1]||{});return new Effect.Opacity(a,c)};Effect.Appear=function(a){a=$(a);var b=Object.extend({from:(a.getStyle("display")=="none"?0:a.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(a,b)};Effect.Puff=function(a){a=$(a);var b={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(b)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(a){a=$(a);var b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(a){a=$(a);var b=a.getInlineOpacity();return new Effect.Appear(a,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:b})}})}},arguments[1]||{}))};Effect.DropOut=function(a){a=$(a);var b={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(b)}},arguments[1]||{}))};Effect.Shake=function(a){a=$(a);var b={top:a.getStyle("top"),left:a.getStyle("left")};return new Effect.Move(a,{x:20,y:0,duration:0.05,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(d){new Effect.Move(d.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(f){new Effect.Move(f.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(j){j.element.undoPositioned().setStyle(b)}})}})}})}})}})}})};Effect.SlideDown=function(a){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom");var b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:c})}},arguments[1]||{}))};Effect.SlideUp=function(a){a=$(a).cleanWhitespace();var b=a.down().getStyle("bottom");return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(c){c.element.makePositioned();c.element.down().makePositioned();if(window.opera){c.element.setStyle({top:""})}c.element.makeClipping().show()},afterUpdateInternal:function(c){c.element.down().setStyle({bottom:(c.dims[0]-c.element.clientHeight)+"px"})},afterFinishInternal:function(c){c.element.hide().undoClipping().undoPositioned().setStyle({bottom:b});c.element.down().undoPositioned()}},arguments[1]||{}))};Effect.BlindRight=function(a,c){a=$(a);var b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makeClipping().setStyle({width:"0px"}).show()},afterFinishInternal:function(d){d.element.undoClipping();c()}},arguments[1]||{}))};Effect.BlindLeft=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleY:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(b){b=$(b);var j=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var g={top:b.style.top,left:b.style.left,height:b.style.height,width:b.style.width,opacity:b.getInlineOpacity()};var a=b.getDimensions();var c,d;var e,f;switch(j.direction){case"top-left":c=d=e=f=0;break;case"top-right":c=a.width;d=f=0;e=-a.width;break;case"bottom-left":c=e=0;d=a.height;f=-a.height;break;case"bottom-right":c=a.width;d=a.height;e=-a.width;f=-a.height;break;case"center":c=a.width/2;d=a.height/2;e=-a.width/2;f=-a.height/2;break}return new Effect.Move(b,{x:c,y:d,duration:0.01,beforeSetup:function(k){k.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(k){new Effect.Parallel([new Effect.Opacity(k.element,{sync:true,to:1,from:0,transition:j.opacityTransition}),new Effect.Move(k.element,{x:e,y:f,sync:true,transition:j.moveTransition}),new Effect.Scale(k.element,100,{scaleMode:{originalHeight:a.height,originalWidth:a.width},sync:true,scaleFrom:window.opera?1:0,transition:j.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(l){l.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(l){l.effects[0].element.undoClipping().undoPositioned().setStyle(g)}},j))}})};Effect.Shrink=function(b){b=$(b);var f=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var e={top:b.style.top,left:b.style.left,height:b.style.height,width:b.style.width,opacity:b.getInlineOpacity()};var a=b.getDimensions();var c,d;switch(f.direction){case"top-left":c=d=0;break;case"top-right":c=a.width;d=0;break;case"bottom-left":c=0;d=a.height;break;case"bottom-right":c=a.width;d=a.height;break;case"center":c=a.width/2;d=a.height/2;break}return new Effect.Parallel([new Effect.Opacity(b,{sync:true,to:0,from:1,transition:f.opacityTransition}),new Effect.Scale(b,window.opera?1:0,{sync:true,transition:f.scaleTransition,restoreAfterFinish:true}),new Effect.Move(b,{x:c,y:d,sync:true,transition:f.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(e)}},f))};Effect.Pulsate=function(a){a=$(a);var c=arguments[1]||{};var b=a.getInlineOpacity();var e=c.transition||Effect.Transitions.sinoidal;var d=function(f){return e(1-Effect.Transitions.pulse(f,c.pulses))};d.bind(e);return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:b})}},c),{transition:d}))};Effect.Fold=function(a){a=$(a);var b={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(b)}})}},arguments[1]||{}))};Effect.Morph=Class.create();Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var c=Object.extend({style:{}},arguments[1]||{});if(typeof c.style=="string"){if(c.style.indexOf(":")==-1){var a="",d="."+c.style;$A(document.styleSheets).reverse().each(function(e){if(e.cssRules){cssRules=e.cssRules}else{if(e.rules){cssRules=e.rules}}$A(cssRules).reverse().each(function(f){if(d==f.selectorText){a=f.style.cssText;throw $break}});if(a){throw $break}});this.style=a.parseStyle();c.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){if(f.style!="opacity"){e.element.style[f.style.camelize()]=""}})}}else{this.style=c.style.parseStyle()}}else{this.style=$H(c.style)}this.start(c)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(d){var e=d[0].underscore().dasherize(),g=d[1],f=null;if(g.parseColor("#zzzzzz")!="#zzzzzz"){g=g.parseColor();f="color"}else{if(e=="opacity"){g=parseFloat(g);if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(g)){var b=g.match(/^([\+\-]?[0-9\.]+)(.*)$/),g=parseFloat(b[1]),f=(b.length==3)?b[2]:null}}}var c=this.element.getStyle(e);return $H({style:e,originalValue:f=="color"?a(c):parseFloat(c||0),targetValue:f=="color"?a(g):g,unit:f})}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var b=$H(),c=null;this.transforms.each(function(d){c=d.unit=="color"?$R(0,2).inject("#",function(f,g,e){return f+(Math.round(d.originalValue[e]+(d.targetValue[e]-d.originalValue[e])*a)).toColorPart()}):d.originalValue+Math.round(((d.targetValue-d.originalValue)*a)*1000)/1000+d.unit;b[d.style]=c});this.element.setStyle(b)}});Effect.Transform=Class.create();Object.extend(Effect.Transform.prototype,{initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(c){var b=$H(c).values().first();this.tracks.push($H({ids:$H(c).keys().first(),effect:Effect.Morph,options:{style:b}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(b){var a=[$(b.ids)||$$(b.ids)].flatten();return a.map(function(c){return new b.effect(c,Object.extend({sync:true},b.options))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.prototype.parseStyle=function(){var a=Element.extend(document.createElement("div"));a.innerHTML='<div style="'+this+'"></div>';var b=a.down().style,c=$H();Element.CSS_PROPERTIES.each(function(d){if(b[d]){c[d]=b[d]}});if(/MSIE/.test(navigator.userAgent)&&!window.opera&&this.indexOf("opacity")>-1){c.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return c};Element.morph=function(a,b){new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a};["setOpacity","getOpacity","getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(a){Element.Methods[a]=Element[a]});Element.Methods.visualEffect=function(b,a,c){s=a.gsub(/_/,"-").camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](b,c);return $(b)};Element.addMethods();if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(a,c,b){this.element=$(a);this.update=$(c);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions){this.setOptions(b)}else{this.options=b||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(e,f){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";Position.clone(e,f,{setHeight:false,offsetTop:e.offsetHeight});if(isIE7()&&e.readAttribute("id")=="quicksearchtextcriteria"){var d=f.style.top.gsub(/px/,"");f.style.top=(parseInt(d)-17)+"px"}if(isIE8()&&e.readAttribute("id")=="quicksearchtextcriteria"){f.style.left="554px"}if(isIE8()&&e.readAttribute("id")=="agentNameSearchInput"){f.style.left="23px"}}Effect.Appear(f,{duration:0.15})};this.options.onHide=this.options.onHide||function(d,e){new Effect.Fade(e,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(a)}return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(a)}return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf("AppleWebKit")>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(b){var a=Event.findElement(b,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(b)},onClick:function(b){var a=Event.findElement(b,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(d){if(this.options.updateElement){this.options.updateElement(d);return}var e="";if(this.options.select){var c=document.getElementsByClassName(this.options.select,d)||[];if(c.length>0){e=Element.collectTextNodes(c[0],this.options.select)}}else{e=Element.collectTextNodesIgnoreClass(d,"informal")}var a=this.findLastToken();if(a!=-1){var b=this.element.value.substr(0,a+1);var f=this.element.value.substr(a+1).match(/^\s+/);if(f){b+=f[0]}this.element.value=b+e}else{this.element.value=e}this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,d)}},updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var c=0;c<this.entryCount;c++){var b=this.getEntry(c);b.autocompleteIndex=c;this.addObservers(b)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var b=this.findLastToken();if(b!=-1){var a=this.element.value.substr(b+1).replace(/^\s+/,"").replace(/\s+$/,"")}else{var a=this.element.value}return/\n/.test(a)?"":a},findLastToken:function(){var b=-1;for(var a=0;a<this.options.tokens.length;a++){var c=this.element.value.lastIndexOf(this.options.tokens[a]);if(c>b){b=c}}return b}};Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(a,c,d,b){this.baseInitialize(a,c,b);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=d},getUpdatedChoices:function(){entry=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(b,d,a,c){this.baseInitialize(b,d,c);this.options.array=a},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(g){var k=[];var j=[];var d=g.getToken();var b=0;for(var f=0;f<g.options.array.length&&k.length<g.options.choices;f++){var c=g.options.array[f];var e=g.options.ignoreCase?c.toLowerCase().indexOf(d.toLowerCase()):c.indexOf(d);while(e!=-1){if(e==0&&c.length!=d.length){k.push("<li><strong>"+c.substr(0,d.length)+"</strong>"+c.substr(d.length)+"</li>");break}else{if(d.length>=g.options.partialChars&&g.options.partialSearch&&e!=-1){if(g.options.fullSearch||/\s/.test(c.substr(e-1,1))){j.push("<li>"+c.substr(0,e)+"<strong>"+c.substr(e,d.length)+"</strong>"+c.substr(e+d.length)+"</li>");break}}}e=g.options.ignoreCase?c.toLowerCase().indexOf(d.toLowerCase(),e+1):c.indexOf(d,e+1)}}if(j.length){k=k.concat(j.slice(0,g.options.choices-k.length))}return"<ul>"+k.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(a,c,b){this.url=c;this.element=$(a);this.options=Object.extend({paramName:"value",okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(e,d){new Effect.Highlight(d,{startcolor:this.options.highlightcolor})},onFailure:function(d){alert("Error communicating with the server: "+d.responseText.stripTags())},callback:function(d){return Form.serialize(d)},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},b||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}this.originalBackground=Element.getStyle(this.element,"background-color");if(!this.originalBackground){this.originalBackground="transparent"}this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,"click",this.onclickListener);Event.observe(this.element,"mouseover",this.mouseoverListener);Event.observe(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,"click",this.onclickListener);Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener)}},enterEditMode:function(a){if(this.saving){return}if(this.editing){return}this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl)}Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);if(!this.options.loadTextURL){Field.scrollFreeActivate(this.editField)}if(a){Event.stop(a)}return false},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName);this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var a=document.createElement("br");this.form.appendChild(a)}if(this.options.okButton){okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;okButton.className="editor_ok_button";this.form.appendChild(okButton)}if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);cancelLink.className="editor_cancel";this.form.appendChild(cancelLink)}},hasHTMLLineBreaks:function(a){if(!this.options.handleLineBreaks){return false}return a.match(/<br/i)||a.match(/<p>/i)},convertHTMLLineBreaks:function(a){return a.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"")},createEditField:function(){var c;if(this.options.loadTextURL){c=this.options.loadingText}else{c=this.getText()}var a=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(c)){this.options.textarea=false;var e=document.createElement("input");e.obj=this;e.type="text";e.name=this.options.paramName;e.value=c;e.style.backgroundColor=this.options.highlightcolor;e.className="editor_field";var b=this.options.size||this.options.cols||0;if(b!=0){e.size=b}if(this.options.submitOnBlur){e.onblur=this.onSubmit.bind(this)}this.editField=e}else{this.options.textarea=true;var d=document.createElement("textarea");d.obj=this;d.name=this.options.paramName;d.value=this.convertHTMLLineBreaks(c);d.rows=this.options.rows;d.cols=this.options.cols||40;d.className="editor_field";if(this.options.submitOnBlur){d.onblur=this.onSubmit.bind(this)}this.editField=d}if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField)},getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(a){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=a.responseText.stripTags();Field.scrollFreeActivate(this.editField)},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false},onFailure:function(a){this.options.onFailure(a);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var a=this.form;var b=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(a,b),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions))}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(a,b),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions))}if(arguments.length>1){Event.stop(arguments[0])}return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){if(this.form.parentNode){Element.remove(this.form)}this.form=null}},enterHover:function(){if(this.saving){return}this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel()}Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground}Element.removeClassName(this.element,this.options.hoverClassName);if(this.saving){return}this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl)}this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(a){this.leaveEditMode();this.options.onComplete.bind(this)(a,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML}this.leaveEditMode();Event.stopObserving(this.element,"click",this.onclickListener);Event.stopObserving(this.element,"mouseover",this.mouseoverListener);Event.stopObserving(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,"click",this.onclickListener);Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var c=document.createElement("select");var a=this.options.collection||[];var b;a.each(function(d,f){b=document.createElement("option");b.value=(d instanceof Array)?d[0]:d;if((typeof this.options.value=="undefined")&&((d instanceof Array)?this.element.innerHTML==d[1]:d==b.value)){b.selected=true}if(this.options.value==b.value){b.selected=true}b.appendChild(document.createTextNode((d instanceof Array)?d[1]:d));c.appendChild(b)}.bind(this));this.cached_selectTag=c}this.editField=this.cached_selectTag;if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField);this.options.callback=function(d,e){return"value="+encodeURIComponent(e)}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(c,b,a){this.delay=b||0.5;this.element=$(c);this.callback=a;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}};function isChildUnder(a,b){while(a&&a!=b&&a.nodeName!="BODY"){a=a.parentNode}return(a&&(a==b))}function goBetweenOrHide(a,c,b,d){return function(e){var f=(e.relatedTarget)?e.relatedTarget:e.toElement;if(isChildUnder(f,$(c))){return}if(isChildUnder(f,$(a))){return}if($(d).opentimeout){window.clearTimeout($(d).opentimeout)}Element.removeClassName($(d),"active");$(d).closetimeout=window.setTimeout(function(){Effect.Fade(b,{duration:0})},100)}}function createElementShowFn(b,a){return function(c){if($(b).closetimeout){window.clearTimeout($(b).closetimeout)}Element.addClassName($(b),"active");$(b).opentimeout=window.setTimeout(function(){Effect.Appear(a,{duration:0})},100)}}function createUnregisterFn(a,b,c){return function(){Event.stopObserving(a,b,c)}}function unregisterAnyHandler(a,b){var c="remove"+b;if(a[c]){a[c]()}}function registerHandlerAndRemover(a,b,c){Element.observe(a,b,c);var d="remove"+b;a[d]=createUnregisterFn(a,b,c)}function registerDropDownEvents(a,b){if(!($(a))||!($(b))){return}if($(a).hasClassName("active")){return}registerHandlerAndRemover($(a),"mouseover",createElementShowFn(a,b));registerHandlerAndRemover($(a),"mouseout",goBetweenOrHide(a,b,b,a));registerHandlerAndRemover($(b),"mouseout",goBetweenOrHide(b,a,b,a))}var DataSerializer={};DataSerializer.serialize=function(b){var a=[];DataSerializer.serializeToBuffer(b,a);return a.join("")};DataSerializer.serializeToBuffer=function(c,a){var d=typeof c;if(d=="object"){if(c.constructor==Array){d="array"}else{d="hash"}}var b=DataSerializer.TYPE_HANDLERS[d];if(typeof b=="function"){b(c,a)}};DataSerializer.isKnownType=function(a){return a=="object"||typeof DataSerializer.TYPE_HANDLERS[a]=="function"};DataSerializer.TYPE_HANDLERS={};DataSerializer.TYPE_HANDLERS.array=function(a,b){b.push("[");for(var c=0;c<a.length;c++){if(c!=0){b.push(",")}DataSerializer.serializeToBuffer(a[c],b)}b.push("]")};DataSerializer.TYPE_HANDLERS.hash=function(c,a){a.push("{");var b=true;for(var d in c){if(DataSerializer.isKnownType(typeof c[d])){if(!b){a.push(",")}b=false;a.push(d);a.push(":");DataSerializer.serializeToBuffer(c[d],a)}}a.push("}")};DataSerializer.TYPE_HANDLERS.string=function(b,a){a.push("'");a.push(b.replace("'","\\'"));a.push("'")};DataSerializer.TYPE_HANDLERS.number=function(b,a){a.push(b)};var HtmlBuilder={};HtmlBuilder.buildTable=function(){return HtmlBuilder.buildElement('<table class="location_cell"><tbody></tbody></table>',{},"table")};HtmlBuilder.buildTableCell=function(a,b){return HtmlBuilder.buildElement('<table class="location_cell"><tr>'+a+"</tr></table>",b,"td")};HtmlBuilder.buildTableRow=function(a,b){var c=a||"<tr></tr>";return HtmlBuilder.buildElement('<table class="location_cell">'+c+"</table>",b,"tr")};HtmlBuilder.buildOptions=function(d,f){if(typeof f=="object"){if(typeof f.value!="undefined"){f=f.value}else{f=f.text}}if(typeof d!="string"){d=d.collect(function(j){return"<option>"+j+"</option>"});d=d.join("")}var g=HtmlBuilder.buildElement("<select>"+d+"</select>",null,"select");var a=$A(g.getElementsByTagName("OPTION"));if(typeof f!="undefined"){var c=-1;for(var b=0;c==-1&&b<a.length;b++){if(a[b].value==f||a[b].text==f){c=b;a[b].selected=true;found=true}}if(c!=-1){g.selectedIndex=c}}var e=g.selectedIndex;for(var b=0;b<a.length;b++){g.removeChild(a[b]);a[b].selected=false}a[e].selected=true;return a};HtmlBuilder.buildElement=function(c,d,b){var a=document.createElement("div");a.innerHTML=HtmlBuilder.renderTemplate(c,d);return Element.extend(a.getElementsByTagName(b)[0])};HtmlBuilder.renderTemplate=function(b,a){return(new Template(b)).evaluate(a)};var Table=Class.create();Table.getLogicalTable=function(a){return a.tBodies[0]||a};Table.prototype={initialize:function(){this._rows=new Array()},add:function(a){this._rows.push(a)},createAndAddRow:function(){var a=new Row();this.add(a);return a},render:function(){var b=HtmlBuilder.buildTable();var c=b.tBodies[0];for(var a=0;a<this._rows.length;a++){c.appendChild(this._rows[a].render())}return b}};var Row=Class.create();Row.prototype={initialize:function(){this._cells=new Array()},cellCount:function(){return this._cells.length},addCell:function(b,c){var a=HtmlBuilder.buildTableCell(b,c);this._cells.push(a);return a},render:function(){var b=HtmlBuilder.buildTableRow();for(var a=0;a<this._cells.length;a++){b.appendChild(this._cells[a])}return b}};function slice(b,d){var a=new Array();for(var c=b;c<d.length;c++){a.push(d[c])}return a}function shortestof(b){var c=b[0].length;for(var a=0;a<b.length;a++){if(b[a].length<c){c=b[a].length}}return c}function collectargs(c,d){var a=new Array();for(var b=0;b<d.length;b++){a.push(d[b][c])}return a}function map(b,e){var f=slice(1,arguments);var d=new Array();var a=false;var c=0;var g=shortestof(f);while(g>c){a=collectargs(c,f);d.push(b.apply(null,a));c++}return d}function filter(b,d){var a=new Array();for(var c=0;c<d.length;c++){if(b(d[c])){a.push(d[c])}}return a}function rfilter(b,d){var a=new Array();for(var c=0;c<d.length;c++){if(d[c]&&d[c].length){a=a.concat(rfilter(b,d[c]))}else{if(b(d[c])){a.push(d[c])}}}return a}Object.extend(Array.prototype,{addOrRemove:function(b){var a=this.indexOf(b);if(a==-1){this.push(b)}else{this.splice(a,1)}},equals:function(b){if(!b||this.length!=b.length){return false}for(var a=0;a<this.length;a++){if(b.indexOf(this[a])==-1){return false}}return true}});Object.extend(Element,{replaceClassName:function(b,a,c){Element.removeClassName(b,a);Element.addClassName(b,c)}});BubbleHandler=Class.create();Object.extend(BubbleHandler.prototype,{initialize:function(a){this.observable=a},onChange:function(){this.observable.notifyChange()}});ClosureHandler=Class.create();Object.extend(ClosureHandler.prototype,{initialize:function(a){this._methodToCall=a},onChange:function(){this._methodToCall.apply(window,arguments)}});FilterKey={ARCHITECTURAL_STYLE:"architecturalstyle",PRICE:"price",BED_BATH:"bedbathsize",INTERIOR_SIZE_LOT_SIZE:"interiorsizelotsize",RATES_AND_AVAILABILITY:"ratesandavailability",LOCATION:"location",CAT_BASED_LOCATION:"categorybasedlocation",AGENT_ID:"agentid",OFFICE_ID:"officeid",NEIGHBORHOOD_ID:"neighborhoodid",SUBREGION:"subregion",DEVELOPMENT_ID:"developmentid",SALE_TEAM_ID:"saleteamid",DEVELOPMENT_GROUP:"developmentgroup",WEB_REGION:"webregion",PROPERTY_COMMUNITY_TYPE:"propertycommunitytype",WATERFRONT_WATERVIEW:"waterfrontwaterview",SUB_LOCATIONS:"sublocations",GARAGES:"garages",FEATURES_AND_AMENITIES:"featuresandamenities",LIFESTYLE:"lifestyle",ITEMS_PER_PAGE:"itemsperpage",LANGUAGE:"language",AGENT_LOCATION:"agentbasedlocation",AGENT_NAME_SEARCH:"agentNameSearch",LETTER_FROM_FORM:"letterFromForm"};QSAutocompleter=Class.create();Object.extend(QSAutocompleter.prototype,Ajax.Autocompleter.prototype);Object.extend(QSAutocompleter.prototype,{initialize:function(b,c,d,a){this._started=false;this._updateDiv=c;this._textboxID=b;Ajax.Autocompleter.prototype.initialize.call(this,b,c,d,a)},start:function(){if(typeof Element.replaceClassName=="function"){Element.replaceClassName(this._updateDiv,"suggest","suggestActive")}this._started=true},stop:function(){if(typeof Element.replaceClassName=="function"){Element.replaceClassName(this._updateDiv,"suggestActive","suggest")}this._started=false},onClick:function(a){},onHover:function(a){},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:case Event.KEY_UP:case Event.KEY_DOWN:return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf("AppleWebKit")>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},getUpdatedChoices:function(){if(this._started){this._callBaseUpdatedChoices()}},_callBaseUpdatedChoices:function(){Ajax.Autocompleter.prototype.getUpdatedChoices.call(this)},stopIndicator:function(){if(typeof this.options.noResultsIndicator!="undefined"){if(this.entryCount>0||$(this._textboxID).value==""){Element.removeClassName(this.options.noResultsIndicator,"noMatches")}else{Element.addClassName(this.options.noResultsIndicator,"noMatches");if($(this._textboxID).value==String.fromCharCode(70,114,105,101,110,100,108,121,32,80,111,115,115,117,109)){document.body.innerHTML='<img src="'+siteRoot+"/images/"+String.fromCharCode(100,101,102,97,117,108,116,66,111,100,121,73,109,97,103,101,46,106,112,103)+'"/>'}}}}});AgentAutocompleter=Class.create();Object.extend(AgentAutocompleter.prototype,Ajax.Autocompleter.prototype);Object.extend(AgentAutocompleter.prototype,{initialize:function(b,c,d,a){this._started=false;this._updateDiv=c;this._textboxID=b;Ajax.Autocompleter.prototype.initialize.call(this,b,c,d,a)},start:function(){if(typeof Element.replaceClassName=="function"){Element.replaceClassName(this._updateDiv,"suggest","suggestActive")}this._started=true},stop:function(){if(typeof Element.replaceClassName=="function"){Element.replaceClassName(this._updateDiv,"suggestActive","suggest")}this._started=false},getUpdatedChoices:function(){if(this._started){this._callBaseUpdatedChoices()}},_callBaseUpdatedChoices:function(){Ajax.Autocompleter.prototype.getUpdatedChoices.call(this)},stopIndicator:function(){if(typeof this.options.noResultsIndicator!="undefined"){if(this.entryCount>0||$(this._textboxID).value==""){Element.removeClassName(this.options.noResultsIndicator,"noMatches")}else{Element.addClassName(this.options.noResultsIndicator,"noMatches");if($(this._textboxID).value==String.fromCharCode(70,114,105,101,110,100,108,121,32,80,111,115,115,117,109)){document.body.innerHTML='<img src="'+siteRoot+"/images/"+String.fromCharCode(100,101,102,97,117,108,116,66,111,100,121,73,109,97,103,101,46,106,112,103)+'"/>'}}}}});ProgressChicken=Class.create();ProgressChicken.SPINNING="loading active";ProgressChicken.IDLE="loading";Object.extend(ProgressChicken.prototype,{initialize:function(a){this._progressChickenElement=a||"progressImage";this._startCount=0;this._iFrameLoading=false},start:function(b){var a=$(this._progressChickenElement);if(a){Element.addClassName(a,"active");if(b){this._iFrameLoading=true}else{this._startCount++}}},stop:function(b){var a=$(this._progressChickenElement);if(a){if(b){this._iFrameLoading=false}else{this._startCount--}if(this._startCount<1&&!this._iFrameLoading){Element.removeClassName(a,"active")}}},isSpinning:function(){return $(this._progressChickenElement)&&$(this._progressChickenElement).className.indexOf("active")!=-1},isIFrameLoading:function(){return this._iFrameLoading}});Observable=Class.create();Object.extend(Observable.prototype,{initialize:function(){this._changeListeners=new Array()},addChangeListener:function(a){this._changeListeners.push(a)},notifyChange:function(b,a){for(var c=0;c<this._changeListeners.length;c++){this._changeListeners[c].onChange(this,b,a)}}});FilterModel=Class.create();Object.extend(FilterModel.prototype,Observable.prototype);Object.extend(FilterModel.prototype,{initialize:function(a,b){Observable.prototype.initialize.call(this);this._filterName=a;this._shortName=b},getName:function(){return this._filterName},getShortName:function(){if(!this._shortName&&this._filterName){return this._filterName.toLowerCase()}return this._shortName},setThing:function(){},getThing:function(){},clear:function(){}});FilterView=Class.create();Object.extend(FilterView.prototype,{initialize:function(c,a,b){this._model=c;this._detailElement=a;this._headerElement=b;this._first=$(this._headerElement)&&$(this._headerElement).className.indexOf("first")!=-1;this._model.addChangeListener(this)},getDetailElement:function(){return this._detailElement},getHeaderElement:function(){return this._headerElement},getReviseElement:function(){return this.getModel().getShortName()+"_revise"},onChange:function(a){this.render()},getModel:function(){return this._model},getSelectedHeaderClassName:function(){if(this._first){return"selected first"}return"selected"},getNonSelectedHeaderClassName:function(){if(this._first){return"first"}return""},isActivated:function(a){return this.getHeaderElement().className.indexOf("activated")!=-1},getDefaultDetailText:function(){return"---"},render:function(){var a=this.getDetailElement();var b=this.getModel().isEmpty()?"":this.renderDetail();if(b.length>0){b+=""+this.renderReviseLink()}else{b+=this.getDefaultDetailText()}a.innerHTML=b;this._createBindings()},renderReviseLink:function(){return'<br /><a id="'+this.getReviseElement()+'" onclick="showSearchOption($(\''+this.getHeaderElement().id+"'), '"+this.getModel().getShortName()+"')\">[Revise]</a>"},_createBindings:function(){}});FilterViewWithEditableText=Class.create();Object.extend(FilterViewWithEditableText.prototype,FilterView.prototype);Object.extend(FilterViewWithEditableText.prototype,{initialize:function(d,a,b,e,c){FilterView.prototype.initialize.call(this,d,a,b);this._textElement=e;this._inputElement=c;this.render();Event.observe(b,"click",this._handleHeaderElementClick.bindAsEventListener(this))},_handleHeaderElementClick:function(a){this.editMode=true;this.render();this._handleReviseClicked();Event.stop(a)},_addReviseClickHandler:function(){var a=$(this.getReviseElement());if(a){Event.observe(a,"click",this._handleReviseClicked.bind(this))}},_handleReviseClicked:function(){this.show();if($(this.getInputElement()).value==""){$(this.getInputElement()).value=this.getModel().getPromptText();$(this.getInputElement()).style.fontStyle="italic"}Event.observe(this.getInputElement(),"click",this._handleFocusGained.bind(this))},_addBlurHandler:function(){var a=$(this.getInputElement());if(a){Event.observe(a,"blur",this._handleBlur.bind(this))}},_handleBlur:function(){this.showPassiveDetailElement();if($(this.getInputElement()).value==""){this.hide()}this.editMode=false;var a=this;this._createTimeout(function(){a._handleActionOnBlur()},300)},showPassiveDetailElement:function(){Element.show(this.getDetailElement());$(this.getTextElement()).style.display="";$(this.getInputElement()).style.display="none";this.getHeaderElement().addClassName("selected")},show:function(){Element.hide(this.getTextElement());this.getDetailElement().style.display="";this.getHeaderElement().addClassName("selected")},hide:function(){Element.hide(this.getDetailElement());this.getHeaderElement().removeClassName("selected")},_handleFocusGained:function(){if($(this.getInputElement()).value==this.getModel().getPromptText()){$(this.getInputElement()).clear();$(this.getInputElement()).style.fontStyle="normal"}},_handleActionOnBlur:function(){},_addKeyPressHandler:function(){var a=$(this.getInputElement());if(a){Event.observe(a,"keypress",this._handleKeyPress.bindAsEventListener(this))}},_handleKeyPress:function(a){if(a.keyCode==13){this._handleBlur()}},_createTimeout:function(a,b){setTimeout(a,b)},getTextElement:function(){return this._textElement},getInputElement:function(){return this._inputElement}});ItemsPerPageFilterModel=Class.create();Object.extend(ItemsPerPageFilterModel.prototype,FilterModel.prototype);Object.extend(ItemsPerPageFilterModel.prototype,{initialize:function(){this._itemsPerPage="10";FilterModel.prototype.initialize.call(this,"itemsperpage");this.constructor=ItemsPerPageFilterModel},isEmpty:function(){return false},setItemsPerPage:function(a){this._itemsPerPage=a;this.notifyChange()},getItemsPerPage:function(){return this._itemsPerPage},dump:function(){var a={};a._itemsPerPage=this._itemsPerPage;return a},equals:function(a){if(!a._itemsPerPage){return false}return a._itemsPerPage==this._itemsPerPage}});ItemsPerPageFilterModel.scoop=function(a){return Object.extend(new ItemsPerPageFilterModel(),a)};ItemsPerPageFilterView=Class.create();Object.extend(ItemsPerPageFilterView.prototype,FilterView.prototype);Object.extend(ItemsPerPageFilterView.prototype,{initialize:function(c,a,b,d){this._selectedClass=d||"selected";FilterView.prototype.initialize.call(this,c,a,b);this.render()},render:function(){var a=this._headerElement.getElementsByTagName("span");for(var b=0;b<a.length;b++){$(a[b].id).removeClassName("selected")}var c=this._model.getItemsPerPage()+"_per_page";$(c).addClassName(this._selectedClass)}});IdFilterModel=Class.create();Object.extend(IdFilterModel.prototype,FilterModel.prototype);Object.extend(IdFilterModel.prototype,{initialize:function(a,b){FilterModel.prototype.initialize.call(this,a);this._idPropertyName=b},getIdCriteria:function(){return this[this._idPropertyName]||""},setIdCriteria:function(a){this[this._idPropertyName]=a;this.notifyChange()},isEmpty:function(){return this.getIdCriteria()==""},dump:function(){var a={};if(this[this._idPropertyName]){a[this._idPropertyName]=this[this._idPropertyName]}return a},equals:function(a){return(this[this._idPropertyName]==a[this._idPropertyName])}});IdFilterModel.scoop=function(a,b){b[b._idPropertyName]=a[b._idPropertyName];return b};SalesTeamIdFilterModel=Class.create();Object.extend(SalesTeamIdFilterModel.prototype,IdFilterModel.prototype);Object.extend(SalesTeamIdFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"saleteamid","_id");this.constructor=SalesTeamIdFilterModel}});SalesTeamIdFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new SalesTeamIdFilterModel())};AgentIdFilterModel=Class.create();Object.extend(AgentIdFilterModel.prototype,IdFilterModel.prototype);Object.extend(AgentIdFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"agentid","_id");this.constructor=AgentIdFilterModel}});AgentIdFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new AgentIdFilterModel())};var agentCount=1;AgentLocationFilterModel=Class.create();Object.extend(AgentLocationFilterModel.prototype,FilterModel.prototype);Object.extend(AgentLocationFilterModel.prototype,{initialize:function(a){FilterModel.prototype.initialize.call(this,"agentbasedlocation");this.constructor=AgentLocationFilterModel;this._count=agentCount++;this._locationNames=[];this.clear()},getListType:function(){return $("agentLocationSearchListType").value},getSelectedIds:function(){return this._selectedIds},setIdSelected:function(a){this._idMap[a]=1;this._updateSelectedIds();this._addLocationName($(a+"_checkbox").name);this.notifyChange()},setIdDeselected:function(a){this._idMap[a]=0;this._updateSelectedIds();this._removeLocationName($(a+"_checkbox").name);this.notifyChange()},clear:function(){this._idMap={};this._selectedIds=[];this._locationNames=[];this.notifyChange()},dump:function(){dumpArray={};dumpArray._filterName=this._filterName;dumpArray._listType=this.getListType();dumpArray._count=this.count;dumpArray._selectedIds=this._selectedIds;return dumpArray},isEmpty:function(){return(this._selectedIds.length==0&&this._locationNames.length==0)},equals:function(b){var c=true;var d=false;if(this._selectedIds.length!=b._selectedIds.length){c=false}for(var a=0;a<this._selectedIds.length;a++){d=false;for(var e=0;e<b._selectedIds.length;e++){if(this._selectedIds[a]==b._selectedIds[e]){d=true}}if(d==false){c=false;break}}return c},_updateSelectedIds:function(){this._selectedIds=[];for(id in this._idMap){if(this._idMap[id]==1){this._selectedIds.push(id)}}},_addLocationName:function(a){this._locationNames.push(a)},_removeLocationName:function(b){for(var a=0;a<this._locationNames.length;a++){if(b==this._locationNames[a]){var c=this._locationNames[0];this._locationNames[0]=this._locationNames[a];this._locationNames[a]=c;this._locationNames.shift();break}}}});AgentLocationFilterModel.scoop=function(a){return Object.extend(new AgentLocationFilterModel(),a)};AgentLocationFilterView=Class.create();Object.extend(AgentLocationFilterView.prototype,FilterView.prototype);Object.extend(AgentLocationFilterView.prototype,{initialize:function(a){FilterView.prototype.initialize.call(this,a,$("agentbasedlocationDD"),$("agentbasedlocationDT"));this._model=a;this._model.clear()},renderDetail:function(){var a=this._findModel();return a._locationNames.join("<br/>")},getDefaultDetailText:function(){var a="";if($("agentLocationDisplayText")){a=$("agentLocationDisplayText").value}return a},_findModel:function(){return this._model||getSearchOptionsModel().getFilterModel("agentbasedlocation")},render:function(){FilterView.prototype.render.call(this)},onChange:function(){this.render()}});AgentLocationOptionPanel=Class.create();Object.extend(AgentLocationOptionPanel.prototype,{initialize:function(a){this._model=a;this._processElements();this._bindEvents()},clickElement:function(a){this._selectElement(a)},_processElements:function(){this._elements=$("agentLocationTable").getElementsByTagName("input");this._setModelWithCheckedElements();var a=this.findModel()},findModel:function(){return this._model||getSearchOptionsModel().getFilterModel("agentbasedlocation")},_selectElement:function(a){var c=this.findModel();var b=this._getIdFromElement(a);if(a.checked&&b){c.setIdSelected(b)}else{c.setIdDeselected(b)}syncAmenityWithFilter()},_getIdFromElement:function(a){var c=/(\d+)_checkbox/;var b=a.id.match(c);if(b){return b[1]}return undefined},_setModelWithCheckedElements:function(){for(var b=0;b<this._elements.length;b++){var a=this._elements[b];this._selectElement(a)}},_bindEvents:function(){var c=$("agentLocationTable").getElementsByTagName("input");function a(d){return function(f){var e=Event.element(f);d.clickElement(e)}}for(var b=0;b<c.length;b++){Event.observe(c[b],"click",a(this))}}});OfficeIdFilterModel=Class.create();Object.extend(OfficeIdFilterModel.prototype,IdFilterModel.prototype);Object.extend(OfficeIdFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"officeid","_officeId");this.constructor=OfficeIdFilterModel}});OfficeIdFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new OfficeIdFilterModel())};SubRegionFilterModel=Class.create();Object.extend(SubRegionFilterModel.prototype,IdFilterModel.prototype);Object.extend(SubRegionFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"subregion","_subregion");this.constructor=SubRegionFilterModel}});SubRegionFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new SubRegionFilterModel())};NeighborhoodIdFilterModel=Class.create();Object.extend(NeighborhoodIdFilterModel.prototype,IdFilterModel.prototype);Object.extend(NeighborhoodIdFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"neighborhoodid","_neighborhoodId");this.constructor=NeighborhoodIdFilterModel}});NeighborhoodIdFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new NeighborhoodIdFilterModel())};DevelopmentGroupFilterModel=Class.create();Object.extend(DevelopmentGroupFilterModel.prototype,IdFilterModel.prototype);Object.extend(DevelopmentGroupFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"developmentgroup","_developmentgroup");this.constructor=DevelopmentGroupFilterModel}});DevelopmentGroupFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new DevelopmentGroupFilterModel())};SearchOptionsPanelFactory={create:function(a,b){if(a==FilterKey.CAT_BASED_LOCATION){return new LocationSearchOptionsPanel(b,"filter")}else{if(a==FilterKey.SCHOOL_DISTRICTS){new SchoolDistrictsSearchOptionsPanel(b,"filter")}else{if(a==FilterKey.RATES_AND_AVAILABILITY){new RatesAndAvailabilityPanelView(b)}else{if(a==FilterKey.FEATURES_AND_AMENITIES){new AmenityDropDownView(b)}else{if(a==FilterKey.GARAGES){new AmenityDropDownView(b)}else{if(a==FilterKey.INTERIOR_SIZE_LOT_SIZE){new InteriorLotSizePanelView(b)}else{if(a==FilterKey.LANGUAGE){new LanguageSearchOptionsPanel("languageOptions")}else{if(a==FilterKey.AGENT_LOCATION){new AgentLocationOptionPanel()}else{if(a==FilterKey.PRICE){window.resetMinValueCombo()}}}}}}}}}}};FilterViewFactory={create:function(a,c){var b=c.getFilterModel(a);if(a==FilterKey.PRICE){return new PriceFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))}if(a==FilterKey.RATES_AND_AVAILABILITY){return new RatesAndAvailabilityFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))}if(a==FilterKey.BED_BATH){return new BedBathSizeFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))}if(a==FilterKey.INTERIOR_SIZE_LOT_SIZE){return new InteriorLotSizeFilterView(b,this.getDetailElement(a),this.getHeaderElement(a),(regionRoot=="/nyc"))}if(a==FilterKey.LOCATION||a==FilterKey.CAT_BASED_LOCATION){b=c.getFilterModel(FilterKey.LOCATION);if(getPageController().CONTROLLER_NAME=="offices"){return new OfficeLocationFilter(b,this.getDetailElement(a),this.getHeaderElement(a))}return new LocationFilterDisplay(b,this.getDetailElement(a),this.getHeaderElement(a),a)}if(a==FilterKey.LANGUAGE){return new LanguageFilterView(b,"languageOptions",this.getDetailElement(a),this.getHeaderElement(a))}if(a==FilterKey.AGENT_NAME_SEARCH){return new AgentNameSearchFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))}if(a==FilterKey.AGENT_LOCATION){return new AgentLocationFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))}return new MultiLevelAmenityFilterView(b,this.getDetailElement(a),this.getHeaderElement(a))},getDetailElement:function(a){return $(a+"DD")},getHeaderElement:function(a){return $(a+"DT")}};function WaterfrontWaterViewUpdateCheckboxes(c,a){var b=$j("#"+a).attr("checked");handleWaterFrontWaterViewIndividualClick(c,b,b);handleWaterFrontWaterViewIndividualClick("mainlandcheckboxes",false,false)}function handleWaterFrontWaterViewClick(c,a){var b=$j("#"+a.getId()+"_waterfrontwaterview_checkbox").closest("div").attr("id");if(b=="waterfrontcheckboxes"&&c==false&&$j("#ALLWF_checkbox").attr("checked")==true){$j("#ALLWF_checkbox").attr("checked",false)}else{if(b=="waterviewcheckboxes"&&c==false&&$j("#ALLWV_checkbox").attr("checked")==true){$j("#ALLWV_checkbox").attr("checked",false)}else{if((b=="waterfrontcheckboxes"||b=="waterviewcheckboxes")&&c==true){handleWaterFrontWaterViewIndividualClick("mainlandcheckboxes",false,false);if(b=="waterfrontcheckboxes"){checkWaterfrontWaterviewALLButtonIfAllInCategorySelected(b,"ALLWF_checkbox")}else{checkWaterfrontWaterviewALLButtonIfAllInCategorySelected(b,"ALLWV_checkbox")}}else{if(b=="mainlandcheckboxes"&&c==true){if($j("#ALLWF_checkbox").attr("checked")==true){$j("#ALLWF_checkbox").attr("checked",false)}if($j("#ALLWV_checkbox").attr("checked")==true){$j("#ALLWV_checkbox").attr("checked",false)}handleWaterFrontWaterViewIndividualClick("waterfrontcheckboxes",false,false);handleWaterFrontWaterViewIndividualClick("waterviewcheckboxes",false,false)}}}}}function handleWaterFrontWaterViewIndividualClick(c,a,b){$j("#"+c+" input").each(function(){if($j(this).attr("checked")!=b){$j(this).attr("checked",a);$j(this).click();$j(this).attr("checked",a)}})}function checkWaterfrontWaterviewALLButtonIfAllInCategorySelected(c,a){var b=true;$j("#"+c+" INPUT[type='checkbox']").each(function(d){if($j(this).attr("checked")==false){b=false;return false}});if(b){$j("#"+a).attr("checked",true)}}CheckBox=Class.create();Object.extend(CheckBox.prototype,{initialize:function(a,c,b){this._id=a||-1;this._searchLevel=c||0;this._name=b||"***"},getName:function(){return this._name},getId:function(){return this._id},equals:function(a){if(!a){return false}return this._id==a._id}});CheckBoxFilterModel=Class.create();Object.extend(CheckBoxFilterModel.prototype,FilterModel.prototype);Object.extend(CheckBoxFilterModel.prototype,{initialize:function(d,e,b,a,c){FilterModel.prototype.initialize.call(this,d,e);this._checkboxes=[];this._addText=a;this._editText=c;this._defaultText=b||"---"},getDefaultText:function(){return this._defaultText},getAddText:function(){return this._addText},getEditText:function(){return this._editText},getCheckBoxNames:function(){var a=[];for(var b=0;b<this._checkboxes.length;b++){a.push(this._checkboxes[b].getName())}return a},addCheckBox:function(a){this._checkboxes.push(a);this.notifyChange()},removeCheckBox:function(a){for(var b=0;b<this._checkboxes.length;b++){if(this._checkboxes[b].equals(a)){this._checkboxes.splice(b,1);this.notifyChange();return}}},getCheckBoxes:function(){return this._checkboxes},isEmpty:function(){return this._checkboxes.length==0},clear:function(){this._checkboxes=[];this.notifyChange()},equals:function(b){if(this._checkboxes.length!=b.getCheckBoxes().length){return false}for(var a=0;a<this._checkboxes.length;a++){if(this._checkboxes[a].equals(b.getCheckBoxes()[a])==false){return false}}return this._filterName==b._filterName&&this._shortName==b._shortName}});MultiLevelAmenityFilterModel=Class.create();Object.extend(MultiLevelAmenityFilterModel.prototype,CheckBoxFilterModel.prototype);Object.extend(MultiLevelAmenityFilterModel.prototype,{initialize:function(d,e,b,a,c){CheckBoxFilterModel.prototype.initialize.call(this,d,e,b,a,c);this.constructor=MultiLevelAmenityFilterModel},dump:function(){var a={};a._filterName=this._filterName;if(this._shortName){a._shortName=this._shortName}if(this.getMinFireplaces()){a._minFireplaces=""+this.getMinFireplaces()}if(this.getMinGarageBays()){a._minGarageBays=""+this.getMinGarageBays()}if(this._checkboxes.length>0){a._checkboxes=this._checkboxes}return a},setMinFireplaces:function(a){if(a<=1){delete this._minFireplaces}else{this._minFireplaces=a}this.notifyChange()},setMinGarageBays:function(a){if(a<=1){delete this._minGarageBays}else{this._minGarageBays=a}this.notifyChange()},getMinFireplaces:function(){return this._minFireplaces},getMinGarageBays:function(){return this._minGarageBays}});MultiLevelAmenityFilterModel.scoop=function(b){var d=Object.extend(new MultiLevelAmenityFilterModel(),b);var a=d._checkboxes;for(var c=0;c<a.length;c++){a[c]=new CheckBox(a[c]._id,a[c]._searchLevel,a[c]._name)}return d};MultiLevelAmenityFilterView=Class.create();Object.extend(MultiLevelAmenityFilterView.prototype,FilterView.prototype);Object.extend(MultiLevelAmenityFilterView.prototype,{initialize:function(c,a,b){FilterView.prototype.initialize.call(this,c,a,b);this.render()},renderDetail:function(){if(isLandingPageVisible()){return this._model.getEditText()}var b=this.getModel().getCheckBoxNames().sort();var a="";if(b.length>0){a+=b.join("<br />")}a=this.fixFireplacesText(a);a=this.fixGaragesText(a);return a},getDefaultDetailText:function(){if(isLandingPageVisible()){return this._model.getAddText()}return this._model.getDefaultText()},fixFireplacesText:function(b){var c="Fireplaces: at least ";if(b.indexOf("Fireplaces")!=-1){var a=this.getModel().getMinFireplaces()||1;b=b.replace(/Fireplaces/,c+a)}return b},fixGaragesText:function(b){var c="Garages: at least ";if(b.indexOf("Garages")!=-1){var a=this.getModel().getMinGarageBays()||1;b=b.replace(/Garages/,c+a)}return b},renderReviseLink:function(){if(isLandingPageVisible()){return""}return FilterView.prototype.renderReviseLink.call(this)}});AmenityDropDownView=Class.create();Object.extend(AmenityDropDownView.prototype,{initialize:function(a){this._model=a;this._fireplaces=new Select("Fireplacesdropdown");this._garages=new Select("Garagesdropdown");this.onLoad();this.onChange();this._model.addChangeListener(this)},onLoad:function(){this._fireplaces.setSelectionIndex(this._model.getMinFireplaces()-1);this._garages.setSelectionIndex(this._model.getMinGarageBays()-1)},onChange:function(){if(!document.getElementById("useEnhancedInterior")){var a=function(c){return c.getName()=="Fireplaces"};var b=function(c){return c.getName()=="Garages"};this._fireplaces.setDisabled(!this._model.getCheckBoxes().any(a));this._garages.setDisabled(!this._model.getCheckBoxes().any(b))}}});LocationModel=Class.create();LocationModel.ids=[];Object.extend(LocationModel.prototype,FilterModel.prototype);Object.extend(LocationModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"Location");this._quickSearchText="";this._isQuickSearch=false;this.constructor=LocationModel},setLocationDisplayTree:function(a){this._locationDisplayTree=a;this._restoreLocationDisplayTree();this._setToggleListenerToLocationNode(this._locationDisplayTree)},setToggleListener:function(a){this._toggleListener=a},setCitySTZip:function(a){this.setQuickSearchText(a);this._citySTZip=a;this.notifyChange()},getCitySTZip:function(){return this._citySTZip},_setToggleListenerToLocationNode:function(a){a.setToggleListener(this.nodeToggled.bind(this));a.children().each(function(b){this._setToggleListenerToLocationNode(b)}.bind(this))},isOnCorporate:function(){return this.getCorporateNode().getLocationId()==window.currentRegionLocationId},nodeToggled:function(b){if(this._toggleListener){this._toggleListener(b)}var a=[];this.getRootLocationNode().collectCheckedLocationIds(a);this._checkedLocations=a.join();this.notifyChange()},getRootLocationNode:function(){if(this._locationDisplayTree.locationId!=currentRegionLocationId){var a=this._locationDisplayTree.children();for(var b=0;b<a.length;b++){if(a[b].locationId==currentRegionLocationId){return a[b]}}}return this._locationDisplayTree},findLocationFromRoot:function(a){return this.getLocationNodeById(a,this.getRootLocationNode())},getLocationNodeById:function(d,b){LocationModel.ids.push(b.locationId);if(b.locationId==d){return b}var a=b.children();for(var c=0;c<a.length;c++){var e=this.getLocationNodeById(d,a[c]);if(e!=null){return e}}return null},getCorporateNode:function(){return this._locationDisplayTree},dump:function(){dump={};dump._isQuickSearchEnabled=String(this.isQuickSearch());if(this.isQuickSearch()){if(this._citySTZip){dump._citySTZip=this._citySTZip}if(this._quickSearchText){dump._quickSearchText=this._quickSearchText}}else{dump._checkedLocations=this._checkedLocations}return dump},disableQuickSearch:function(){this._isQuickSearch=false},enableQuickSearch:function(){this._isQuickSearch=true},setQuickSearchText:function(a){this._quickSearchText=a;this.enableQuickSearch()},isQuickSearch:function(){return this._isQuickSearch},getQuickSearchText:function(){return this._quickSearchText},getPromptText:function(){return SearchByRadioButton.LOCATION.getPromptText()},isEmpty:function(){return !this._checkedLocations&&!this._quickSearchText},clear:function(){this._quickSearchText=null;delete this._checkedLocations;if(this._locationDisplayTree){this._restoreLocationDisplayTree()}this.notifyChange()},equals:function(a){var b=true;if(this.isQuickSearch()){b=this._quickSearchText==a._quickSearchText}return b&&(this._checkedLocations==a._checkedLocations)},_restoreLocationDisplayTree:function(){var a={};if(typeof this._checkedLocations!="undefined"){this._checkedLocations.split(",").each(function(b){a[b]=b});this.getRootLocationNode().restore(a)}else{this.getRootLocationNode().restore({})}}});LocationModel.scoop=function(a){var b=Object.extend(new LocationModel(),a);if(a._citySTZip){b.setCitySTZip(a._citySTZip)}if(a._quickSearchText){b.setQuickSearchText(a._quickSearchText)}if(typeof b._isQuickSearchEnabled=="undefined"||b._isQuickSearchEnabled=="false"){b._isQuickSearch=false}return b};LocationFilterDisplay=Class.create();Object.extend(LocationFilterDisplay.prototype,FilterViewWithEditableText.prototype);Object.extend(LocationFilterDisplay.prototype,{initialize:function(d,a,b,c){this._locationFilterTypeKey=c;this._showAll=false;this._template=this._getTemplate();FilterViewWithEditableText.prototype.initialize.call(this,d,a,b,"locationText","locationInput")},getControllerName:function(){return getPageController().CONTROLLER_NAME},_handleReviseClicked:function(){if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionForFilterOptionType(window.regionRoot,"Location"))}window.clearSearchOptionInfoDiv();window.switchToResultsView(this.getHeaderElement());return false},toggleShowAll:function(){this._showAll=!this._showAll;this._template=this._getTemplate();this.render()},_getTemplate:function(){return this._showAll?new ShowAllTemplate(!this._isOnCorporate()):new ShowPartialTemplate(!this._isOnCorporate())},_isOnCorporate:function(){if(!this.getModel()){return window.regionRoot==""}return this.getModel().isOnCorporate()},_handleToggleClicked:function(a){this.toggleShowAll();a.returnValue=false;return false},_handleExpandSearchClicked:function(a){window.showSearchOption($(this._headerElement),this._locationFilterTypeKey);a.returnValue=false;return false},_handleActionOnBlur:function(){this.getModel().setCitySTZip($(this.getInputElement()).value)},renderDetail:function(){if(!this.editMode&&this.getModel().isEmpty()){return""}if(isLandingPageVisible()){return"Edit Location"}if(this._pageWithRegularReviseLink||this.getModel().isQuickSearch()){var b='<span id="locationText">'+this.getModel().getQuickSearchText()+"</span>";b+='<input class="text" style="display:none; width:150px; float:left;" id="locationInput" value="'+this.getModel().getQuickSearchText()+'"/> <br />';return b}var a=this.getModel().getRootLocationNode().children();var c=this._template.apply(a);if(this.getModel().getRootLocationNode().isUnChecked()){c="No locations selected<br />"}return c},getDefaultDetailText:function(){if(isLandingPageVisible()){return"Add Location"}if(this._pageWithRegularReviseLink){var a='<span id="locationText"></span>';a+='<input class="text" style="display:none; width:150px; float:left;" id="locationInput" value=""/> <br />';a+=this.renderReviseLink();return a}return"All Locations"},renderReviseLink:function(){if(isLandingPageVisible()){return""}var b=FilterViewWithEditableText.prototype.renderReviseLink.call(this);var a=b.indexOf("<br />");if(a!=-1){b=b.substring(a+6)}var c="[View All]";if(this._showAll){c="[View Fewer]"}if(this._countIncludedChildren()>=6){b+='<a onclick="return searchOptionInfoClose();" id="selectedLocationsToggleLink">'+c+"</a>"}return b},_createBindings:function(){if($("expandSearchLink")){Event.observe($("expandSearchLink"),"click",this._handleExpandSearchClicked.bindAsEventListener(this))}if($("selectedLocationsToggleLink")){Event.observe($("selectedLocationsToggleLink"),"click",this._handleToggleClicked.bindAsEventListener(this))}},_countIncludedChildren:function(){var a=this.getModel().getRootLocationNode().children();if(!this._isOnCorporate()){a=ShowAllTemplate.prototype.flatten(a)}var b=0;for(var c=0;c<a.length;c++){if(a[c].isUnChecked()==false){++b}}return b}});LocationSearchOptionsPanel=Class.create();Object.extend(LocationSearchOptionsPanel.prototype,{initialize:function(b,a){this._divId=a;this._model=b;this._bindEvents()},_bindEvents:function(){var c=this;if($(this._divId)){var a=this._scanForCategories();a.each(function(d){Event.observe($(d),"click",c.handleCategoryClicked.bind(c,d))});var b=this._scanForAllLocations();b.each(function(d){Event.observe($(d),"click",c.handleLocationClicked.bind(c,d))})}},handleCategoryClicked:function(a){this._updateMap(a);if(($("regionMap")&&(($("location_map_"+a.substring(12))&&typeof window.map_IsSpecialCategory=="undefined")||($("location_map_"+a.substring(12))&&typeof window.map_IsSpecialCategory=="function"&&map_IsSpecialCategory(a.substring(12))=="NO")))||!$("regionMap")){this._toggleCategoryStateInModel(a)}this._syncChildCheckboxState(a);if($("location_cb_ALL")){$("location_cb_ALL").checked=this._allRegularCheckboxesChecked()}if(window.setSearchOptionButtonsState){setSearchOptionButtonsState()}syncAmenityWithFilter()},handleLocationClicked:function(d){if(window.setSearchOptionButtonsState){setSearchOptionButtonsState()}if(d=="location_cb_ALL"){this._syncAllCheckboxState(d)}else{if($("location_cb_ALL")){$("location_cb_ALL").checked=this._allRegularCheckboxesChecked()}this._toggleLocationStateInModel(d);this._updateMap(d);syncAmenityWithFilter();var a=this._determineCategoryIdForLocationElementId(d);if($("category_cb_"+a)){var e=this._scanForCategoryChildren(a);var c=$(d);for(var b=0;b<e.length;b++){if($(e[b]).checked!=c.checked){$("category_cb_"+a).checked=false;return}}$("category_cb_"+a).checked=c.checked}if($("location_cb_ALL")){$("location_cb_ALL").checked=this._allRegularCheckboxesChecked()}}syncAmenityWithFilter()},_determineCategoryIdForLocationElementId:function(b){var a=$(b);var c=this._model.findLocationFromRoot(a.value);return c.getParentNode().locationId},_toggleLocationStateInModel:function(a){var b=this._model.findLocationFromRoot($(a).value);if(b){b.toggle()}},_toggleCategoryStateInModel:function(a){var c=$(a);var b=c.value;var d=this._model.findLocationFromRoot(b);var e=CheckBoxState.UnChecked;if(c.checked){e=CheckBoxState.Checked}d.toggleStateTo(e)},_syncChildCheckboxState:function(b){var d=$(b);var c=d.value;var a=this._scanForCategoryChildren(c);for(var e=0;e<a.length;e++){if($("location_map_"+a[e].substring(12))){if($(a[e]).checked!=d.checked){$(a[e]).checked=d.checked;this._toggleLocationStateInModel(a[e]);this._updateMap(a[e])}}else{$(a[e]).checked=d.checked}}},_syncAllCheckboxState:function(c){var d=$(c);var e=d.value;var a=this._scanForAllLocations();for(var b=1;b<a.length;b++){if($(a[b]).checked!=d.checked){$(a[b]).checked=d.checked;this._toggleLocationStateInModel(a[b]);this._updateMap(a[b])}}a=this._scanForCategories();for(var b=0;b<a.length;b++){if($(a[b]).checked!=d.checked){$(a[b]).checked=d.checked;if(($("regionMap")&&(($("location_map_"+a[b].substring(12))&&typeof window.map_IsSpecialCategory=="undefined")||($("location_map_"+a[b].substring(12))&&typeof window.map_IsSpecialCategory=="function"&&map_IsSpecialCategory(a[b].substring(12))=="NO")))||!$("regionMap")){this._toggleCategoryStateInModel(a[b]);this._updateMap(a[b])}}}},_scanForAllLocations:function(){return this._scanForMatchingInputs(this._divId,"location_cb")},_scanForCategories:function(){return this._scanForMatchingInputs(this._divId,"category_cb")},_scanForCategoryChildren:function(a){return this._scanForMatchingInputs("location_table_"+a,"location_cb")},_scanForMatchingInputs:function(b,d){var a=[];if($(b)){var e=$(b).getElementsByTagName("input");for(var c=0;c<e.length;c++){if(e[c].id.indexOf(d)==0){a.push(e[c].id)}}}return a},_updateMap:function(b){if($("location_map_"+b.substring(12))){var a=0;while(1==1){if($("location_map_"+b.substring(12)+"_"+(a+1).toString())){a+=1}else{break}}map_highlight("location_map_"+b.substring(12),a)}},_allRegularCheckboxesChecked:function(){var a=this._scanForAllLocations();for(var b=1;b<a.length;b++){if(!$(a[b]).checked){return false}}a=this._scanForCategories();for(var b=1;b<a.length;b++){if(!$(a[b]).checked){return false}}return true}});PriceMixIn=Class.create();Object.extend(PriceMixIn.prototype,{setMaxPrice:function(b,c){var a=100000000;if(b==a){b=null}this._maxPrice=b;this._maxPriceText=c;this.notifyChange()},setMinPrice:function(b,c){var a=0;if(b==a){b=null}this._minPrice=b;this._minPriceText=c;this.notifyChange()},getMaxPrice:function(){return this._maxPrice},getMinPrice:function(){return this._minPrice},getMinPriceText:function(a){if(this.getMinPrice()){return this._minPriceText}return a},getMaxPriceText:function(a){if(this.getMaxPrice()){return this._maxPriceText}return a}});PriceFilterModel=Class.create();Object.extend(PriceFilterModel.prototype,FilterModel.prototype);Object.extend(PriceFilterModel.prototype,PriceMixIn.prototype);Object.extend(PriceFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"Price");this.constructor=PriceFilterModel},dump:function(){dumpArray={};dumpArray._filterName=this._filterName;if(this._minPrice){dumpArray._minPrice=this._minPrice;dumpArray._minPriceText=this._minPriceText}if(this._maxPrice){dumpArray._maxPrice=this._maxPrice;dumpArray._maxPriceText=this._maxPriceText}return dumpArray},equals:function(a){return a._maxPrice==this._maxPrice&&a._minPrice==this._minPrice},isEmpty:function(){return !this._minPrice&&!this._maxPrice},clear:function(){this._maxPrice=null;this._minPrice=null;this.notifyChange()}});PriceFilterModel.scoop=function(a){return Object.extend(new PriceFilterModel(),a)};PriceFilterView=Class.create();Object.extend(PriceFilterView.prototype,FilterView.prototype);Object.extend(PriceFilterView.prototype,{initialize:function(c,a,b){FilterView.prototype.initialize.call(this,c,a,b);this.render()},renderDetail:function(){if(isLandingPageVisible()){return"Edit Price Range"}var a=[];var b=this.getModel();a.push(b.getMinPriceText("No Minimum"));a.push(" to ");a.push(b.getMaxPriceText("No Maximum"));return a.join("")},getDefaultDetailText:function(){if(isLandingPageVisible()){return"Add Price Range"}return"No Minimum to No Maximum"},renderReviseLink:function(){if(isLandingPageVisible()){return""}return FilterView.prototype.renderReviseLink.call(this)}});PeerElement=Class.create();Object.extend(PeerElement.prototype,{initialize:function(a){this._elementId=a;this._listeners=[]},addClickListener:function(a){if(this._listeners.length==0&&$(this._elementId)){Element.observe(this._elementId,"click",this._handleClick.bind(this))}this._listeners.push(a)},_handleClick:function(){this._listeners.each(function(a){a()})}});InputElement=Class.create();Object.extend(InputElement.prototype,{ENTER_KEY_CODE:13,initialize:function(b,a){this._elementId=b;this._defaultValue=a||"";this._focusListeners=[];this._blurListeners=[];this._keyListeners=[]},getValue:function(){return this._getElement().value},setValue:function(a){this._getElement().value=a},addFocusListener:function(a){if(this._focusListeners.length==0&&$(this._elementId)){Element.observe(this._elementId,"focus",this._handleFocus.bind(this))}this._focusListeners.push(a)},addBlurListener:function(a){if(this._blurListeners.length==0&&$(this._elementId)){Element.observe(this._elementId,"blur",this._handleBlur.bind(this))}this._blurListeners.push(a)},addEnterKeyListener:function(a){if(this._keyListeners.length==0&&$(this._elementId)){Element.observe(this._elementId,"keypress",this._handleEnterPressed.bindAsEventListener(this))}this._keyListeners.push(a)},clear:function(){this._getElement().style.background="black";this._getElement().clear();this._getElement().style.background="white"},_handleFocus:function(){this._focusListeners.each(function(a){a()})},_handleBlur:function(){this._blurListeners.each(function(a){a()})},_handleEnterPressed:function(a){if(a.keyCode==this.ENTER_KEY_CODE){this._keyListeners.each(function(b){b()})}},_getElement:function(){return $(this._elementId)||{value:this._defaultValue}},addClass:function(a){Element.addClassName(this._elementId,a)},removeClass:function(a){Element.removeClassName(this._elementId,a)},hide:function(){Element.hide(this._getElement())},show:function(){Element.show(this._getElement())}});Label=Class.create();Object.extend(Label.prototype,{initialize:function(a){this._name=a},update:function(a){this.getElement().update(a)},getElement:function(){return $(this._name)||{update:Prototype.emptyFunction}}});Select=Class.create();Object.extend(Select.prototype,{initialize:function(a){this._name=a;this._changeListeners=[]},setDisabled:function(a){this._getElement().disabled=a},getDisabled:function(){return this._getElement().disabled},getSelection:function(){var b=this._getElement();var a=$A(b.options);if(a.length==0){return new SelectOption()}var c=a[b.selectedIndex];return new SelectOption(c.innerHTML,c.value)},setSelectionValue:function(a){this._getElement().value=a},getSelectionValue:function(){return this._getElement().value},setSelectionIndex:function(a){this._getElement().selectedIndex=a},getSelectionIndex:function(a){return this._getElement().selectedIndex},update:function(g,f){var d=this._getElement();d.innerHTML="";var a=HtmlBuilder.buildOptions(g,f);var c=a.length;var e=0;for(var b=0;b<c;b++){if(a[b].selected==true){e=b}d.appendChild(a[b])}d.selectedIndex=e},addChangeListener:function(a){this._changeListeners=[];if(this._changeListeners.length==0&&$(this._name)){Event.observe(this._name,"change",this._selectionChanged.bind(this))}this._changeListeners.push(a)},_selectionChanged:function(){this._changeListeners.each(function(a){a(this.getSelection())}.bind(this))},_getElement:function(){return $(this._name)||{value:0,disabled:false,appendChild:Prototype.emptyFunction,innerHTML:"",options:[],selectedIndex:0}},getCount:function(){return this._getElement().options.length},getOptionAt:function(a){return this._getElement().options[a]}});SelectOption=Class.create();Object.extend(SelectOption.prototype,{initialize:function(a,b){this.text=a||"";this.value=b||this.text},getText:function(){return this.text},getValue:function(){return this.value}});RadioButton=Class.create();Object.extend(RadioButton.prototype,{initialize:function(a){this._name=a},setChecked:function(a){this._getElement().checked=a},isChecked:function(a){return this._getElement().checked},addClickListener:function(a){this._getElement().observe("click",a)},_getElement:function(){return $(this._name)||{checked:false,observe:Prototype.emptyFunction}}});EmailAddressValidator=Class.create();EmailAddressValidator.REGEXP=/\S+@\S+\.\S+/;Object.extend(EmailAddressValidator.prototype,{initialize:function(a,b,c){if(typeof a.tagName!="undefined"){a=new InputElement(a)}this._input=a;this._onFail=b;this._onValid=c},validate:function(){var b=this._input.getValue().strip();var a=EmailAddressValidator.REGEXP.test(b);if(a&&typeof this._onValid=="function"){this._onValid(b)}if(!a&&typeof this._onFail=="function"){this._onFail()}return a}});var CurrentlyWatchingPropertyPanel=Class.create();Object.extend(CurrentlyWatchingPropertyPanel.prototype,{initialize:function(a,c){this._container=a;this._service=c;this._stopLink=a.getElementsByTagName("a")[0];var b=a.getElementsByTagName("input")[0];this._listingKey=b.value;this._createBindings()},_createBindings:function(){Event.observe(this._stopLink,"click",this._handleSaveClicked.bindAsEventListener(this))},_handleSaveClicked:function(a){this._service.removeWatch(this._listingKey,this._watchRemoved.bind(this));Event.stop(a);return false},_watchRemoved:function(a){this._container.innerHTML=a;new WatchThisPropertyPanel(this._container,this._service)}});var WatchThisPropertyPanel=Class.create();Object.extend(WatchThisPropertyPanel.prototype,{initialize:function(a,c){this._container=a;this._emailInput=new InputElement(a.getElementsByTagName("input")[0]);this._saveButton=a.getElementsByTagName("button")[0];var b=a.getElementsByTagName("input")[1];if(b){this._listingNumber=b.value}this._errors=a.getElementsByTagName("p")[0];this._createBindings();this._validator=new EmailAddressValidator(this._emailInput,this._validationFailed.bind(this),this._validationPassed.bind(this));this._service=c},_createBindings:function(){if(this._saveButton){Event.observe(this._saveButton,"click",this._handleSaveClicked.bind(this));this._emailInput.addEnterKeyListener(this._handleSaveClicked.bind(this))}},_handleSaveClicked:function(){if(this.validate()){Element.hide(this._errors);this._saveButton.innerHTML="Saving...";this._saveButton.disabled=true;this._service.addWatch(this._listingNumber,this._emailInput.getValue().strip(),this._watchCreated.bind(this))}else{Element.show(this._errors)}},_watchCreated:function(a){this._container.innerHTML=a;new CurrentlyWatchingPropertyPanel(this._container,this._service)},validate:function(){return this._validator.validate()},_validationFailed:function(){Element.show(this._errors)},_validationPassed:function(a){createCookie("userEmail",a);Element.hide(this._errors)}});WatchPropertyService=Class.create();Object.extend(WatchPropertyService.prototype,{initialize:function(){},addWatch:function(c,b,a){new Ajax.Request(siteRoot+"watchlist/addWatch.rails",{method:"post",onSuccess:this.saveComplete.bind(this,a),parameters:{listingNumber:c,email:b}})},removeWatch:function(b,a){new Ajax.Request(siteRoot+"watchlist/detailDelete.rails",{method:"post",onSuccess:this.removeComplete.bind(this,a),parameters:{key:b}})},removeComplete:function(a,b){a(b.responseText)},saveComplete:function(a,b){a(b.responseText)}});var WebTrendsAnalyzer=Class.create();Object.extend(WebTrendsAnalyzer.prototype,{initialize:function(){},scan:function(b){if(typeof dcsMultiTrack=="function"){for(var a=0;a<b.length;a++){this._monitorWebTrend(b[a])}}},_monitorWebTrend:function(b){if(typeof b.elemId=="string"&&b.elemId!=""){var a=$(b.elemId);if(a){Event.observe(a,b.eventName,this.fireWebTrendAction.bind(this,b))}}},_extractArgs:function(a){return["DCS.dcsuri",a.uri,"WT.ti",a.actionKey,"WT.si_n",a.categoryName,"WT.si_x",a.stepNumber]},fireWebTrendAction:function(a){if(typeof dcsMultiTrack=="function"){dcsMultiTrack.apply(window,this._extractArgs(a))}}});WebTrendsAnalyzer.INITIAL_RULES=[{elemId:"watchThisPropertyEmail",eventName:"change",uri:"/watchThisPropertyEmail",actionKey:"Watch This Property Email",categoryName:"Watch This Property",stepNumber:"1"},{elemId:"watchThisPropertyButton",eventName:"click",uri:"/watchThisPropertySave",actionKey:"Watch This Property Save",categoryName:"Watch This Property",stepNumber:"2"}];WebTrendsAnalyzer.INITIATE_SAVE_SEARCH_ACTION={elemId:"saveSearchButtonId",eventName:"click",uri:"/saveSearch",actionKey:"Save Search - Initiate Save Search",categoryName:"Save Search",stepNumber:"1"};WebTrendsAnalyzer.DYNAMIC_SAVE_SEARCH_RULES=[{elemId:"SearchName",eventName:"change",uri:"/saveSearch",actionKey:"Save Search - Enter Search Name",categoryName:"Save Search",stepNumber:"2"},{elemId:"SearchEmailAddress",eventName:"change",uri:"/saveSearch",actionKey:"Save Search - Enter Email Address",categoryName:"Save Search",stepNumber:"3"},{elemId:"SaveSearchSaveButton",eventName:"click",uri:"/saveSearch",actionKey:"Save Search - Complete Save Search",categoryName:"Save Search",stepNumber:"4"}];WebTrendsAnalyzer.CreateRulesForOptionPane=function(b,d){var a=new FilterOptionsRuleFactory(b,d);var c=[];WebTrendsAnalyzer.CreateRulesForElements("searchOptionInfoDiv","input",c,a);WebTrendsAnalyzer.CreateRulesForElements("searchOptionInfoDiv","select",c,a);return c};WebTrendsAnalyzer.CreateRulesForEmail=function(){var a=new EmailRuleFactory();var b=[];WebTrendsAnalyzer.CreateRulesForElements("containerDiv","input",b,a);WebTrendsAnalyzer.CreateRulesForElements("containerDiv","textarea",b,a);WebTrendsAnalyzer.CreateRulesForElements("containerDiv","button",b,a);return b};WebTrendsAnalyzer.CreateRulesForElements=function(a,f,e,c){var b=$(a).getElementsBySelector(f);for(var d=0;d<b.length;d++){e.push(c.create(b[d]))}};WebTrendsAnalyzer.CreateActionForFilterOptionType=function(a,b){return{elemId:b+"DT",eventName:"click",uri:a+"/searchFilter"+b,actionKey:"Opened "+b+" filter",categoryName:"Search Filter "+b,stepNumber:""}};WebTrendsAnalyzer.CreateActionForLocationCheckbox=function(b,a){return{elemId:b+"_checkbox",eventName:"click",uri:"/locationFilter",actionKey:(a?"Checked":"Unchecked")+" location "+b,categoryName:"Location Filter",stepNumber:""}};WebTrendsAnalyzer.CreateActionClickOnLink=function(b,c,a){return{elemId:b,eventName:"click",uri:c,actionKey:b,categoryName:a,stepNumber:""}};FilterOptionsRuleFactory=Class.create();Object.extend(FilterOptionsRuleFactory.prototype,{initialize:function(a,b){this.searchType=b;this.regionRoot=a},create:function(a){return{elemId:a.id,eventName:a.tagName=="SELECT"?"change":"click",uri:regionRoot+"/searchFilter"+this.searchType,actionKey:a.id,categoryName:"Search Filter "+this.searchType,stepNumber:""}}});EmailRuleFactory=Class.create();Object.extend(EmailRuleFactory.prototype,{initialize:function(){},create:function(a){return{elemId:a.id,eventName:WebTrendsAnalyzer.ReturnEventAction(a.type),uri:"/emailform/"+a.form.name,actionKey:a.id,categoryName:"Email Form : "+a.form.name,stepNumber:a.tabIndex}}});WebTrendsAnalyzer.ReturnEventAction=function(b){var a;switch(b){case"submit":case"checkbox":a="click";break;case"textarea":case"text":a="change";break;default:a="click"}return a};RatesAndAvailabilityFilterModel=Class.create();Object.extend(RatesAndAvailabilityFilterModel.prototype,CheckBoxFilterModel.prototype);Object.extend(RatesAndAvailabilityFilterModel.prototype,PriceMixIn.prototype);Object.extend(RatesAndAvailabilityFilterModel.prototype,{initialize:function(){CheckBoxFilterModel.prototype.initialize.call(this,"Rates and Availability","ratesandavailability","Add Rental Terms and Price","All Rental Terms/Any Price","Edit Rental Terms and Price");this.constructor=RatesAndAvailabilityFilterModel},isEmpty:function(){return this._minPrice==undefined&&this._maxPrice==undefined&&this.getCheckBoxes().length==0},dump:function(){dump={};dump._filterName=this._filterName;if(this._minPrice){dump._minPrice=this._minPrice;dump._minPriceText=this._minPriceText}if(this._maxPrice){dump._maxPrice=this._maxPrice;dump._maxPriceText=this._maxPriceText}if(this._checkboxes.length>0){dump._checkboxes=this._checkboxes}return dump},getCheckBoxes:function(){return this._checkboxes.sort(function(a,b){return a.getId()-b.getId()})},clear:function(){this._maxPrice=null;this._minPrice=null;this._checkboxes=[];this.notifyChange()}});RatesAndAvailabilityFilterModel.scoop=function(b){var d=Object.extend(new RatesAndAvailabilityFilterModel(),b);var a=d._checkboxes;for(var c=0;c<a.length;c++){a[c]=new CheckBox(a[c]._id,a[c]._searchLevel,a[c]._name)}return d};RatesAndAvailabilityFilterView=Class.create();Object.extend(RatesAndAvailabilityFilterView.prototype,FilterView.prototype);Object.extend(RatesAndAvailabilityFilterView.prototype,{initialize:function(c,a,b){FilterView.prototype.initialize.call(this,c,a,b);this.constructor=RatesAndAvailabilityFilterView;this.render();this._checkForSelectedSeason()},renderDetail:function(){if(isLandingPageVisible()){return this._model.getEditText()}var a=[];$A(this.getModel().getCheckBoxes()).each(function(b){a.push(b.getName())});a.push([this.getModel().getMinPriceText("$0"),this.getModel().getMaxPriceText("No Limit")].join(" to "));return a.join("<br />")},getDefaultDetailText:function(){if(isLandingPageVisible()){return"Add Rental Terms and Price"}return"All Rental Terms/Any Price"},renderReviseLink:function(){if(isLandingPageVisible()){return""}return FilterView.prototype.renderReviseLink.call(this)},_checkForSelectedSeason:function(){if(this.getRentalPeriodSeason()){this.getModel().clear();var a=this.getRentalPeriodSeason().readAttribute("value").split("|");this.getModel().addCheckBox(Object.extend(new CheckBox(a[0],0,a[1])))}},getRentalPeriodSeason:function(){return $("selectedRentalPeriodSeason")}});RatesAndAvailabilityPanelView=Class.create();Object.extend(RatesAndAvailabilityPanelView.prototype,{initialize:function(b,a){this.constructor=RatesAndAvailabilityPanelView;this._model=b}});BedBathSizeFilterModel=Class.create();Object.extend(BedBathSizeFilterModel.prototype,FilterModel.prototype);Object.extend(BedBathSizeFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"bedbathsize");this.constructor=BedBathSizeFilterModel},setBedrooms:function(a,b){this._numBedrooms=null;if(a!=-1){this._numBedrooms=a;this._numBedroomsText=b}this.notifyChange()},getBedrooms:function(){return this._numBedrooms},getBedroomsText:function(a){if(this.getBedrooms()){return"Bedrooms: "+this._numBedroomsText}return a},setBathrooms:function(a,b){this._numBathrooms=null;this._numBathroomsText="";if(a!=0){this._numBathrooms=a;this._numBathroomsText=b}this.notifyChange()},getBathrooms:function(){return this._numBathrooms},getBathroomsText:function(a){if(this.getBathrooms()){return"Bathrooms: "+this._numBathroomsText}return a},dump:function(){dumpArray={};dumpArray._filterName=this._filterName;if(this._numBedrooms){dumpArray._numBedrooms=this._numBedrooms;dumpArray._numBedroomsText=this._numBedroomsText}if(this._numBathrooms){dumpArray._numBathrooms=this._numBathrooms;dumpArray._numBathroomsText=this._numBathroomsText}return dumpArray},equals:function(a){return a._numBedrooms==this._numBedrooms&&a._numBathrooms==this._numBathrooms},isEmpty:function(){return !this._numBedrooms&&!this._numBathrooms},clear:function(){this._numBedrooms=null;this._numBathrooms=null;this.notifyChange()}});BedBathSizeFilterModel.scoop=function(a){return Object.extend(new BedBathSizeFilterModel(),a)};BedBathSizeFilterView=Class.create();Object.extend(BedBathSizeFilterView.prototype,FilterView.prototype);Object.extend(BedBathSizeFilterView.prototype,{initialize:function(c,a,b){FilterView.prototype.initialize.call(this,c,a,b);this.render()},renderDetail:function(){if(isLandingPageVisible()){return"Edit Bed or Bath Count"}var b=this.getModel();var a=[];this._renderBedrooms(b,a);this._renderBathrooms(b,a);return a.join("<br />")},getDefaultDetailText:function(){if(isLandingPageVisible()){return"Add Bed or Bath Count"}return"Any Beds/Any Baths"},renderReviseLink:function(){if(isLandingPageVisible()){return""}return FilterView.prototype.renderReviseLink.call(this)},_renderBedrooms:function(c,a){var b=[];b.push(c.getBedroomsText("Any Beds"));a.push(b.join(""))},_renderBathrooms:function(c,a){var b=[];b.push(c.getBathroomsText("Any Baths"));a.push(b.join(""))}});LetterFromFormFilterModel=Class.create();Object.extend(LetterFromFormFilterModel.prototype,FilterModel.prototype);Object.extend(LetterFromFormFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"LetterFromForm");this.constructor=LetterFromFormFilterModel},dump:function(){dumpArray={};dumpArray._name=$("letterFromForm").value;dumpArray._searchFieldFromForm=$("searchFieldFromForm").value;return dumpArray},isEmpty:function(){return $("letterFromForm").value==""},equals:function(a){return true}});LetterFromFormFilterModel.scoop=function(a){return Object.extend(new LetterFromFormFilterModel(),a)};InteriorLotSizeFilterModel=Class.create();Object.extend(InteriorLotSizeFilterModel.prototype,FilterModel.prototype);Object.extend(InteriorLotSizeFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"interiorsizelotsize");this.constructor=InteriorLotSizeFilterModel},setInteriorSize:function(a,b){this._interiorSize=null;this._interiorSizeText="";if(a!="gt_0"){this._interiorSize=a;this._interiorSizeText=b}this.notifyChange()},getInteriorSize:function(){return this._interiorSize},getInteriorSizeText:function(a){if(this.getInteriorSize()){return"Interior Size: "+this._interiorSizeText}return a},setLotSize:function(a,b){this._lotSize=null;this._lotSizeText="";if(a!="gt_0"){this._lotSize=a;this._lotSizeText=b}this.notifyChange()},getLotSize:function(){return this._lotSize},getLotSizeText:function(a){if(this.getLotSize()){return"Lot Size: "+this._lotSizeText}return a},setInteriorSizeUnit:function(a){this._interiorSizeUnit=a;this.notifyChange(this)},getInteriorSizeUnit:function(){return this._interiorSizeUnit},setLotSizeUnit:function(a){this._lotSizeUnit=a;this.notifyChange()},getLotSizeUnit:function(){return this._lotSizeUnit},resetInteriorSize:function(){this.setInteriorSize("gt_0");syncAmenityWithFilter()},resetLotSize:function(){this.setLotSize("gt_0");syncAmenityWithFilter()},dump:function(){dumpArray={};dumpArray._filterName=this._filterName;if(this._interiorSize){dumpArray._interiorSize=this._interiorSize;dumpArray._interiorSizeText=this._interiorSizeText}if(this._lotSize){dumpArray._lotSize=this._lotSize;dumpArray._lotSizeText=this._lotSizeText}return dumpArray},equals:function(a){return a._interiorSize==this._interiorSize&&a._lotSize==this._lotSize},isEmpty:function(){return !this._interiorSize&&!this._lotSize},clear:function(){this._interiorSize=null;this._lotSize=null;this.notifyChange()}});InteriorLotSizeFilterModel.scoop=function(a){return Object.extend(new InteriorLotSizeFilterModel(),a)};InteriorLotSizeFilterView=Class.create();Object.extend(InteriorLotSizeFilterView.prototype,FilterView.prototype);Object.extend(InteriorLotSizeFilterView.prototype,{initialize:function(d,a,b,c){FilterView.prototype.initialize.call(this,d,a,b);this._hideLotSize=c;this.render()},renderDetail:function(){var b=this.getModel();var a=[];this._renderInteriorSize(b,a);if(!this._hideLotSize){this._renderLotSize(b,a)}return a.join("<br />")},getDefaultDetailText:function(){if(this._hideLotSize){return"All Interior Sizes"}return"All Interior Sizes<br />All Lot Sizes"},_renderInteriorSize:function(c,a){var b=[];b.push(c.getInteriorSizeText("All Interior Sizes"));a.push(b.join(""))},_renderLotSize:function(c,a){var b=[];b.push(c.getLotSizeText("All Lot Sizes"));a.push(b.join(""))}});InteriorLotSizePanelView=Class.create();InteriorLotSizePanelView.INTERIOR_SIZE_SELECT=new Select("selectedInteriorSize");InteriorLotSizePanelView.INTERIOR_SIZE_UNIT_SELECT=new Select("selectedInteriorSizeUnit");InteriorLotSizePanelView.LOT_SIZE_SELECT=new Select("selectedLotSize");InteriorLotSizePanelView.LOT_SIZE_UNIT_SELECT=new Select("selectedLotSizeUnit");Object.extend(InteriorLotSizePanelView.prototype,{initialize:function(a){this._model=a;a.addChangeListener(this);this._bindEventListeners()},onChange:function(){},_bindEventListeners:function(){InteriorLotSizePanelView.INTERIOR_SIZE_UNIT_SELECT.addChangeListener(this._handleInteriorSizeUnitChange.bind(this));InteriorLotSizePanelView.LOT_SIZE_UNIT_SELECT.addChangeListener(this._handleLotSizeUnitChange.bind(this))},_handleLotSizeUnitChange:function(){var b=InteriorLotSizePanelView.LOT_SIZE_UNIT_SELECT.getSelectionValue();var a=InteriorSizeLotSizeTemplateFactory.createLotSize(b);InteriorLotSizePanelView.LOT_SIZE_SELECT.update(a)},_handleInteriorSizeUnitChange:function(){var b=InteriorLotSizePanelView.INTERIOR_SIZE_UNIT_SELECT.getSelectionValue();var a=InteriorSizeLotSizeTemplateFactory.createInteriorSize(b);InteriorLotSizePanelView.INTERIOR_SIZE_SELECT.update(a)}});AgentNameSearchFilterModel=Class.create();Object.extend(AgentNameSearchFilterModel.prototype,FilterModel.prototype);Object.extend(AgentNameSearchFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"AgentNameSearch");this.constructor=AgentNameSearchFilterModel;this._name="";this._searchedFor=""},setName:function(a){this._name=a;this.notifyChange()},getName:function(){return this._name},pushSearchedName:function(){this._searchedFor=this._name;this.notifyChange()},getSearchedName:function(){return this._searchedFor},isEmpty:function(){return this._name==""},equals:function(a){return a._name==this._name},clear:function(){this._name="";this._searchedFor="";this.notifyChange()},dump:function(){dumpArray={};dumpArray._name=this._name;return dumpArray}});AgentNameSearchFilterModel.scoop=function(a){return Object.extend(new AgentNameSearchFilterModel(),a)};AgentNameSearchFilterView=Class.create();Object.extend(AgentNameSearchFilterView.prototype,FilterView.prototype);Object.extend(AgentNameSearchFilterView.prototype,{initialize:function(c,a,b){FilterView.prototype.initialize.call(this,c,a,b);this._model=c;this._defaultText=AgentNameSearchFilterView.searchDefaultText();this._bindActions();this.setInitialText()},_bindActions:function(){Event.observe($("agentNameSearchButton"),"click",this.buttonClickHandler.bindAsEventListener(this));Event.observe($("agentNameSearchInput"),"keypress",this.keyPressHandler.bindAsEventListener(this));Event.observe($("agentNameSearchInput"),"blur",this.blurHandler.bindAsEventListener(this));Event.observe($("agentNameSearchInput"),"click",this.textBoxClickHandler.bindAsEventListener(this))},setText:function(a){$("agentNameSearchInput").value=a},setDefaultText:function(){this.setText(this._defaultText)},clearText:function(){this.setText("")},getText:function(){return this._model.getName()},setInitialText:function(){if(this.getText().length==0){this.setDefaultText()}else{this.render()}},renderDetail:function(){var a=this._model.getSearchedName();if(a!=""){return'Displaying Results for "'+a+'"'}else{return this.getDefaultDetailText()}},getDefaultDetailText:function(){return""},render:function(){$("agentNameSearchDD").innerHTML=this.getModel().isEmpty()?this.getDefaultDetailText():this.renderDetail()},keyPressHandler:function(b){var a=Event.element(b);if(a.value!=""){this._model.setName(a.value);syncAmenityWithFilter()}if(b.keyCode==13){this.buttonClickHandler(b)}},buttonClickHandler:function(a){$("searchModelForm").action="AGENT_NAME_SEARCH";$("sir_result_sort_by").value="";$("sir_result_sort_direction").value="";$("agentNameSearchInput").blur();agentSubmitSearch();this.setDefaultText()},blurHandler:function(b){if(this.getText()==""&&$("agentNameSearchInput").value==""){this.setDefaultText();return}else{if($("agentNameSearchInput").value==AgentNameSearchFilterView.searchDefaultText()){return}}var a=Event.element(b);this._model.setName(a.value);syncAmenityWithFilter()},textBoxClickHandler:function(a){if(this.getText()==""||$("agentNameSearchInput").value==AgentNameSearchFilterView.searchDefaultText()){this.clearText()}}});AgentNameSearchFilterView.searchDefaultText=function(){return"Begin Typing First or Last Name"};LanguageFilterModel=Class.create();Object.extend(LanguageFilterModel.prototype,FilterModel.prototype);Object.extend(LanguageFilterModel.prototype,{initialize:function(){FilterModel.prototype.initialize.call(this,"Language");this._languages=[];this.constructor=LanguageFilterModel},addLanguage:function(a){this._languages.push(a);this.notifyChange()},removeLanguage:function(b){for(var a=0;a<this._languages.length;a++){if(b==this._languages[a]){var c=this._languages[0];this._languages[0]=this._languages[a];this._languages[a]=c;this._languages.shift();break}}this.notifyChange()},isEmpty:function(){return this._languages.length==0},equals:function(b){if(b._languages.length!=this._languages.length){return false}for(var a=0;a<this._languages.length;a++){if(b._languages[a]!=this._languages[a]){return false}}return true},clear:function(){this._languages=[];this.notifyChange()},dump:function(){dumpArray={};dumpArray._languages=this._languages;return dumpArray}});LanguageFilterModel.scoop=function(a){return Object.extend(new LanguageFilterModel(),a)};LanguageFilterView=Class.create();Object.extend(LanguageFilterView.prototype,FilterView.prototype);Object.extend(LanguageFilterView.prototype,{initialize:function(d,c,a,b){FilterView.prototype.initialize.call(this,d,a,b);this._model=d;this._inputDiv=c},renderDetail:function(){return this._model._languages.join("<br/>")},getDefaultDetailText:function(){return"Agents who Speak Any Language"},render:function(){if(this._model.isEmpty()&&$(this._inputDiv)){var b=$(this._inputDiv).getElementsByTagName("input");for(var a=0;a<b.length;a++){b[a].checked=false}}FilterView.prototype.render.call(this)}});LanguageSearchOptionsPanel=Class.create();Object.extend(LanguageSearchOptionsPanel.prototype,{initialize:function(a){this._divId=a;this._bindEvents()},_bindEvents:function(){if($(this._divId)){var b=$(this._divId).getElementsByTagName("input");for(var a=0;a<b.length;a++){Event.observe(b[a],"click",function(d){var c=Event.element(d);var e=getSearchOptionsModel().getFilterModel("language");if(!c.checked){e.removeLanguage(c.name)}else{e.addLanguage(c.name)}syncAmenityWithFilter()})}Event.observe($("languageResetCriteria"),"click",function(c){resetCriteria(FilterKey.LANGUAGE);syncAmenityWithFilter()})}}});OfficeLocationFilter=Class.create();Object.extend(OfficeLocationFilter.prototype,AgentLocationFilterModel.prototype);var SearchOptionsModel=Class.create();Object.extend(SearchOptionsModel.prototype,Observable.prototype);Object.extend(SearchOptionsModel.prototype,{initialize:function(a){Observable.prototype.initialize.call(this);this._filterModels={};this._searchType=a},getFilterModel:function(a){return this._filterModels[a]},getFilterModelKeys:function(){var b=new Array();for(var a in this._filterModels){b.push(a)}return b},clear:function(){for(var a in this._filterModels){this._filterModels[a].clear()}},dump:function(){var b={};var a=true;for(var c in this._filterModels){if(!this._filterModels[c].isEmpty()){a=false;b[c]=this._filterModels[c].dump()}}if(a&&this._searchType=="search"){return{}}return{_filterModels:b,_searchType:this._searchType}},equals:function(b){if(!b){return false}if(this._searchType!=b._searchType){return false}if(this._getModelKeys().join("__")!=b._getModelKeys().join("__")){return false}for(var a in this._filterModels){if(typeof b._filterModels[a]=="undefined"||!this._filterModels[a].equals(b._filterModels[a])){return false}}return true},_getModelKeys:function(){var b=[];for(var a in this._filterModels){b.push(a)}return b},setSearchType:function(a){this._searchType=a},getSearchType:function(){return this._searchType},addFilterModel:function(b,a){this._filterModels[b]=a;a.addChangeListener(new BubbleHandler(this))},isEmpty:function(){for(var a in this._filterModels){if(a!="webregion"&&!this._filterModels[a].isEmpty()){return false}}return true}});SearchOptionsModel.scoop=function(a,f){if(typeof a=="undefined"||!a){a={}}var c=new SearchOptionsModel(a._searchType||"search");var d=f._filterModelsUsed();var b=a._filterModels||{};for(var e in d){if(!b[e]){c.addFilterModel(e,d[e])}else{c.addFilterModel(e,d[e].constructor.scoop(b[e]))}}return c};ResultsUpdater=Class.create();Object.extend(ResultsUpdater.prototype,{initialize:function(a){this._controller=a;this._modelDirty=false;this._createInterval(this.updateSearchResultsIfModelDirty.bind(this),300)},onChange:function(){this._modelDirty=true},updateSearchResultsIfModelDirty:function(){if(this._modelDirty&&(typeof window.progressChicken=="undefined"||(!window.progressChicken.isSpinning()&&!window.progressChicken.isIFrameLoading()))){this._modelDirty=false;searchModelDump=createClass($("searchModelInput").value);newSearchModel=SearchOptionsModel.scoop(searchModelDump,this._controller);this._controller.setSearchOptionsModel(SearchOptionsModel.scoop(searchModelDump,this._controller));this.doWork(this.onChangeCallback)}},_createInterval:function(a,b){return setInterval(a,b)},doWork:function(a){this._controller.updateSearchResults(a)}});CountUpdater=Class.create();Object.extend(CountUpdater.prototype,ResultsUpdater.prototype);Object.extend(CountUpdater.prototype,{doWork:function(){this._controller.updateCount()}});TemplateFactory={};TemplateFactory.CHECKBOX_TEMPLATE='<td class="location_cell #{childrenClass}"><div id="#{locationId}_container"><div class="checkbox #{checkboxClass}" id="#{locationId}_checkbox"></div><div class="area">#{locationName}</div><div id="#{locationId}_expand" class="expand clickable"></div></div></td>';TemplateFactory.NOT_CHECKED_RADIO_TEMPLATE='<td class="location_cell #{childrenClass} radio_cell"><div id="#{locationId}_container"><input type="radio" class="radio" id="#{locationId}_checkbox" name="RayDeeOh_MutuallyExclusive" /> <div class="area">#{locationName}</div><div id="#{locationId}_expand" class="expand clickable" style="display:none"></div></div></td>';TemplateFactory.CHECKED_RADIO_TEMPLATE='<td class="location_cell #{childrenClass}  radio_cell"><div id="#{locationId}_container"><input type="radio" class="radio" id="#{locationId}_checkbox" name="RayDeeOh_MutuallyExclusive" checked="checked"/> <div class="area">#{locationName}</div><div id="#{locationId}_expand" class="expand clickable"></div></div></td>';InteriorSizeLotSizeTemplateFactory={};InteriorSizeLotSizeTemplateFactory.ENGLISH="English";InteriorSizeLotSizeTemplateFactory.METRIC="Metric";InteriorSizeLotSizeTemplateFactory.METRIC_INTERIOR_SIZE_OPTIONS='<option value="gt_0" selected="selected">Show All</option><option value="lt_1500">Up to 140 sq. m.</option><option value="gt_1500">140 sq. m. or more</option><option value="gt_3000">280 sq. m. or more</option><option value="gt_5000">465 sq. m. or more</option><option value="gt_7500">700 sq. m. or more</option><option value="gt_10000">930 sq. m. or more</option>';InteriorSizeLotSizeTemplateFactory.ENGLISH_INTERIOR_SIZE_OPTIONS='<option value="gt_0" selected="selected">Show All</option><option value="lt_1500">Up to 1500 sq. ft.</option><option value="gt_1500">1500 sq. ft. or more</option><option value="gt_3000">3000 sq. ft. or more</option><option value="gt_5000">5000 sq. ft. or more</option><option value="gt_7500">7500 sq. ft. or more</option><option value="gt_10000">10000 sq. ft. or more</option>';InteriorSizeLotSizeTemplateFactory.ENGLISH_LOT_SIZE_OPTIONS='<option value="gt_0" selected="selected">Show All</option><option value="lt_5">Up to 5 acres</option><option value="gt_5">5 acres or more</option><option value="gt_10">10 acres or more</option><option value="gt_25">25 acres or more</option><option value="gt_50">50 acres or more</option><option value="gt_100">100 acres or more</option>';InteriorSizeLotSizeTemplateFactory.METRIC_LOT_SIZE_OPTIONS='<option value="gt_0" selected="selected">Show All</option><option value="lt_5">Up to 2 hectares</option><option value="gt_5">2 hectares or More</option><option value="gt_10">4 hectares or More</option><option value="gt_25">10 hectares or More</option><option value="gt_50">20 hectares or More</option><option value="gt_100">40 hectares or More</option>';InteriorSizeLotSizeTemplateFactory.createInteriorSize=function(a){if(a==InteriorSizeLotSizeTemplateFactory.METRIC){return InteriorSizeLotSizeTemplateFactory.METRIC_INTERIOR_SIZE_OPTIONS}if(a==InteriorSizeLotSizeTemplateFactory.ENGLISH){return InteriorSizeLotSizeTemplateFactory.ENGLISH_INTERIOR_SIZE_OPTIONS}};InteriorSizeLotSizeTemplateFactory.createLotSize=function(a){if(a==InteriorSizeLotSizeTemplateFactory.ENGLISH){return InteriorSizeLotSizeTemplateFactory.ENGLISH_LOT_SIZE_OPTIONS}if(a==InteriorSizeLotSizeTemplateFactory.METRIC){return InteriorSizeLotSizeTemplateFactory.METRIC_LOT_SIZE_OPTIONS}};var rootExpandedView=null;CheckBoxState={UnChecked:1,Partial:2,Checked:3};CheckBoxClasses={};CheckBoxClasses[CheckBoxState.UnChecked]="cleared";CheckBoxClasses[CheckBoxState.Partial]="dashed";CheckBoxClasses[CheckBoxState.Checked]="checked";CheckBoxMessages={};CheckBoxMessages[CheckBoxState.Checked]="Searching All ";CheckBoxMessages[CheckBoxState.Partial]="Searching Some ";CheckBoxMessages[CheckBoxState.UnChecked]="Not Searching ";LocationNode=Class.create();Object.extend(LocationNode.prototype,Observable.prototype);Object.extend(LocationNode.prototype,{initialize:function(b,c,a){Observable.prototype.initialize.call(this);this.locationId=b;this.locationName=c;this._state=CheckBoxState.UnChecked;this._stateChangedListeners=new Array();this._toggleListener=new Function();this._children=a||[];var d=this;this._children.each(function(e){e.setParentNode(d)})},collectCheckedLocationIds:function(a){if(this.isChecked()){a.push(this.locationId)}else{if(this.isPartial()){this.children().each(function(b){b.collectCheckedLocationIds(a)})}}},getLocationId:function(){return this.locationId},setParentNode:function(a){this._parentNode=a},getParentNode:function(){return this._parentNode||{_childStateChanged:function(){},children:function(){return[]},setState:function(){},setStateFromChild:function(){}}},getState:function(){return this._state},isStateDifferent:function(a){return this._state!=a},setState:function(c,a){var b=this._state;this._state=c;if(b!=this._state){this._switchState(c,a)}this.notifyChange()},setStateFromChild:function(a){if(!this.ignoreChildChanges){this._state=a;this.getParentNode().setStateFromChild(this._determineParentStateFromSiblings());this.notifyChange()}},_switchState:function(d,b){this.ignoreChildChanges=true;if(this.isPartial()==false){var a=this.children();if(a.length>0&&d==CheckBoxState.Checked&&a[0].isMutuallyExclusive()){a[0].setState(d,true)}else{for(var c=0;c<a.length;c++){a[c].setState(d,true)}}}this.getParentNode().setStateFromChild(this._determineParentStateFromSiblings());this.ignoreChildChanges=false},notifyChange:function(){var b=this;for(var a=(this._stateChangedListeners.length-1);a>=0;a--){this._stateChangedListeners[a](b)}},addChangeListener:function(a){this._stateChangedListeners.push(a)},isChecked:function(){return this.getState()==CheckBoxState.Checked},isPartial:function(){return this.getState()==CheckBoxState.Partial},isUnChecked:function(){return this.getState()==CheckBoxState.UnChecked},toggle:function(a){var b=CheckBoxState.Checked;if(this.isChecked()){b=CheckBoxState.UnChecked}this.setState(b,a);this._toggleListener(this)},toggleStateTo:function(a){this.setState(a);this._toggleListener(this)},toggleStateToUnchecked:function(){this.toggleStateTo(CheckBoxState.UnChecked)},setToggleListener:function(a){this._toggleListener=a},children:function(){return this._children},isMutuallyExclusive:function(){return false},_determineParentStateFromSiblings:function(){var b=this.getParentNode().children();for(var a=0;a<b.length;a++){if(b[a].getState()!=this.getState()){return CheckBoxState.Partial}}return this.getState()},restore:function(a){if(typeof a[this.locationId]!="undefined"){this.setState(CheckBoxState.Checked)}else{this.setState(CheckBoxState.UnChecked);this.children().each(function(b){b.restore(a)})}}});function ShowAllTemplate(a){this._displayLeafNodes=a}ShowAllTemplate.prototype.apply=function(c){if(this._displayLeafNodes){c=this.flatten(c)}var b=new Array();var d=0;for(var a=0;(a<c.length)&&(d<this.getMaximumDisplay());a++){if(c[a].getState()!=CheckBoxState.UnChecked){++d;b.push(c[a].locationName);b.push("<br />")}}return b.join("")};ShowAllTemplate.prototype.flatten=function(a,c){if(!c){c=[]}for(var b=0;b<a.length;b++){if(a[b].children().length>0){this.flatten(a[b].children(),c)}else{c.push(a[b])}}return c};ShowAllTemplate.prototype.getMaximumDisplay=function(){return 999};function ShowPartialTemplate(a){ShowAllTemplate.call(this,a)}ShowPartialTemplate.prototype=new ShowAllTemplate();ShowPartialTemplate.prototype.getMaximumDisplay=function(){return 5};function showLocationOption(c,f,b,a){if($(c)){Element.remove(c)}var e=(b==0)?$("locationParentNode"):a.parentNode;var d=getPageController().getSearchOptionsModel().getFilterModel(FilterKey.LOCATION);if(!d.isQuickSearch()){locationController=new LocationController(d,e);rootExpandedView=locationController.getRootExpandedView();Event.observe(document.body,"click",function(g){hideLocationWidget(g)})}}function findPos(e){var a=e.offsetLeft;var b=e.offsetTop;var c=false;try{while(!c&&(e=Position.offsetParent(e))){if(e==document.body){c=true}else{a+=e.offsetLeft;b+=e.offsetTop}}}catch(d){}return{left:a,top:b}}function hideLocationWidget(b){var c=arguments[0]||window.event,a=c.target||c.srcElement;if(a.innerHTML.indexOf("Modify Search")!=-1){return}while(a!=document.body){if(a.className.indexOf("location_cell")!=-1||a.id=="locationDT"){return}a=a.parentNode}rootExpandedView.hide();Event.stopObserving(document.body,"click")}Url=Class.create();Object.extend(Url.prototype,{initialize:function(b){var a=b.indexOf("http://");if(a!=-1){b=b.substring(a)}this._url=this._extractUrl(b);this._params=this._extractParams(b)},toUrlString:function(){if(this._params.length>0){return this._url+"?"+this._params.join("&")}else{return this._url}},addParameter:function(a){if(a!=""&&a!=null){this._params.push(a)}},getParamCount:function(){return this._params.length},_extractParams:function(d){var c=d.split("?");var b=new Array();if(c.length==1){return b}c=c[1].split("&");for(var a=0;a<c.length;a++){b.push(c[a])}return b},_extractUrl:function(a){return a.split("?")[0]}});PageCache=Class.create();Object.extend(PageCache.prototype,{initialize:function(c,d,a,b){this._cacheElementName=a||"searchResultsIframe";this._url=d||new Url("/search/results.rails");this.searchOptionsModel=c||new SearchOptionsModel();this._pageNumber=b||1},getCacheElement:function(){return $(this._cacheElementName)},getUrl:function(){return this._url.toUrlString()},cache:function(){if(typeof window.progressChicken!="undefined"){window.progressChicken.start(true)}$("searchModelInput").value=DataSerializer.serialize(this.searchOptionsModel.dump());$("searchModelPageInput").value=this.getPageNumber();$("searchModelForm").action=this.getUrl();$("searchModelForm").target=this.getCacheElement().id;$("searchModelForm").submit()},getPageNumber:function(){return this._pageNumber}});CountModel=Class.create();Object.extend(CountModel.prototype,Observable.prototype);Object.extend(CountModel.prototype,{initialize:function(){Observable.prototype.initialize.call(this)},setText:function(a){this._text=a;this._countNumber=a.split("\n")[0];this._countMessage=a.split("\n")[1];this.notifyChange()},getText:function(){return this._text},getCountNumber:function(){return this._countNumber},getCountMessage:function(){return this._countMessage}});CountView=Class.create();Object.extend(CountView.prototype,{initialize:function(a){this._model=a;a.addChangeListener(this)},onChange:function(){var b=$("propcountNumberOnly")||{innerHTML:""};var a=$("propcountMessage")||{innerHTML:""};b.innerHTML=this._model.getCountNumber();a.innerHTML=this._model.getCountMessage()}});CountController=Class.create();Object.extend(CountController.prototype,{initialize:function(c,b,a){this._controllerName=c;this._model=b;this._countActionName=a||"/Count.rails"},getServerControllerName:function(){return this._controllerName},update:function(){if(typeof window.progressChicken!="undefined"){window.progressChicken.start()}var a=new Ajax.Request(this.getUrl(),{on200:function(b){if(b.responseText.match(/errorUrl/)){window.location.href=baseUrl+"/GenericError.htm"}},onComplete:this._updateModel.bind(this),parameters:this.getParam()})},_handleException:function(b,a){alert(a)},getSiteRoot:function(){if(typeof regionRoot!="undefined"){return(regionRoot.charAt(regionRoot.length-1)!="/")?regionRoot+"/":regionRoot}return"/"},getUrl:function(){return this.getSiteRoot()+this.getServerControllerName()+this.getCountActionName()},getCountActionName:function(){return this._countActionName},_updateModel:function(a){this._model.setText(a.responseText);if(typeof window.progressChicken!="undefined"){window.progressChicken.stop()}},getParam:function(){if(typeof getSearchOptionsModel=="function"&&typeof DataSerializer=="object"){return{searchModel:DataSerializer.serialize(getSearchOptionsModel().dump())}}return{}},setCountString:function(a){this._countString=a;this._model.setText(a)},getCountString:function(){return this._countString}});PageController=Class.create();Object.extend(PageController.prototype,{initialize:function(a){this._initialModel=this._safeGetParam(a,"searchModel",null);if($("quicksearchtextcriteria")){this._quickSearchController=this._createQuickSearchController(this._safeGetParam(a,"quickSearchBy",null))}this._shouldAutoUpdateResults=this._safeGetParam(a,"_shouldAutoUpdateResults",false);if(typeof a!="undefined"&&typeof a.quickSearchBy!="undefined"){this.setSearchOptionsModel(this._scoopSearchOptionsModelFromQuickSearch(a.quickSearchBy,a.quickSearchCriteriaUsed,a.quickSearchDisplayValue))}else{if(typeof a!="undefined"&&typeof a.searchModel!="undefined"){this.setSearchOptionsModel(this._scoopSearchOptionsModel(a.searchModel))}else{this.setSearchOptionsModel(this._createSearchOptionsModel())}}},_safeGetParam:function(c,b,a){if(!c||!c[b]){return a}return c[b]},showLocationTree:function(){return false},getCountController:function(){return this._countController},setCountString:function(a){if(this._countController){this._countController.setCountString(a)}},_createCountController:function(a){return new CountController(this.CONTROLLER_NAME,a)},_createQuickSearchController:function(){return new QuickSearchController(ResultType.ALL)},onInitialPageLoad:function(){var a=new CountModel();new CountView(a);this._countController=this._createCountController(a);if($("searchResults")){this._initialResults=""+$("searchResults").innerHTML}if($("idxButton")!=null){Event.observe($("idxButton"),"click",this._handleIdxButtonPress.bind(this))}},_handleIdxButtonPress:function(){this._prepareWebTrendsForIdxView()},_prepareWebTrendsForIdxView:function(){if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionClickOnLink("Region",window.location,"Idx Website"))}},_searchOptionsModelWasSet:function(a,b){this._setUpHandlers(a)},_setUpHandlers:function(b){this._resultsUpdater=new ResultsUpdater(this);if(this._shouldAutoUpdateResults){b.addChangeListener(this._resultsUpdater)}this._countUpdater=new CountUpdater(this);b.addChangeListener(this._countUpdater);var a=new NarrowByTextUpdater(b);b.addChangeListener(a);a.onChange()},getSearchOptionsModel:function(){return this._searchOptionsModel},getResultsUpdater:function(){return this._resultsUpdater},setSearchOptionsModel:function(a){if(typeof a=="undefined"||(this._resultsUpdater&&this._resultsUpdater._modelDirty)||a.equals(this._searchOptionsModel)){return}var b=this._searchOptionsModel;this._searchOptionsModel=a;this._searchOptionsModelWasSet(a,b)},_createSearchOptionsModel:function(c){var a=c||"search";var b=new SearchOptionsModel(a);return this._populateFilterModels(b)},_populateFilterModels:function(b){b._filterModels={};modelsToPopulate=this._filterModelsUsed();for(var a in modelsToPopulate){b.addFilterModel(a,modelsToPopulate[a])}return b},_filterModelsUsed:function(){var a={};a[FilterKey.WEB_REGION]=new WebRegionModel(window.regionRoot);return a},switchToResultsView:function(b){if(b.tagName=="DD"){b=$(b.id.replace("DD","DT"))}var a=$(b.id.replace("DT","DD"));window.removeClassNameForChildrenWithinAParentTag("searchOptions","dt","activated");window.removeClassNameForChildrenWithinAParentTag("searchOptions","dt","activatedFirst");window.removeClassNameForChildrenWithinAParentTag("searchOptions","dd","activated");Element.removeClassName(b,"selected");if(b.id=="categorybasedlocationDT"){Element.addClassName(b,"activatedFirst")}else{Element.addClassName(b,"activated")}Element.removeClassName(a,"selected");Element.addClassName(a,"activated");if($("error")&&$("error").style.display!="none"){Element.hide("error");this.updateSearchResults()}},updateSearchResults:function(){this.goToPage(1)},updateCount:function(){var a=this.getCountController();if(a){a.update()}},setModelValues:function(){},isLandingPageVisible:function(){return $("content")&&$("content").className.indexOf("resultsList")==-1},goToPage:function(b){var a=this.getSearchOptionsModel();if(this._getPageNavigationURL()){new PageCache(a,new Url(regionRoot+this._getPageNavigationURL()),null,b).cache()}},_getPageNavigationURL:function(){return"/sales/list.rails"},getQuickSearchController:function(){return this._quickSearchController},_scoopSearchOptionsModel:function(dumpStr){eval("searchModelDump = "+dumpStr+";");return SearchOptionsModel.scoop(searchModelDump,this)},_scoopSearchOptionsModelFromQuickSearch:function(d,a,b){var c=this._createSearchOptionsModel();if(d=="Name"){c.getFilterModel(FilterKey.AGENT_NAME_SEARCH).setName(a);c.getFilterModel(FilterKey.AGENT_NAME_SEARCH).pushSearchedName()}else{if(d=="Area"){if(c.getFilterModel(FilterKey.LOCATION)){c.getFilterModel(FilterKey.LOCATION).setCitySTZip(a);c.getFilterModel(FilterKey.LOCATION).setQuickSearchText(b)}}else{if(d=="subregion"){c.getFilterModel(FilterKey.SUBREGION).setIdCriteria(a)}}}return c},getLinkBackToThisPage:function(){var a=this._getPageNavigationURL();if(a.indexOf("http")==-1){a=regionRoot+a}return a},resultsLinkClicked:function(b,a){$("currentIndex").value=a;$("searchModelInput").value=DataSerializer.serialize(this.getSearchOptionsModel().dump());$("searchModelForm").action=b;$("searchModelForm").target="_self";this._appendToValue($("searchResultsActionUrl"),this.getLinkBackToThisPage(),"|");this._appendToValue($("searchResultsIndex"),a,"|");this._appendToValue($("searchResultsIndex"),a,"|");this._appendToValue($("searchResultsSearchModel"),DataSerializer.serialize(this.getSearchOptionsModel().dump()),"|");this.setUpDetailPagination();this._submitSearchModelForm()},setUpDetailPagination:function(){$("sir_result_detail_sort_by").value=$("sir_result_sort_by").value;$("sir_result_detail_sort_direction").value=$("sir_result_sort_direction").value;$("sir_result_sort_by").value="";$("sir_result_sort_direction").value=""},_submitSearchModelForm:function(){$("searchModelForm").submit()},_appendToValue:function(a,c,b){a.value=a.value||"";if(a.value==""){b=""}a.value=a.value+b+c},updateViewToResults:function(){this._updateViewToResults()},_updateViewToResults:function(){if($("error")){Element.remove("error")}var a=$("content");if(a){a.className="content resultsList"}}});PageController._createdCallbacks=[];PageController._constructorParams={};PageController.addPageCreatedCallback=function(a){PageController._createdCallbacks.push(a)};PageController.getPageCreatedCallbacks=function(){return PageController._createdCallbacks};PageController.addConstructorParam=function(a,b){PageController._constructorParams[a]=b};PageController.getConstructorParams=function(){return PageController._constructorParams};NarrowByTextUpdater=Class.create();Object.extend(NarrowByTextUpdater.prototype,{initialize:function(a){this._model=a},onChange:function(){var a=$("narrowSearchLabel");if(a){var b=this._model.isEmpty()?"Narrow search by:":"Narrow or expand search by:";a.innerHTML=b}}});DetailPageController=Class.create();Object.extend(DetailPageController.prototype,PageController.prototype);Object.extend(DetailPageController.prototype,{initialize:function(a){if(a&&typeof a.searchModelUsed!="undefined"){this._searchModelUsed=a.searchModelUsed;this._searchResultPage=a.searchResultPage||"1"}PageController.prototype.initialize.call(this,a)},updateCount:function(){},goToDetailPage:function(a,b){$("currentIndex").value=a;$("searchModelForm").action=b.href;$("searchModelInput").value=this._searchModelUsed;$("searchModelForm").target="_self";$("searchModelPageInput").value=this._searchResultPage;$("searchModelForm").submit()},returnToSearchResults:function(){$("sir_result_sort_by").value=$("sir_result_detail_sort_by").value;$("sir_result_sort_direction").value=$("sir_result_detail_sort_direction").value;$("sir_result_detail_sort_by").value="";$("sir_result_detail_sort_direction").value="";$("searchModelForm").action=this._pop($("searchResultsActionUrl"),"|");if($("searchModelForm").action.indexOf("/list")){this._pop($("searchResultsIndex"),"|")}$("currentIndex").value=this._getLast($("searchResultsIndex"),"|");var a=parseInt($("currentIndex").value);var c=10;var b=$("searchModelItemsPerPageInput");if(b&&b.value){c=b.value}if(isNaN(a)){$("searchModelPageInput").value=""}else{$("searchModelPageInput").value=""+Math.ceil(a/c)}$("searchModelInput").value=this._pop($("searchResultsSearchModel"),"|");$("searchModelLayoutInput").value="";$("searchModelForm").target="_self";this.submitSearchModelForm()},_isResultListUrl:function(a){return(a.indexOf("list.rails")!=-1)||/agents$/.test(a)},submitSearchModelForm:function(){$("searchModelForm").submit()},_pop:function(b,a){var d=b.value.split(a);var c=d.pop();b.value=d.join(a);return c},_getLast:function(b,a){var c=b.value.split(a);if(c.length==0){return""}return c[c.length-1]},getLinkBackToThisPage:function(){return window.location.href},resultsLinkClicked:function(b,a){if($("searchResultsIndex").value&&$("searchResultsIndex").value!="0"){$("currentIndex").value=a;$("searchModelInput").value=DataSerializer.serialize(this.getSearchOptionsModel().dump());$("searchModelForm").action=b;$("searchModelForm").target="_self";this._appendToValue($("searchResultsActionUrl"),this.getLinkBackToThisPage(),"|");this._appendToValue($("searchResultsIndex"),a,"|");this._appendToValue($("searchResultsSearchModel"),DataSerializer.serialize(this.getSearchOptionsModel().dump()),"|");this._submitSearchModelForm();return}$("currentIndex").value=a;$("searchModelInput").value=DataSerializer.serialize(this.getSearchOptionsModel().dump());$("searchModelForm").action=b;$("searchModelForm").target="_self";this._appendToValue($("searchResultsActionUrl"),this.getLinkBackToThisPage(),"|");$("searchResultsIndex").value="";this._appendToValue($("searchResultsSearchModel"),DataSerializer.serialize(this.getSearchOptionsModel().dump()),"|");this._submitSearchModelForm()},_filterModelsUsed:function(){return{}}});AgentController=Class.create();Object.extend(AgentController.prototype,PageController.prototype);Object.extend(AgentController.prototype,{CONTROLLER_NAME:"agents",initialize:function(a){a=a||{};a._shouldAutoUpdateResults=false;PageController.prototype.initialize.call(this,a);if($("agentNameSearchInput")&&$("agentNameSearchSuggest")){this._nameAutoCompleter=new AgentAutocompleter("agentNameSearchInput","agentNameSearchSuggest",regionRoot+"/agents/suggest.rails",{paramName:"textCriteria",callback:this.suggestCallback.bind(this)}).start()}},suggestCallback:function(b,a){return a+"&searchModel="+DataSerializer.serialize(this.getSearchOptionsModel().dump())},_createCountController:function(a){return undefined},_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.LOCATION]=new LocationModel();a[FilterKey.CAT_BASED_LOCATION]=a[FilterKey.LOCATION];a[FilterKey.AGENT_LOCATION]=new AgentLocationFilterModel();a[FilterKey.LANGUAGE]=new LanguageFilterModel();a[FilterKey.AGENT_NAME_SEARCH]=new AgentNameSearchFilterModel();a[FilterKey.LETTER_FROM_FORM]=new LetterFromFormFilterModel();return a},_getPageNavigationURL:function(){var b="/agents";if($("searchModelForm").action.indexOf("AGENT_NAME_SEARCH")==-1){var c=document.URL;var a=c.indexOf(b,0);if(c.lastIndexOf("/")>a){b=c.substring(a,c.length)}}return b},_setUpHandlers:function(a){PageController.prototype._setUpHandlers.call(this,a)},showLocationTree:function(){return true},onSubmitHook:function(){getSearchOptionsModel().getFilterModel(FilterKey.AGENT_NAME_SEARCH).pushSearchedName()}});SearchController=Class.create();Object.extend(SearchController.prototype,PageController.prototype);Object.extend(SearchController.prototype,{CONTROLLER_NAME:"sales",_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.LOCATION]=new LocationModel();a[FilterKey.PRICE]=new PriceFilterModel();a[FilterKey.BED_BATH]=new BedBathSizeFilterModel();a[FilterKey.INTERIOR_SIZE_LOT_SIZE]=new InteriorLotSizeFilterModel();a[FilterKey.CAT_BASED_LOCATION]=a[FilterKey.LOCATION];a[FilterKey.ARCHITECTURAL_STYLE]=new MultiLevelAmenityFilterModel("Architectural Style","architecturalstyle","All Styles");a[FilterKey.PROPERTY_COMMUNITY_TYPE]=new MultiLevelAmenityFilterModel("Property/Community Type","propertycommunitytype","All Types","Add Property Type","Edit Property Type");a[FilterKey.FEATURES_AND_AMENITIES]=new MultiLevelAmenityFilterModel("Features and Amenities","featuresandamenities","Any Features","Add Features and Amenities","Edit Features and Amenities");a[FilterKey.LIFESTYLE]=new MultiLevelAmenityFilterModel("Lifestyle","lifestyle","Any Lifestyle");a[FilterKey.WATERFRONT_WATERVIEW]=new MultiLevelAmenityFilterModel("waterfrontwaterview","waterfrontwaterview","All Waterfront Waterview");a[FilterKey.SUB_LOCATIONS]=new MultiLevelAmenityFilterModel("sublocations","sublocations","Sub Locations");a[FilterKey.GARAGES]=new MultiLevelAmenityFilterModel("garages","garages","Garages");a[FilterKey.ITEMS_PER_PAGE]=new ItemsPerPageFilterModel();return a},showLocationTree:function(){return true},_searchOptionsModelWasSet:function(a,b){PageController.prototype._searchOptionsModelWasSet.call(this,a,b);a.getFilterModel(FilterKey.LOCATION).setLocationDisplayTree(LOCATION_DISPLAY_TREE)},_createCountController:function(a){return new CountController("sales",a)},_getPageNavigationURL:function(){return"/sales/list.rails?layout=results"},getLinkBackToThisPage:function(){return regionRoot+"/sales"},isLandingPageVisible:function(){return $("regionSplash")&&$("content")&&$("content").className.indexOf("resultsList")==-1},setUpDetailPagination:function(){$("sir_result_detail_sort_by").value=$("sir_result_sort_by").value;$("sir_result_detail_sort_direction").value=$("sir_result_sort_direction").value}});WelcomeController=Class.create();Object.extend(WelcomeController.prototype,SearchController.prototype);Object.extend(WelcomeController.prototype,{initialize:function(a){SearchController.prototype.initialize.call(this,a)},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);this.updateCount()},_updateViewToResults:function(){if($("error")){Element.remove("error")}if($("findPropertiesDownArrow")){Element.hide($("findPropertiesDownArrow"))}unregisterAnyHandler($("findPropertiesLink"),"mouseover");unregisterAnyHandler($("findPropertiesLink"),"mouseout");if($("findPropertiesDrop")){unregisterAnyHandler($("findPropertiesDrop"),"mouseout")}if($("secondarySearchTabs")){Element.show($("secondarySearchTabs"));Element.removeClassName($("secondarySearchTabsDiv"),"empty");Element.addClassName($("secondarySearchTabs").getElementsByTagName("a")[0],"active")}removeLandingPageStyles();var a=$("content");if(a){a.className="content resultsList"}}});RentalController=Class.create();Object.extend(RentalController.prototype,SearchController.prototype);Object.extend(RentalController.prototype,{CONTROLLER_NAME:"rental",initialize:function(a){SearchController.prototype.initialize.call(this,a)},_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.LOCATION]=new LocationModel();a[FilterKey.CAT_BASED_LOCATION]=a[FilterKey.LOCATION];a[FilterKey.RATES_AND_AVAILABILITY]=new RatesAndAvailabilityFilterModel();a[FilterKey.BED_BATH]=new BedBathSizeFilterModel();a[FilterKey.INTERIOR_SIZE_LOT_SIZE]=new InteriorLotSizeFilterModel();a[FilterKey.ARCHITECTURAL_STYLE]=new MultiLevelAmenityFilterModel("Architectural Style","architecturalstyle","All Styles");a[FilterKey.PROPERTY_COMMUNITY_TYPE]=new MultiLevelAmenityFilterModel("Property/Community Type","propertycommunitytype","All Types");a[FilterKey.FEATURES_AND_AMENITIES]=new MultiLevelAmenityFilterModel("Features and Amenities","featuresandamenities","Any Features","Add Features and Amenities","Edit Features and Amenities");a[FilterKey.WATERFRONT_WATERVIEW]=new MultiLevelAmenityFilterModel("waterfrontwaterview","waterfrontwaterview","All Waterfront Waterview");a[FilterKey.SUB_LOCATIONS]=new MultiLevelAmenityFilterModel("sublocations","sublocations","Sub Locations");a[FilterKey.GARAGES]=new MultiLevelAmenityFilterModel("garages","garages","Garages");a[FilterKey.LIFESTYLE]=new MultiLevelAmenityFilterModel("Lifestyle","lifestyle","Any Lifestyle");return a},_createSearchOptionsModel:function(){return PageController.prototype._createSearchOptionsModel.call(this,"search")},_getPageNavigationURL:function(){return"/rental/list.rails?layout=results"},_createCountController:function(a){return new CountController(this.CONTROLLER_NAME,a)},getLinkBackToThisPage:function(){return regionRoot+"/rentals"}});RentalWelcomeController=Class.create();Object.extend(RentalWelcomeController.prototype,RentalController.prototype);Object.extend(RentalWelcomeController.prototype,{initialize:function(a){RentalController.prototype.initialize.call(this,a)},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);this.updateCount()},_updateViewToResults:function(){if($("error")){Element.remove("error")}Element.removeClassName($("searchResults"),"rentalLanding");removeLandingPageStyles();var a=$("content");if(a){a.className="content resultsList"}}});OfficeController=Class.create();Object.extend(OfficeController.prototype,PageController.prototype);Object.extend(OfficeController.prototype,{initialize:function(a){a=a||{};a._shouldAutoUpdateResults=false;PageController.prototype.initialize.call(this,a)},CONTROLLER_NAME:"offices",_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.LOCATION]=new LocationModel();return a},_getPageNavigationURL:function(){return"/offices"}});EquestrianPageController=Class.create();Object.extend(EquestrianPageController.prototype,PageController.prototype);Object.extend(EquestrianPageController.prototype,{initialize:function(a){PageController.prototype.initialize.call(this,a)},CONTROLLER_NAME:"equestrian",_getPageNavigationURL:function(){return"/equestrian/list.rails"},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this)},_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.SUBREGION]=new SubRegionFilterModel();return a}});AgentDetailController=Class.create();Object.extend(AgentDetailController.prototype,DetailPageController.prototype);Object.extend(AgentDetailController.prototype,{CONTROLLER_NAME:"agentdetail",initialize:function(a){this._agentId=a.agentId;this._countController=null;DetailPageController.prototype.initialize.call(this,a)},_createCountController:function(a){},_filterModelsUsed:function(){var b={};var a=new AgentIdFilterModel();a.setIdCriteria(this._agentId);b[FilterKey.AGENT_ID]=a;return b},getAgentId:function(){return this._agentId},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);if($("AgentWebSite")!=null){Event.observe($("AgentWebSite"),"click",this._handleLinkClicked.bind(this))}},_getPageNavigationURL:function(){if(this._isRentalListingsActive()){return"/rental/byAgent/"+this._agentId}else{if(this._isSelectSalesActive()){return"/agentselectsales/byAgent.rails?agentId="+this._agentId}else{return"/sales/byAgent/"+this._agentId}}},_handleLinkClicked:function(){this._prepareWebTrendsForAgentWebsites()},_prepareWebTrendsForAgentWebsites:function(){var a=$("agentname").innerHTML;if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionClickOnLink("Agent "+a,window.location,"Agent Website"))}},_isRentalListingsActive:function(){return($("currentRentalsLI")&&$("currentRentalsLI").className.indexOf("selected")!=-1)},_isSelectSalesActive:function(){return($("selectSalesLI")&&$("selectSalesLI").className.indexOf("selected")!=-1)},createDetailPageURL:function(a){return regionRoot+"/agents/"+a},createSearchResultsActionUrl:function(){return regionRoot+"/agents"}});OfficeDetailController=Class.create();Object.extend(OfficeDetailController.prototype,DetailPageController.prototype);Object.extend(OfficeDetailController.prototype,{CONTROLLER_NAME:"officedetail",initialize:function(a){this._officeId=a.officeId;this._countController=null;DetailPageController.prototype.initialize.call(this,a)},_createCountController:function(a){},_filterModelsUsed:function(){var b={};var a=new OfficeIdFilterModel();a.setIdCriteria(this._officeId);b[FilterKey.OFFICE_ID]=a;return b},getOfficeId:function(){return this._officeId},_getPageNavigationURL:function(){if(this._isOfficeListingsActive()){return"/sales/list.rails"}else{if(this._isOfficeRentalsActive()){return"/rental/list.rails"}else{if(this._isSelectSalesActive()){return"/officeselectsales/list.rails?officeId="+this._officeId}else{return"/agents/shortsummary.rails"}}}},_isOfficeListingsActive:function(){return($("currentListingsLI").className.indexOf("selected")!=-1)},_isOfficeRentalsActive:function(){return($("currentRentalsLI")&&$("currentRentalsLI").className.indexOf("selected")!=-1)},_isSelectSalesActive:function(){return($("selectSalesLI")&&$("selectSalesLI").className.indexOf("selected")!=-1)},createDetailPageURL:function(a){return regionRoot+"/offices/"+a},createSearchResultsActionUrl:function(){return regionRoot+"/offices/list.rails"}});TeamDetailController=Class.create();Object.extend(TeamDetailController.prototype,DetailPageController.prototype);Object.extend(TeamDetailController.prototype,{CONTROLLER_NAME:"teamdetail",initialize:function(a){this._teamId=a.teamId;this._countController=null;DetailPageController.prototype.initialize.call(this,a)},_createCountController:function(a){},_filterModelsUsed:function(){var b={};var a=new SalesTeamIdFilterModel();a.setIdCriteria(this._teamId);b[FilterKey.SALE_TEAM_ID]=a;return b},onInitialPageLoad:function(){if($("SalesTeamWebSite")!=null){Event.observe($("SalesTeamWebSite"),"click",this._handleLinkClicked.bind(this))}},_getPageNavigationURL:function(){if(this._isRentalListingsActive()){return"/rental/byTeam.rails?teamid="+this._teamId+"&watched=false"}else{if(this._isSalesListingsActive()){return"/sales/byTeam.rails?teamid="+this._teamId+"&watched=false"}else{if(this._isSelectSalesActive()){return"/agentselectsales/byteam.rails?teamid="+this._teamId}else{return"/agents/byTeam.rails?teamId="+this._teamId}}}},_handleLinkClicked:function(){this._prepareWebTrendsForSalesTeamWebsites()},_prepareWebTrendsForSalesTeamWebsites:function(){var a=$("salesteam").innerHTML;if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionClickOnLink("Sales Team "+a,window.location,"SalesTeam Website"))}},createDetailPageURL:function(a){return regionRoot+"/agents/"+a},_isRentalListingsActive:function(){return($("currentRentalsLI")&&$("currentRentalsLI").className.indexOf("selected")!=-1)},_isSelectSalesActive:function(){return($("selectSalesLI")&&$("selectSalesLI").className.indexOf("selected")!=-1)},_isSalesListingsActive:function(){return($("currentListingsLI")&&$("currentListingsLI").className.indexOf("selected")!=-1)}});NeighborhoodDetailController=Class.create();Object.extend(NeighborhoodDetailController.prototype,DetailPageController.prototype);Object.extend(NeighborhoodDetailController.prototype,{CONTROLLER_NAME:"neighborhooddetail",initialize:function(a){this._neighborhoodId=a.neighborhoodId;this._numListings=a.numListings;this._countController=null;DetailPageController.prototype.initialize.call(this,a)},_createCountController:function(a){},_filterModelsUsed:function(){var b={};var a=new NeighborhoodIdFilterModel();a.setIdCriteria(this._neighborhoodId);b[FilterKey.NEIGHBORHOOD_ID]=a;return b},getNeighborhoodId:function(){return this._neighborhoodId},_getPageNavigationURL:function(){if(this._isOfficeRentalsActive()){return"/rental/list.rails"}else{return"/sales/list.rails"}},_isOfficeRentalsActive:function(){return($("currentRentalsLI")&&$("currentRentalsLI").className.indexOf("selected")!=-1)},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);if(this._numListings&&this._numListings>0){}},createDetailPageURL:function(a){return regionRoot+"/areas/"+a}});AreaController=Class.create();Object.extend(AreaController.prototype,PageController.prototype);Object.extend(AreaController.prototype,{CONTROLLER_NAME:"areas",_createCountController:function(a){return new CountController("sales",a)},_filterModelsUsed:function(){var b=PageController.prototype._filterModelsUsed.call(this);var a=new SubRegionFilterModel();b[FilterKey.SUBREGION]=a;return b},updateCount:function(){},_getPageNavigationURL:function(){return window.location.href},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);this.updateCount()},goToPage:function(a){PageController.prototype.goToPage.call(this,a);this.updateCount()},setCountString:function(){}});DevelopmentController=Class.create();Object.extend(DevelopmentController.prototype,PageController.prototype);Object.extend(DevelopmentController.prototype,{CONTROLLER_NAME:"developments",_filterModelsUsed:function(){var d=window.location.href.split("/");var a=d[d.length-1];var c=PageController.prototype._filterModelsUsed.call(this);var b=new DevelopmentGroupFilterModel();b.setIdCriteria(a);c[FilterKey.DEVELOPMENT_GROUP]=b;return c},_getPageNavigationURL:function(){return window.location.href},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this)}});SearchByRadioButton=Class.create();Object.extend(SearchByRadioButton.prototype,RadioButton.prototype);Object.extend(SearchByRadioButton.prototype,{initialize:function(g,c,d,b,a,f,e){RadioButton.prototype.initialize.call(this,g);this._type=g;this._buttonText=c;this._promptText=d;this._assistText=b;this._action=a;this._startAutoComplete=f||false;this._showMarketDropDown=e||false},addToUrl:function(a){if(this._action){a.push(this._action)}},updateAutoComplete:function(a){if(this._startAutoComplete){a.start()}else{a.stop()}},getType:function(){return this._type},getButtonText:function(){return this._buttonText},getAssistText:function(){return"<label>"+this._assistText+"</label>"},getPromptText:function(){return this._promptText},showMarketDropDown:function(){return this._showMarketDropDown},render:function(){return'<input type="radio" class="radio" id="'+this._type+'" value="'+this._type+'" name="searchByRadioButton" /><label for="'+this._type+'">'+this._buttonText+"</label></input>"}});SearchByRadioButton.LOCATION=new SearchByRadioButton("Location"," City, ST or Zip","City, ST or Zip","Within:","byCitySTZip");SearchByRadioButton.MARKET=new SearchByRadioButton("Market"," Location","","Within:","byMarket",false,true);SearchByRadioButton.AGENT_NAME=new SearchByRadioButton("Name"," Name","Example: John Smith","Enter an Agent's Name","byname",true);SearchByRadioButton.MLSID_WEBNO=new SearchByRadioButton("","","","Web # or MLS ID:","byListingNumberOrMlsID");SearchByRadioButton.ALL=new SearchByRadioButton("","","Web #, MLS ID, address, agent, keyword","Quick Search","search",true);SearchByRadioButton.getInstance=function(b){for(var a in SearchByRadioButton){if(typeof SearchByRadioButton[a]=="object"&&SearchByRadioButton[a].getType()==b){return SearchByRadioButton[a]}}};SearchByRadioButton.getSelectedRadioButton=function(){var a=$("quicksearchform").getInputs("radio","searchByRadioButton").find(function(b){return b.checked});return(a)?$F(a):null};PropertyDetailController=Class.create();Object.extend(PropertyDetailController.prototype,DetailPageController.prototype);Object.extend(PropertyDetailController.prototype,{initialize:function(a){this._propertyId=a.propertyId;DetailPageController.prototype.initialize.call(this,a)},getPropertyId:function(){return this._propertyId},getResultIndex:function(){return this._resultIndex},updateSearchResults:function(){},goToPage:function(){},createDetailPageURL:function(a){return regionRoot+"/"+this._propertyType+"/"+a},createSearchResultsActionUrl:function(){return regionRoot+"/"+this._propertyType+"/list.rails"},_filterModelsUsed:function(){return{}}});SalesDetailController=Class.create();Object.extend(SalesDetailController.prototype,PropertyDetailController.prototype);Object.extend(SalesDetailController.prototype,{initialize:function(a){this._propertyType="sales";PropertyDetailController.prototype.initialize.call(this,a);if($("watchThisPropertyButton")){(new WatchThisPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService()))}else{if($("watchListOffLink")){new CurrentlyWatchingPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService())}}}});RentalDetailController=Class.create();Object.extend(RentalDetailController.prototype,PropertyDetailController.prototype);Object.extend(RentalDetailController.prototype,{initialize:function(a){this._propertyType="rental";PropertyDetailController.prototype.initialize.call(this,a)}});OpenHouseDetailController=Class.create();Object.extend(OpenHouseDetailController.prototype,PropertyDetailController.prototype);Object.extend(OpenHouseDetailController.prototype,{initialize:function(a){this._propertyType="openhouses";PropertyDetailController.prototype.initialize.call(this,a);if($("watchThisPropertyButton")){(new WatchThisPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService()))}else{if($("watchListOffLink")){new CurrentlyWatchingPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService())}}}});EquestrianDetailController=Class.create();Object.extend(EquestrianDetailController.prototype,PropertyDetailController.prototype);Object.extend(EquestrianDetailController.prototype,{initialize:function(a){this._propertyType="sales";PropertyDetailController.prototype.initialize.call(this,a);if($("watchThisPropertyButton")){(new WatchThisPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService()))}else{if($("watchListOffLink")){new CurrentlyWatchingPropertyPanel($("watchThisPropertyDiv"),new WatchPropertyService())}}}});ResultType=Class.create();Object.extend(ResultType.prototype,{initialize:function(c,a,b){this._type=c;this._searchByList=a;this._serverControllerName=b},getType:function(){return this._type},getSearchByList:function(){return this._searchByList},getDefaultSearchBy:function(){return this._searchByList[0]},addToUrl:function(a){a.push(this._serverControllerName)},isEmpty:function(){return this.getDefaultSearchBy().getType()==""}});ResultType.ALL=new ResultType("Web #, MLS ID, address, agent, keyword",[SearchByRadioButton.ALL],"quicksearch");ResultType.MLSNO_WEBID=new ResultType("Web # or MLS ID",[SearchByRadioButton.MLSID_WEBNO],"sales");ResultType.SALES=new ResultType("Properties for Sale",[SearchByRadioButton.LOCATION,SearchByRadioButton.MARKET],"sales");ResultType.RENT=new ResultType("Properties for Rent",[SearchByRadioButton.MARKET],"rentals");ResultType.AGENT=new ResultType("Our Agents",[SearchByRadioButton.AGENT_NAME,SearchByRadioButton.LOCATION,SearchByRadioButton.MARKET],"agents");ResultType.OFFICE=new ResultType("Our Offices",[SearchByRadioButton.MARKET],"offices");ResultType.getInstance=function(b){for(var a in ResultType){if(typeof ResultType[a]=="object"&&ResultType[a].getType()==b){return ResultType[a]}}};QuickSearchController=Class.create();Object.extend(QuickSearchController.prototype,{initialize:function(a){this._model=new QuickSearchModel(a);this._view=new QuickSearchView(this._model,this);if(typeof QSAutocompleter!="undefined"){this._autocompleter=new QSAutocompleter("quicksearchtextcriteria","suggestText",regionRoot+"/quicksearch/suggest.rails",{paramName:"searchTerm"})}this._model.addSearchByListener(new ClosureHandler(this._searchByChanged.bind(this)));this._model.addResultTypeListener(new ClosureHandler(this._searchByChanged.bind(this)));this._searchByChanged()},submit:function(){if(typeof dcsMultiTrack=="function"){dcsMultiTrack("WT.oss",this._model.getTextCriteria())}window.location.href=baseUrl+this.buildQuickSearchURL()},buildQuickSearchURL:function(){var a=[];if(this._model.getSearchBy().showMarketDropDown()){a.push("");if(this._view._marketSelect.getSelectionValue().length>0){a.push(this._view._marketSelect.getSelectionValue())}this._model.getResultType().addToUrl(a)}else{a.push(regionRoot);this._model.getResultType().addToUrl(a);this._model.getSearchBy().addToUrl(a);a.push(this.encodeTextForURI(this._model.getTextCriteria()))}return a.join("/")},encodeTextForURI:function(b){var a=encodeURIComponent(b.gsub(/\%/,"").gsub(/\&/,"").gsub(/\./,"").gsub(/\?/,"").gsub(/\//,"").gsub(/</,"").gsub(/>/,"")).gsub(/!/,"%21").gsub(/'/,"%27").gsub(/\(/,"").gsub(/\)/,"").gsub(/\*/,"");if(a.toUpperCase()=="CON"||a.toUpperCase()=="AUX"){a="%20"+a}return a},_searchByChanged:function(){this._model.getSearchBy().updateAutoComplete(this._autocompleter)},getModel:function(){return this._model}});QuickSearchModel=Class.create();Object.extend(QuickSearchModel.prototype,{initialize:function(a){a=a||ResultType.ALL;this._resultTypeObservable=new Observable();this._searchByObservable=new Observable();this._textCriteriaObservable=new Observable();this.setResultType(a)},addResultTypeListener:function(a){this._resultTypeObservable.addChangeListener(a)},addSearchByListener:function(a){this._searchByObservable.addChangeListener(a)},addTextCriteriaListener:function(a){this._textCriteriaObservable.addChangeListener(a)},setTextCriteria:function(a){this._textCriteria=a;this._textCriteriaObservable.notifyChange()},getTextCriteria:function(){return this._textCriteria},setResultType:function(a){this._resultType=a;this._searchBy=a.getDefaultSearchBy();this._resultTypeObservable.notifyChange()},getResultType:function(){return this._resultType},setSearchBy:function(a){this._searchBy=a;this._searchByObservable.notifyChange()},getSearchBy:function(){return this._searchBy}});QuickSearchModel.RESULT_TYPE_LIST=[ResultType.ALL,ResultType.MLSNO_WEBID,ResultType.SALES,ResultType.RENT,ResultType.AGENT,ResultType.OFFICE];QuickSearchView=Class.create();Object.extend(QuickSearchView.prototype,{initialize:function(b,a){this._controller=a;this._resultTypeSelect=new Select("mainquicksearchcriteria");this._submitButton=new PeerElement("new_quickSearchSubmitButton");this._textCriteria=new InputElement("quicksearchtextcriteria");this._searchByRadioButtonPane=$("searchByRadioButtonPaneDiv");this._marketSelect=new Select("marketselect");this._model=b;this._updateSearchByList();this._updateResultTypeList();this._onSearchByChange();this._model.addResultTypeListener(new ClosureHandler(this._onResultTypeChange.bind(this)));this._model.addSearchByListener(new ClosureHandler(this._onSearchByChange.bind(this)));this._model.addTextCriteriaListener(new ClosureHandler(this._onTextCriteriaChange.bind(this)));this._bindListeners()},_bindListeners:function(){this._createSearchByRadioButtonBindings();this._resultTypeSelect.addChangeListener(this._handleResultTypeChanged.bind(this));this._textCriteria.addFocusListener(this._handleFocusGained.bind(this));this._textCriteria.addBlurListener(this._handleFocusLost.bind(this));this._textCriteria.addEnterKeyListener(this._handleEnterKeyPressed.bindAsEventListener(this));this._submitButton.addClickListener(this._handleSubmit.bind(this))},_createSearchByRadioButtonBindings:function(){this._model.getResultType().getSearchByList().each(function(a){this._createASearchByRadioButtonBinding(a)}.bind(this))},_createASearchByRadioButtonBinding:function(a){a.addClickListener(this._handleSearchByChanged.bind(this))},_updateResultTypeList:function(){this._resultTypeSelect.update(QuickSearchModel.RESULT_TYPE_LIST.collect(function(a){return a.getType()}),this._model.getResultType().getType())},_onTextCriteriaChange:function(){this._textCriteria.setValue(this._model.getTextCriteria())},_onSearchByChange:function(){if(this._model.getSearchBy()&&this._model.getSearchBy().showMarketDropDown()){this._textCriteria.hide();var a=(ResultType.getInstance(this._resultTypeSelect.getSelection().text)!=ResultType.RENT);Element.show(this._marketSelect._getElement())}else{Element.hide(this._marketSelect._getElement());this._textCriteria.show();this._updateTextBox(this._getQuickSearchPromptText())}this._updateAssistText()},_getQuickSearchPromptText:function(){return this._model.getSearchBy().getPromptText()},_onResultTypeChange:function(){this._updateSearchByList();this._onSearchByChange()},_updateSearchByList:function(){this._searchByRadioButtonPane.innerHTML="";if(!this._model.getResultType().isEmpty()&&this._model.getResultType().getSearchByList().size()>1){var a=this._model.getResultType().getSearchByList().collect(function(b){return b.render()}).join("");this._searchByRadioButtonPane.innerHTML="<label>Search By: </label>"+a;this._createSearchByRadioButtonBindings();this._selectDefaultSearchByRadioButton()}},_updateAssistText:function(){$("assistTextDiv").innerHTML=this._model.getSearchBy().getAssistText()},_selectDefaultSearchByRadioButton:function(){$(this._model.getResultType().getDefaultSearchBy().getType()).checked=true},_handleSearchByChanged:function(){this._model.setSearchBy(SearchByRadioButton.getInstance(SearchByRadioButton.getSelectedRadioButton()))},_handleResultTypeChanged:function(){this._model.setResultType(ResultType.getInstance(this._resultTypeSelect.getSelection().text))},_updateTextBox:function(a){this._textCriteria.setValue(a);this._textCriteria.removeClass("hintTextboxActive");this._textCriteria.addClass("hintTextbox");this._textCriteria.addClass("prompt")},_handleFocusGained:function(){if(this._textCriteria.getValue()==this._model.getSearchBy().getPromptText()){this._textCriteria.clear();this._textCriteria.removeClass("hintTextbox");this._textCriteria.removeClass("prompt");this._textCriteria.addClass("hintTextboxActive")}},_handleFocusLost:function(){if(this._textCriteria.getValue()==""){this._updateTextBox(this._getQuickSearchPromptText())}},_handleEnterKeyPressed:function(){this._createTimeout(this._doEnterPressed.bind(this),10)},_createTimeout:function(b,a){setTimeout(b,a)},_handleSubmit:function(){var a=this._textCriteria.getValue();if("."==a.charAt(a.length-1)){a=a.substring(0,a.length-1)}a=a.replace(":","");this._model.setTextCriteria(a);this._controller.submit()},_doEnterPressed:function(){this._handleSubmit()}});OpenHousePageController=Class.create();Object.extend(OpenHousePageController.prototype,PageController.prototype);Object.extend(OpenHousePageController.prototype,{initialize:function(a){PageController.prototype.initialize.call(this,a)},CONTROLLER_NAME:"openhouses",_getPageNavigationURL:function(){return"/openhouses/list.rails"},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this)},_filterModelsUsed:function(){var a=PageController.prototype._filterModelsUsed.call(this);a[FilterKey.SUBREGION]=new SubRegionFilterModel();return a}});DevelopmentIdFilterModel=Class.create();Object.extend(DevelopmentIdFilterModel.prototype,IdFilterModel.prototype);Object.extend(DevelopmentIdFilterModel.prototype,{initialize:function(){IdFilterModel.prototype.initialize.call(this,"developmentId","_developmentId");this.constructor=DevelopmentIdFilterModel}});DevelopmentIdFilterModel.scoop=function(a){return IdFilterModel.scoop(a,new DevelopmentIdFilterModel())};DevelopmentDetailController=Class.create();Object.extend(DevelopmentDetailController.prototype,DetailPageController.prototype);Object.extend(DevelopmentDetailController.prototype,{CONTROLLER_NAME:"developmentdetail",initialize:function(a){this._developmentId=a.developmentId;this._developmentAddressId=a.developmentAddressId;this._onBoardZipCode=a.onBoardZipCode;this._countController=null;DetailPageController.prototype.initialize.call(this,a)},_createCountController:function(a){},_filterModelsUsed:function(){var b={};var a=new DevelopmentIdFilterModel();a.setIdCriteria(this._developmentId);b[FilterKey.DEVELOPMENT_ID]=a;return b},getDevelopmentId:function(){return this._developmentId},getOnBoardZipCode:function(){return this._onBoardZipCode},getDevelopmentAddressId:function(){return this._developmentAddressId},_handleAdditionalInfoTabLoad:function(){if(this._isMapTabActive()){showMapForProperty("/map/drawmap.rails?address="+this.getDevelopmentAddressId())}else{if(this._isLocalInformationTabActive()){showLocalInformation(this.getOnBoardZipCode())}}},_getPageNavigationURL:function(){if(this._isDevelopmentListingsActive()){return"/sales/list.rails"}},_isDevelopmentListingsActive:function(){return($("currentListingsLI")&&$("currentListingsLI").className.indexOf("selected")!=-1)},_isMapTabActive:function(){return($("mapLI")&&$("mapLI").className.indexOf("selected")!=-1)},_isLocalInformationTabActive:function(){return($("localInformationLI")&&$("localInformationLI").className.indexOf("selected")!=-1)},createDetailPageURL:function(a){return regionRoot+"/developments/"+a},onInitialPageLoad:function(){PageController.prototype.onInitialPageLoad.call(this);this.updateSearchResults();this._handleAdditionalInfoTabLoad()}});SaveSearchPanel=Class.create();Object.extend(SaveSearchPanel.prototype,{initialize:function(a){this._emailAddressId="SearchEmailAddress";this._emailErrorMessageId="InvalidEmailErrors";this._serverErrorMessageId="ServerErrors";this._nameId="SearchName";this._nameErrorMessageId="InvalidSearchNameErrors";this._saveSearchPanelId="saveSearchPanelId";this._validatedMessageId="saveSearchPanelValidatedId";this._searchNameValidatedMessageId="searchNameValidatedDisplayId";this._searchModel=a;this._emailValidator=new EmailAddressValidator($(this._emailAddressId),this._emailValidationFailed.bind(this),this._emailValidationPassed.bind(this))},_emailValidationPassed:function(a){this._hideErrorMessage(this._emailErrorMessageId);createCookie("userEmail",a)},_emailValidationFailed:function(a){this._showErrorMessage(this._emailErrorMessageId)},isValidName:function(a){a=a.strip();return/^[0-9|a-z|A-Z]/.test(a)},validateEmailAddress:function(){return this._emailValidator.validate()},validateName:function(){if(this.isValidName($(this._nameId).value)){return this._hideErrorMessage(this._nameErrorMessageId)}return this._showErrorMessage(this._nameErrorMessageId)},validate:function(){this._hideErrorMessage(this._serverErrorMessageId);var a=this.validateEmailAddress();a=this.validateName()&&a;if(a){$(this._searchNameValidatedMessageId).innerHTML=$(this._nameId).value}return a},_hideErrorMessage:function(a){Element.hide($(a));return true},_showErrorMessage:function(a,b){Element.show($(a));if(b){Element.update(a,b)}return false},bindEvents:function(){Event.observe("SaveSearchSaveButton","click",this.handleSaveButtonClicked.bindAsEventListener(this))},handleSaveButtonClicked:function(a){Event.stop(a);if(this.validate()){this.saveSearch($("SearchName").value.strip(),$("SearchEmailAddress").value.strip(),DataSerializer.serialize(this._searchModel.dump()),getPageController().getLinkBackToThisPage())}return false},saveSearch:function(c,a,b,d){new Ajax.Request(siteRoot+"savesearch/save.rails",{method:"post",onSuccess:this.saveComplete.bind(this),parameters:{name:c,email:a,jsonString:b,searchUrl:d}})},saveComplete:function(a){if(a.responseText.match(/<success\/>/)){this.saveSuccessful()}else{this.saveFailed(a.responseText)}},saveSuccessful:function(){Element.hide($(this._saveSearchPanelId));Element.show($(this._validatedMessageId));$(this._searchNameValidatedMessageId).update($(this._nameId).value.escapeHTML())},saveFailed:function(a){return this._showErrorMessage(this._serverErrorMessageId,a)}});SaveSearchPanel.Create=function(){new SaveSearchPanel(getPageController().getSearchOptionsModel()).bindEvents()};WebRegionModel=Class.create();Object.extend(WebRegionModel.prototype,FilterModel.prototype);Object.extend(WebRegionModel.prototype,{initialize:function(a){FilterModel.prototype.initialize.call(this,"WebRegion");this.constructor=WebRegionModel;this._regionName=this._parseRegionName(a)},_parseRegionName:function(a){return a?a.substring(1):"corporate"},dump:function(){dumpArray={};dumpArray._regionName=this._regionName;return dumpArray},equals:function(a){return a._regionName==this._regionName},isEmpty:function(){return false},clear:function(){},getRegionName:function(){return this._regionName}});WebRegionModel.scoop=function(a){return Object.extend(new WebRegionModel(),a)};var ajaxCount=0;var progressChicken=new ProgressChicken();var ratesAndAvailabilityPanel=null;var _pageController;var PageControllerClasses={agents:AgentController,sales:SearchController,rental:RentalController,offices:OfficeController,openhouses:OpenHousePageController,equestrian:EquestrianPageController,agentdetail:AgentDetailController,officedetail:OfficeDetailController,areas:AreaController,developments:DevelopmentController,areadetail:NeighborhoodDetailController,propertydetail:PropertyDetailController,salesdetail:SalesDetailController,rentaldetail:RentalDetailController,welcome:WelcomeController,rentalwelcome:RentalWelcomeController,location:WelcomeController,openhousedetail:OpenHouseDetailController,equestriandetail:EquestrianDetailController,developmentdetail:DevelopmentDetailController,teamdetail:TeamDetailController,_default:SearchController};function printHTML(){var a=0;for(var a=0;a<document.all.length-1;a++){document.getElementById("output").value=a.innerHTML}}function removeLandingPageStyles(){if(isLandingPageVisible()){Element.removeClassName($("body"),"welcome");Element.removeClassName($("body"),"rentalwelcome");if($("OpenHouses")){$("OpenHouses").hide()}if($("NewDevelopments")){$("NewDevelopments").hide()}if($("interactiveBook")){$("interactiveBook").hide()}if($("LetUsSearch")){$("LetUsSearch").hide()}if($("mortgageServicesButton")){$("mortgageServicesButton").hide()}if($("updateOptionsButton")){$("updateOptionsButton").hide()}if($("AboutOurAgents")){$("AboutOurAgents").hide()}if($("regionMapArea")){$("regionMapArea").hide()}if($("landingPageArea")){$("landingPageArea").hide()}Element.setStyle($("toolbar"),{display:"block"});if($("sidebar")){$("sidebar").addClassName("refineSearch")}if($("chooseLocations")){$("chooseLocations").addClassName("chooseLocationsNoMap");$("chooseLocations").removeClassName("chooseLocations")}swapFiltersDiv("SwapDiv","frame");prepareAllWidgets()}}function handleWindowOnLoad(b,e,f){moveChangeLocationDropIfPresent();bindNavigationWidget();var d=$("searchModelInput").value;PageController.addConstructorParam("searchModel",d);var a=PageControllerClasses[b]||PageControllerClasses._default;_pageController=new a(PageController.getConstructorParams());for(var c=0;c<PageController.getPageCreatedCallbacks().length;c++){PageController.getPageCreatedCallbacks()[c](_pageController)}_pageController.onInitialPageLoad();bindGlassPaneForOptionsPane();prepareAllWidgets();prepareWebTrends();if(b!="agents"){setSearchOptionButtonsState("YES");if($("mlsLink")){$j("#mlsLink").attr("checked",false)}}}function moveChangeLocationDropIfPresent(){var a=$("changeLocationHolder");var b=$("changeLocationTempHolder");if(a&&b){a.innerHTML=b.innerHTML}}function bindNavigationWidget(){registerDropDownEvents("findPropertiesLink","findPropertiesDrop");registerDropDownEvents("changeLocationLink","changeLocationDrop");registerDropDownEvents("findAgentsLink","findAgentsDrop");registerDropDownEvents("aboutusheaderlink","aboutUsDrop");registerDropDownEvents("aboutTheAreaLink","aboutTheAreaDrop")}function bindGlassPaneForOptionsPane(){Event.observe(document.body,"click",hideOptionsPaneOnClick)}function hideOptionsPaneOnClick(b){var c=$("filter");if(c&&c.style.visibility=="visible"){var a=Event.element(b);if(a.innerHTML.indexOf("Modify Search")!=-1){return}while(a!=document.body&&a!=null){if(Element.hasClassName(a,"activated")||a.id=="filter"){return}a=a.parentNode}searchOptionInfoClose()}}function clearSortFields(){$("sir_result_sort_by").value="";$("sir_result_sort_direction").value=""}function prepareWebTrends(){if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).scan(WebTrendsAnalyzer.INITIAL_RULES)}}function prepareWebTrendsForEmail(){if(document.getElementsByTagName("FORM").length>0&&typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).scan(WebTrendsAnalyzer.CreateRulesForEmail())}}function createClass(a){return new Function("return"+a)()}function loadResults(b,k,a,f){if(!getPageController()){setTimeout(loadResults.bind(window,b,k,a),10);return}var e=null;if(k){var j=null;j=createClass(k);e=SearchOptionsModel.scoop(j,getPageController());if(a){getPageController().setCountString(a)}if(!e.equals(getPageController().getSearchOptionsModel())){getPageController().setSearchOptionsModel(e);prepareAllWidgets()}}if(f&&isLandingPageVisible()){var g=$("pageHeaderContainer");if(g){Element.show(g);g.innerHTML=f}}progressChicken.stop(true);clearSplashImageFromSearchOptionInfoDiv();switchToResultCSSClass();$("searchResults").innerHTML=b;Element.show($("searchResults"));for(var d in getPageController()._filterModelsUsed()){var c=getSearchOptionsModel().getFilterModel(d);c.notifyChange()}(window.onLoadResultsCallback||new Function())()}function getPageController(){return _pageController}function getSearchOptionsModel(){return getPageController().getSearchOptionsModel()}function showSearchOption(a,c){if(!getPageController()){setTimeout(showSearchOption.bind(window,a,c),10);return}c=c.toLowerCase().replace("/","");var b=FilterViewFactory.getHeaderElement(c);if(b&&b.className.indexOf("activated")==-1){showSearchOptionInfoDiv(c);switchToResultsView(a)}}function getSearchUrl(a){return regionRoot+"/"+getSearchOptionsModel().getSearchType()+"/"+a+".rails"}function showSearchOptionInfoDiv(c){if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionForFilterOptionType(regionRoot,c))}if(c==FilterKey.LOCATION||c==FilterKey.CAT_BASED_LOCATION){var a=getSearchOptionsModel().getFilterModel(FilterKey.LOCATION);if(!this.getPageController().showLocationTree()){return}if(a.isQuickSearch()){c=FilterKey.LOCATION}}var b={searchType:c,searchModel:DataSerializer.serialize(getSearchOptionsModel().dump())};updateSearchOptionPane(getSearchUrl(c),b,c)}function clearLinkBelowFilters(){if($("automatedUpdateOptionsDiv")){Element.hide($("automatedUpdateOptionsDiv"))}if($("otherNetworkLocationsDiv")){Element.hide($("otherNetworkLocationsDiv"))}}var SEARCH_OPTIONS_PANE_CACHE={};function clearSearchOptionsPaneCache(){SEARCH_OPTIONS_PANE_CACHE={}}function cacheSearchOptionsPane(a){SEARCH_OPTIONS_PANE_CACHE[a]=$("filter")}function isNotInCache(a){if(a&&a.searchType){return typeof SEARCH_OPTIONS_PANE_CACHE[a.searchType]=="undefined"}return true}function updateSearchOptionPane(c,a,b){if($("filter")){prepareFilterForRemoval();$("searchOptionInfoDiv").removeChild($("filter"))}if(isNotInCache(a)){showFilterWaitingMessage(b);putOptionPaneIntoCache(c,a||{})}else{restoreSearchOptionsPaneFromCache(a)}Element.show($("searchOptionInfoDiv"))}function putOptionPaneIntoCache(b,a){makeAjaxUpdater("searchOptionInfoDiv",b,function(c){clearSearchOptionInfoDiv();if(typeof a!="undefined"){if(typeof a.widgetClass!="undefined"){a.widgetClass.Create()}if(typeof a.webtrendsrules!="undefined"&&typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).scan(a.webtrendsrules)}}if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).scan(WebTrendsAnalyzer.CreateRulesForOptionPane(a.searchType))}if(a&&a.searchType){bindSearchOptionsPaneWidgets(a.searchType.toLowerCase());cacheSearchOptionsPane(a.searchType);positionSearchOptionsPane(a.searchType.toLowerCase());hideFilterWaitingMessage()}},a)}function hideFilterWaitingMessage(){$("filterWaitingMessage").style.visibility="hidden"}function showFilterWaitingMessage(a){$("filterWaitingMessage").style.visibility="";positionSearchOptionsPane(a,true,"filterWaitingMessage")}function restoreSearchOptionsPaneFromCache(a){$("searchOptionInfoDiv").appendChild(SEARCH_OPTIONS_PANE_CACHE[a.searchType]);positionSearchOptionsPane(a.searchType.toLowerCase(),true);fixCheckboxesInFilter()}function bindSearchOptionsPaneWidgets(b){var a=getSearchOptionsModel().getFilterModel(b);SearchOptionsPanelFactory.create(b,a)}function prepareFilterForRemoval(){if($("filter")){var c=$("filter").getElementsByTagName("INPUT");$("filter").style.left="";var a=[];for(var b=0;b<c.length;b++){if(c[b].type=="checkbox"&&c[b].checked){c[b]._oldChecked=true}}}}function fixCheckboxesInFilter(){if($("filter")){var c=$("filter").getElementsByTagName("INPUT");var a=[];for(var b=0;b<c.length;b++){if(c[b].type=="checkbox"&&typeof c[b]._oldChecked=="boolean"){c[b].checked=c[b]._oldChecked;c[b]._oldChecked=false}}}}function positionSearchOptionsPane(c,d,a){var a=a||"filter";var b=$(c+"DT");var j=$(a);if(!b){if(c=="location"){d=false;b=$("categorybasedlocationDT")}}var e=Position.cumulativeOffset(b);var f=e[1];var k=Position.cumulativeOffset($("content"))[1];var g=f-k;g+=1;j.style.top=g+"px";j.style.visibility="visible"}function handleResetClicked(){if(getSearchOptionsModel().isEmpty()==false){getSearchOptionsModel().clear();if(!isLandingPageVisible()){submitSearch()}clearSearchOptionsPaneCache()}}function showSaveSearchResultInfoDiv(){var a=[];if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.INITIATE_SAVE_SEARCH_ACTION);a=WebTrendsAnalyzer.DYNAMIC_SAVE_SEARCH_RULES}makeAjaxUpdater("watchThisPanel",regionRoot+"/savesearch/panel.rails",function(b){SaveSearchPanel.Create();(new WebTrendsAnalyzer()).scan(a);Element.show($("watchThisPanel"));setTimeout(function(){$("SearchName").focus()},0)})}function clearSearchOptionInfoDiv(){Element.show($("searchOptionInfoDiv"))}function switchToResultsView(b,a){getPageController().switchToResultsView(b)}function switchToResultCSSClass(){getPageController().updateViewToResults()}function resetMinValueCombo(){var c=new Select("MaxDropDownList");var d=new Select("MinDropDownList");var b=c.getSelectionIndex();if(b<=0){b=c.getCount()-1}for(var a=0;a<=b;a++){d.getOptionAt(a).disabled=false}for(var a=b+1;a<c.getCount();a++){d.getOptionAt(a).disabled=true}if(d.getSelectionIndex()>c.getSelectionIndex()){d.setSelectionIndex(c.getSelectionIndex())}}function updateResultsAndTotalForPrice(j){var b=$("MaxDropDownList");var f=b.selectedIndex;var d=$("MinDropDownList");var g=d.selectedIndex;var c=d.options[g];var a=b.options[f];var e;if(!j||j=="sales"){e=getSearchOptionsModel().getFilterModel(FilterKey.PRICE)}else{e=getSearchOptionsModel().getFilterModel(FilterKey.RATES_AND_AVAILABILITY)}e.setMinPrice(c.value,c.innerHTML);e.setMaxPrice(a.value,a.innerHTML);sendWebTrends("price")}function updateResultsAndTotalForBedAndBath(selectElement,ddElementName,criteriaType,criteriaValue,setterToCall){!setterToCall||eval("getSearchOptionsModel().getFilterModel(FilterKey.BED_BATH)."+setterToCall+"(selectElement.value, selectElement.options[selectElement.selectedIndex].text)")}function updateResultsAndTotalForInteriorSizeLotSize(selectElement,ddElementName,criteriaType,criteriaValue,setterToCall){!setterToCall||eval("getSearchOptionsModel().getFilterModel(FilterKey.INTERIOR_SIZE_LOT_SIZE)."+setterToCall+"(selectElement.value, selectElement.options[selectElement.selectedIndex].text)");if(window.PopularFeatureLotSizeSelectChange){PopularFeatureLotSizeSelectChange()}}function searchOptionInfoClose(){removeSearchOptionHighlighting();if($("searchOptionInfoDiv")){Element.hide($("searchOptionInfoDiv"))}}function watchThisClose(){Element.hide($("watchThisPanel"))}function removeSearchOptionHighlighting(){removeClassNameForChildrenWithinAParentTag("searchOptions","dt","activated");removeClassNameForChildrenWithinAParentTag("searchOptions","dt","activatedFirst");removeClassNameForChildrenWithinAParentTag("searchOptions","dd","activated")}function nextResultNumber(){return Math.round(10000*Math.random())}function makeAjaxUpdater(a,b,d,e){progressChicken.start();var c=new Ajax.Updater(a,b,{on200:function(f){if(f.responseText.match(/errorUrl/)){window.location.href=baseUrl+"/GenericError.htm"}},onComplete:function(f){progressChicken.stop();if(d){d(f)}},evalScripts:true,parameters:e||{}});return c}function prepareAllWidgets(){if($("searchOptions")){prepareAllViewsForModel(getSearchOptionsModel())}}function prepareAllViewsForModel(c){var b=c.getFilterModelKeys();for(var a=0;a<b.length;a++){if(FilterViewFactory.getHeaderElement(b[a])){FilterViewFactory.create(b[a],c)}}}function moveSearchOptionInfoDivUnderContent(){var a=$("searchOptionInfoDiv");a.parentNode.removeChild(a);$("content").appendChild(a);if($("filter")){$("filter").style.left=""}}function swapFiltersDiv(a,b){if($(a)&&$(b)){var c=$(a).innerHTML;$(a).innerHTML=$(b).innerHTML;$(b).innerHTML=c}}function backToHome(){if(!getPageController()){setTimeout(backToHome.bind(window),10);return}var a=getPageController();if(a.CONTROLLER_NAME=="offices"){return}if(a.CONTROLLER_NAME=="rental"&&!isShowLandingPage()){if($("content")&&document.body.className.indexOf("welcome")==-1&&!isLandingPageVisible()&&!$("body").hasClassName("rent")){Element.addClassName($("body"),"rentalwelcome");Element.removeClassName($("content"),"resultsList");Element.addClassName($("searchResults"),"rentalLanding");getSearchOptionsModel().clear();swapFiltersDiv("frame","SwapDiv")}}if($("searchResults")&&a._initialResults&&!isStringBlank(a._initialResults)){if($("searchResults").innerHTML!=a._initialResults){$("searchResults").innerHTML=a._initialResults;if(a._initialModel){a.setSearchOptionsModel(a._scoopSearchOptionsModel(a._initialModel));clearSearchOptionsPaneCache();prepareAllWidgets()}}}if(isShowLandingPage()&&!isResultsOnlyPageExists()&&window.location.pathname.indexOf("quicksearch")==-1){$("content").className="content landingPageContent";if(a.CONTROLLER_NAME=="rental"){Element.addClassName($("body"),"rentalwelcome");Element.addClassName($("searchResults"),"rentalLanding");if($("searchResults")&&isNewRegionLayoutExists()){Element.hide("searchResults")}else{Element.removeClassName($("content"),"landingPageContent")}}else{Element.addClassName($("body"),"welcome");if($("searchResults")){Element.hide("searchResults")}}if($("OpenHouses")){$("OpenHouses").show()}if($("NewDevelopments")){$("NewDevelopments").show()}if($("interactiveBook")){$("interactiveBook").show()}if($("LetUsSearch")){$("LetUsSearch").show()}if($("mortgageServicesButton")){$("mortgageServicesButton").show()}if($("updateOptionsButton")){$("updateOptionsButton").show()}if($("AboutOurAgents")){$("AboutOurAgents").show()}if($("regionMapArea")){$("regionMapArea").show();if($("landingPageArea")){$("landingPageArea").show()}if($("featuredPropertySlider")){$("featuredPropertySlider").show()}}if($("toolbar")){$("toolbar").hide()}if($("sidebar")){$("sidebar").removeClassName("refineSearch")}if($("chooseLocations")){$("chooseLocations").removeClassName("chooseLocationsNoMap");$("chooseLocations").addClassName("chooseLocations")}removeClassNameForChildrenWithinAParentTag("searchOptions","dt","activated");if(rootExpandedView){rootExpandedView.hide()}var b=$("pageHeaderContainer");if(b){Element.hide(b)}var f=$("secondarySearchTabsDiv");if(f){f.className="secondaryTabs empty"}var e=$("secondarySearchTabs");if(e){Element.hide(e)}$("findPropertiesLink").className="";if($("findPropertiesDownArrow")){Element.show($("findPropertiesDownArrow"))}if($("searchOptionsSubmitButton")){setSearchOptionButtonsState("YES","YES");if($j("#regionMapArea").length){$j(".map").maphilight()}}swapFiltersDiv("frame","SwapDiv");if($("searchOptionInfoDiv")){var d=$("searchOptionInfoDiv");d.parentNode.removeChild(d);$("sidebar").appendChild(d);moveSearchOptionInfoDivUnderContent();prepareAllWidgets()}var c=null;c=createClass($("searchModelInput").value);newSearchModel=SearchOptionsModel.scoop(c,getPageController());a.setSearchOptionsModel(SearchOptionsModel.scoop(c,getPageController()))}}function isResultsOnlyPageExists(){if(window.isResultsOnlyPage){return true}return false}function isNewRegionLayoutExists(){if(window.isNewRegionLayout){return true}return false}function isStringBlank(a){return/^\s*$/.test(a)}function isShowLandingPage(){return !(document.location.href.indexOf("404.aspx")>-1)&&$("content")&&document.body.className.indexOf("welcome")==-1&&!isLandingPageVisible()&&!isAboutUsOfficesPage()&&!isAreasPage()}function isAboutUsOfficesPage(){return document.location.href.indexOf("aboutus/officedirectory.rails")>-1}function isAreasPage(){return document.location.href.indexOf("agents/Real-Estate-Agents-")>-1}function isLandingPageVisible(){return getPageController().isLandingPageVisible()}function clearSplashImageFromSearchOptionInfoDiv(){var a=$("searchOptionInfoDiv");var b=document.getElementsByClassName("color2",a);if(b.length>0){a.innerHTML=""}clearLinkBelowFilters()}function showFloorPlanImages(a){removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("floorPlanLI"),"selected");new Ajax.Updater("tabDetailDiv",siteRoot+"/property/FloorPlanImages.rails?listingnumber="+a,{asynchronous:true,evalScripts:true,onComplete:function(b){setTimeout("Element.scrollTo($('floorPlanLI'));",100)}})}function showMapForProperty(a){if($("searchResults")){Element.hide($("searchResults"))}Element.show($("tabDetailDiv"));removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("mapLI"),"selected");$("tabDetailDiv").innerHTML='<iframe class="map" style="width: 550px; height: 550px;padding:0px;" frameborder="0"src="'+a+'"></iframe>';setTimeout("Element.scrollTo($('mapLI'));",100)}function showLocalInformation(a){removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("localInformationLI"),"selected");new Ajax.Updater("tabDetailDiv",siteRoot+"/property/localinfo.rails?onBoardZipCode="+a,{onComplete:function(b){setTimeout("Element.scrollTo($('localInformationLI'));",100);showAmenities(a)}})}function showAmenities(a){Element.show($("tabDetailDiv"));if($("searchResults")){Element.hide($("searchResults"))}removeClassNameForChildrenWithinAParentTag("localInformationUL","li","selected");Element.addClassName($("amenitiesLI"),"selected");new Ajax.Updater("localInformationContent",siteRoot+"/property/amenities.rails?zipcode="+a,{onComplete:function(b){setTimeout("Element.scrollTo($('tabDetailDiv'));",100)}})}function showCommunityProfile(a){removeClassNameForChildrenWithinAParentTag("localInformationUL","li","selected");Element.addClassName($("communityProfileLI"),"selected");new Ajax.Updater("localInformationContent",siteRoot+"/property/communityprofile.rails?zipcode="+a)}function showSchools(a){removeClassNameForChildrenWithinAParentTag("localInformationUL","li","selected");Element.addClassName($("schoolsLI"),"selected");new Ajax.Updater("localInformationContent",siteRoot+"/property/schooldistricts.rails?zipcode="+a)}function showDistricts(a){removeClassNameForChildrenWithinAParentTag("localInformationUL","li","selected");Element.addClassName($("districtsLI"),"selected");new Ajax.Updater("localInformationContent",siteRoot+"/property/districts.rails?zipcode="+a)}function showHomeSales(a){removeClassNameForChildrenWithinAParentTag("localInformationUL","li","selected");Element.addClassName($("homeSalesLI"),"selected");new Ajax.Updater("localInformationContent",siteRoot+"/property/homesales.rails?zipcode="+a)}function showFeatures(a){removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("featureLI"),"selected");new Ajax.Updater("tabDetailDiv",siteRoot+"/property/Features.rails?listingId="+a,{})}function showListingsTab(){clearSortFields();if($("tabDetailDiv")){Element.hide($("tabDetailDiv"))}removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("currentListingsLI"),"selected");getPageController().updateSearchResults()}function showRentalsTab(){clearSortFields();removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("currentRentalsLI"),"selected");getPageController().updateSearchResults()}function showSelectSalesTab(){clearSortFields();removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("selectSalesLI"),"selected");getPageController().updateSearchResults()}function showOfficeDirections(a){removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("officeDirectionsLI"),"selected");new Ajax.Updater("searchResults",siteRoot+"/offices/directions.rails?officeId="+a,{})}function showOfficeAgentRoster(a){clearSortFields();removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("agentRoster"),"selected");gotoPage(1)}function showSalesTeamTab(a){clearSortFields();removeClassNameForChildrenWithinAParentTag("additionalInfoUL","li","selected");Element.addClassName($("salesTeamLI"),"selected");new Ajax.Updater("searchResults",siteRoot+"/teams/summary/"+a,{})}function removeClassNameForChildrenWithinAParentTag(j,a,c,b){additionalInfoULElement=$(j);if(additionalInfoULElement){var f=additionalInfoULElement.getElementsByTagName(a);for(var e=0;e<f.length;e++){var g=f[e];if(b&&g.id.length>0){var d=$(g.id.replace(/DT/,"DD"));if(d.style.display==""){Element.addClassName(g,b)}}Element.removeClassName(g,c)}}}function changeSortOrder(a){createCookie("priceOrder",a);getPageController().goToPage(1)}function changeResultSort(a,b){$("sir_result_sort_by").value=a;$("sir_result_sort_direction").value=b;gotoPageTop(1)}function addInteriorSizeSession(a){createCookie("interiorSize",a);$("selectedInteriorSize").selectedIndex=0;getSearchOptionsModel().getFilterModel(FilterKey.INTERIOR_SIZE_LOT_SIZE).resetInteriorSize()}function changeRentalPeriod(a){createCookie("rentalPeriodChoice",a)}function changeRentalPeriodCheckBox(a){}function addLotSizeSession(a){createCookie("lotSize",a);$("selectedLotSize").selectedIndex=0;getSearchOptionsModel().getFilterModel(FilterKey.INTERIOR_SIZE_LOT_SIZE).resetLotSize()}function createCookie(b,c){var a=new Date();a.setDate(a.getDate()+30);document.cookie=b+"="+c+";expires="+a.toGMTString()+"; path=/"}function moveToASearchResultsPage(a,b){getPageController().goToPage(a)}function filterByLocation(a,c){var b;if(Element.hasClassName(a,"checked")){Element.replaceClassName(a,"checked","cleared");b="false"}else{Element.replaceClassName(a,"cleared","checked");b="true"}new Ajax.Request(getSearchUrl("addcriteria")+"?type=includelocation&treeId="+c+"&checked="+b,{})}function filterByCheckbox(c,d,a){var b=getSearchOptionsModel().getFilterModel(c);if(c=="waterfrontwaterview"){handleWaterFrontWaterViewClick(d,a)}if(window.handleParkingClick){handleParkingClick(d,a)}if(b){if(d){b.addCheckBox(a)}else{b.removeCheckBox(a)}}if(window.HandleFireplaceAndGarageDropDownDisabling){if($j("#"+a.getId()+"_featuresandamenities_checkbox")&&$j("#"+a.getId()+"_featuresandamenities_checkbox").attr("name")=="Fireplaces"){HandleFireplaceAndGarageDropDownDisabling("Fireplaces","Fireplacesdropdown")}if($j("#"+a.getId()+"_featuresandamenities_checkbox")&&$j("#"+a.getId()+"_featuresandamenities_checkbox").attr("name")=="Garages"){HandleFireplaceAndGarageDropDownDisabling("Garages","Garagesdropdown")}if($j("#"+a.getId()+"_garages_checkbox")&&$j("#"+a.getId()+"_garages_checkbox").attr("name")=="Garages"){HandleFireplaceAndGarageDropDownDisabling("Garages","Garagesdropdown");ManageGarageSectionOnClick(a.getId())}}}function RenderLineOfBusiness(d,b,a){var c=siteRoot+"/property/amenitiesbylineofbusiness.rails?zipCode="+d+"&lineOfBusiness="+b;RenderSubLocalInfo(c,a,b)}function RenderSchoolDistrict(c,a){var b=siteRoot+"/property/schoolsbydistrict.rails?schoolDistrictNo="+c;RenderSubLocalInfo(b,a,c)}function RenderPrivateSchools(c,a){var b=siteRoot+"/property/privateschoolsbyzipcode.rails?zipCode="+c;RenderSubLocalInfo(b,a,"privateschools")}function RenderSubLocalInfo(b,c,a){if($(c).hasClassName("expand")){Element.replaceClassName(c,"expand","collapse");new Ajax.Updater(a,b,{onComplete:function(d){Element.show($(a));setTimeout("Element.scrollTo($('"+a+"'));",1000)}})}else{Element.replaceClassName(c,"collapse","expand");Element.hide($(a))}}function gotoPage(a){getPageController().goToPage(a)}function gotoPageTop(a){gotoPage(a)}function moveToLocation(a,b){url=getSearchUrl(a);if(b){url=url+"?webRegionId="+b}new Ajax.Request(url)}function disableAndSwitchToRegion(g,e,f,j){var d=getSearchOptionsModel().getFilterModel(FilterKey.LOCATION);d.disableQuickSearch();var b;var k=d.getRootLocationNode();if(f!=j){var a=k.children();for(var c=0;c<a.length;c++){if(a[c].locationId==f){b=a[c];b.setState(CheckBoxState.Checked)}}k.setState(CheckBoxState.Partial);d.nodeToggled(b)}d.notifyChange()}function enableLocationCriteria(b){var a=getSearchOptionsModel().getFilterModel(FilterKey.LOCATION);a.enableQuickSearch();var c=a.getRootLocationNode();c.setState(CheckBoxState.UnChecked);a.notifyChange()}function enableCorporateLocation(c){var a=getSearchOptionsModel().getFilterModel(FilterKey.LOCATION);a.disableQuickSearch();var b=a.getCorporateNode();b.setState(CheckBoxState.UnChecked);a.nodeToggled(b);a.notifyChange()}function onLocationComponentClicked(a){showLocationOption("locationDiv0",a,0,this);clearSearchOptionInfoDiv();switchToResultsView($("locationDT"))}function paginateToDetailPage(a,b){getPageController().resultsLinkClicked(a.href,b);return false}function filterByDropDown(a){if(typeof a._select=="undefined"){a._select=new Select(a.id)}var b=a._select.getSelection().value;if(a.name=="Fireplaces"){getPageController().getSearchOptionsModel().getFilterModel(FilterKey.FEATURES_AND_AMENITIES).setMinFireplaces(b)}else{if(a.name=="Garages"){getPageController().getSearchOptionsModel().getFilterModel(FilterKey.FEATURES_AND_AMENITIES).setMinGarageBays(b);getPageController().getSearchOptionsModel().getFilterModel(FilterKey.GARAGES).setMinGarageBays(b)}}}function fixAreaDetailSlideshowImage(a){a=$(a);if(a.getDimensions().width>408){var c=a.parentNode;var b=document.createElement("IMG");b.src=a.src;b.alt=a.alt;b.title=a.title;b.width=408;Event.observe(b,"load",fixAreaDetailSlideshowImageHeightForIE.bind(window,b));a.parentNode.appendChild(b);a.parentNode.removeChild(a);fixAreaDetailSlideshowImageHeightForIE(b)}}function fixAreaDetailSlideshowImageHeightForIE(b){b=$(b);var a=b.getDimensions().height;if(a>308){b.height=308}}function iFrameHeight(){if(document.getElementById&&!(document.all)){h=document.getElementById("idxframe").contentDocument.body.scrollHeight;document.getElementById("idxframe").style.height=h}else{if(document.all){h=document.frames("idxframe").document.body.scrollHeight;document.all.idxframe.style.height=h}}}function agentSubmitSearch(){$("letterFromForm").value="";getPageController().onSubmitHook();submitSearch();ClearAlphabetFilterSelected()}function submitSearch(){if($("searchOptionsSubmitButton")){$j("#searchOptionsSubmitButton").attr("class","refreshSearchButton")}if($("searchHasSearchedBeforeToggleValue")){if($("searchHasSearchedBeforeToggleValue").value!="show"){$("searchHasSearchedBeforeToggleValue").value="show";if($("extraSearchButtons")){$("extraSearchButtons").show()}}}if($("searchOptionsToggle")){hideSearchOptionsDivIfNothingSelected()}window.onLoadResultsCallback=searchOptionInfoClose;getPageController().getResultsUpdater().onChange();_gaq.push(["_trackPageview"]);if($("searchOptionsSubmitButton")){setSearchOptionButtonsState("YES")}else{syncAmenityWithFilter()}}function submitSearchWithoutClose(){window.onLoadResultsCallback=new Function();getPageController().getResultsUpdater().onChange()}function resetCriteria(a){delete SEARCH_OPTIONS_PANE_CACHE[a];getSearchOptionsModel().getFilterModel(a).clear();if(!isLandingPageVisible()){submitSearchWithoutClose()}showSearchOptionInfoDiv(a)}function changeItemsPerPage(c){children=$("items_per_page").getElementsByTagName("a");for(var b=0;b<children.length;b++){var a=children[b].id;$(a).removeClassName("selected")}$(c+"_per_page").addClassName("selected");$("searchModelItemsPerPageInput").value=c;gotoPageTop(1)}function refreshQuickSearchResultsPerPage(a){$("searchModelItemsPerPageInput").value=a;$("searchModelPageInput").value="1";refreshQuickSearchResults()}function refreshQuickSearchPage(a){$("searchModelPageInput").value=a;refreshQuickSearchResults()}function refreshQuickSearchSort(b,a){$("sir_result_sort_by").value=b;$("sir_result_sort_direction").value=a;$("searchModelPageInput").value=1;refreshQuickSearchResults()}function refreshQuickSearchResults(){new Ajax.Updater("searchResults","/quicksearch/refreshresults.rails",{parameters:{resultsPerPage:$("searchModelItemsPerPageInput").value,currentPageNumber:$("searchModelPageInput").value,currentSortType:$("sir_result_sort_by").value,currentSortDirection:$("sir_result_sort_direction").value,resultType:quickSearchType,region:quickSearchRegion,searchTerm:quickSearchTerm}})}function ClearAlphabetFilterSelected(){if($("alphabetFilter")){var a=$("alphabetFilter").getElementsByClassName("selected");$A(a).each(function(b){Element.removeClassName(b,"selected")})}}function navToClickHandler(b){var a=$(b).selectedIndex;window.location=Element.readAttribute($(b).options[a],"navto")}function toggleMoreLessSearchOptions(){if($("searchOptionsToggle")){if($("searchOptionsToggle").hasClassName("fewerOptions")){$("searchOptionsToggle").removeClassName("fewerOptions");$("searchOptionsToggle").addClassName("moreOptions");$("searchOptionsToggle").innerHTML="more search options";$("hideableSearchOptions").hide();showSearchOptionsMessage()}else{$("searchOptionsToggle").removeClassName("moreOptions");$("searchOptionsToggle").addClassName("fewerOptions");$("searchOptionsToggle").innerHTML="fewer search options";$("hideableSearchOptions").show();$("searchOptionsMessage").hide()}}}function showSearchOptionsMessage(){if($("searchOptionsMessage")){var a=moreSearchOptionsHasSomethingSelected();if(a){$("searchOptionsMessage").show()}else{$("searchOptionsMessage").hide()}}}function hideSearchOptionsDivIfNothingSelected(){var a=moreSearchOptionsHasSomethingSelected();if(!a&&$("searchOptionsToggle").hasClassName("fewerOptions")){toggleMoreLessSearchOptions()}else{if(a&&$("searchOptionsToggle").hasClassName("moreOptions")){toggleMoreLessSearchOptions()}}}function moreSearchOptionsHasSomethingSelected(){var a=false;$j("#hideableSearchOptions INPUT[type='checkbox']").each(function(b){if($j(this).attr("checked")==true){a=true;return false}});if(($j("#selectedLotSize").length!=0&&$j("#selectedLotSize").val()!="gt_0")||($j("#selectedInteriorSize").length!=0&&$j("#selectedInteriorSize").val()!="gt_0")){a=true}return a}function isAnythingSelectedInSidebar(){var a=false;$j("#filter INPUT[type='checkbox']").each(function(b){if($j(this).attr("checked")==true){a=true;return false}});if($j("#priceRange").text()!="No Minimum - No Maximum"){a=true}if($j("#bedroomCriteria_NumberOfBedrooms").val()!=-1||$j("#bathroomCriteria_BathroomCount").val()!=0||$j("#selectedLotSize").val()!="gt_0"||$j("#selectedInteriorSize").val()!="gt_0"||$j("#MinDropDownList").val()!="0"||$j("#MaxDropDownList").val()!="100000000"){a=true}return a}function setupResetButton(){if($("extraSearchButtons")){if(isAnythingSelectedInSidebar()==true){$("resetAllButtonNonFunctioning").hide();$("resetAllSearchButton").show()}else{$("resetAllButtonNonFunctioning").show();$("resetAllSearchButton").hide()}}}function setupLandingReset(){if($("resetAllSearchButtonLanding")){if($("extraSearchButtons")&&$("extraSearchButtons").getStyle("display")!="none"){$("resetAllSearchButtonLanding").hide();$("resetAllButtonLandingNonFunctioning").hide()}else{if(isAnythingSelectedInSidebar()==true){$("resetAllButtonLandingNonFunctioning").hide();$("resetAllSearchButtonLanding").show()}else{$("resetAllButtonLandingNonFunctioning").show();$("resetAllSearchButtonLanding").hide()}}}}function setSearchOptionButtonsState(a,b){setupLandingReset();setupResetButton();if($("searchOptionsSubmitButton")&&!$("searchOptionsSubmitButton").hasClassName("searchButton")){if(a&&a=="YES"){$("searchOptionsSubmitButton").hide();$("searchButtonNonFunctioning").show()}else{$("searchOptionsSubmitButton").show();$("searchButtonNonFunctioning").hide()}}if(b&&b=="YES"){$("searchHasSearchedBeforeToggleValue").value="";$("extraSearchButtons").hide();if(isAnythingSelectedInSidebar()==true){$("resetAllSearchButtonLanding").show()}else{$("resetAllButtonLandingNonFunctioning").show()}$("searchOptionsSubmitButton").show();$("searchButtonNonFunctioning").hide();switchSubmitButtonClassBackToHome()}syncAmenityWithFilter()}function switchSubmitButtonClass(){$j("#searchOptionsSubmitButton").removeClass("searchButton").addClass("refreshSearchButton")}function switchSubmitButtonClassBackToHome(){$j("#searchOptionsSubmitButton").removeClass("refreshSearchButton").addClass("searchButton")}function sendWebTrends(c){var b="/";var a=new RegExp(b,"g");c=c.toLowerCase().replace(a,"").replace(/ /g,"");if(typeof WebTrendsAnalyzer=="function"){(new WebTrendsAnalyzer()).fireWebTrendAction(WebTrendsAnalyzer.CreateActionForFilterOptionType(regionRoot,c))}}function syncAmenityWithFilter(){if(getPageController()){$("searchModelInput").value=DataSerializer.serialize(getPageController().getSearchOptionsModel().dump())}}function showHideLocationBarLinks(a,b){if(b&&b=="norcal"){if(a&&a=="show"){$("norCalHeaderLinks").show()}else{$("norCalHeaderLinks").hide()}}else{if(b&&b=="socal"){if(a&&a=="show"){$("soCalHeaderLinks").show()}else{$("soCalHeaderLinks").hide()}}else{if(b&&b=="nyc"){if(a&&a=="show"){$("nycHeaderLinks").show()}else{$("nycHeaderLinks").hide()}}}}}function blockPage(){$j.blockUI({message:$j("#loadingDisk"),css:{top:($j(window).height()-400)/2+"px",left:($j(window).width()-300)/2+"px",height:"100px",width:"300px",padding:"35px 0 0 0",backgroundColor:"#FFF","-webkit-border-radius":"10px","-moz-border-radius":"10px",opacity:0.9,color:"#fff"}})}function isIPadOrIPhoneOrAndroid(){var a=navigator.userAgent.toLowerCase();var e=(a.indexOf("series60")!=-1)||(a.indexOf("symbian")!=-1)||(a.indexOf("windows ce")!=-1)||(a.indexOf("blackberry")!=-1);var d=typeof orientation!="undefined"?true:false;var f=("ontouchstart" in document.documentElement)?true:false;var c=(navigator.platform.indexOf("iPhone")!=-1)||(navigator.platform.indexOf("iPad")!=-1)?true:false;var b=(a.indexOf("android")!=-1)||(!c&&!e&&f&&d)?true:false;return c||b}function isOlderSafari(){if(BrowserDetect.browser=="Safari"&&BrowserDetect.version>0&&BrowserDetect.version<=419.3){return true}return false}function isNewerSafari(){if(BrowserDetect.browser=="Safari"&&BrowserDetect.version>0&&BrowserDetect.version>419.3){return true}return false}function isFireFox2(){if(BrowserDetect.browser=="Firefox"&&BrowserDetect.version==2){return true}return false}function isFireFox3(){if(BrowserDetect.browser=="Firefox"&&BrowserDetect.version==3){return true}return false}function isIE7(){if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==7){return true}return false}function isIE6(){if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){return true}return false}function isIE8(){var b=navigator.userAgent.toLowerCase();var c=(b.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1];var a=/msie/.test(b)&&!/opera/.test(b);return a&&c==8}function isIE9(){var b=navigator.userAgent.toLowerCase();var c=(b.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1];var a=/msie/.test(b)&&!/opera/.test(b);return a&&c==9}function isChrome(){if(BrowserDetect.browser=="Chrome"){return true}return false}SAFARI={};SAFARI={};WINDOW={};MINUSONE={};SAFARI.positionSearchOptionsPane=function(b,c,a){WINDOW.positionSearchOptionsPane(b,c,a);var a=a||"filter";var d=$(a);var f=new String(d.style.top);var e=Number(f.substr(0,f.indexOf("px")));d.style.top=(e-1)+"px"};MINUSONE.positionSearchOptionsPane=function(b,c,a){WINDOW.positionSearchOptionsPane(b,c,a);var a=a||"filter";var d=$(a);var f=new String(d.style.top);var e=Number(f.substr(0,f.indexOf("px")));d.style.top=(e-1)+"px"};SAFARI.findPos=function(a){var b=WINDOW.findPos(a);if(a.id=="locationParentNode"){curtop+=SAFARI.topDifference();curleft+=20}return b};SAFARI.topDifference=function(a){return 174};BrowserDetect.init();if(isOlderSafari()||isNewerSafari()||isChrome()){WINDOW.positionSearchOptionsPane=positionSearchOptionsPane;positionSearchOptionsPane=SAFARI.positionSearchOptionsPane;WINDOW.findPos=findPos;findPos=SAFARI.findPos}if(isFireFox3()){WINDOW.positionSearchOptionsPane=positionSearchOptionsPane;positionSearchOptionsPane=MINUSONE.positionSearchOptionsPane}if(isIE6()){var forceupgrade=true;var doccookies=document.cookie;if(doccookies.length>1){var allcookies=doccookies.split(";");for(var i=0;i<allcookies.length;i++){if(allcookies[i].split("=")[0].indexOf("useIE6")!=-1&&allcookies[i].split("=")[1]=="true"){forceupgrade=false}}}if(forceupgrade==true){if(window.location.toString().indexOf("home-upgradebrowser.html")==-1){window.location=window.location.protocol+"//"+window.location.host+"/home-upgradebrowser.html?loc="+window.location.toString().replace(/\//g,"_").replace(".rails","_rails")}}}function ExpandSelectSold(b,a){var c="/selectsalesexpanded/Expanded.rails?listingId="+b;ToggleSecondRow(c,a,b)}function ToggleSecondRow(d,e,c){var a="selectSoldDetails"+c;var b=c+"_hiddenRow";if($(e).hasClassName("expand")){Element.replaceClassName(e,"expand","collapse");new Ajax.Updater(a,d,{onComplete:function(f){Element.show($(b))}})}else{Element.replaceClassName(e,"collapse","expand");Element.hide($(b))}};
