var Prototype={Version:"1.6.0.3",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div")["__proto__"]&&document.createElement("div")["__proto__"]!==document.createElement("form")["__proto__"]},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var B=null,C=$A(arguments);if(Object.isFunction(C[0])){B=C.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=B;A.subclasses=[];if(B){var E=function(){};E.prototype=B.prototype;A.prototype=new E;B.subclasses.push(A)}for(var D=0;D<C.length;D++){A.addMethods(C[D])}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(B){var E=this.superclass&&this.superclass.prototype;var D=Object.keys(B);if(!Object.keys({toString:true}).length){D.push("toString","valueOf")}for(var F=0,C=D.length;F<C;F++){var A=D[F],G=B[A];if(E&&Object.isFunction(G)&&G.argumentNames().first()=="$super"){var H=G;G=(function(I){return function(){return E[I].apply(this,arguments)}})(A).wrap(H);G.valueOf=H.valueOf.bind(H);G.toString=H.toString.bind(H)}this.prototype[A]=G}return this}};var Abstract={};Object.extend=function(C,B){for(var A in B){C[A]=B[A]}return C};Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"}if(A===null){return"null"}return A.inspect?A.inspect():String(A)}catch(B){if(B instanceof RangeError){return"..."}throw B}},toJSON:function(C){var D=typeof C;switch(D){case"undefined":case"function":case"unknown":return;case"boolean":return C.toString()}if(C===null){return"null"}if(C.toJSON){return C.toJSON()}if(Object.isElement(C)){return}var B=[];for(var A in C){var E=Object.toJSON(C[A]);if(!Object.isUndefined(E)){B.push(A.toJSON()+": "+E)}}return"{"+B.join(", ")+"}"},toQueryString:function(A){return $H(A).toQueryString()},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)},keys:function(B){var C=[];for(var A in B){C.push(A)}return C},values:function(B){var C=[];for(var A in B){C.push(B[A])}return C},clone:function(A){return Object.extend({},A)},isElement:function(A){return !!(A&&A.nodeType==1)},isArray:function(A){return A!=null&&typeof A=="object"&&"splice" in A&&"join" in A},isHash:function(A){return A instanceof Hash},isFunction:function(A){return typeof A=="function"},isString:function(A){return typeof A=="string"},isNumber:function(A){return typeof A=="number"},isUndefined:function(A){return typeof A=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return A.length==1&&!A[0]?[]:A},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var C=this,A=$A(arguments),B=A.shift();return function(){return C.apply(B,A.concat($A(arguments)))}},bindAsEventListener:function(){var C=this,A=$A(arguments),B=A.shift();return function(D){return C.apply(B,[D||window.event].concat(A))}},curry:function(){if(!arguments.length){return this}var B=this,A=$A(arguments);return function(){return B.apply(this,A.concat($A(arguments)))}},delay:function(){var C=this,B=$A(arguments),A=B.shift()*1000;return window.setTimeout(function(){return C.apply(C,B)},A)},defer:function(){var A=[0.01].concat($A(arguments));return this.delay.apply(this,A)},wrap:function(B){var A=this;return function(){return B.apply(this,[A.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var A=this;return this._methodized=function(){return A.apply(null,[this].concat($A(arguments)))}}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){var B;for(var C=0,A=arguments.length;C<A;C++){var D=arguments[C];try{B=D();break}catch(E){}}return B}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({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)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}finally{this.currentlyExecuting=false}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(B,D){var E="",A=this,C;D=arguments.callee.prepareReplacement(D);while(A.length>0){if(C=A.match(B)){E+=A.slice(0,C.index);E+=String.interpret(D(C));A=A.slice(C.index+C[0].length)}else{E+=A,A=""}}return E},sub:function(A,B,C){B=this.gsub.prepareReplacement(B);C=Object.isUndefined(C)?1:C;return this.gsub(A,function(D){if(--C<0){return D[0]}return B(D)})},scan:function(A,B){this.gsub(A,B);return String(this)},truncate:function(A,B){A=A||30;B=Object.isUndefined(B)?"...":B;return this.length>A?this.slice(0,A-B.length)+B:String(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 B=new RegExp(Prototype.ScriptFragment,"img");var A=new RegExp(Prototype.ScriptFragment,"im");return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var A=arguments.callee;A.text.data=this;return A.div.innerHTML},unescapeHTML:function(){var A=new Element("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(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());var D=F.length>1?F.join("="):F[0];if(D!=undefined){D=decodeURIComponent(D)}if(C in E){if(!Object.isArray(E[C])){E[C]=[E[C]]}E[C].push(D)}else{E[C]=D}}return E})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(A){return A<1?"":new Array(A+1).join(this)},camelize:function(){var D=this.split("-"),A=D.length;if(A==1){return D[0]}var B=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var C=1;C<A;C++){B+=D[C].charAt(0).toUpperCase()+D[C].substring(1)}return B},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.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16)});if(B){return'"'+A.replace(/"/g,'\\"')+'"'}return"'"+A.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}")},isJSON:function(){var A=this;if(A.blank()){return false}A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(A){return this.indexOf(A)>-1},startsWith:function(A){return this.indexOf(A)===0},endsWith:function(A){var B=this.length-A.length;return B>=0&&this.lastIndexOf(A)===B},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(B,A){return new Template(this,A).evaluate(B)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(B){if(Object.isFunction(B)){return B}var A=new Template(B);return function(C){return A.evaluate(C)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(B,A){this.template=B.toString();this.pattern=A||Template.Pattern},evaluate:function(A){if(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(F){if(A==null){return""}var C=F[1]||"";if(C=="\\"){return F[2]}var D=A,G=F[3];var B=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;F=B.exec(G);if(F==null){return C}while(F!=null){var E=F[1].startsWith("[")?F[2].gsub("\\\\]","]"):F[1];D=D[E];if(null==D||""==F[3]){break}G=G.substring("["==F[3]?F[1].length:F[0].length);F=B.exec(G)}return C+String.interpret(D)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this},eachSlice:function(A,D,C){var B=-A,E=[],F=this.toArray();if(A<1){return F}while((B+=A)<F.length){E.push(F.slice(B,B+A))}return E.collect(D,C)},all:function(B,A){B=B||Prototype.K;var C=true;this.each(function(E,D){C=C&&!!B.call(A,E,D);if(!C){throw $break}});return C},any:function(B,A){B=B||Prototype.K;var C=false;this.each(function(E,D){if(C=!!B.call(A,E,D)){throw $break}});return C},collect:function(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A},detect:function(B,A){var C;this.each(function(E,D){if(B.call(A,E,D)){C=E;throw $break}});return C},findAll:function(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A},grep:function(A,D,C){D=D||Prototype.K;var B=[];if(Object.isString(A)){A=new RegExp(A)}this.each(function(F,E){if(A.match(F)){B.push(D.call(C,F,E))}});return B},include:function(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B},inGroupsOf:function(A,B){B=Object.isUndefined(B)?null:B;return this.eachSlice(A,function(C){while(C.length<A){C.push(B)}return C})},inject:function(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A},invoke:function(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})},max:function(B,A){B=B||Prototype.K;var C;this.each(function(E,D){E=B.call(A,E,D);if(C==null||E>=C){C=E}});return C},min:function(B,A){B=B||Prototype.K;var C;this.each(function(E,D){E=B.call(A,E,D);if(C==null||E<C){C=E}});return C},partition:function(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]},pluck:function(A){var B=[];this.each(function(C){B.push(C[A])});return B},reject:function(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A},sortBy:function(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.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,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var A=C.length||0,B=new Array(A);while(A--){B[A]=C[A]}return B}if(Prototype.Browser.WebKit){$A=function(C){if(!C){return[]}if(!(typeof C==="function"&&typeof C.length==="number"&&typeof C.item==="function")&&C.toArray){return C.toArray()}var A=C.length||0,B=new Array(A);while(A--){B[A]=C[A]}return B}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(C){for(var B=0,A=this.length;B<A;B++){C(this[B])}},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(B,A){return B.concat(Object.isArray(A)?A.flatten():[A])})},without:function(){var A=$A(arguments);return this.select(function(B){return !A.include(B)})},reverse:function(A){return(A!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)}return D})},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var A=[];this.each(function(B){var C=Object.toJSON(B);if(!Object.isUndefined(C)){A.push(C)}});return"["+A.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,B){B||(B=0);var A=this.length;if(B<0){B=A+B}for(;B<A;B++){if(this[B]===C){return B}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1}}Array.prototype.toArray=Array.prototype.clone;function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];for(var C=0,A=this.length;C<A;C++){E.push(this[C])}for(var C=0,A=arguments.length;C<A;C++){if(Object.isArray(arguments[C])){for(var B=0,D=arguments[C].length;B<D;B++){E.push(arguments[C][B])}}else{E.push(arguments[C])}}return E}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(B,A){$R(0,this,true).each(B,A);return this},toPaddedString:function(A,C){var B=this.toString(C||10);return"0".times(A-B.length)+B},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(A){Number.prototype[A]=Math[A].methodize()});function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function A(B,C){if(Object.isUndefined(C)){return B}return B+"="+encodeURIComponent(String.interpret(C))}return{initialize:function(B){this._object=Object.isHash(B)?B.toObject():Object.clone(B)},_each:function(C){for(var B in this._object){var D=this._object[B],E=[B,D];E.key=B;E.value=D;C(E)}},set:function(B,C){return this._object[B]=C},get:function(B){if(this._object[B]!==Object.prototype[B]){return this._object[B]}},unset:function(B){var C=this._object[B];delete this._object[B];return C},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(C){var B=this.detect(function(D){return D.value===C});return B&&B.key},merge:function(B){return this.clone().update(B)},update:function(B){return new Hash(B).inject(this,function(C,D){C.set(D.key,D.value);return C})},toQueryString:function(){return this.inject([],function(C,E){var B=encodeURIComponent(E.key),D=E.value;if(D&&typeof D=="object"){if(Object.isArray(D)){return C.concat(D.map(A.curry(B)))}}else{C.push(A(B,D))}return C}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(B){return B.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{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(C,B,D,A){this.each(function(E){if(Object.isFunction(E[C])){try{E[C].apply(E,[B,D,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,A,B){$super(B);this.transport=Ajax.getTransport();this.request(A)},request:function(A){this.url=A;this.method=this.options.method;var D=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){D._method=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}try{var B=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(B)}Ajax.Responders.dispatch("onCreate",this,B);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["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){E.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var B=this.options.requestHeaders;if(Object.isFunction(B.push)){for(var D=0,A=B.length;D<A;D+=2){E[B[D]]=B[D+1]}}else{$H(B).each(function(F){E[F.key]=F.value})}}for(var C in E){this.transport.setRequestHeader(C,E[C])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)},getStatus:function(){try{return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(E){this.dispatchException(E)}var D=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&D&&D.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(E){this.dispatchException(E)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,C,A,B){this.container={success:(C.success||C),failure:(C.failure||(C.success?null:C))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(F,E){this.updateContent(F.responseText);if(Object.isFunction(D)){D(F,E)}}).bind(this);$super(A,B)},updateContent:function(D){var B=this.container[this.success()?"success":"failure"],C=this.options;if(!C.evalScripts){D=D.stripScripts()}if(B=$(B)){if(C.insertion){if(Object.isString(C.insertion)){var A={};A[C.insertion]=D;B.insert(A)}else{C.insertion(B,D)}}else{B.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,C,A,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=C;this.url=A;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=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(C){if(arguments.length>1){for(var D=0,A=[],B=arguments.length;D<B;D++){A.push($(arguments[D]))}return A}if(Object.isString(C)){C=document.getElementById(C)}return Element.extend(C)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,D){var C=[];var E=document.evaluate(F,$(D)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,A=E.snapshotLength;B<A;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var A=this.Element;this.Element=function(D,C){C=C||{};D=D.toLowerCase();var B=Element.cache;if(Prototype.Browser.IE&&C.name){D="<"+D+' name="'+C.name+'">';delete C.name;return Element.writeAttribute(document.createElement(D),C)}if(!B[D]){B[D]=Element.extend(document.createElement(D))}return Element.writeAttribute(B[D].cloneNode(false),C)};Object.extend(this.Element,A||{});if(A){this.Element.prototype=A.prototype}}).call(window);Element.cache={};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=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:function(A,B){A=$(A);if(B&&B.toElement){B=B.toElement()}if(Object.isElement(B)){return A.update().insert(B)}B=Object.toHTML(B);A.innerHTML=B.stripScripts();B.evalScripts.bind(B).defer();return A},replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(D,F){D=$(D);if(Object.isString(F)||Object.isNumber(F)||Object.isElement(F)||(F&&(F.toElement||F.toHTML))){F={bottom:F}}var E,B,C,G;for(var A in F){E=F[A];A=A.toLowerCase();B=Element._insertionTranslations[A];if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){B(D,E);continue}E=Object.toHTML(E);C=((A=="before"||A=="after")?D.parentNode:D).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(C,E.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(B.curry(D));E.evalScripts.bind(E).defer()}return D},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(A){A=$(A);var B="<"+A.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(F){var C=F.first(),D=F.last();var E=(A[C]||"").toString();if(E){B+=" "+D+"="+E.inspect(true)}});return B+">"},recursivelyCollect:function(C,B){C=$(C);var A=[];while(C=C[B]){if(C.nodeType==1){A.push(Element.extend(C))}}return A},ancestors:function(A){return $(A).recursivelyCollect("parentNode")},descendants:function(A){return $(A).select("*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},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(B,A){if(Object.isString(A)){A=new Selector(A)}return A.match($(B))},up:function(C,D,B){C=$(C);if(arguments.length==1){return $(C.parentNode)}var A=C.ancestors();return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},down:function(B,C,A){B=$(B);if(arguments.length==1){return B.firstDescendant()}return Object.isNumber(C)?B.descendants()[C]:Element.select(B,C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=B.previousSiblings();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(B))}var C=B.nextSiblings();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},select:function(){var B=$A(arguments),A=$(B.shift());return Selector.findChildElements(A,B)},adjacent:function(){var B=$A(arguments),A=$(B.shift());return Selector.findChildElements(A.parentNode,B).without(A)},identify:function(B){B=$(B);var C=B.readAttribute("id"),A=arguments.callee;if(C){return C}do{C="anonymous_element_"+A.counter++}while($(C));B.writeAttribute("id",C);return C},readAttribute:function(B,A){B=$(B);if(Prototype.Browser.IE){var C=Element._attributeTranslations.read;if(C.values[A]){return C.values[A](B,A)}if(C.names[A]){A=C.names[A]}if(A.include(":")){return(!B.attributes||!B.attributes[A])?null:B.attributes[A].value}}return B.getAttribute(A)},writeAttribute:function(D,C,F){D=$(D);var B={},E=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=E.names[A]||A;F=B[A];if(E.values[A]){C=E.values[A](D,F)}if(F===false||F===null){D.removeAttribute(C)}else{if(F===true){D.setAttribute(C,C)}else{D.setAttribute(C,F)}}}return D},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;return(C.length>0&&(C==A||new RegExp("(^|\\s)"+A+"(\\s|$)").test(C)))},addClassName:function(B,A){if(!(B=$(B))){return}if(!B.hasClassName(A)){B.className+=(B.className?" ":"")+A}return B},removeClassName:function(B,A){if(!(B=$(B))){return}B.className=B.className.replace(new RegExp("(^|\\s+)"+A+"(\\s+|$)")," ").strip();return B},toggleClassName:function(B,A){if(!(B=$(B))){return}return B[B.hasClassName(A)?"removeClassName":"addClassName"](A)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=A.cumulativeOffset();window.scrollTo(B[0],B[1]);return A},getStyle:function(A,C){A=$(A);C=C=="float"?"cssFloat":C.camelize();var D=A.style[C];if(!D||D=="auto"){var B=document.defaultView.getComputedStyle(A,null);D=B?B[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(E,C){E=$(E);var B=E.style,D;if(Object.isString(C)){E.style.cssText+=";"+C;return C.include("opacity")?E.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):E}for(var A in C){if(A=="opacity"){E.setOpacity(C[A])}else{B[(A=="float"||A=="cssFloat")?(Object.isUndefined(B.styleFloat)?"cssFloat":"styleFloat"):A]=C[A]}}return E},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(C){C=$(C);var G=C.getStyle("display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var E=C.style;var A=E.visibility;var B=E.position;var D=E.display;E.visibility="hidden";E.position="absolute";E.display="block";var H=C.clientWidth;var F=C.clientHeight;E.display=D;E.position=B;E.visibility=A;return{width:H,height:F}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.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=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="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},cumulativeOffset:function(A){var B=0,C=0;do{B+=A.offsetTop||0;C+=A.offsetLeft||0;A=A.offsetParent}while(A);return Element._returnOffset(C,B)},positionedOffset:function(A){var B=0,D=0;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;A=A.offsetParent;if(A){if(A.tagName.toUpperCase()=="BODY"){break}var C=Element.getStyle(A,"position");if(C!=="static"){break}}}while(A);return Element._returnOffset(D,B)},absolutize:function(B){B=$(B);if(B.getStyle("position")=="absolute"){return B}var A=B.positionedOffset();var F=A[1];var E=A[0];var C=B.clientWidth;var D=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=D+"px";return B},relativize:function(A){A=$(A);if(A.getStyle("position")=="relative"){return A}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;return A},cumulativeScrollOffset:function(A){var B=0,C=0;do{B+=A.scrollTop||0;C+=A.scrollLeft||0;A=A.parentNode}while(A);return Element._returnOffset(C,B)},getOffsetParent: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)},viewportOffset:function(C){var B=0,D=0;var A=C;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;if(A.offsetParent==document.body&&Element.getStyle(A,"position")=="absolute"){break}}while(A=A.offsetParent);A=C;do{if(!Prototype.Browser.Opera||(A.tagName&&(A.tagName.toUpperCase()=="BODY"))){B-=A.scrollTop||0;D-=A.scrollLeft||0}}while(A=A.parentNode);return Element._returnOffset(D,B)},clonePosition:function(C,A){var D=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});A=$(A);var E=A.viewportOffset();C=$(C);var F=[0,0];var B=null;if(Element.getStyle(C,"position")=="absolute"){B=C.getOffsetParent();F=B.viewportOffset()}if(B==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(D.setLeft){C.style.left=(E[0]-F[0]+D.offsetLeft)+"px"}if(D.setTop){C.style.top=(E[1]-F[1]+D.offsetTop)+"px"}if(D.setWidth){C.style.width=A.offsetWidth+"px"}if(D.setHeight){C.style.height=A.offsetHeight+"px"}return C}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(A,C,D){switch(D){case"left":case"top":case"right":case"bottom":if(A(C,"position")==="static"){return null}case"height":case"width":if(!Element.visible(C)){return null}var E=parseInt(A(C,D),10);if(E!==C["offset"+D.capitalize()]){return E+"px"}var B;if(D==="height"){B=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{B=["border-left-width","padding-left","padding-right","border-right-width"]}return B.inject(E,function(G,F){var H=A(C,F);return H===null?G:G-parseInt(H,10)})+"px";default:return A(C,D)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(A,B,C){if(C==="title"){return B.title}return A(B,C)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(B,C){C=$(C);try{C.offsetParent}catch(E){return $(document.body)}var A=C.getStyle("position");if(A!=="static"){return B(C)}C.setStyle({position:"relative"});var D=B(C);C.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(C,D){D=$(D);try{D.offsetParent}catch(G){return Element._returnOffset(0,0)}var B=D.getStyle("position");if(B!=="static"){return C(D)}var E=D.getOffsetParent();if(E&&E.getStyle("position")==="fixed"){E.setStyle({zoom:1})}D.setStyle({position:"relative"});var F=C(D);D.setStyle({position:B});return F})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(A,B){try{B.offsetParent}catch(C){return Element._returnOffset(0,0)}return A(B)});Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(C,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}C=$(C);var B=C.currentStyle;if((B&&!B.hasLayout)||(!B&&C.style.zoom=="normal")){C.style.zoom=1}var A=C.getStyle("filter"),D=C.style;if(E==1||E===""){(A=F(A))?D.filter=A:D.removeAttribute("filter");return C}else{if(E<0.00001){E=0}}D.filter=F(A)+"alpha(opacity="+(E*100)+")";return C};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)},_getAttrNode:function(A,C){var B=A.getAttributeNode(C);return B?B.value:""},_getEv:function(A,B){B=A.getAttribute(B);return B?B.toString().slice(23,-2):null},_flag:function(A,B){return $(A).hasAttribute(B)?B:null},style:function(A){return A.style.cssText.toLowerCase()},title:function(A){return A.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr,src:A._getAttr,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values)}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A};Element.Methods.cumulativeOffset=function(A){var B=0,C=0;do{B+=A.offsetTop||0;C+=A.offsetLeft||0;if(A.offsetParent==document.body){if(Element.getStyle(A,"position")=="absolute"){break}}A=A.offsetParent}while(A);return Element._returnOffset(C,B)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}if(Object.isElement(C)){return B.update().insert(C)}C=Object.toHTML(C);var A=B.tagName.toUpperCase();if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(D){B.removeChild(D)});Element._getContentFromAnonymousElement(A,C.stripScripts()).each(function(D){B.appendChild(D)})}else{B.innerHTML=C.stripScripts()}C.evalScripts.bind(C).defer();return B}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(E,F){E=$(E);if(F&&F.toElement){F=F.toElement()}if(Object.isElement(F)){E.parentNode.replaceChild(F,E);return E}F=Object.toHTML(F);var C=E.parentNode,D=C.tagName.toUpperCase();if(Element._insertionTranslations.tags[D]){var B=E.next();var A=Element._getContentFromAnonymousElement(D,F.stripScripts());C.removeChild(E);if(B){A.each(function(G){C.insertBefore(G,B)})}else{A.each(function(G){C.appendChild(G)})}}else{E.outerHTML=F.stripScripts()}F.evalScripts.bind(F).defer();return E}}Element._returnOffset=function(A,B){var C=[A,B];C.left=A;C.top=B;return C};Element._getContentFromAnonymousElement=function(A,C){var D=new Element("div"),B=Element._insertionTranslations.tags[A];if(B){D.innerHTML=B[0]+C+B[1];B[2].times(function(){D=D.firstChild})}else{D.innerHTML=C}return $A(D.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div")["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div")["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var B={},A=Element.Methods.ByTag;var C=Object.extend(function(G){if(!G||G._extendedByPrototype||G.nodeType!=1||G==window){return G}var E=Object.clone(B),F=G.tagName.toUpperCase(),D,H;if(A[F]){Object.extend(E,A[F])}for(D in E){H=E[D];if(Object.isFunction(H)&&!(D in G)){G[D]=H.methodize()}}G._extendedByPrototype=Prototype.emptyFunction;return G},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(B,Element.Methods);Object.extend(B,Element.Methods.Simulated)}}});C.refresh();return C})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var I=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var G=C;C=arguments[1]}if(!G){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(G)){G.each(A)}else{A(G)}}function A(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function B(K,N,M){M=M||false;for(var F in K){var L=K[F];if(!Object.isFunction(L)){continue}if(!M||!(F in N)){N[F]=L.methodize()}}}function E(K){var F;var L={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(L[K]){F="HTML"+L[K]+"Element"}if(window[F]){return window[F]}F="HTML"+K+"Element";if(window[F]){return window[F]}F="HTML"+K.capitalize()+"Element";if(window[F]){return window[F]}window[F]={};window[F].prototype=document.createElement(K)["__proto__"];return window[F]}if(I.ElementExtensions){B(Element.Methods,HTMLElement.prototype);B(Element.Methods.Simulated,HTMLElement.prototype,true)}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var H=E(J);if(Object.isUndefined(H)){continue}B(D[J],H.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var A={},C=Prototype.Browser;$w("width height").each(function(E){var B=E.capitalize();if(C.WebKit&&!document.evaluate){A[E]=self["inner"+B]}else{if(C.Opera&&parseFloat(window.opera.version())<9.5){A[E]=document.body["client"+B]}else{A[E]=document.documentElement["client"+B]}}});return A},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(A){this.expression=A.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var A=this.expression;if(Prototype.Browser.WebKit&&(A.include("-of-type")||A.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(A)){return false}return true},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(A){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;if(Selector._cache[E]){this.xpath=Selector._cache[E];return}this.matcher=[".//*"];while(E&&D!=E&&(/\S/).test(E)){D=E;for(var C in F){if(A=E.match(F[C])){this.matcher.push(Object.isFunction(B[C])?B[C](A):new Template(B[C]).evaluate(A));E=E.replace(A[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var C=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var D=A.id,E=$(A).identify();C="#"+E+" "+C}B=$A(A.querySelectorAll(C)).map(Element.extend);A.id=D;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(H){this.tokens=[];var L=this.expression,B=Selector.patterns,F=Selector.assertions;var A,D,E;while(L&&A!==L&&(/\S/).test(L)){A=L;for(var I in B){D=B[I];if(E=L.match(D)){if(F[I]){this.tokens.push([I,Object.clone(E)]);L=L.replace(E[0],"")}else{return this.findElements(document).include(H)}}}}var K=true,C,J;for(var I=0,G;G=this.tokens[I];I++){C=G[0],J=G[1];if(!Selector.assertions[C](H,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,C;var F=[];while(H&&E!=H&&(/\S/).test(H)){E=H;for(var D in G){if(B=H.match(G[D])){C=Object.isFunction(A[D])?A[D](B):new Template(A[D]).evaluate(B);F.push("("+C.substring(1,C.length-1)+")");H=H.replace(B[0],"");break}}}return"[not("+F.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(D,B){var G,F=B[6],E;if(F=="even"){F="2n+0"}if(F=="odd"){F="2n+1"}if(G=F.match(/^(\d+)$/)){return"["+D+"= "+G[1]+"]"}if(G=F.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(G[1]=="-"){G[1]=-1}var C=G[1]?Number(G[1]):1;var A=G[2]?Number(G[2]):0;E="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(E).evaluate({fragment:D,a:C,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:function(A){for(var B=0,C;C=A[B];B++){C._countedByPrototype=undefined}return A},index:function(F,C,G){F._countedByPrototype=Prototype.emptyFunction;if(C){for(var A=F.childNodes,D=A.length-1,B=1;D>=0;D--){var E=A[D];if(E.nodeType==1&&(!G||E._countedByPrototype)){E.nodeIndex=B++}}}else{for(var D=0,B=1,A=F.childNodes;E=A[D];D++){if(E.nodeType==1&&(!G||E._countedByPrototype)){E.nodeIndex=B++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(!(E=B[C])._countedByPrototype){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,F,G){var I=F.toUpperCase();var D=[],E=Selector.handlers;if(A){if(G){if(G=="descendant"){for(var C=0,B;B=A[C];C++){E.concat(D,B.getElementsByTagName(F))}return D}else{A=this[G](A)}if(F=="*"){return A}}for(var C=0,B;B=A[C];C++){if(B.tagName.toUpperCase()===I){D.push(B)}}return D}else{return H.getElementsByTagName(F)}},id:function(C,B,H,A){var G=$(H),E=Selector.handlers;if(!G){return[]}if(!C&&B==document){return[G]}if(C){if(A){if(A=="child"){for(var D=0,F;F=C[D];D++){if(G.parentNode==F){return[G]}}}else{if(A=="descendant"){for(var D=0,F;F=C[D];D++){if(Element.descendantOf(G,F)){return[G]}}}else{if(A=="adjacent"){for(var D=0,F;F=C[D];D++){if(Selector.handlers.previousElementSibling(G)==F){return[G]}}}else{C=E[A](C)}}}}for(var D=0,F;F=C[D];D++){if(F==G){return[G]}}return[]}return(G&&Element.descendantOf(G,B))?[G]:[]},className:function(D,B,C,A){if(D&&A){D=this[A](D)}return Selector.handlers.byClassName(D,B,C)},byClassName:function(C,A,B){if(!C){C=Selector.handlers.descendant([A])}var H=" "+B+" ";for(var E=0,D=[],G,F;G=C[E];E++){F=G.className;if(F.length==0){continue}if(F==B||(" "+F+" ").include(H)){D.push(G)}}return D},attrPresence:function(D,C,A,B){if(!D){D=C.getElementsByTagName("*")}if(D&&B){D=this[B](D)}var F=[];for(var E=0,G;G=D[E];E++){if(Element.hasAttribute(G,A)){F.push(G)}}return F},attr:function(A,I,H,J,G,F){if(!A){A=I.getElementsByTagName("*")}if(A&&F){A=this[F](A)}var K=Selector.operators[G],D=[];for(var C=0,B;B=A[C];C++){var E=Element.readAttribute(B,H);if(E===null){continue}if(K(E,J)){D.push(B)}}return D},pseudo:function(C,D,E,B,A){if(C&&A){C=this[A](C)}if(!C){C=B.getElementsByTagName("*")}return Selector.pseudos[D](C,E,B)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,B,N,L,K){if(A.length==0){return[]}if(B=="even"){B="2n+0"}if(B=="odd"){B="2n+1"}var J=Selector.handlers,I=[],C=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,L,K);C.push(D.parentNode)}}if(B.match(/^\d+$/)){B=Number(B);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==B){I.push(D)}}}else{if(E=B.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(C);return I},empty:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||E.firstChild){continue}C.push(E)}return C},not:function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},enabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled&&(!E.type||E.type!=="hidden")){C.push(E)}}return C},disabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},checked:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B==A||B&&B.startsWith(A)},"$=":function(B,A){return B==A||B&&B.endsWith(A)},"*=":function(B,A){return B==A||B&&B.include(A)},"$=":function(B,A){return B.endsWith(A)},"*=":function(B,A){return B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+(B||"").toUpperCase()+"-").include("-"+(A||"").toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(A,G){var F=$$(G),E=Selector.handlers;E.mark(F);for(var D=0,C=[],B;B=A[D];D++){if(B._countedByPrototype){C.push(B)}}E.unmark(F);return C},findElement:function(A,C,B){if(Object.isNumber(C)){B=C;C=false}return Selector.matchElements(A,C||"*")[B||0]},findChildElements:function(C,G){G=Selector.split(G.join(","));var E=[],F=Selector.handlers;for(var D=0,B=G.length,A;D<B;D++){A=new Selector(G[D].strip());F.concat(E,A.findElements(C))}return(B>1)?F.unique(E):E}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B},unmark:function(A){for(var B=0,C;C=A[B];B++){C.removeAttribute("_countedByPrototype")}return A}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){$(A).reset();return A},serializeElements:function(C,E){if(typeof E!="object"){E={hash:!!E}}else{if(Object.isUndefined(E.hash)){E.hash=true}}var D,G,B=false,A=E.submit;var F=C.inject({},function(I,H){if(!H.disabled&&H.name){D=H.name;G=$(H).getValue();if(G!=null&&H.type!="file"&&(H.type!="submit"||(!B&&A!==false&&(!A||D==A)&&(B=true)))){if(D in I){if(!Object.isArray(I[D])){I[D]=[I[D]]}I[D].push(G)}else{I[D]=G}}}return I});return E.hash?F:Object.toQueryString(F)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C))}return B})},getInputs:function(G,E,C){G=$(G);var F=G.getElementsByTagName("input");if(!E&&!C){return $A(F).map(Element.extend)}for(var D=0,H=[],A=F.length;D<A;D++){var B=F[D];if((E&&B.type!=E)||(C&&B.name!=C)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(C){var A=$(C).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var B=A.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return B?B:A.find(function(D){return["input","select","textarea"].include(D.tagName.toLowerCase())})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(C,B){C=$(C),B=Object.clone(B||{});var D=B.parameters,A=C.readAttribute("action")||"";if(A.blank()){A=window.location.href}B.parameters=C.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(B.parameters,D)}if(C.hasAttribute("method")&&!B.method){B.method=C.method}return new Ajax.Request(A,B)}};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 B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(B,F){if(Object.isUndefined(F)){return this[B.type=="select-one"?"selectOne":"selectMany"](B)}else{var D,E,G=!Object.isArray(F);for(var C=0,A=B.length;C<A;C++){D=B.options[C];E=this.optionValue(D);if(G){if(E==F){D.selected=true;return}}else{D.selected=F.include(E)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(B){var E,A=B.length;if(!A){return null}for(var D=0,E=[];D<A;D++){var C=B.options[D];if(C.selected){E.push(this.optionValue(C))}}return E},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,C,B){$super(B,C);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;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,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(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event={}}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,KEY_INSERT:45,cache:{},relatedTarget:function(B){var A;switch(B.type){case"mouseover":A=B.fromElement;break;case"mouseout":A=B.toElement;break;default:return null}return Element.extend(A)}});Event.Methods=(function(){var B;if(Prototype.Browser.IE){var A={0:1,1:4,2:2};B=function(D,C){return D.button==A[C]}}else{if(Prototype.Browser.WebKit){B=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;case 1:return D.which==1&&D.metaKey;default:return false}}}else{B=function(D,C){return D.which?(D.which===C+1):(D.button===C)}}}return{isLeftClick:function(C){return B(C,0)},isMiddleClick:function(C){return B(C,1)},isRightClick:function(C){return B(C,2)},element:function(E){E=Event.extend(E);var D=E.target,C=E.type,F=E.currentTarget;if(F&&F.tagName){if(C==="load"||C==="error"||(C==="click"&&F.tagName.toLowerCase()==="input"&&F.type==="radio")){D=F}}if(D.nodeType==Node.TEXT_NODE){D=D.parentNode}return Element.extend(D)},findElement:function(E,F){var D=Event.element(E);if(!F){return D}var C=[D].concat(D.ancestors());return Selector.findElement(C,F,0)},pointer:function(E){var D=document.documentElement,C=document.body||{scrollLeft:0,scrollTop:0};return{x:E.pageX||(E.clientX+(D.scrollLeft||C.scrollLeft)-(D.clientLeft||0)),y:E.pageY||(E.clientY+(D.scrollTop||C.scrollTop)-(D.clientTop||0))}},pointerX:function(C){return Event.pointer(C).x},pointerY:function(C){return Event.pointer(C).y},stop:function(C){Event.extend(C);C.preventDefault();C.stopPropagation();C.stopped=true}}})();Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,C){B[C]=Event.Methods[C].methodize();return B});if(Prototype.Browser.IE){Object.extend(A,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(B){if(!B){return false}if(B._extendedByPrototype){return B}B._extendedByPrototype=Prototype.emptyFunction;var C=Event.pointer(B);Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:C.x,pageY:C.y});return Object.extend(B,A)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")["__proto__"];Object.extend(Event.prototype,A);return Prototype.K}})();Object.extend(Event,(function(){var A=Event.cache;function D(J){if(J._prototypeEventID){return J._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return J._prototypeEventID=[++arguments.callee.id]}function E(J){if(J&&J.include(":")){return"dataavailable"}return J}function G(J){return A[J]=A[J]||{}}function F(L,J){var K=G(L);return K[J]=K[J]||[]}function I(K,J,L){var O=D(K);var N=F(O,J);if(N.pluck("handler").include(L)){return false}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false}Event.extend(P);L.call(K,P)};M.handler=L;N.push(M);return M}function H(M,J,K){var L=F(M,J);return L.find(function(N){return N.handler==K})}function B(M,J,K){var L=G(M);if(!L[J]){return false}L[J]=L[J].without(H(M,J,K))}function C(){for(var K in A){for(var J in A[K]){A[K][J]=null}}}if(window.attachEvent){window.attachEvent("onunload",C)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}return{observe:function(L,J,M){L=$(L);var K=E(J);var N=I(L,J,M);if(!N){return L}if(L.addEventListener){L.addEventListener(K,N,false)}else{L.attachEvent("on"+K,N)}return L},stopObserving:function(L,J,M){L=$(L);var O=D(L),K=E(J);if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)});return L}else{if(!J){Object.keys(G(O)).each(function(P){L.stopObserving(P)});return L}}var N=H(O,J,M);if(!N){return L}if(L.removeEventListener){L.removeEventListener(K,N,false)}else{L.detachEvent("on"+K,N)}B(O,J,M);return L},fire:function(L,K,J){L=$(L);if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",true,true)}else{M=document.createEventObject();M.eventType="ondataavailable"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return Event.extend(M)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var B;function A(){if(document.loaded){return}if(B){window.clearInterval(B)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){B=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()}},0);Event.observe(window,"load",A)}else{document.addEventListener("DOMContentLoaded",A,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;A()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(A,B){return Element.insert(A,{before:B})},Top:function(A,B){return Element.insert(A,{top:B})},Bottom:function(A,B){return Element.insert(A,{bottom:B})},After:function(A,B){return Element.insert(A,{after:B})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');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},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=Element.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=Element.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.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}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();return Element.absolutize(A)},relativize:function(A){Position.prepare();return Element.relativize(A)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(A,C,B){B=B||{};return Element.clonePosition(C,A,B)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(D,C){C=C.toString().strip();var E=/\s/.test(C)?$w(C).map(A).join(""):A(C);return E?document._getElementsByXPath(".//*"+E,D):[]}:function(F,E){E=E.toString().strip();var C=[],H=(/\s/.test(E)?$w(E):null);if(!H&&!E){return C}var D=$(F).getElementsByTagName("*");E=" "+E+" ";for(var G=0,J,I;J=D[G];G++){if(J.className&&(I=" "+J.className+" ")&&(I.include(E)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){C.push(Element.extend(J))}}return C};return function(C,D){return $(D||document.body).getElementsByClassName(C)}}(Element.Methods)}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);Element.addMethods();Element.exception=undefined;if(Prototype.Browser.IE&&/MSIE\s8\.0/.test(navigator.userAgent)){Element.addMethods({readAttribute:function(B,A){B=$(B);return B.getAttribute(A)}});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}}}Element.addMethods({getElementsByTagAndClass:function(C,A){var B=arguments[0];var C=arguments[1];var A=arguments[2];var D=B.getElementsByTagName(C);return $A(D).inject([],function(F,E){if(E.className.match(new RegExp("(^|\\s)"+A+"(\\s|$)"))){F.push(Element.extend(E))}return F})},getNthElementByClassName:function(){if(arguments.length<3){return Element.exception}var D=arguments[0];var B=arguments[1];var A=parseInt(arguments[2]);var C=(arguments[3]?arguments[3]:"*");if(isNaN(A)){return Element.exception}var F=$A((D||document.body).getElementsByTagName(C));if(A==0){return Element.exception}else{if(A<0){F.reverse(true);A=Math.abs(A)}}var G=0;var H=null;for(var E=0;E<F.length;E++){if(F[E].className.match(new RegExp("(^|\\s)"+B+"(\\s|$)"))){G++;if(G==A){H=Element.extend(F[E]);break}}}return H},getFirstElementByClassName:function(){var C=arguments[0];var A=arguments[1];var B=arguments[2];if(B){return C.getNthElementByClassName(A,1,B)}else{return C.getNthElementByClassName(A,1)}},getLastElementByClassName:function(){var C=arguments[0];var A=arguments[1];var B=arguments[2];if(B){return C.getNthElementByClassName(A,-1,B)}else{return C.getNthElementByClassName(A,-1)}},containsElementWithClassName:function(){if(arguments.length<2){return null}var C=arguments[0];var A=arguments[1];var B=arguments[2];var D=null;if(B){D=C.getNthElementByClassName(A,1,arguments[2])}else{D=C.getNthElementByClassName(A,1)}if(D){return true}else{return false}},getElementsByAttribute:function(){if(arguments.length<2){return null}var C=arguments[0];var F=arguments[1];if(F.toLowerCase()=="class"||F.toLowerCase()=="classname"){log.error("getElementsByAttribute does not support 'class' or 'className' as the attribute parameter");return null}var B=C.getElementsByTagName(arguments[2]||"*");var E=$A();var G=B.length;for(var D=0;D<G;D++){var A=B[D];if(A.getAttribute(F)){E.push(Element.extend(A))}}return E},getParentByTagName:function(){var C=$A(arguments),B=C.shift(),A=C[0].toUpperCase();while(B.parentNode){if(B.tagName==A){return Element.extend(B)}B=B.parentNode}return null},getParentByClassName:function(){var C=$A(arguments),B=C.shift(),A=C[0];while(B.tagName!="HTML"){if(B.hasClassName(A)){return Element.extend(B)}B=$(B.parentNode)}return null},toggleClasses:function(D,C){var B=$A(arguments),A=B.shift();if(Element.hasClassName(A,B[0])){Element.removeClassName(A,B[0]),Element.addClassName(A,B[1])}else{if(Element.hasClassName(A,B[1])){Element.removeClassName(A,B[1]),Element.addClassName(A,B[0])}}},visibleByClass:function(){var A=arguments[0];var B=true;if(A.hasClassName("noneTableRow")||A.hasClassName("noneTableRowGroup")||A.hasClassName("noneBlock")||A.hasClassName("noneInline")||A.hasClassName("hidden")||(A.style.display=="none")||(A.style.visibility=="hidden")){B=false}return B},hideByClass:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);if(A.visibleByClass()){if(A.hasClassName("tableRow")){A.removeClassName("tableRow");A.addClassName("noneTableRow")}else{if(A.hasClassName("tableRowGroup")){A.removeClassName("tableRowGroup");A.addClassName("noneTableRowGroup")}else{if(A.hasClassName("block")){A.removeClassName("block");A.addClassName("noneBlock")}else{if(A.hasClassName("inline")){A.removeClassName("inline");A.addClassName("noneInline")}else{if(A.hasClassName("visible")){A.removeClassName("visible");A.addClassName("hidden")}else{log.error("hideByClass(): missing required class for "+A)}}}}}}else{log.warning(A+" already hidden")}}if(arguments.length==1){return $(arguments[0])}},showByClass:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);if(!A.visibleByClass()){if(A.hasClassName("noneTableRow")){A.removeClassName("noneTableRow");A.addClassName("tableRow")}else{if(A.hasClassName("noneTableRowGroup")){A.removeClassName("noneTableRowGroup");A.addClassName("tableRowGroup")}else{if(A.hasClassName("noneBlock")){A.removeClassName("noneBlock");A.addClassName("block")}else{if(A.hasClassName("noneInline")){A.removeClassName("noneInline");A.addClassName("inline")}else{if(A.hasClassName("hidden")){A.removeClassName("hidden");A.addClassName("visible")}else{log.error("showByClass(): missing required class for "+A)}}}}}}else{log.warning(A+" already visible")}}if(arguments.length==1){return $(arguments[0])}},toggleByClass:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);if(A.visibleByClass()){A.hideByClass()}else{A.showByClass()}}},getParams:function(){var result="null";var element=arguments[0];this.params=null;var attr=(arguments[1]||"params");if(typeof(element)=="object"&&element.getAttribute(attr)){var jsonRaw=element.getAttribute(attr);var convertedString=jsonRaw.unescapeJSON();try{result=eval("({"+convertedString+"})")}catch(error){Errors.capture(error,"Error converting attributes to json object  ["+convertedString+"]")}return result}},getAgents:function(){var result;var element=arguments[0];this.params=null;if(typeof(element)=="object"&&element.getAttribute("agent")){var jsonRaw=element.getAttribute("agent");var convertedString=jsonRaw.unescapeJSON();try{result=eval("(["+convertedString+"])")}catch(error){Errors.capture(error,"Error converting attributes to json object  ["+convertedString+"]")}return result}},getPosition:function(){var B=arguments[0];var A=Position.cumulativeOffset(B);return{x:A[0],y:A[1],units:"px"}},getPositionOffset:function(A){return Position.delta(arguments[0],arguments[1])},destroy:function(){var A=$(arguments[0]);if(A){if(A.innerHTML){A.innerHTML=""}if(A.parentNode){A.parentNode.removeChild(A)}else{log.warning("Element.destroy(): no parent node - element not in DOM?")}}return null},updateAndFocus:function(D){log.debug("updateAndFocus - updating");var C=arguments[0];var E=arguments[1]?arguments[1]:1000;if(C){var B=function(){if(this&&this.parentNode&&(this.parentNode.nodeType===1)){log.debug("updateAndFocus - setting focus: "+this);this.focus()}else{log.warning("Element.updateAndFocus(): attempting to focus on a node that is not nodeType 1 (ELEMENT_NODE).Target of focus was probably removed from the document during the delay")}}.bind(C);if(window.virtualBufferManager){window.virtualBufferManager.update();clearTimeout(window.virtualBufferManager.timeout)}else{log.error("Element.updateAndFocus(): virtualBufferManager does not exist!")}var A=setTimeout(B,E);if(window.virtualBufferManager){window.virtualBufferManager.timeout=A}return A}else{log.error("Element.updateAndFocus must have an element to operate on!")}}});String.prototype.unescapeJSON=function(){var A=this.toString();A=A.replace(/!#/,"{");A=A.replace(/#!/,"}");A=A.replace(/\r\n/g," ");A=A.replace(/\r/g," ");A=A.replace(/\n/g," ");A=A.replace(/'\s*/g,"'");A=A.replace(/'\s*(,|$|}|])/gm,"QUOTE_CONSTANT$1");A=A.replace(/((\[|:|,)\s*)'/mg,"$1QUOTE_CONSTANT");A=A.replace(/'/gm,"\\'");A=A.replace(/QUOTE_CONSTANT/gm,"'");A=A.replace(/models\['([^']*)']/g,"models[\\'$1\\']");return A};Form.HiddenField={add:function(B,A,D){var C=document.createElement("INPUT");C.setAttribute("name",A);C.setAttribute("type","hidden");C.setAttribute("value",D);log.debug("adding hidden field:"+A+":"+D);B.appendChild(C)}};Form.Element.resetValue=function(B){var A=B.getElementsByTagName("select")[0];if(A){A.selectedIndex=0}var D=B.getElementsByTagName("input");if(D){for(var C=0;D[C];C++){switch(D[C].type){case"radio":case"checkbox":D[C].checked=false;break;case"text":case"password":D[C].value="";break}}}};Object.extend(String.prototype,{stripNoScripts:function(){return this.replace(new RegExp("(?:<noscript.*?>)((\n|\r|.)*?)(?:</noscript>)","img"),"")},upperCaseFirst:function(){var A=this.substr(0,1).toUpperCase();return this.substr(0,1).toUpperCase()+this.substr(1,this.length)},unescapeXML:function(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#039;/g,"'").replace(/&#034;/g,'"').replace(/&amp;/g,"&")}});Date.prototype.getShortYear=function(){var A=new String(this.getFullYear());return A.substring(2)};Function.prototype.bindAsEventListener=function(B){var C=this,A=$A(arguments),B=A.shift();return function(D){return C.apply(B,[(D||window.event)].concat(A).concat($A(arguments)))}};Object.extend(Event,{_domReady:function(){if(arguments.callee.done){return}arguments.callee.done=true;if(this._timer){clearInterval(this._timer)}this._readyCallbacks.each(function(A){A()});this._readyCallbacks=null},onDOMReady:function(f){if(!this._readyCallbacks){var domReady=this._domReady.bind(this);if(document.addEventListener){document.addEventListener("DOMContentLoaded",domReady,false);
/*@cc_on @*/
/*@if (@_win32)
				  document.write("<script id=__ie_onload defer src=/script/blank.js><\/script>");
				  document.getElementById("__ie_onload").onreadystatechange = function() {
					if (this.readyState == "complete") domReady();
				  };
				  /*@end @*/
}if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){domReady()}},10)}Event.observe(window,"load",domReady);Event._readyCallbacks=[]}Event._readyCallbacks.push(f)},findElementByTagName:function(C,B){var A=Event.element(C);while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode}return A}});var Units={PX_TO_EM:10.88,EM_TO_PX:1/10.88,TYPE:"px"};Position.putInViewport=function(A,F){var E=Position.calculateViewport();var I=Position.calculateScroll();var C=Position.calculatePageHeight();F.dim=F.getDimensions();F.pos=F.getPosition();A.pos=Position.cumulativeOffset(A);A.dim=A.getDimensions();A.pos=A.getPosition();var B=A.pos.x-F.dim.width;if(A.pos.x+A.dim.width+F.dim.width<=E.width||B<=0){B=A.dim.width+A.pos.x}var H=(parseInt(I.x)+E.width-(B+F.dim.width)>=0);if(Units.TYPE=="em"){B=B/Units.PX_TO_EM}F.setStyle({left:B+Units.TYPE});E=Position.calculateViewport();var G=A.pos.y+(A.dim.height/2);if(E.height<F.dim.height||parseInt(I.y)-G>=0){G=parseInt(I.y)}else{if(G+F.dim.height>=parseInt(I.y)+E.height){G=G-(G+F.dim.height-(parseInt(I.y)+E.height))}}var D=(parseInt(I.y)+E.height-(G+F.dim.height)>=0);if(Units.TYPE=="em"){G=G/Units.PX_TO_EM}F.setStyle({top:G+Units.TYPE});return{x:B,y:G,inViewport:(H&&D),units:Units.TYPE}};Position.delta=function(A,B){A.pos=A.getPosition();B.pos=B.getPosition();return{x:(B.pos.x-A.pos.x),y:(B.pos.y-A.pos.y),units:"px"}};Position.calculatePageHeight=function(){var A=0;if(document.documentElement.scrollHeight>document.documentElement.offsetHeight){A=document.documentElement.scrollHeight}else{A=document.documentElement.offsetHeight}return{height:A,units:"px"}};Position.calculateScroll=function(){var B=0,A=0;if(window.pageYOffset&&window.pageXOffset){B=window.pageYOffset;A=window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){B=document.documentElement.scrollTop;A=document.documentElement.scrollLeft}else{if(document.body){B=document.body.scrollTop;A=document.body.scrollLeft}}}return{x:A,y:B,units:"px"}};Position.calculateViewport=function(){var C=document.documentElement;var B=window.innerHeight;var A=window.innerWidth;if(B!=null&&C.clientHeight!=null){B=(C.clientHeight<B&&C.clientHeight>0)?C.clientHeight:B;A=(C.clientWidth<window.innerWidth&&C.clientWidth>0)?C.clientWidth:A}else{if(C&&C.clientHeight){B=C.clientHeight;A=C.clientWidth}else{if(document.body){B=document.body.clientHeight;A=document.body.clientWidth}}}return{height:B,width:A,units:"px"}};Position.cumulativeOffset=function(A){var B=Element.extend(A);var D=0,E=0;do{if(Element.getStyle(B,"position")=="fixed"){var C=Position.calculateScroll();D+=C.y+B.offsetTop;E+=C.x+B.offsetLeft;B=null}else{D+=B.offsetTop||0;E+=B.offsetLeft||0;B=$(B.offsetParent)}}while(B);return[E,D]};Ajax.Request.prototype.abort=function(){this.transport.onreadystatechange=Prototype.emptyFunction;this.transport.abort();Ajax.activeRequestCount--};Ajax.PartialRequest=function(A,B){try{var D=function(){var F=A.split("?")[1];var E=B.parameters;if(typeof E!="undefined"&&typeof F!="undefined"){throw new Error("Cannot resolve both parameters and queryString in Ajax.PartialRequest. Must choose either parameters or querystring.")}if(typeof E=="undefined"&&typeof F=="undefined"){return""}return E||F}();if(!D.match(/req=partial/)){var D=D.split("&");D.push("rep=partial");D=D.join("&")}B.parameters=D;new Ajax.Request(A.split("?")[0],B)}catch(C){Errors.capture(C)}};var ManagedEventObservers=Class.create();ManagedEventObservers.prototype={initialize:function(){this.observers=$A()},add:function(A,B,D,C){if(arguments.length>=3){A=$(A);C=C||false;Event.observe(A,B,D,C);this.observers.push([A,B,D,C])}else{throw new Error("ManagedEventObservers.add(): too few parameters")}},getFirstTriggerElement:function(){if(this.observers[0]){return this.observers[0][0]}else{return null}},remove:function(A){if($(A)){for(var B=0;B<this.observers.length;B++){if(this.observers[B][0]==A){Event.stopObserving.apply(this,this.observers[B]);this.observers[B][0]=null;this.observers.splice(B)}}}},clear:function(){for(var A=0;A<this.observers.length;A++){Event.stopObserving.apply(this,this.observers[A]);this.observers[A][0]=null}this.observers.clear();return null},isWatchingElement:function(A){var C=false;if($(A)){for(var B=0;B<this.observers.length;B++){if(this.observers[B][0]==A){C=true}}}return C}};var virtualBufferManager={initialize:function(){var A=document.createElement("input");A.type="hidden";A.name="virtualBufferHiddenField";A.value="0";this.hiddenField=document.body.appendChild(A);log.debug("virtualBufferManager initialized")},update:function(){if(this.hiddenField){if(this.hiddenField.value==="0"){this.hiddenField.value="1"}else{this.hiddenField.value="0"}log.debug("virtualBufferManager.update: "+this.hiddenField.value)}else{log.error("virtualBufferManager has not been initialized, it should have been")}}};Event.onDOMReady(window.virtualBufferManager.initialize.bind(virtualBufferManager));var Profiler={items:{},start:function(A){this.items[A]=new Object();this.items[A].startTime=new Date()},stop:function(A){if(this.items[A]){this.items[A].endTime=new Date();this.log(A)}else{log.warning("No profiler of label: "+A+" was found")}},log:function(A){this.items[A].elapsedTime=((this.items[A].endTime-this.items[A].startTime)/1000);if(this.items[A].elapsedTime==undefined){this.items[A].elapsedTime=0}var B=(A+" elapsedTime: "+this.items[A].elapsedTime+" secs");if(this.items[A].elapsedTime>=0.1){log.warning(B)}else{log.debug(B)}},toString:function(){var A=["latency profile"];for(props in this.items){A.push(props+":"+Profiler.items[props].elapsedTime)}return A.join(",\n")}};var log=new function(){this.debug=function(){};this.info=function(){};this.warning=function(){};this.error=function(){}};var Errors={list:[],capture:function(B){var A=$A(arguments),E=A.shift();var F=["name","message","description","number","fileName","sourceURL","lineNumber","line"];var D=A;for(var C=0;C<F.length;C++){if(E[F[C]]!==undefined){D.push(F[C]+":"+E[F[C]])}}if(B.message&&B.message=="Object doesn't support this property or method"){log.error("If IE only, this error often means that you are trying to use prototype.js Element extensions (eg: .getElementByClassName) on a non-extended element")}this.list.push(D);log.error(""+D.join(",\n"))},toString:function(){if(this.list.length>0){var B=["JavaScript Error"];for(var A=0;A<this.list.length;A++){B.push(this.list[A])}return B.join("")}}};var Inspector={unpack:function(A){result=[];for(prop in A){result.push(prop+":"+A[prop])}return result.join("\n")}};var report=function(A){window.open("","report").document.write("<pre>"+A+"</pre>")};String.prototype.deleteQueryStringParam=function(D,C){var B=new RegExp("^&|&$","g");var A=new RegExp("&&","g");String.prototype.deleteQueryStringParam=function(H,F){var E=H+(F===true?"[^&]*":"=[^&]*");var G=new RegExp(E,"g");return this.replace(G,"").replace(A,"&").replace(B,"")};return this.deleteQueryStringParam(D,C)};var $QS=QueryString=function(A){A=A.replace(/&amp;/,"&");var B=A.split("&");return{addParam:function(E){for(var D=0,C=arguments.length;D<C;D++){B.push(arguments[D])}B=B.uniq();return this},removeParam:function(E){for(var D=0,C=arguments.length;D<C;D++){B=B.without(arguments[D])}return this},toString:function(){return B.join("&")}}};var DialogManager=Class.create({initialize:function(A){this.dialogs=$A();this.$element=Element.extend(A);this.openListener=this.dialogOpen.bindAsEventListener(this);this.$element.observe("dialog:dialogOpen",this.openListener)},close:function(){this.dialogs.each(function(A){A.close()});this.dialogs.clear()},dialogOpen:function(A){if(A&&A.memo&&A.memo.dialog){this.dialogs.push(A.memo.dialog)}},destroy:function(){this.close();this.dialogs=null;this.$element.stopObserving("dialog:dialogOpen",this.openListener);this.$element=null}});var Dialog={};Dialog.Base={version:"Dialog 1.5",setProperties:function(B,C,A){this.type=B;this.content=C;this.triggerContext;this.options={anchorName:"",triggerEvent:"click",closeLabel:"",topBoundaryText:"",bottomBoundaryText:"",wrapLinkText:"",sessionTimeoutUrl:"",closeElements:$A(),classes:"",hasCustomPositioningContext:false,setUp:function(){},tearDown:function(){}};Object.extend(this.options,A||{});this.isOpen=false;this.activated=false;this.layoutBuilt=false;this.triggers=new ManagedEventObservers();this.managedEventObservers=new ManagedEventObservers();this.closeEventObservers=new ManagedEventObservers()},createMarkup:function(){log.error("You have not defined createMarkup() for your "+this.type+" object.")},showDialog:function(){log.error("You have not defined showDialog() for your "+this.type+" object.")},positionInViewport:function(){log.error("You have not defined positionInViewport() for your "+this.type+" object.")},open:function(A){log.error("You have not defined open() for your "+this.type+" object.")},close:function(A){log.error("You have not defined close() for your "+this.type+" object.")},createDialogDivs:function(){log.debug("createDialogDivs");this.markup={dialogWrapper:new Element("div",{"class":"dialogWrapper "+this.type.toLowerCase()+" "+this.options.classes}),topBoundary:new Element("p",{"class":"offscreen"}),bottomBoundary:new Element("p",{"class":"offscreen"}),dialogAnchor:new Element("a",{"class":"dialogAnchor"}),top:new Element("div",{"class":"dialogTop"}),main:new Element("div",{"class":"dialogMain"}),bottom:new Element("div",{"class":"dialogBottom"}),topContent:new Element("div",{"class":"dialogTopContent"}),dialogTitle:new Element("h3",{"class":"dialogTitle"}),topRight:new Element("div",{"class":"dialogTopRight"}),topCloseLink:new Element("a",{"class":"dialogTopCloseLink dialogCloseLink",href:"javascript:void(0);",tabIndex:"-1"}),mainRight:new Element("div",{"class":"dialogMainRight"}),mainContent:new Element("div",{"class":"dialogMainContent"}),bottomContent:new Element("div",{"class":"dialogBottomContent"}),bottomRight:new Element("div",{"class":"dialogBottomRight"}),bottomCloseLink:new Element("a",{"class":"dialogBottomCloseLink dialogCloseLink offscreen",href:"javascript:void(0);",tabIndex:"-1"}),wrapLink:new Element("a",{"class":"dialogWrapLink offscreen"})};if(this.options.id){this.markup.dialogWrapper.id=this.options.id}this.markup.topCloseLink.innerHTML=this.options.closeLabel;this.options.closeElements.push(this.markup.topCloseLink);this.markup.bottomCloseLink.innerHTML=this.options.closeLabel;this.options.closeElements.push(this.markup.bottomCloseLink);if(this.options.heading){this.markup.dialogTitle.innerHTML=this.options.heading}this.markup.topBoundary.innerHTML=this.options.topBoundaryText;this.markup.dialogWrapper.appendChild(this.markup.topBoundary);if(this.options.anchorName!==""){this.markup.dialogAnchor.name="_"+this.options.anchorName;this.markup.dialogAnchor.tabIndex="-1";this.markup.dialogWrapper.appendChild(this.markup.dialogAnchor);this.markup.wrapLink.tabIndex="-1";this.markup.wrapLink.href="#"+this.markup.dialogAnchor.name;this.markup.wrapLink.innerHTML=this.options.wrapLinkText}this.markup.dialogWrapper.appendChild(this.markup.top);this.markup.dialogWrapper.appendChild(this.markup.main);this.markup.dialogWrapper.appendChild(this.markup.bottom);this.markup.dialogWrapper.appendChild(this.markup.wrapLink);this.markup.bottomBoundary.innerHTML=this.options.bottomBoundaryText;this.markup.dialogWrapper.appendChild(this.markup.bottomBoundary);this.markup.top.appendChild(this.markup.topContent);this.markup.topContent.appendChild(this.markup.dialogTitle);this.markup.topContent.appendChild(this.markup.topRight);this.markup.topRight.appendChild(this.markup.topCloseLink);this.markup.main.appendChild(this.markup.mainRight);this.markup.mainRight.appendChild(this.markup.mainContent);this.markup.bottom.appendChild(this.markup.bottomContent);this.markup.bottomContent.appendChild(this.markup.bottomRight);this.markup.bottomRight.appendChild(this.markup.bottomCloseLink)},createShim:function(){if(navigator.userAgent.toLowerCase().indexOf("msie 6")!==-1){log.debug("is ie6, creating shim");this.markup.shim=this.markup.shim?this.markup.shim.destroy():null;this.markup.shim=Element.extend(document.createElement("div"));var E=Element.extend(document.createElement("iframe"));E.style.display="none";this.markup.shim.appendChild(E);this.markup.shim.className="dialogShim "+this.options.classes;E.src="/script/empty.html";E.scrolling="no";E.frameBorder="0";this.triggerContext.activeDialogsContainer.insertBefore(this.markup.shim,this.markup.dialogWrapper);this.markup.shim.style.top=this.markup.dialogWrapper.style.top;this.markup.shim.style.left=this.markup.dialogWrapper.style.left;var C=this.markup.shim.currentStyle.paddingTop.replace("px","")*1;var D=this.markup.shim.currentStyle.paddingRight.replace("px","")*1;var A=this.markup.shim.currentStyle.paddingBottom.replace("px","")*1;var B=this.markup.shim.currentStyle.paddingLeft.replace("px","")*1;E.style.width=(this.dialogBoundingBox.x2-this.dialogBoundingBox.x1-D-B)+"px";E.style.height=(this.dialogBoundingBox.y2-this.dialogBoundingBox.y1-C-A)+"px";E.style.display="block"}},attachTriggers:function(B){if(Object.isArray(B)){if(this.triggers instanceof ManagedEventObservers){for(var A=0;B[A];A++){if(this.options.triggerEvent=="mouseover"){this.triggers.add(B[A],"mouseover",this.open.bindAsEventListener(this))}this.triggers.add(B[A],"click",this.open.bindAsEventListener(this))}log.debug("Dialog.Base triggers attached: "+B.length)}else{log.error("Dialog.Base.prototype.triggers not instance of ManagedEventObservers")}}else{log.error("newTriggers parameter either undefined, or is not an array")}},attachCloseListeners:function(B){if(this.options.closeElements){for(var A=0;this.options.closeElements[A];A++){if(!this.options.closeElements[A].isAttached){this.closeEventObservers.add(this.options.closeElements[A],"click",B);this.options.closeElements[A].isAttached=true}}}var C=this.markup.mainContent.getElementsByClassName("closeListener");for(var A=0;C[A];A++){if(!C[A].isAttached){this.managedEventObservers.add(C[A],"click",B);C[A].isAttached=true}}},inspectTrigger:function(A){if(this.triggers.isWatchingElement(A)){this.trigger=$(A)}else{this.trigger=$(A).ancestors().find(function(B){return this.triggers.isWatchingElement(B)}.bind(this));if(!this.trigger){this.trigger=$(A)}}this.trigger.pos=this.trigger.getPosition();this.trigger.dim=this.trigger.getDimensions();this.triggerContext={};if(this.options.hasCustomPositioningContext){this.triggerContext.element=this.trigger.up(".dialogPositioningContext")}else{this.triggerContext.element=this.trigger.up(".dialogWrapper, #bodyWrapper, body")}if(this.triggerContext.element===$(document.body)){this.triggerContext.pos={x:0,y:0}}else{this.triggerContext.pos=this.triggerContext.element.getPosition()}this.triggerContext.activeDialogsContainer=this.triggerContext.element.childElements().find(function(B){return B.hasClassName("activeDialogs")});if(!this.triggerContext.activeDialogsContainer){this.triggerContext.activeDialogsContainer=new Element("div",{"class":"activeDialogs"});this.triggerContext.element.appendChild(this.triggerContext.activeDialogsContainer)}log.debug("Dialog.Base.trigger: "+this.trigger.tagName+", pos: "+this.trigger.pos.x+", "+this.trigger.pos.y+" dim: "+this.trigger.dim.width+", "+this.trigger.dim.height+", triggerContext: "+this.triggerContext+", triggerContextPos: "+this.triggerContext.pos.x+", "+this.triggerContext.pos.y)},wrapFocus:function(A){A.preventDefault();this.focusCloseLink()},attachFocusWrapListeners:function(){this.managedEventObservers.add(this.markup.wrapLink,"click",this.wrapFocus.bindAsEventListener(this))},getContent:function(){if(this.response){log.debug("Dialog.Base.getContent: response");this.showDialog(this.response)}else{if(!this.content){log.debug("Dialog.Base.getContent: null")}else{if(this.content.domNode){this.content.domNode=$(this.content.domNode);log.debug("Dialog.Base.getContent - domNode: "+this.content.domNode);this.showDialog(this.content.domNode.cloneNode(true))}else{if(this.content.url){log.debug("Dialog.Base.getContent - url: "+this.content.url);this.content.url=this.content.url.replace("&amp;","&");this.content.url=this.content.url.replace("&amp;","&");this.request=new Ajax.Request(this.content.url,{method:(this.options.ajaxParameters)?"post":"get",parameters:(this.options.ajaxParameters)?this.options.ajaxParameters:"",onComplete:this.showDialog.bind(this),onSuccess:function(A){log.debug(A.status+": Dialog.Base.getContent() content.url successful");if(this.options.sessionTimeoutUrl&&A.responseText.indexOf("<html")!=-1){this.sessionHasExpired=true;top.location.href=this.options.sessionTimeoutUrl}}.bind(this)})}else{if(this.content.string){log.debug("Dialog.Base.getContent - markup: "+this.content.string);this.showDialog(this)}else{log.error("Dialog.response is null and Dialog.content not a recognized type")}}}}}},populateDialog:function(){if(this.response){if(this.options.interstitial){this.markup.mainContent.innerHTML=""}if(this.content.domNode){var A=$(this.content.domNode).immediateDescendants();log.debug("populateDialog: "+A.length+" nodes");for(var B=0;B<A.length;B++){this.markup.mainContent.appendChild(A[B])}}else{if(this.content.url&&this.response.responseText){this.markup.mainContent.update(this.response.responseText);Page.initializeDOMFragment(this.markup.mainContent)}else{if(this.content.string){this.markup.mainContent.update(this.content.string);Page.initializeDOMFragment(this.markup.mainContent)}else{log.error("Dialog.populateDialog: unable to determine response type")}}}this.markup.backToTopLink=this.markup.mainContent.getLastElementByClassName("footnoteBackToTop","A");if(this.markup.backToTopLink){this.markup.backToTopLink.style.display="none"}}},depopulateDialog:function(){if(this.markup.backToTopLink){this.markup.backToTopLink.style.display="inline"}if(this.markup.mainContent){if(this.content.domNode){var A=this.markup.mainContent.immediateDescendants();for(var B=0;B<A.length;B++){this.content.domNode.appendChild(A[B])}}this.markup.mainContent.innerHTML=""}},appendToDOM:function(){if(this.triggerContext.activeDialogsContainer){this.triggerContext.activeDialogsContainer.appendChild(this.markup.dialogWrapper);this.markup.dialogWrapper.setStyle({visibility:"hidden"})}else{log.error("Dialog.Base.appendToDOM: couldn't find 'triggerContext.activeDialogContainer' container to insert new dialog")}},_removeFromDOM:function(){log.debug("Dialog._removeFromDOM()");if(this.triggerContext){this.triggerContext.element=null;this.triggerContext.activeDialogsContainer=null;this.triggerContext=null}this.markup.backToTopLink=null;this.markup.shim=this.markup.shim?this.markup.shim.destroy():null;this.markup.bottomCloseLink=this.markup.bottomCloseLink?this.markup.bottomCloseLink.destroy():null;this.markup.bottomRight=this.markup.bottomRight?this.markup.bottomRight.destroy():null;this.markup.bottomContent=this.markup.bottomContent?this.markup.bottomContent.destroy():null;this.markup.mainContent=this.markup.mainContent?this.markup.mainContent.destroy():null;this.markup.mainRight=this.markup.mainRight?this.markup.mainRight.destroy():null;this.markup.topCloseLink=this.markup.topCloseLink?this.markup.topCloseLink.destroy():null;this.markup.topRight=this.markup.topRight?this.markup.topRight.destroy():null;this.markup.dialogTitle=this.markup.dialogTitle?this.markup.dialogTitle.destroy():null;this.markup.topContent=this.markup.topContent?this.markup.topContent.destroy():null;this.markup.wrapLink=this.markup.wrapLink?this.markup.wrapLink.destroy():null;this.markup.bottom=this.markup.bottom?this.markup.bottom.destroy():null;this.markup.main=this.markup.main?this.markup.main.destroy():null;this.markup.top=this.markup.top?this.markup.top.destroy():null;this.markup.dialogAnchor=this.markup.dialogAnchor?this.markup.dialogAnchor.destroy():null;this.markup.topBoundary=this.markup.topBoundary?this.markup.topBoundary.destroy():null;this.markup.dialogWrapper=this.markup.dialogWrapper?this.markup.dialogWrapper.destroy():null},focusCloseLink:function(){clearTimeout(this.focusTimeout);if(this.markup.topCloseLink){var A=this.markup.topCloseLink.updateAndFocus(1500);this.focusTimeout=A;var B=function(C){log.debug("Clearing close link focus timeout");clearTimeout(A);this.stopObserving("mousedown",B)};$("bodyWrapper").observe("mousedown",B)}}};var Microcontent=Class.create(Dialog.Base,{initialize:function(A,D,E){var C={triggerEvent:"mouseover",triggerDelay:0,compact:false,displayBeak:true,preferredPosition:"bottomRight",debug:{enabled:false}};var A=$A(A);Object.extend(C,E||{});this.setProperties("Microcontent",D,C);this.attachTriggers(A);if(this.options.triggerEvent=="mouseover"){for(var B=0;A[B];B++){this.triggers.add(A[B],"mouseout",this.clearTriggerFocus.bindAsEventListener(this))}}else{if(this.options.triggerEvent=="click"){}else{log.error("Microcontent.options.triggerEvent: "+this.options.triggerEvent+" is not a recognized event type")}}this.focusListeners=new ManagedEventObservers();this.focusListenersAttached=false},createMarkup:function(){this.createDialogDivs();if(this.options.displayBeak){this.markup.beak=Element.extend(document.createElement("div"));this.markup.dialogWrapper.appendChild(this.markup.beak)}},showDialog:function(B){try{if(this.markup.dialogWrapper){this.response=B;this.populateDialog();this.attachCloseListeners(this.close.bindAsEventListener(this));this.focusListenersAttached=this.attachFocusListeners();this.attachFocusWrapListeners();this.appendToDOM();this.buildLayout();var C=this.trigger.pos.y;if(Units.TYPE=="em"){C=C/Units.PX_TO_EM}this.markup.dialogWrapper.setStyle({top:C+Units.TYPE});this.positionInViewport();this.markup.dialogWrapper.setStyle({visibility:"visible"});this.focusCloseLink();$(this.trigger).fire("dialog:dialogOpen",{dialog:this});this.manager=new DialogManager(this.markup.dialogWrapper);this.isOpen=true;window.setTimeout(function(){this.createShim()}.bind(this),0)}else{log.error("Microcontent.showDialog: markup.dialogWrapper doesn't exist")}}catch(A){log.error("EXCEPTION: Microcontent.showDialog: "+A.message)}finally{this.activated=false}},positionInViewport:function(){var O={x1:this.trigger.pos.x-this.triggerContext.pos.x,y1:this.trigger.pos.y-this.triggerContext.pos.y,x2:this.trigger.pos.x-this.triggerContext.pos.x+this.trigger.dim.width,y2:this.trigger.pos.y-this.triggerContext.pos.y+this.trigger.dim.height};if(this.options.displayBeak){var I={x:O.x1,y:O.y1+(this.trigger.dim.height/2)};var J={x:O.x2,y:O.y1+(this.trigger.dim.height/2)}}else{var I={x:O.x2,y:O.y1+(this.trigger.dim.height/2)};var J={x:O.x1,y:O.y1+(this.trigger.dim.height/2)}}var b=this.markup.dialogWrapper.getDimensions();var T=function(){var k=0;var h=0;var e;var d;if(this.markup.main.currentStyle){if(this.options.displayBeak){var c=this.markup.beak.currentStyle;var k=(c.height.replace("px",""))*1;var h=(c.width.replace("px",""))*1}var g=this.markup.main.currentStyle;var f=this.markup.mainRight.currentStyle;var e=(g.paddingLeft.replace("px",""))*1;var d=(f.paddingRight.replace("px",""))*1}else{if(this.options.displayBeak){var c=document.defaultView.getComputedStyle(this.markup.beak,"");var k=(c.getPropertyValue("height").replace("px",""))*1;var h=(c.getPropertyValue("width").replace("px",""))*1}var g=document.defaultView.getComputedStyle(this.markup.main,"");var f=document.defaultView.getComputedStyle(this.markup.mainRight,"");var e=(g.getPropertyValue("padding-left").replace("px",""))*1;var d=(f.getPropertyValue("padding-right").replace("px",""))*1}if(this.options.displayBeak){this.offsets={top:(this.markup.bottom.dim.height+(k/2)),right:h-e,bottom:(0-this.markup.top.dim.height-(k/2)),left:(0-(h-d))}}else{this.offsets={top:this.markup.bottom.dim.height,right:0-e*2,bottom:0-this.markup.top.dim.height/2,left:d*2}}this.beakHeight=k}.bind(this);var G=function(){if(this.options.displayBeak){this.markup.beak.className="microcontentBeakRight";this.markup.beak.setStyle({left:b.width+"px"})}T()}.bind(this);var a=function(){if(this.options.displayBeak){this.markup.beak.className="microcontentBeakLeft";this.markup.beak.setStyle({left:"0"})}T()}.bind(this);a();var A={x1:J.x+this.offsets.right+this.triggerContext.pos.x,y1:J.y-b.height+this.offsets.top+this.triggerContext.pos.y,x2:J.x+b.width+this.offsets.right+this.triggerContext.pos.x,y2:J.y+this.offsets.top+this.triggerContext.pos.y};var R={x1:J.x+this.offsets.right+this.triggerContext.pos.x,y1:J.y+this.offsets.bottom+this.triggerContext.pos.y,x2:J.x+b.width+this.offsets.right+this.triggerContext.pos.x,y2:J.y+b.height+this.offsets.bottom+this.triggerContext.pos.y};G();var H={x1:I.x-b.width+this.offsets.left+this.triggerContext.pos.x,y1:I.y-b.height+this.offsets.top+this.triggerContext.pos.y,x2:I.x+this.offsets.left+this.triggerContext.pos.x,y2:I.y+this.offsets.top+this.triggerContext.pos.y};var W={x1:I.x-b.width+this.offsets.left+this.triggerContext.pos.x,y1:I.y+this.offsets.bottom+this.triggerContext.pos.y,x2:I.x+this.offsets.left+this.triggerContext.pos.x,y2:I.y+b.height+this.offsets.bottom+this.triggerContext.pos.y};var V=Position.calculateViewport();var P=Position.calculateScroll();var E={x1:P.x,y1:P.y,x2:(P.x+V.width),y2:(P.y+V.height)};var D=(R.x2<=E.x2)&&(R.y2<=E.y2);var M=(W.x1>=E.x1)&&(W.y2<=E.y2);var C=(A.x2<=E.x2)&&(A.y1>=E.y1);var Z=(H.x1>=E.x1)&&(H.y1>=E.y1);this.debugPosition({dialogWrapperDimensions:b,topRightBoundingBox:A,topLeftBoundingBox:H,bottomRightBoundingBox:R,bottomLeftBoundingBox:W,bottomRightGood:D,bottomLeftGood:M,topRightGood:C,topLeftGood:Z});this.dialogBoundingBox;var B=function(){G();this.markup.dialogWrapper.setStyle({left:((this.dialogBoundingBox.x1-this.triggerContext.pos.x)/Units.PX_TO_EM)+"em"})}.bind(this);var Q=function(){a();this.markup.dialogWrapper.setStyle({left:((this.dialogBoundingBox.x1-this.triggerContext.pos.x)/Units.PX_TO_EM)+"em"})}.bind(this);var S=function(){if(this.options.displayBeak){this.markup.beak.setStyle({top:this.markup.top.dim.height+this.markup.main.dim.height-this.beakHeight+"px"})}this.markup.dialogWrapper.setStyle({top:((this.dialogBoundingBox.y1-this.triggerContext.pos.y)/Units.PX_TO_EM)+"em"})}.bind(this);var F=function(){if(this.options.displayBeak){this.markup.beak.setStyle({top:this.markup.top.dim.height+"px"})}this.markup.dialogWrapper.setStyle({top:((this.dialogBoundingBox.y1-this.triggerContext.pos.y)/Units.PX_TO_EM)+"em"})}.bind(this);var X=function(){this.dialogBoundingBox=R;Q();F()}.bind(this);var K=function(){this.dialogBoundingBox=A;Q();S()}.bind(this);var Y=function(){this.dialogBoundingBox=W;B();F()}.bind(this);var L=function(){this.dialogBoundingBox=H;B();S()}.bind(this);var N=X;var U=false;if(this.options.preferredPosition=="bottomRight"){if(D){U=true}N=X}else{if(this.options.preferredPosition=="topRight"){if(C){U=true}N=K}else{if(this.options.preferredPosition=="bottomLeft"){if(M){U=true}N=Y}else{if(this.options.preferredPosition=="topLeft"){if(Z){U=true}N=L}}}}if(U){N()}else{if(D){X()}else{if(C){K()}else{if(M){Y()}else{if(Z){L()}else{N()}}}}}},open:function(B){log.debug("Microcontent.open()");if(B){B.preventDefault()}if(this.isOpen==false&&this.activated==false){this.triggerFocused=true;this.dialogFocused=false;this.activated=true;var A=$(Event.element(B));this.inspectTrigger(A);this.options.setUp(B);if(!this.markup||!this.markup.dialogWrapper){this.createMarkup()}setTimeout(function(){if(this.triggerFocused){this.getContent()}}.bind(this),this.options.triggerDelay)}else{this.focusCloseLink();log.error("already open or activated: isOpen:"+this.isOpen+", activated:"+this.activated)}},close:function(A){log.debug("Microcontent.close()");if(A){A.preventDefault()}if(this.manager){this.manager.destroy();this.manager=null}this.focusListeners.clear();this.focusListenersAttached=false;this.managedEventObservers.clear();this.closeEventObservers.clear();this.depopulateDialog();this.removeFromDOM();this.triggerFocused=false;this.dialogFocused=false;this.activated=false;if(this.isOpen&&this.trigger.type!=="mouseover"){this.trigger.updateAndFocus()}this.isOpen=false;this.cleanUpDebug()},attachFocusListeners:function(){if(this.focusListenersAttached==false&&this.options.triggerEvent!="click"){this.focusListeners.add(this.markup.dialogWrapper,"mouseover",this.setDialogFocus.bindAsEventListener(this));this.focusListeners.add(this.markup.dialogWrapper,"mouseout",this.clearDialogFocus.bindAsEventListener(this));return true}else{return false}},checkFocus:function(){setTimeout(function(){if(this.dialogFocused==false&&this.triggerFocused==false){this.close()}}.bind(this),200)},clearTriggerFocus:function(){log.debug("trigger mouse out");this.triggerFocused=false;this.checkFocus()},setDialogFocus:function(){log.debug("dialog mouseover");this.dialogFocused=true;this.triggerFocused=false},clearDialogFocus:function(){log.debug("dialog mouseout");this.dialogFocused=false;this.checkFocus()},buildLayout:function(){if(!this.layoutBuilt){if(this.options.compact){this.markup.dialogWrapper.addClassName("dialogCompact")}this.markup.bottom.removeClassName("dialogBottom");this.markup.bottom.addClassName("dialogBottomCompact");this.markup.top.dim=this.markup.top.getDimensions();this.markup.bottom.dim=this.markup.bottom.getDimensions();this.markup.main.dim=this.markup.main.getDimensions();this.layoutBuilt=true}},removeFromDOM:function(){this.markup.beak=this.markup.beak?this.markup.beak.destroy():null;this._removeFromDOM();this.layoutBuilt=false},destroy:function(){this.content=null;this.options=null;this.closeEventObservers=this.closeEventObservers.clear();for(var A=0;A<this.managedEventObservers.observers.length;A++){this.managedEventObservers.observers[A][0].isAttached=null}this.managedEventObservers=this.managedEventObservers.clear();this.focusListeners=this.focusListeners.clear()},inspectPositioningData:function(A,D,C){var B="Microcontent.inspectPositioningData:<br/>viewport.height: "+A.height+"<br/>scroll.y: "+D.y+"<br/>this.markup.dialogWrapper.dim: "+this.markup.dialogWrapper.dim.width+","+this.markup.dialogWrapper.dim.height+"<br/>this.markup.dialogWrapper.pos: "+this.markup.dialogWrapper.pos.x+","+this.markup.dialogWrapper.pos.y+"<br/>this.trigger: "+this.trigger+"<br/>this.trigger.pos: "+this.trigger.pos.x+","+this.trigger.pos.y+"<br/>this.trigger.dim: "+this.trigger.dim.width+","+this.trigger.dim.height+"<br/>"+log.info(B)},debugPosition:function(B){log.debug("bottomRightGood: "+B.bottomRightGood+", bottomLeftGood: "+B.bottomLeftGood+", topRightGood: "+B.topRightGood+", topLeftGood: "+B.topLeftGood);var G="border:3px solid green;";var D="border:3px dashed red;";var C=B.topRightGood?G:D;var A=B.topLeftGood?G:D;var E=B.bottomRightGood?G:D;var F=B.bottomLeftGood?G:D;if(this.options.debug.enabled){this.options.debug.topRightDebugBox=new Element("div",{style:C+"z-index:40; top:"+B.topRightBoundingBox.y1+"px; left:"+B.topRightBoundingBox.x1+"px; width:"+(B.dialogWrapperDimensions.width-6)+"px; height:"+(B.dialogWrapperDimensions.height-6)+"px; position:absolute;"});this.options.debug.topLeftDebugBox=new Element("div",{style:A+"z-index:40; top:"+B.topLeftBoundingBox.y1+"px; left:"+B.topLeftBoundingBox.x1+"px; width:"+(B.dialogWrapperDimensions.width-6)+"px; height:"+(B.dialogWrapperDimensions.height-6)+"px; position:absolute;"});this.options.debug.bottomRightDebugBox=new Element("div",{style:E+"z-index:40; top:"+B.bottomRightBoundingBox.y1+"px; left:"+B.bottomRightBoundingBox.x1+"px; width:"+(B.dialogWrapperDimensions.width-6)+"px; height:"+(B.dialogWrapperDimensions.height-6)+"px; position:absolute;"});this.options.debug.bottomLeftDebugBox=new Element("div",{style:F+"z-index:40; top:"+B.bottomLeftBoundingBox.y1+"px; left:"+B.bottomLeftBoundingBox.x1+"px; width:"+(B.dialogWrapperDimensions.width-6)+"px; height:"+(B.dialogWrapperDimensions.height-6)+"px; position:absolute;"});$("bodyWrapper").appendChild(this.options.debug.topRightDebugBox);$("bodyWrapper").appendChild(this.options.debug.topLeftDebugBox);$("bodyWrapper").appendChild(this.options.debug.bottomRightDebugBox);$("bodyWrapper").appendChild(this.options.debug.bottomLeftDebugBox)}},cleanUpDebug:function(){if(this.options.debug.enabled){this.options.debug.topRightDebugBox.remove();this.options.debug.topLeftDebugBox.remove();this.options.debug.bottomRightDebugBox.remove();this.options.debug.bottomLeftDebugBox.remove()}}});var Lightbox=Class.create(Dialog.Base,{initialize:function(A,C,D){var B={triggerEvent:"click",interstitial:"",id:"",compact:false,openOnInit:false};Object.extend(B,D||{});this.setProperties("Lightbox",C,B);this.isFixedAtTop=null;this.isFixedAtBottom=null;this.positionFixedUnsupportedVal=null;this.attachTriggers(A);if(this.options.openOnInit){this.open()}},createMask:function(){var A=Position.calculatePageHeight();this.markup.mask=Element.extend(document.createElement("div"));this.markup.mask.className="dialogMask";this.markup.mask.style.height=A.height+A.units},createMarkup:function(){this.createDialogDivs();this.createMask()},showDialog:function(A){log.debug("Lightbox.showDialog()");if(!this.sessionHasExpired){this.displayContent(A);this.activated=false}},positionFixedUnsupported:function(){if(this.positionFixedUnsupportedVal==null){this.positionFixedUnsupportedVal=this.markup.dialogWrapper.getStyle("position")=="absolute"}return this.positionFixedUnsupportedVal},positionInViewport:function(){var A=Position.calculateViewport();var B=Position.calculateScroll();this.markup.dialogWrapper.dim=this.markup.dialogWrapper.getDimensions();if(this.positionFixedUnsupported()){this.markup.dialogWrapper.setStyle({top:B.y+"px"})}else{this.markup.dialogWrapper.setStyle({top:"0px"})}if(this.markup.dialogWrapper.dim.width<A.width){this.markup.dialogWrapper.setStyle({left:(A.width-this.markup.dialogWrapper.dim.width)/2+"px"})}this.isFixedAtTop=true;this.isFixedAtBottom=false;this.inspectScrollData(A,B,Position.calculatePageHeight())},open:function(B){if(this.isOpen==false&&this.activated==false){this.activated=true;if(B){var A=$(Event.element(B));this.inspectTrigger(A);this.options.setUp(B)}else{if(this.triggers&&this.triggers instanceof ManagedEventObservers){var A=this.triggers.getFirstTriggerElement();this.inspectTrigger(A)}this.options.setUp()}this.createMarkup();this.showMask();this.displayLightbox();setTimeout(this.getContent.bind(this),250)}else{this.focusCloseLink();log.error("isOpen: "+this.isOpen+", activated: "+this.activated+" either the lightbox is already open or activated, see Lightbox.open")}B.preventDefault()},close:function(A){A.preventDefault();if(this.request){log.debug("aborting request");this.request.abort();this.request=null}this.trigger.focus();if(this.markup.dialogWrapper){this.markup.dialogWrapper.style.visibility="hidden"}if(this.manager){this.manager.destroy();this.manager=null}this.managedEventObservers.clear();this.closeEventObservers.clear();this.depopulateDialog();this.hideMask();this.markup.mask=this.markup.mask?this.markup.mask.destroy():null;this.removeFromDOM();if(this.options.tearDown){this.options.tearDown()}window.virtualBufferManager.update();this.activated=false;this.isOpen=false;this.lastScroll=null;this.bottomOfDialog=null;this.dialogViewportDiff=null;this.isFixedAtBottom=false;this.isFixedAtTop=false;this.dialogSelects.clear();this.response=null},showMask:function(){if(this.markup.mask){this.allSelects=$A(document.getElementsByTagName("select")).each(function(A){A.style.visibility="hidden";return Element.extend(A)});this.triggerContext.activeDialogsContainer.appendChild(this.markup.mask);this.options.closeElements.push(this.markup.mask);this.markup.mask.style.display="block";this.closeEventObservers.add(this.markup.mask,"click",this.close.bindAsEventListener(this))}else{log.error("this.markup.mask doesn't exist")}},hideMask:function(){if(this.markup.mask){this.markup.mask.style.display="none"}if(this.allSelects){this.allSelects.each(function(A){A.style.visibility="inherit"});this.allSelects.clear()}},resizeMask:function(){var A=Position.calculatePageHeight();this.markup.mask.dim=this.markup.mask.getDimensions();if(A.height>this.markup.mask.dim.height){this.markup.mask.setStyle({height:A.height+"px"})}},buildLayout:function(){if(!this.layoutBuilt){if(this.options.compact){this.markup.bottom.removeClassName("dialogBottom");this.markup.bottom.addClassName("dialogBottomCompact")}else{this.markup.bottomCloseLink.removeClassName("offscreen")}this.appendToDOM();this.markup.dialogWrapper.addClassName("fixed");this.layoutBuilt=true}},resize:function(){log.debug("Lightbox.resize");this.resizeMask();this.isFixedAtBottom=false},attachResizeListeners:function(B,D){var C;if(arguments.length>1&&$(D).getElementsByClassName){C=$(D).getElementsByClassName("resizeListener")}else{C=this.markup.dialogWrapper.getElementsByClassName("resizeListener")}for(var A=0;C[A];A++){this.managedEventObservers.add(C[A],"click",B)}},displayLightbox:function(){if(this.content.url){this.markup.mainContent.innerHTML=this.options.interstitial}this.buildLayout();this.onWindowScroll();this.managedEventObservers.add(window,"scroll",this.onWindowScroll.bindAsEventListener(this));this.managedEventObservers.add(window,"resize",this.onWindowResize.bindAsEventListener(this));this.attachCloseListeners(this.close.bindAsEventListener(this));this.attachFocusWrapListeners();this.positionInViewport();this.markup.dialogWrapper.style.visibility="visible";setTimeout(this.resize.bind(this),250);this.markup.dialogAnchor.updateAndFocus();$(this.trigger).fire("dialog:dialogOpen",{dialog:this});this.manager=new DialogManager(this.markup.dialogWrapper);this.isOpen=true;log.debug("end Lightbox.displayLightbox")},displayContent:function(A){this.response=A;this.populateDialog();this.dialogSelects=$A(this.markup.dialogWrapper.getElementsByTagName("select")).each(function(B){B.style.visibility="inherit";return Element.extend(B)});this.attachCloseListeners(this.close.bindAsEventListener(this));this.attachResizeListeners(this.onLightboxResize.bindAsEventListener(this));setTimeout(this.resize.bind(this),250);this.focusCloseLink()},replaceContent:function(A,C){if(this.isOpen==true&&this.activated==false){this.activated=true;this.response=null;this.managedEventObservers.clear();this.markup.mainContent.innerHTML=this.options.interstitial;this.resize();var D=Position.calculatePageHeight();this.markup.mask.dim=this.markup.mask.getDimensions();if(D.height>this.markup.mask.dim.height){this.markup.mask.setStyle({height:D.height+"px"})}if(arguments.length>1){var B=$H(C).toQueryString()}if(A.indexOf("?")!=-1){this.content={url:A+"&"+B}}else{this.content={url:A+"?"+B}}this.focusCloseLink();this.getContent()}else{if(this.isOpen==false){log.error("called replaceContent on a Lightbox that was not open")}}},onWindowResize:function(){this.positionInViewport();var A=Position.calculateViewport()},onLightboxResize:function(){setTimeout(this.resize.bind(this),0)},onWindowScroll:function(){var A=Position.calculateViewport();var C=Position.calculateScroll();var B=Position.calculatePageHeight();this.markup.dialogWrapper.dim=this.markup.dialogWrapper.getDimensions();this.markup.dialogWrapper.pos=this.markup.dialogWrapper.getPosition();if(this.markup.dialogWrapper.dim.height<A.height){this.bottomOfDialog=null;this.dialogViewportDiff=null;this.markup.dialogWrapper.addClassName("fixed");this.isFixedAtTop=true;this.isFixedAtBottom=false;if(this.positionFixedUnsupported()){this.markup.dialogWrapper.setStyle({top:C.y+"px"})}else{this.markup.dialogWrapper.setStyle({top:"0px"})}}else{if(this.markup.dialogWrapper.dim.height>A.height){this.bottomOfDialog=this.markup.dialogWrapper.pos.y+this.markup.dialogWrapper.dim.height;this.dialogViewportDiff=this.markup.dialogWrapper.dim.height-A.height;if(this.markup.dialogWrapper.pos.y<C.y&&this.bottomOfDialog>(C.y+A.height)){this.isFixedAtTop=false;this.isFixedAtBottom=false;if(this.markup.dialogWrapper.hasClassName("fixed")){this.markup.dialogWrapper.setStyle({top:this.markup.dialogWrapper.pos.y+"px"});this.markup.dialogWrapper.removeClassName("fixed")}}if(this.lastScroll!=null){if(C.y>this.lastScroll.y){if(this.isFixedAtTop){this.markup.dialogWrapper.removeClassName("fixed");this.markup.dialogWrapper.setStyle({top:this.lastScroll.y+"px"});this.isFixedAtTop=false;this.bottomOfDialog=this.lastScroll.y+this.markup.dialogWrapper.dim.height}if((C.y+A.height)>this.bottomOfDialog){if(!this.isFixedAtBottom){this.markup.dialogWrapper.addClassName("fixed");this.isFixedAtBottom=true}if(this.positionFixedUnsupported()){this.markup.dialogWrapper.setStyle({top:(C.y-this.dialogViewportDiff)+"px"})}else{this.markup.dialogWrapper.setStyle({top:-(this.dialogViewportDiff)+"px"})}}}else{if(C.y<this.lastScroll.y){if(this.positionFixedUnsupported()&&C.y<=this.markup.dialogWrapper.pos.y){this.markup.dialogWrapper.setStyle({top:C.y+"px"})}else{if(this.isFixedAtBottom){this.markup.dialogWrapper.removeClassName("fixed");this.markup.dialogWrapper.setStyle({top:this.lastScroll.y-this.dialogViewportDiff+"px"});this.isFixedAtBottom=false}if(C.y<=this.markup.dialogWrapper.pos.y&&!this.isFixedAtTop){this.markup.dialogWrapper.addClassName("fixed");this.markup.dialogWrapper.setStyle({top:0});this.isFixedAtTop=true}}}}}}}this.lastScroll=C},inspectScrollData:function(A,D,C){var B="Lightbox.inspectScrollData:<br/>viewport.height: "+A.height+"<br/>scroll.y: "+D.y+"<br/>page.height: "+C.height+"<br/>this.markup.dialogWrapper.dim.height: "+this.markup.dialogWrapper.dim.height+"<br/>this.markup.dialogWrapper.pos.y: "+this.markup.dialogWrapper.pos.y+"<br/>this.markup.dialogWrapper.style.top: "+this.markup.dialogWrapper.style.top+"<br/>this.bottomOfDialog: "+this.bottomOfDialog+"<br/>this.dialogViewportDiff: "+this.dialogViewportDiff+"<br/>this.markup.dialogWrapper.className: "+this.markup.dialogWrapper.className+"<br/>this.isFixedAtTop: "+this.isFixedAtTop+"<br/>this.isFixedAtBottom: "+this.isFixedAtBottom+"<br/>this.positionFixedUnsupported: "+this.positionFixedUnsupported();if(this.lastScroll!=null){B="this.lastScroll.y: "+this.lastScroll.y+"<br/>"+B}log.info(B)},removeFromDOM:function(){this._removeFromDOM();this.layoutBuilt=false},destroy:function(){this.markup.mask.dim=null;this.markup.mask=this.markup.mask.destroy();this.removeFromDOM();this.closeEventObservers.clear();this.activated=null;this.isFixedAtBottom=null;this.isFixedAtTop=null;this.isOpen=null;this.lastScroll=null;this.managedEventObservers=null;this.options.closeLabel=null;this.options.heading=null;this.options.id=null;this.options.interstitial=null;this.options.sessionTimeoutUrl=null;this.options.triggerEvent=null;this.options.setUp=function(){};this.options.tearDown=function(){};this.positionFixedUnsupportedVal=null;this.layoutBuilt=null;this.content=null;this.triggers.clear()}});var ChangeSearchLightbox=Class.create(Lightbox,{initialize:function($super,A,C,E,B){$super(A,C,E);this.wrapperMarkup=B;var D=this.content.url;if(D.indexOf("book")!=-1){this.content.url="/book/bookingpath"}else{this.content.url="/shop/searchForm"}D="&"+D.substr(D.indexOf("?")+1);D=D.replace("&amp%3B","&");D=D.replace("&amp;","&");this.options.ajaxParameters="changeSearch=true"+D},populateDialog:function($super){var A=new Element("div").update(this.wrapperMarkup);A.select("div.formWrapper")[0].update(this.response.responseText);Page.initializeDOMFragment(A);this.content.domNode=A;$super();this.content.domNode=null}});var DialogPositioningContext=Class.create({initialize:function(A){this.element=A;this.element.addClassName("dialogPositioningContext");this.activeDialogContainer=new Element("div",{"class":"activeDialogs"});this.element.appendChild(this.activeDialogContainer)}});String.prototype.parseColor=function(){var A="#";if(this.slice(0,4)=="rgb("){var C=this.slice(4,this.length-1).split(",");var B=0;do{A+=parseInt(C[B]).toColorPart()}while(++B<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var B=1;B<4;B++){A+=(this.charAt(B)+this.charAt(B)).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(B,A){B=$(B);B.setStyle({fontSize:(A/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return B};Element.getInlineOpacity=function(A){return $(A).style.opacity||""};Element.forceRerendering=function(A){try{A=$(A);var C=document.createTextNode(" ");A.appendChild(C);A.removeChild(C)}catch(B){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},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){var A=((-Math.cos(A*Math.PI)/4)+0.75)+Math.random()/4;return A>1?1:A},wobble:function(A){return(-Math.cos(A*Math.PI*(9*A))/2)+0.5},pulse:function(B,A){return(-Math.cos((B*((A||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(A){return 1-(Math.cos(A*4.5*Math.PI)*Math.exp(-A*6))},none:function(A){return 0},full:function(A){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(A){var B="position:relative";if(Prototype.Browser.IE){B+=";zoom:1"}A=$(A);$A(A.childNodes).each(function(C){if(C.nodeType==3){C.nodeValue.toArray().each(function(D){A.insertBefore(new Element("span",{style:B}).update(D==" "?String.fromCharCode(160):D),C)});Element.remove(C)}})},multiple:function(C,B){var A;if(((typeof C=="object")||Object.isFunction(C))&&(C.length)){A=C}else{A=$(C).childNodes}var D=Object.extend({speed:0.1,delay:0},arguments[2]||{});var E=D.delay;$A(A).each(function(G,F){new B(G,Object.extend(D,{delay:F*D.speed+E}))})},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)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(A){this.effects._each(A)},add:function(B){var C=new Date().getTime();var A=Object.isString(B.options.queue)?B.options.queue:B.options.queue.position;switch(A){case"front":this.effects.findAll(function(D){return D.state=="idle"}).each(function(D){D.startOn+=B.finishOn;D.finishOn+=B.finishOn});break;case"with-last":C=this.effects.pluck("startOn").max()||C;break;case"end":C=this.effects.pluck("finishOn").max()||C;break}B.startOn+=C;B.finishOn+=C;if(!B.options.queue.limit||(this.effects.length<B.options.queue.limit)){this.effects.push(B)}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 B=0,A=this.effects.length;B<A;B++){this.effects[B]&&this.effects[B].loop(C)}}});Effect.Queues={instances:$H(),get:function(A){if(!Object.isString(A)){return A}return this.instances.get(A)||this.instances.set(A,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(A){function B(D,C){return((D[C+"Internal"]?"this.options."+C+"Internal(this);":"")+(D[C]?"this.options."+C+"(this);":""))}if(A&&A.transition===false){A.transition=Effect.Transitions.linear}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.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function C(E,D){if(E.options[D+"Internal"]){E.options[D+"Internal"](E)}if(E.options[D]){E.options[D](E)}}return function(D){if(this.state==="idle"){this.state="running";C(this,"beforeSetup");if(this.setup){this.setup()}C(this,"afterSetup")}if(this.state==="running"){D=(this.options.transition(D)*this.fromToDelta)+this.options.from;this.position=D;C(this,"beforeUpdate");if(this.update){this.update(D)}C(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(A){if(A>=this.startOn){if(A>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var C=(A-this.startOn)/this.totalTime,B=(C*this.totalFrames).round();if(B>this.currentFrame){this.render(C);this.currentFrame=B}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"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(!Object.isFunction(this[property])){A.set(property,this[property])}}return"#<Effect:"+A.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{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.Tween=Class.create(Effect.Base,{initialize:function(C,F,E){C=Object.isString(C)?$(C):C;var A=$A(arguments),D=A.last(),B=A.length==5?A[3]:null;this.method=Object.isFunction(D)?D.bind(C):Object.isFunction(C[D])?C[D].bind(C):function(G){C[D]=G};this.start(Object.extend({from:F,to:E},B||{}))},update:function(A){this.method(A)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!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(Effect.Base,{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:(this.options.x*A+this.originalLeft).round()+"px",top:(this.options.y*A+this.originalTop).round()+"px"})}});Effect.MoveBy=function(B,C,A){return new Effect.Move(B,Object.extend({x:A,y:C},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(B,A){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:A},arguments[2]||{});this.start(C)},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(A){var B=(this.options.scaleFrom/100)+(this.factor*A);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*B+this.fontSizeType})}this.setDimensions(this.dims[0]*B,this.dims[1]*B)},finish:function(A){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(D,C){var E={};if(this.options.scaleX){E.width=C.round()+"px"}if(this.options.scaleY){E.height=D.round()+"px"}if(this.options.scaleFromCenter){var B=(D-this.dims[0])/2;var A=(C-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){E.top=this.originalTop-B+"px"}if(this.options.scaleX){E.left=this.originalLeft-A+"px"}}else{if(this.options.scaleY){E.top=-B+"px"}if(this.options.scaleX){E.left=-A+"px"}}}this.element.setStyle(E)}});Effect.Highlight=Class.create(Effect.Base,{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(B,C,D){return B+((this._base[D]+(this._delta[D]*A)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(A){var B=arguments[1]||{},D=document.viewport.getScrollOffsets(),C=$(A).cumulativeOffset();if(B.offset){C[1]+=B.offset}return new Effect.Tween(null,D.top,C[1],B,function(E){scrollTo(D.left,E.round())})};Effect.Fade=function(B){B=$(B);var A=B.getInlineOpacity();var C=Object.extend({from:B.getOpacity()||1,to:0,afterFinishInternal:function(D){if(D.options.to!=0){return}D.element.hide().setStyle({opacity:A})}},arguments[1]||{});return new Effect.Opacity(B,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(B){B=$(B);var A={opacity:B.getInlineOpacity(),position:B.getStyle("position"),top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};return new Effect.Parallel([new Effect.Scale(B,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(B,{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(A)}},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(B){B=$(B);var A=B.getDimensions();return new Effect.Scale(B,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(C){C.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(C){C.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(B){B=$(B);var A=B.getInlineOpacity();return new Effect.Appear(B,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:A})}})}},arguments[1]||{}))};Effect.DropOut=function(B){B=$(B);var A={top:B.getStyle("top"),left:B.getStyle("left"),opacity:B.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(B,{x:0,y:100,sync:true}),new Effect.Opacity(B,{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(A)}},arguments[1]||{}))};Effect.Shake=function(B){B=$(B);var D=Object.extend({distance:20,duration:0.5},arguments[1]||{});var E=parseFloat(D.distance);var C=parseFloat(D.duration)/10;var A={top:B.getStyle("top"),left:B.getStyle("left")};return new Effect.Move(B,{x:E,y:0,duration:C,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(G){new Effect.Move(G.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(H){new Effect.Move(H.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(I){new Effect.Move(I.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(J){new Effect.Move(J.element,{x:-E,y:0,duration:C,afterFinishInternal:function(K){K.element.undoPositioned().setStyle(A)}})}})}})}})}})}})};Effect.SlideDown=function(B){B=$(B).cleanWhitespace();var C=B.down().getStyle("bottom");var A=B.getDimensions();return new Effect.Scale(B,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:A.height,originalWidth:A.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(B){B=$(B).cleanWhitespace();var C=B.down().getStyle("bottom");var A=B.getDimensions();return new Effect.Scale(B,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(D){D.element.makePositioned();D.element.down().makePositioned();if(window.opera){D.element.setStyle({top:""})}D.element.makeClipping().show()},afterUpdateInternal:function(D){D.element.down().setStyle({bottom:(D.dims[0]-D.element.clientHeight)+"px"})},afterFinishInternal:function(D){D.element.hide().undoClipping().undoPositioned();D.element.down().undoPositioned().setStyle({bottom:C})}},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 C=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var A={top:B.style.top,left:B.style.left,height:B.style.height,width:B.style.width,opacity:B.getInlineOpacity()};var H=B.getDimensions();var F,G;var E,D;switch(C.direction){case"top-left":F=G=E=D=0;break;case"top-right":F=H.width;G=D=0;E=-H.width;break;case"bottom-left":F=E=0;G=H.height;D=-H.height;break;case"bottom-right":F=H.width;G=H.height;E=-H.width;D=-H.height;break;case"center":F=H.width/2;G=H.height/2;E=-H.width/2;D=-H.height/2;break}return new Effect.Move(B,{x:F,y:G,duration:0.01,beforeSetup:function(I){I.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(I){new Effect.Parallel([new Effect.Opacity(I.element,{sync:true,to:1,from:0,transition:C.opacityTransition}),new Effect.Move(I.element,{x:E,y:D,sync:true,transition:C.moveTransition}),new Effect.Scale(I.element,100,{scaleMode:{originalHeight:H.height,originalWidth:H.width},sync:true,scaleFrom:window.opera?1:0,transition:C.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(J){J.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(J){J.effects[0].element.undoClipping().undoPositioned().setStyle(A)}},C))}})};Effect.Shrink=function(B){B=$(B);var C=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var A={top:B.style.top,left:B.style.left,height:B.style.height,width:B.style.width,opacity:B.getInlineOpacity()};var F=B.getDimensions();var E,D;switch(C.direction){case"top-left":E=D=0;break;case"top-right":E=F.width;D=0;break;case"bottom-left":E=0;D=F.height;break;case"bottom-right":E=F.width;D=F.height;break;case"center":E=F.width/2;D=F.height/2;break}return new Effect.Parallel([new Effect.Opacity(B,{sync:true,to:0,from:1,transition:C.opacityTransition}),new Effect.Scale(B,window.opera?1:0,{sync:true,transition:C.scaleTransition,restoreAfterFinish:true}),new Effect.Move(B,{x:E,y:D,sync:true,transition:C.moveTransition})],Object.extend({beforeStartInternal:function(G){G.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(G){G.effects[0].element.hide().undoClipping().undoPositioned().setStyle(A)}},C))};Effect.Pulsate=function(C){C=$(C);var D=arguments[1]||{},B=C.getInlineOpacity(),E=D.transition||Effect.Transitions.linear,A=function(F){return 1-E((-Math.cos((F*(D.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(C,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(F){F.element.setStyle({opacity:B})}},D),{transition:A}))};Effect.Fold=function(B){B=$(B);var A={top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};B.makeClipping();return new Effect.Scale(B,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(C){new Effect.Scale(B,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(D){D.element.hide().undoClipping().setStyle(A)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(C.style)){this.style=$H(C.style)}else{if(C.style.include(":")){this.style=C.style.parseStyle()}else{this.element.addClassName(C.style);this.style=$H(this.element.getStyles());this.element.removeClassName(C.style);var B=this.element.getStyles();this.style=this.style.reject(function(D){return D.value==B[D.key]});C.afterFinishInternal=function(D){D.element.addClassName(D.options.style);D.transforms.each(function(E){D.element.style[E.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(G){var B=G[0],F=G[1],E=null;if(F.parseColor("#zzzzzz")!="#zzzzzz"){F=F.parseColor();E="color"}else{if(B=="opacity"){F=parseFloat(F);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(F)){var D=F.match(/^([\+\-]?[0-9\.]+)(.*)$/);F=parseFloat(D[1]);E=(D.length==3)?D[2]:null}}}var C=this.element.getStyle(B);return{style:B.camelize(),originalValue:E=="color"?A(C):parseFloat(C||0),targetValue:E=="color"?A(F):F,unit:E}}.bind(this)).reject(function(B){return((B.originalValue==B.targetValue)||(B.unit!="color"&&(isNaN(B.originalValue)||isNaN(B.targetValue))))})},update:function(A){var D={},B,C=this.transforms.length;while(C--){D[(B=this.transforms[C]).style]=B.unit=="color"?"#"+(Math.round(B.originalValue[0]+(B.targetValue[0]-B.originalValue[0])*A)).toColorPart()+(Math.round(B.originalValue[1]+(B.targetValue[1]-B.originalValue[1])*A)).toColorPart()+(Math.round(B.originalValue[2]+(B.targetValue[2]-B.originalValue[2])*A)).toColorPart():(B.originalValue+(B.targetValue-B.originalValue)*A).toFixed(3)+(B.unit===null?"":B.unit)}this.element.setStyle(D,true)}});Effect.Transform=Class.create({initialize:function(A){this.tracks=[];this.options=arguments[1]||{};this.addTracks(A)},addTracks:function(A){A.each(function(B){B=$H(B);var C=B.values().first();this.tracks.push($H({ids:B.keys().first(),effect:Effect.Morph,options:{style:C}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(B){var E=B.get("ids"),C=B.get("effect"),D=B.get("options");var A=[$(E)||$$(E)].flatten();return A.map(function(F){return new C(F,Object.extend({sync:true},D))})}).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.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var B,A=$H();if(Prototype.Browser.WebKit){B=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';B=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(C){if(B[C]){A.set(C,B[C])}});if(Prototype.Browser.IE&&this.include("opacity")){A.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return A};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(A){var B=document.defaultView.getComputedStyle($(A),null);return Element.CSS_PROPERTIES.inject({},function(D,C){D[C]=B[C];return D})}}else{Element.getStyles=function(B){B=$(B);var C=B.currentStyle,A;A=Element.CSS_PROPERTIES.inject({},function(E,D){E[D]=C[D];return E});if(!A.opacity){A.opacity=B.getOpacity()}return A}}Effect.Methods={morph:function(A,B){A=$(A);new Effect.Morph(A,Object.extend({style:B},arguments[2]||{}));return A},visualEffect:function(C,B,D){C=$(C);var E=B.dasherize().camelize(),A=E.charAt(0).toUpperCase()+E.substring(1);new Effect[A](C,D);return C},highlight:function(A,B){A=$(A);new Effect.Highlight(A,B);return A}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(A){Effect.Methods[A]=function(B,C){B=$(B);Effect[A.charAt(0).toUpperCase()+A.substring(1)](B,C);return B}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(A){Effect.Methods[A]=Element[A]});Element.addMethods(Effect.Methods);if(!Control){var Control={}}Control.Slider=Class.create({initialize:function(A,C,D){var B=this;if(Object.isArray(A)){this.handles=A.collect(function(E){return $(E)})}else{this.handles=[$(A)]}this.track=$(C);this.options=D||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1");this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(E){return $(E)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0");this.alignY=parseInt(this.options.alignY||"0");this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled){this.setDisabled()}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(F,E){E=B.handles.length-1-E;B.setValue(parseFloat((Object.isArray(B.options.sliderValue)?B.options.sliderValue[E]:B.options.sliderValue)||B.range.start),E);F.makePositioned().observe("mousedown",B.eventMouseDown)});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var A=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(B){Event.stopObserving(B,"mousedown",A.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(A){if(this.allowedValues){if(A>=this.allowedValues.max()){return(this.allowedValues.max())}if(A<=this.allowedValues.min()){return(this.allowedValues.min())}var C=Math.abs(this.allowedValues[0]-A);var B=this.allowedValues[0];this.allowedValues.each(function(D){var E=Math.abs(D-A);if(E<=C){B=D;C=E}});return B}if(A>this.range.end){return this.range.end}if(A<this.range.start){return this.range.start}return A},setValue:function(B,A){if(!this.active){this.activeHandleIdx=A||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}A=A||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((A>0)&&(B<this.values[A-1])){B=this.values[A-1]}if((A<(this.handles.length-1))&&(B>this.values[A+1])){B=this.values[A+1]}}B=this.getNearestValue(B);this.values[A]=B;this.value=this.values[0];this.handles[A].style[this.isVertical()?"top":"left"]=this.translateToPx(B);this.drawSpans();if(!this.dragging||!this.event){this.updateFinished()}},setValueBy:function(B,A){this.setValue(this.values[A||this.activeHandleIdx||0]+B,A||this.activeHandleIdx||0)},translateToPx:function(A){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(A-this.range.start))+"px"},translateToValue:function(A){return((A/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)},getRange:function(B){var A=this.values.sortBy(Prototype.K);B=B||0;return $R(A[B],A[B+1])},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX)},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var A=this;if(this.spans){$R(0,this.spans.length-1).each(function(B){A.setSpan(A.spans[B],A.getRange(B))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(B,A){if(this.isVertical()){B.style.top=this.translateToPx(A.start);B.style.height=this.translateToPx(A.end-A.start+this.range.start)}else{B.style.left=this.translateToPx(A.start);B.style.width=this.translateToPx(A.end-A.start+this.range.start)}},updateStyles:function(){this.handles.each(function(A){Element.removeClassName(A,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(D){if(Event.isLeftClick(D)){if(!this.disabled){this.active=true;var A=Event.element(D);var E=[Event.pointerX(D),Event.pointerY(D)];var C=A;if(C==this.track){var B=Position.cumulativeOffset(this.track);this.event=D;this.setValue(this.translateToValue((this.isVertical()?E[1]-B[1]:E[0]-B[0])-(this.handleLength/2)));var B=Position.cumulativeOffset(this.activeHandle);this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}else{while((this.handles.indexOf(A)==-1)&&A.parentNode){A=A.parentNode}if(this.handles.indexOf(A)!=-1){this.activeHandle=A;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var B=Position.cumulativeOffset(this.activeHandle);this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}}}Event.stop(D)}},update:function(A){if(this.active){if(!this.dragging){this.dragging=true}this.draw(A);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(A)}},draw:function(B){var C=[Event.pointerX(B),Event.pointerY(B)];var A=Position.cumulativeOffset(this.track);C[0]-=this.offsetX+A[0];C[1]-=this.offsetY+A[1];this.event=B;this.setValue(this.translateToValue(this.isVertical()?C[1]:C[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(A){if(this.active&&this.dragging){this.finishDrag(A,true);Event.stop(A)}this.active=false;this.dragging=false},finishDrag:function(A,B){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}});if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(A,C,B){A=$(A);this.element=A;this.update=$(C);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;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(D,E){if(!E.style.position||E.style.position=="absolute"){E.style.position="absolute";Position.clone(D,E,{setHeight:false,offsetTop:D.offsetHeight})}Effect.Appear(E,{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)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}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,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(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();Event.stop(A);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(A);return}}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>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(F){if(this.options.updateElement){this.options.updateElement(F);return}var D="";if(this.options.select){var B=$(F).select("."+this.options.select)||[];if(B.length>0){D=Element.collectTextNodes(B[0],this.options.select)}}else{D=Element.collectTextNodesIgnoreClass(F,"informal")}var A=this.getTokenBounds();if(A[0]!=-1){var E=this.element.value.substr(0,A[0]);var C=this.element.value.substr(A[0]).match(/^\s+/);if(C){E+=C[0]}this.element.value=E+D+this.element.value.substr(A[1])}else{this.element.value=D}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,F)}},updateChoices:function(C){if(!this.changed&&this.hasFocus){this.update.innerHTML=C;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 A=0;A<this.entryCount;A++){var B=this.getEntry(A);B.autocompleteIndex=A;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;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var A=this.getTokenBounds();return this.element.value.substring(A[0],A[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var E=this.element.value;if(E.strip().empty()){return[-1,0]}var F=arguments.callee.getFirstDifferencePos(E,this.oldElementValue);var H=(F==this.oldElementValue.length?1:0);var D=-1,C=E.length;var G;for(var B=0,A=this.options.tokens.length;B<A;++B){G=E.lastIndexOf(this.options.tokens[B],F+H-1);if(G>D){D=G}G=E.indexOf(this.options.tokens[B],F+H);if(-1!=G&&G<C){C=G}}return(this.tokenBounds=[D+1,C])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(C,A){var D=Math.min(C.length,A.length);for(var B=0;B<D;++B){if(C[B]!=A[B]){return B}}return D};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(B,D,A,C){this.baseInitialize(B,D,C);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=A},getUpdatedChoices:function(){this.startIndicator();var A=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,A):A;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.Base,{initialize:function(A,C,D,B){this.baseInitialize(A,C,B);this.options.array=D},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(B){var C=[];var E=[];var H=B.getToken();var G=0;for(var D=0;D<B.options.array.length&&C.length<B.options.choices;D++){var F=B.options.array[D];var I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase()):F.indexOf(H);while(I!=-1){if(I==0&&F.length!=H.length){C.push("<li><strong>"+F.substr(0,H.length)+"</strong>"+F.substr(H.length)+"</li>");break}else{if(H.length>=B.options.partialChars&&B.options.partialSearch&&I!=-1){if(B.options.fullSearch||/\s/.test(F.substr(I-1,1))){E.push("<li>"+F.substr(0,I)+"<strong>"+F.substr(I,H.length)+"</strong>"+F.substr(I+H.length)+"</li>");break}}}I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase(),I+1):F.indexOf(H,I+1)}}if(E.length){C=C.concat(E.slice(0,B.options.choices-C.length))}return"<ul>"+C.join("")+"</ul>"}},A||{})}});Field.scrollFreeActivate=function(A){setTimeout(function(){Field.activate(A)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(B,A,C){this.url=A;this.element=B=$(B);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(C);Object.extend(this.options,C||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=""}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}if(!this.options.externalControl){this.options.externalControlOnly=false}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(A){if(!this._editing||A.ctrlKey||A.altKey||A.shiftKey){return}if(Event.KEY_ESC==A.keyCode){this.handleFormCancellation(A)}else{if(Event.KEY_RETURN==A.keyCode){this.handleFormSubmission(A)}}},createControl:function(G,C,B){var E=this.options[G+"Control"];var F=this.options[G+"Text"];if("button"==E){var A=document.createElement("input");A.type="submit";A.value=F;A.className="editor_"+G+"_button";if("cancel"==G){A.onclick=this._boundCancelHandler}this._form.appendChild(A);this._controls[G]=A}else{if("link"==E){var D=document.createElement("a");D.href="#";D.appendChild(document.createTextNode(F));D.onclick="cancel"==G?this._boundCancelHandler:this._boundSubmitHandler;D.className="editor_"+G+"_link";if(B){D.className+=" "+B}this._form.appendChild(D);this._controls[G]=D}}},createEditField:function(){var C=(this.options.loadTextURL?this.options.loadingText:this.getText());var B;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){B=document.createElement("input");B.type="text";var A=this.options.size||this.options.cols||0;if(0<A){B.size=A}}else{B=document.createElement("textarea");B.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);B.cols=this.options.cols||40}B.name=this.options.paramName;B.value=C;B.className="editor_field";if(this.options.submitOnBlur){B.onblur=this._boundSubmitHandler}this._controls.editor=B;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var B=this;function A(E,C){var D=B.options["text"+E+"Controls"];if(!D||C===false){return}B._form.appendChild(document.createTextNode(D))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)}A("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);A("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");A("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML}this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(A){if(this._saving||this._editing){return}this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(A){Event.stop(A)}},enterHover:function(A){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(A){this.triggerCallback("onFailure",A);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(A){this.wrapUp();if(A){Event.stop(A)}},handleFormSubmission:function(D){var B=this._form;var C=$F(this._controls.editor);this.prepareSubmission();var E=this.options.callback(B,C)||"";if(Object.isString(E)){E=E.toQueryParams()}E.editorId=this.element.id;if(this.options.htmlResponse){var A=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(A,{parameters:E,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,A)}else{var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:E,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,A)}if(D){Event.stop(D)}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show()}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(A){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(C){this._form.removeClassName(this.options.loadingClassName);var B=C.responseText;if(this.options.stripLoadedTextTags){B=B.stripTags()}this._controls.editor.value=B;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,A)},postProcessEditField:function(){var A=this.options.fieldPostCreation;if(A){$(this._controls.editor)["focus"==A?"focus":"activate"]()}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(A){Object.extend(this.options,A)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var A;$H(Ajax.InPlaceEditor.Listeners).each(function(B){A=this[B.value].bind(this);this._listeners[B.key]=A;if(!this.options.externalControlOnly){this.element.observe(B.key,A)}if(this.options.externalControl){this.options.externalControl.observe(B.key,A)}}.bind(this))},removeForm:function(){if(!this._form){return}this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(B,A){if("function"==typeof this.options[B]){this.options[B](this,A)}},unregisterListeners:function(){$H(this._listeners).each(function(A){if(!this.options.externalControlOnly){this.element.stopObserving(A.key,A.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(A.key,A.value)}}.bind(this))},wrapUp:function(A){this.leaveEditMode();this._boundComplete(A,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,B,A,C){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(B,A,C)},createEditField:function(){var A=document.createElement("select");A.name=this.options.paramName;A.size=1;this._controls.editor=A;this._collection=this.options.collection||[];if(this.options.loadCollectionURL){this.loadCollection()}else{this.checkForExternalText()}this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js)){throw ("Server returned an invalid collection representation.")}this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(B){this._controls.editor.disabled=true;var A=this._controls.editor.firstChild;if(!A){A=document.createElement("option");A.value="";this._controls.editor.appendChild(A);A.selected=true}A.update((B||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(B){this._text=B.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,A)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(D){return 2===D.length?D:[D,D].flatten()});var B=("value" in this.options)?this.options.value:this._text;var C=this._collection.any(function(D){return D[0]==B}.bind(this));this._controls.editor.update("");var A;this._collection.each(function(E,D){A=document.createElement("option");A.value=E[0];A.selected=C?E[0]==B:0==D;A.appendChild(document.createTextNode(E[1]));this._controls.editor.appendChild(A)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(A){if(!A){return}function B(C,D){if(C in A||D===undefined){return}A[C]=D}B("cancelControl",(A.cancelLink?"link":(A.cancelButton?"button":A.cancelLink==A.cancelButton==false?false:undefined)));B("okControl",(A.okLink?"link":(A.okButton?"button":A.okLink==A.okButton==false?false:undefined)));B("highlightColor",A.highlightcolor);B("highlightEndColor",A.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(A){return Form.serialize(A)},onComplete:function(B,A){new Effect.Highlight(A,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(A){A.element.style.backgroundColor=A.options.highlightColor;if(A._effect){A._effect.cancel()}},onFailure:function(B,A){alert("Error communication with the server: "+B.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(A){A._effect=new Effect.Highlight(A.element,{startcolor:A.options.highlightColor,endcolor:A.options.highlightEndColor,restorecolor:A._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(B,A,C){this.delay=A||0.5;this.element=$(B);this.callback=C;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))}});Object.extend(Autocompleter.Base.prototype,{markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}}});Object.extend(Ajax.Autocompleter.prototype,{initialize:function(B,D,A,C){this.baseInitialize(B,D,C);this.options.asynchronous=true;this.options.onSuccess=this.onSuccess.bind(this);this.options.onFailure=this.onFailure.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=A},onSuccess:function(A){this.updateChoices(A.responseText)},onFailure:function(A){log.error("Ajax.Autocompleter: request failed")}});Ajax.AutocompleterJSON=Class.create(Ajax.Autocompleter,{onSuccess:function(E){try{var B=E.responseText.evalJSON(true);if(B.length>0){this.results=B}}catch(G){log.error("Ajax.Autocompleter: invalid response")}var C=new Element("div");var F=new Element("ul");C.appendChild(F);for(var A=0;A<B.length;A++){var D=new Element("li").update(B[A].suggestion);if(A%2==0){D.setAttribute("class","odd")}else{D.setAttribute("class","even")}F.appendChild(D)}if(this.options.transformResponse){F=this.options.transformResponse(F)}this.updateChoices(C.innerHTML)}});Abstract.Agent=Class.create();Abstract.Agent.prototype={initialize:function(B,C){if(typeof(B)=="object"){try{Profiler.start(C.type);log.debug(C.type+".initialize() *");Object.extend(this,C);this.element=Element.extend(B);this.initExtend();Profiler.stop(C.type)}catch(A){Errors.capture(A,"Initialization failure : "+C.type,"Source element : "+B)}}},initializeChildren:function(){var self=this;if(Page.childAgents[self.type]){this.childAgents=[];Page.childAgents[self.type].each(function(child,index){eval("new "+child.agent.type+"(child.element,self)");Page.childAgents[self.type][index]=null});Page.childAgents[self.type]=Page.childAgents[self.type].compact()}},initExtend:function(){}};Abstract.ChildAgent=Class.create();Abstract.ChildAgent.prototype={initialize:function(C,A){if(typeof(C)=="object"){try{this.parent=A;this.element=Element.extend(C);this.agent=this.element.getAgents()[0];Object.extend(this,this.agent);Profiler.start(this.type);log.debug(this.agent.type+".initialize() *");this.initExtend.apply(this,arguments);A.childAgents.push(this);Profiler.stop(this.type)}catch(B){Errors.capture(B,"Initialization failure : "+this.agent.type,"Source element : "+C)}}},initExtend:function(){}};var Page={agents:[],childAgents:[],hideRevealRadios:[],init:function(){Profiler.start("Loading DOM");Profiler.start("Combined: Loading DOM + init");Event.onDOMReady(function(){if(Page.isInitialized==true){return}Profiler.stop("Loading DOM");Page.initializeDOMFragment($("bodyWrapper"));Profiler.stop("Combined: Loading DOM + init")})},initAgent:function(element,agent){try{var object=(eval(("new "+agent.type+"(element, agent)")));if(!this.agents[agent.type]){this.agents[agent.type]=[]}this.agents[agent.type].push(object)}catch(e){log.warning("Error trying to instantiate agent of type "+agent.type+". Error: \n\n"+e)}},initializeAjaxResponse:function(A){var B=$(document.createElement("DIV"));B.innerHTML=A;Page.initializeDOMFragment(B)},initializeDOMFragment:function(C){Profiler.start("Page.init");var C=Element.extend(C);var A=C.getElementsByAttribute("agent");var B=[];var H=$A();for(var F=0;A[F];F++){var I=A[F];var G=I.getAgents();for(var E=0;G[E];E++){if(G[E].deferred=="true"){B.push({element:I,agent:G[E]})}else{if(G[E].childOf!=""&&G[E].childOf!=undefined){if(this.childAgents[G[E].childOf]==null){this.childAgents[G[E].childOf]=[]}this.childAgents[G[E].childOf].push({element:I,agent:G[E]})}else{if(G[E].lazy!="true"){this.initAgent(I,G[E])}}}}}for(var D=0;B[D];D++){this.initAgent(B[D].element,B[D].agent)}Profiler.stop("Page.init");Page.isInitialized=true}};YAHOO.tool.Profiler.registerFunction("Abstract.Agent.prototype.initialize");var Calendar=Class.create();Calendar.prototype=Object.extend(new Abstract.Agent(),{datePattern:"",initExtend:function(){this.body=this.element.getFirstElementByClassName("calendarBody");this.dateSeparator=null;this.NUM_WEEKS=6;this.X_OFFSET=60;this.Y_OFFSET=-82;this.inputFocused=false;this.calendarFocused=false;this.daysPerMonth=[31,28,31,30,31,30,31,31,30,31,30,31];this.monthNames=this.params.months.split(",");this.dayNames=this.params.days.split(",");this.closeString=this.params.close;var A=new Date(this.params.today);this.today=new Date(A.getFullYear(),A.getMonth(),A.getDate(),0,0,0);this.calDate=new Date(this.params.today);this.maxDate=new Date(this.params.maxDate);this.firstDayOfWeekIndex=this.params.firstDayOfWeekIndex/1;this.processPattern();var B=true;if(this.dateSeparator==null){B=false;log.warning("Calendar: unsupported date format or date separator pattern supplied.")}if(this.monthNames.length!=12){B=false;log.warning("Calendar: twelve (12) month names not defined")}if(this.dayNames.length!=7){B=false;log.warning("Calendar: seven (7) day names not defined")}if(this.pattern.string.length==0){B=false;log.warning("Calendar: invalid date format pattern")}if(B){this.isFirstDate=null;Event.observe(document,"mouseup",this.documentClick.bindAsEventListener(this));if(this.params.parentClass){this.ancestor=this.element.getParentByClassName(this.params.parentClass)}else{if(this.params.parentTag){this.ancestor=this.element.getParentByTagName(this.params.parentTag)}else{this.ancestor=$$("body")}}this.days=this.buildMarkupWithObservers();this.addInputObservers();this.repositionAndShim();this.element.addClassName("active")}else{this.gracefullyDegrade()}},gracefullyDegrade:function(){log.error("Calendar: initialization failed due to calendarRules model")},processPattern:function(){this.pattern=new Object();this.pattern.string=new String(this.params.pattern);this.pattern.localisedString=new String(this.params.localisedPattern);this.setDateSeparator(this.pattern.string);if(this.pattern.string.length!=0){this.pattern.string=this.pattern.string.toLowerCase();var A=this.pattern.string.split(this.dateSeparator);for(var C=0;C<A.length;C++){if(A[C].indexOf("y")!=-1){this.pattern.yearStringLength=A[C].length;A[C]="y"}if(A[C].indexOf("m")!=-1){A[C]="m"}if(A[C].indexOf("d")!=-1){A[C]="d"}}this.pattern.yearPosition=A.indexOf("y");this.pattern.monthPosition=A.indexOf("m");this.pattern.dayPosition=A.indexOf("d");var B=new String(A[0]+this.dateSeparator+A[1]+this.dateSeparator+A[2]);this.pattern.simpleString=B;B=B.replace("d","\\d{1,2}");B=B.replace("m","\\d{1,2}");B=B.replace("y","\\d{1,"+this.pattern.yearStringLength+"}");this.regExpPattern=new RegExp(B);Calendar.prototype.datePattern=this.pattern.string}},setDateSeparator:function(A){if(A.indexOf("/")!=-1&&A.indexOf("/")!=A.lastIndexOf("/")){this.dateSeparator="/"}else{if(A.indexOf("-")!=-1&&A.indexOf("-")!=A.lastIndexOf("-")){this.dateSeparator="-"}else{if(A.indexOf(".")!=-1&&A.indexOf(".")!=A.lastIndexOf(".")){this.dateSeparator="."}}}},formatDateString:function(C){var B=this.pattern;var E=B.simpleString;var A=C.split("_");var D=(A[0]/1)+1+"";if(D.length!=2){D="0"+D}E=E.replace("m",D);var G=A[1]+"";if(G.length!=2){G="0"+G}E=E.replace("d",G);var F=A[2]+"";if(F.length!=B.yearStringLength){while(F.length>B.yearStringLength){F=F.substr(1)}}E=E.replace("y",F);return E},buildMarkupWithObservers:function(){Event.observe(this.body,"mousedown",this.setCalendarFocus.bindAsEventListener(this));var K=$A();var E='<div class="closeBar"><span>'+this.closeString+"</span></div>";E+='<table cellpadding="0" cellspacing="0" border="0"><thead><tr>';E+='<th colspan="'+this.dayNames.length+'"><span class="arrow arrowPrev visible"></span>';E+='<span class="arrow arrowNext visible"></span><span class="monthName"></span></th></tr></thead>';E+="<tbody><tr>";for(var G=0;this.dayNames[G];G++){var H=(G+this.firstDayOfWeekIndex)%this.dayNames.length;E+="<th>"+this.dayNames[H]+"</th>"}E+="</tr>";for(var C=0;C<this.NUM_WEEKS;C++){if(C==this.NUM_WEEKS-1){E+='<tr class="week last"></tr>'}else{E+='<tr class="week"></tr>'}}E+="</tbody></table>";this.body.update(E);var J=this.body.getElementsByClassName("arrow");this.previousArrow=J[0];this.nextArrow=J[1];Event.observe(this.nextArrow,"click",this.changeMonth.bindAsEventListener(this));Event.observe(this.previousArrow,"click",this.changeMonth.bindAsEventListener(this));var B=this.body.getFirstElementByClassName("closeBar");var I=B.getElementsByTagName("span")[0];Event.observe(I,"click",this.hideCalendar.bindAsEventListener(this));var A=this.body.getElementsByClassName("week");for(var F=0;F<A.length;F++){for(var G=0;this.dayNames[G];G++){var D=document.createElement("td");A[F].appendChild(D);K.push(D);Event.observe(D,"click",this.selectDate.bindAsEventListener(this));Event.observe(D,"mouseover",this.highlight.bindAsEventListener(this));Event.observe(D,"mouseout",this.clearHighlight.bindAsEventListener(this))}}return K},addInputObservers:function(){this.userStartDate=null;this.userEndDate=null;this.dateInputArray=$A();if(this.params.selectors){this.selectors=this.params.selectors.split(",");var B=$A();for(var I=0;this.selectors[I];I++){var H=this.ancestor.getElementsBySelector(this.selectors[I]);for(var F=0;H[F];F++){var C=H[F];var D=H[F].getElementsByTagName("input");for(var E=0;D[E];E++){var A=D[E];A.datePairParent=C;B.push(A);this.dateInputArray.push(A);if(A.value.length==0){A.value=this.pattern.localisedString}else{if(this.dateInputArray.length==1){this.userStartDate=this.validateDate(A.value)}else{this.userEndDate=this.validateDate(A.value)}}}if(this.dateInputArray.length==2){this.computeDuration(C)}}}for(var I=0;B[I];I++){Event.observe(B[I],"focus",this.showAndPosition.bindAsEventListener(this));Event.observe(B[I],"blur",this.setInputBlur.bindAsEventListener(this));if(B[I].form){var G=B[I].form.getInputs("submit");for(var F=0;G[F];F++){Event.observe(G[F],"click",this.clearField.bindAsEventListener(this,B[I]))}}}}},repositionAndShim:function(){var B=document.createElement("iframe");B.src="/script/empty.html";this.element.insertBefore(B,this.element.childNodes[0]);var A=this.element.parentNode;A.removeChild(this.element);this.ancestor.insertBefore(this.element,this.ancestor.childNodes[0])},showAndPosition:function(B){this.inputFocused=true;this.calendarFocused=false;var I=this.eventElement;log.info("previous event element="+I);this.eventElement=Event.element(B);if(I!=this.eventElement||!this.element.visibleByClass()){if(this.element.visibleByClass()){this.element.hideByClass()}var G=Position.cumulativeOffset(this.eventElement);var K=Position.cumulativeOffset(this.element.getOffsetParent());var D=(G[0]-K[0]+this.X_OFFSET)/10.88;var C=(G[1]-K[1]+this.Y_OFFSET)/10.88;this.element.style.left=D+"em";this.element.style.top=C+"em";var J=this.validateDate();var E=true;var F=null;this.isFirstDate=true;for(i=1;i<this.dateInputArray.length;i++){if(this.dateInputArray[i]==this.eventElement){var H=null;var A=i-1;while(H==null&&A>=0){H=this.validateDate(this.dateInputArray[A].value);A--}this.userStartDate=H;this.isFirstDate=false}}if(this.isFirstDate){this.userStartDate=J;this.calDate=J;if(this.userStartDate==null){this.calDate=this.today;E=false}}else{this.userEndDate=J;this.calDate=J;if(this.userEndDate==null&&this.userStartDate!=null){this.calDate=this.userStartDate;F=this.userStartDate}else{if(this.userEndDate==null&&this.userStartDate==null){this.calDate=this.today;E=false}else{if(this.userStartDate!=null){if(this.compareDates(this.userEndDate,"<",this.userStartDate)){this.calDate=this.userStartDate;E=false}F=this.userStartDate}else{log.info("this.userStartDate is null, so not setting validStartDate")}}}}this.update(F,E);if(!this.element.visibleByClass()){this.element.showByClass()}}this.eventElement.select()},compareDates:function(dateA,compareString,dateB){var returnVal;try{var evalString=String(Date.parse(dateA)+compareString+Date.parse(dateB));log.info("method compareDates evaulation string = "+evalString);returnVal=eval(evalString)}catch(e){log.warning("method compareDates failed to execute properly. error message: "+e);returnVal=-1}return returnVal},validateDate:function(I){var B=null;var A=true;var D=(I==undefined?$F(this.eventElement):I);if(this.regExpPattern.test(D)){var G=D.split(this.dateSeparator);var E=G[this.pattern.dayPosition];var C=G[this.pattern.monthPosition];var F=G[this.pattern.yearPosition];if(F.length==2){F="20"+F}if(E<1||E>this.getTotalDays((C-1),F)){A=false}if(A&&(C<1||C>12)){A=false}if(A){var H=new Date(F,C-1,E,0,0,0);if(H<=this.maxDate&&H>=this.today){B=H}}}return B},update:function(J,I){log.info("calling calendar.update()");var A=false;if(J==null){J=this.today;A=true}if(this.calDate.getMonth()<=this.today.getMonth()&&this.calDate.getFullYear()==this.today.getFullYear()&&this.previousArrow.visibleByClass()){this.previousArrow.hideByClass()}else{if(this.calDate.getMonth()>this.today.getMonth()&&this.calDate.getFullYear()==this.today.getFullYear()&&!this.previousArrow.visibleByClass()){this.previousArrow.showByClass()}else{if(this.calDate.getFullYear()>this.today.getFullYear()&&!this.previousArrow.visibleByClass()){this.previousArrow.showByClass()}}}if(this.nextArrow.visibleByClass()&&this.calDate.getMonth()>=this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear()){this.nextArrow.hideByClass()}else{if(!this.nextArrow.visibleByClass()&&(A||(this.calDate.getMonth()<this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear()))){this.nextArrow.showByClass()}}var F=this.element.getFirstElementByClassName("monthName");F.innerHTML=this.monthNames[this.calDate.getMonth()]+" "+this.calDate.getFullYear();var L=this.cloneDateObject(this.calDate);L.setDate(1);var C=L.getDay()-this.firstDayOfWeekIndex;var B=(C<0?C+7:C);var E=false;var N=1;var M=this.calDate.getMonth()==J.getMonth()&&this.calDate.getFullYear()==J.getFullYear();var H=this.calDate.getMonth()==this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear();var D=(this.calDate.getFullYear()<J.getFullYear())||(this.calDate.getMonth()<J.getMonth()&&this.calDate.getFullYear()==J.getFullYear());var K=(this.calDate.getFullYear()>this.maxDate.getFullYear())||(this.calDate.getMonth()>this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear());var O=this.getTotalDays(this.calDate.getMonth(),this.calDate.getFullYear());for(var G=0;this.days[G];G++){this.days[G].className="";this.days[G].setAttribute("date","");if(E==false){this.days[G].innerHTML="&nbsp;";if(G==B){E=true}}if(E){this.days[G].innerHTML=N;if((D||(N<J.getDate()&&M))||(K||(N>this.maxDate.getDate()&&H))){this.days[G].addClassName("inactive")}else{if(N==J.getDate()&&M&&A){this.days[G].addClassName("today")}if(N==this.calDate.getDate()&&I){this.days[G].addClassName("selected")}this.days[G].setAttribute("date",this.calDate.getMonth()+"_"+N+"_"+this.calDate.getFullYear())}if(N>=O){E=false}N++}}},selectDate:function(C){var B=Event.element(C);var A=B.getAttribute("date");if(A){this.eventElement.value=this.formatDateString(A);if(this.isFirstDate){this.userStartDate=this.validateDate()}else{this.userEndDate=this.validateDate()}this.computeDuration(this.eventElement.datePairParent);this.hideCalendar()}},computeDuration:function(A){if(this.userStartDate!=null&&this.userEndDate!=null){A.tripDuration=Math.round((this.userEndDate-this.userStartDate)/86400000);DateDuration.prototype.updateDuration(A)}},highlight:function(B){if(Event.element){var A=Event.element(B);if(A.getAttribute("date")){A.addClassName("highlight")}}},clearHighlight:function(B){if(Event.element){var A=Event.element(B);if(A!=this.selectionElement&&A.getAttribute("date")){A.removeClassName("highlight")}}},getTotalDays:function(D,B){var C=((B%4==0&&B%100!=0)||B%400==0);var A=this.daysPerMonth[D];return(D==1&&C?A+1:A)},hideCalendar:function(){this.element.hideByClass();this.calendarFocused=false},setCalendarFocus:function(){this.calendarFocused=true},setInputBlur:function(A){if(this.isFirstDate){this.userStartDate=this.validateDate()}else{this.userEndDate=this.validateDate()}this.inputFocused=false;window.setTimeout(this.getFocus.bind(this),100)},documentClick:function(B){if(this.element.visibleByClass()){var A=Event.element(B);if(A.getParentByClassName("calendar")==null){this.calendarFocused=false;this.getFocus()}}},getFocus:function(){if(this.inputFocused==false&&this.calendarFocused==false&&this.element.visibleByClass()){this.hideCalendar()}},changeMonth:function(A){var C=Event.element(A);var B=this.cloneDateObject(this.calDate);var I=B.getMonth();var H=B.getFullYear();if(C.hasClassName("arrowPrev")){var D=I-1;if(D<0){D=11;H=H-1}var J=this.getTotalDays(D,H);if(B.getDate()>J){B.setDate(J)}B.setMonth(B.getMonth()-1);B.setYear(H);if(B.getMonth()<this.today.getMonth()&&B.getFullYear()==this.today.getFullYear()){B=this.today}}else{if(C.hasClassName("arrowNext")){var G=I+1;if(G>11){G=0;H=H+1}var J=this.getTotalDays(G,H);if(B.getDate()>J){B.setDate(J)}B.setMonth(B.getMonth()+1);B.setYear(H);if(B.getMonth()>this.maxDate.getMonth()&&B.getFullYear()==this.maxDate.getFullYear()){B=this.maxDate}}}this.calDate=B;var E=false;if((this.isFirstDate&&this.userStartDate!=null)||(!this.isFirstDate&&this.userEndDate==null&&this.userStartDate!=null)){if(this.calDate.getMonth()==this.userStartDate.getMonth()&&this.calDate.getFullYear()==this.userStartDate.getFullYear()){E=true}}else{if(!this.isFirstDate&&this.userEndDate!=null){if(this.calDate.getMonth()==this.userEndDate.getMonth()&&this.calDate.getFullYear()==this.userEndDate.getFullYear()){E=true}}}var F=null;if(!this.isFirstDate&&this.userStartDate!=null){F=this.userStartDate}this.update(F,E)},cloneDateObject:function(A){return new Date(A.getFullYear(),A.getMonth(),A.getDate())},clearField:function(B,A){if(A.value==this.pattern.localisedString){A.value=""}}});var DateDuration=Class.create();DateDuration.prototype=Object.extend(new Abstract.Agent(),{initialized:false,initExtend:function(){var B=this.element;var A=document.createElement("label");A.className="control textInput durationLabel";A.innerHTML=this.params.labelContent;B.appendChild(A);if(B.tripDuration){this.updateDuration(B)}},updateDuration:function(B){if(B.tripDuration){var A=B.getFirstElementByClassName("durationLabel","label");if(A){var C=A.getFirstElementByClassName("readOnlyValue","span");C.innerHTML=B.tripDuration}}}});var RadioAsLink=Class.create();RadioAsLink.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.radio=null;var B=this.element.parentNode;var F=this.element.getElementsByTagName("a")[0];var D=document.createElement("label");var C=F.href;this.element.removeClassName("radioAsLink");var E=this.element.className;var G=(F.getAttribute("checked"))?" checked":"";D.className="radio "+E+G;var A='<input type="radio" name="'+F.getAttribute("name")+'" value="'+F.getAttribute("value")+'" ';A+='class="'+F.getAttribute("classes")+'" ';if(F.getAttribute("checked")){A+='checked="checked" '}A+="/>";D.innerHTML=A+"<span>"+F.innerHTML+"</span>";B.replaceChild(D,this.element);D.childNodes[0].setAttribute("linkURL",C)}});var Matrix=Class.create();Matrix.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.table=this.element;var A=this.table.tBodies[0].rows[0].getElementsByTagName("TH").length;$A(this.table.tHead.rows).each(function(B){$A(B.cells).each(function(C,D){if(D<A){return}if(C.title!=""){C.title=C.title.strip()}Element.extend(C);if(C.innerHTML==""||C.hasClassName("noHighlight")){return}Event.observe(C,"mouseover",this.colHeaderMouseEvent.bind(this,D));Event.observe(C,"mouseout",this.colHeaderMouseEvent.bind(this,D));Event.observe(C,"click",this.cellClickEvent.bind(this,"TH"))}.bind(this))}.bind(this));$A(this.table.tBodies[0].rows).each(function(B){$A(B.cells).each(function(C,D){if(C.title!=""){C.title=C.title.strip()}Element.extend(C);if(C.innerHTML==""||C.hasClassName("noHighlight")){return}if(C.tagName=="TH"){Event.observe(C,"mouseover",this.rowHeaderMouseEvent.bind(this));Event.observe(C,"mouseout",this.rowHeaderMouseEvent.bind(this));Event.observe(C,"click",this.cellClickEvent.bind(this,"TH"))}else{Event.observe(C,"mouseover",this.cellMouseEvent.bind(this,D));Event.observe(C,"mouseout",this.cellMouseEvent.bind(this,D));Event.observe(C,"click",this.cellClickEvent.bind(this,"TD"))}}.bind(this))}.bind(this))},cellMouseEvent:function(A,C){var B=Event.findElementByTagName(C,"TD");var D=(C.type=="mouseover");this.highlightCell(B,D);this.highlightRowHeader(B,D);this.highlightColumnHeader(A,D)},rowHeaderMouseEvent:function(B){var A=Event.findElementByTagName(B,"TH");this.highlightRow(A,(B.type=="mouseover"))},colHeaderMouseEvent:function(A,B){this.highlightColumn(A,(B.type=="mouseover"))},cellClickEvent:function(C,B){var A=Event.findElementByTagName(B,C);if(A.getElementsByTagName("a")[0]){window.location=A.getElementsByTagName("a")[0].href}},highlightRowHeader:function(A,B){$A(A.parentNode.cells).each(function(C){if(C.tagName!="TH"){throw $break}this.highlightCell(C,B)}.bind(this))},highlightColumnHeader:function(A,B){$A(this.table.tHead.rows).each(function(C){this.highlightCell(C.cells[A],B)}.bind(this))},highlightRow:function(A,C,B){$A(A.parentNode.cells).each(function(D){this.highlightCell(D,C)}.bind(this))},highlightColumn:function(B,C,A){$A(this.table.rows).each(function(D){this.highlightCell(D.cells[B],C)}.bind(this))},highlightCell:function(A,B){if(A.hasClassName("noHighlight")){return}if(B){A.addClassName("hover")}else{A.removeClassName("hover")}}});var HideRevealRadio=Class.create();HideRevealRadio.prototype={initialize:function(A){this.hrRadio=A;this.groupName=this.hrRadio.input.name;if(!Page.hideRevealRadios[this.groupName]){Page.hideRevealRadios[this.groupName]=[]}Event.observe(this.hrRadio.input,this.hrRadio.eventType,this.groupEvent.bindAsEventListener(this));Page.hideRevealRadios[this.groupName].push(this);if(this.hrRadio.input.checked){if(!this.hrRadio.input.defaultChecked){var C=Page.hideRevealRadios[this.groupName];for(var B=0;C[B];B++){if(C[B].hrRadio.input.defaultChecked){C[B].hrRadio.toggle()}C[B].checked=false}this.hrRadio.toggle()}this.checked=true}},groupEvent:function(C){var A=Event.element(C);if(this.checked){return}var D=Page.hideRevealRadios[this.groupName];for(var B=0;D[B];B++){if(D[B].checked){D[B].hrRadio.toggle(C)}D[B].checked=false}this.hrRadio.toggle(C);this.checked=true}};var HideReveal=Class.create();HideReveal.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){log.info(this.selectors);this.targets=$A();this.swapContent=(this.swapContent)?this.swapContent:this.content;if(this.selectors){this.selectors=this.selectors.split(",")}if(this.swapSelectors){this.swapSelectors=this.swapSelectors.split(",")}switch(this.element.tagName){case"SPAN":this.hrType="link";if(!this.element.hasClassName("progressive")){this.bindObserver();this.updateContent()}break;case"A":this.hrType="link";this.bindObserver();this.updateContent();break;case"LABEL":this.inputs=this.element.getElementsByTagName("INPUT");if(this.inputs){var A=0;while(this.inputs[A]&&this.inputs[A].type=="hidden"){A++}this.input=this.inputs[A];this.hrType=this.input.type;switch(this.input.type){case"radio":new HideRevealRadio(this);break;case"checkbox":Event.observe(this.input,this.eventType,this.toggle.bindAsEventListener(this));if(this.input.checked){this.toggle()}break;default:log.warning('&lt;input type="'+this.input.type+'"&gt; not supported in HideReveal agent.');log.info("Please edit HideReveal.initExtend if you wish to implement hide/reveal functionality for this input type.")}}else{log.warning("&lt;label&gt; tag does not contain an input.")}break;case"DIV":this.bindObserver();break;default:log.warning("&lt;"+this.element.tagName+"&gt; tag not supported in HideReveal agent.");log.info("Please edit HideReveal.initExtend if you wish to implement hide/reveal functionality for this tag type.");break}},bindObserver:function(C,B){var A=C?C:this.toggle;var D=B?B:this;Event.observe(this.element,this.eventType,A.bindAsEventListener(D));if(this.radioValue){Event.observe(this.element,this.eventType,this.changeRadio.bind(this))}if(this.checkboxValue){Event.observe(this.element,this.eventType,this.toggleCheckbox.bind(this));Event.observe(this.input,this.eventType,this.toggleCheckbox.bind(this))}},toggleCheckbox:function(){this.input.checked=!(this.input.checked)},updateContent:function(A){var B=A?A:this.content;if(B){this.element.update(B);log.info("HideReveal is updating content to "+B)}this.content=this.swapContent;this.swapContent=B},findTargets:function(){this.targets=this._findTargets(this.selectors);if(this.swapSelectors){this.swapTargets=this._findTargets(this.swapSelectors)}var A=this.targets.length;log.info(A+" "+(A!=1?"targets":"target")+" found for HideReveal")},_findTargets:function(A){var B=[];A.each(function(D){if(this.parentClass){var E=this.element.getParentByClassName(this.parentClass);var C=E.getElementsBySelector(D);for(var F=0;C[F];F++){B.push(C[F])}}else{if(this.parentTag){var E=this.element.getParentByTagName(this.parentTag);var C=E.getElementsBySelector(D);for(var F=0;C[F];F++){B.push(C[F])}}else{var C=$$(D);for(var F=0;C[F];F++){B.push(C[F])}}}}.bind(this));return B},changeRadio:function(){var B=this.radioValue;var A,C;if(this.parentClass){ancestor=this.element.getParentByClassName(this.parentClass)}else{if(this.parentTag){ancestor=this.element.getParentByTagName(this.parentTag)}}if(ancestor){A=$A(ancestor.getElementsByClassName("radio"));A.each(function(E){var D=E.getElementsByTagName("input")[0];if(D.value==B){D.click()}})}},hide:function(B){for(var A=0;B[A];A++){B[A].hideByClass()}},show:function(B){for(var A=0;B[A];A++){B[A].showByClass()}},toggle:function(C){if(this.targets.length==0&&this.selectors.length>0){this.findTargets()}if(C){var A=Element.extend(Event.element(C));if(A.hasClassName("selected")){A.removeClassName("selected")}else{A.addClassName("selected")}if(this.hrType=="link"){Event.stop(C);this.updateContent()}if(this.removeOnEvent){this.element.remove()}}if(this.exclusive){if(this.currentState=="show"){this.hide(this.targets);if(this.swapTargets){this.show(this.swapTargets)}this.currentState="hide"}else{this.show(this.targets);if(this.swapTargets){this.hide(this.swapTargets)}this.currentState="show"}}else{for(var B=0;this.targets[B];B++){this.targets[B].toggleByClass()}}}});HideReveal.Progressive=Class.create();HideReveal.Progressive.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(A){if(!this.params.validIndices||!this.params.validIndices.length||this.params.currentIndex!=0&&this.params.currentIndex!=1||!this.params.expandSelectors||!this.params.expandLinks||!this.params.scopeClass||!this.params.linkClass){log.warning("HideReveal.Progressive.initExtend: exiting because required params missing or invalid");return}this.setIndex(this.params.currentIndex);this.createHideReveal(true);log.info("HideReveal.Progressive.initExtend has successfully completed")},setIndex:function(A){this.currentIndex=!isNaN(A)?A:this.getNextIndex();log.info("HideReveal.Progressive.currentIndex="+this.currentIndex)},getNextIndex:function(){var A=-1;for(var C=0;C<this.params.validIndices.length;C++){var B=parseInt(this.params.validIndices[C]);if(B>this.currentIndex){A=B;break}}return A},createLinkNode:function(){if(!this.linkNode){this.linkNode=this.element.appendChild(document.createElement("div"));this.linkNodeLink=this.linkNode.appendChild(document.createElement("span"));this.linkNodeLink.className="link "+this.params.linkClass;log.info("HideReveal.Progressive has created its link node")}},destroyLinkNode:function(){this.element.removeChild(this.linkNode);log.info("HideReveal.Progressive has destroyed its link node")},createHideReveal:function(A){if(A){this.createLinkNode()}if(this.getNextIndex()>=0){this.hideRevealLink=new HideReveal(this.linkNodeLink,{type:"HideReveal [inside HideReveal.Progressive]",eventType:"click",parentClass:this.params.scopeClass,selectors:"."+this.params.expandSelectors[this.getNextIndex()]});log.info("HideReveal.Progressive.hideRevealLink="+this.hideRevealLink);if(A){this.hideRevealLink.bindObserver(this.updateLink,this)}this.hideRevealLink.updateContent(this.params.expandLinks[this.currentIndex])}else{this.destroyLinkNode();log.info("HideReveal.Progressive has no hideRevealLink because index is out of bounds.")}},updateLink:function(){log.info("HideReveal.Progressive.updateLink called");log.info("type="+this.type);this.hideRevealLink.toggle();this.setIndex();this.createHideReveal()}});var Fixed=Class.create();Fixed.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(this.params&&this.params.adjustScrollForAnchoredPageLoads){this.adjustScrollForAnchoredPageLoads=true}else{this.adjustScrollForAnchoredPageLoads=false}this.element.addClassName("fixedAgentInPage");this.placeHolder=Element.extend(document.createElement("div"));this.placeHolder.setStyle({height:this.element.getHeight()+"px"});this.placeHolder.addClassName("noneBlock");var A=Element.extend(this.element.parentNode);A.appendChild(this.placeHolder);this.iFrame=this.createIFrame(A);this.TEST_INTERVAL=100;this.initialYPos=new Position.cumulativeOffset(this.element)[1];this.initialXPos=new Position.cumulativeOffset(this.element)[0];this.fixedState=false;this.scrollingState=false;Event.observe(window,"scroll",this.setScrolling.bind(this));Event.observe(document,"mouseup",this.setScrolling.bind(this));this.testModeChange(this.adjustScrollForAnchoredPageLoads)},createIFrame:function(A){var B=null;if(this.params==null||this.params.hideIFrame==null||this.params.hideIFrame!=true){B=Element.extend(document.createElement("iframe"));B.addClassName("fixedAgentInPage");B.src="/script/empty.html";B.setStyle({height:A.getHeight()+"px",width:A.getWidth()+"px"});A.insertBefore(B,this.element)}return B},testModeChange:function(D){if(!this.fixedState){var B=new Position.cumulativeOffset(this.element)[1];if((B!=this.initialYPos)&&(B>=0)){this.initialYPos=B;log.info("Fixed Agent: Change initialYPos to "+B)}}if(!this.fixedState&&this.getVerticalScrolledDistance()>this.initialYPos){if(this.iFrame!=null){this.iFrame.removeClassName("fixedAgentInPage");this.iFrame.addClassName("fixedAgentLocked")}this.element.removeClassName("fixedAgentInPage");this.element.addClassName("fixedAgentLocked");this.placeHolder.showByClass();this.fixedState=true;if(D){var C=this.element.getDimensions();var A=C.height;if(document.body&&document.body.scrollTop){document.body.scrollTop=document.body.scrollTop+A}else{if(document.documentElement&&document.documentElement.scrollTop){document.documentElement.scrollTop=document.documentElement.scrollTop-A}}}}else{if(this.fixedState&&this.getVerticalScrolledDistance()<this.initialYPos){this.element.removeClassName("fixedAgentLocked");this.element.addClassName("fixedAgentInPage");this.placeHolder.hideByClass();if(this.iFrame!=null){this.iFrame.removeClassName("fixedAgentLocked");this.iFrame.addClassName("fixedAgentInPage")}this.fixedState=false}}if(this.element.getStyle("position")=="fixed"&&this.fixedState){this.horizontalDistance=this.initialXPos-this.getHorizontalScrolledDistance();this.element.style.left=this.horizontalDistance+"px"}else{this.element.style.left=0}},getVerticalScrolledDistance:function(){var A=0;if(document.body&&document.body.scrollTop){A=document.body.scrollTop}else{if(document.documentElement&&document.documentElement.scrollTop){A=document.documentElement.scrollTop}}return A},getHorizontalScrolledDistance:function(){var A=0;if(document.body&&document.body.scrollLeft){A=document.body.scrollLeft}else{if(document.documentElement&&document.documentElement.scrollLeft){A=document.documentElement.scrollLeft}}return A},setScrolling:function(){if(!this.scrollingState){this.scrollingState=true;setTimeout(function(){this.scrollingState=false}.bind(this),this.TEST_INTERVAL);setTimeout(function(){if(!this.scrollingState){this.testModeChange()}}.bind(this),(this.TEST_INTERVAL*1.5))}}});var Collapse=Class.create();Collapse.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.titleBar=this.element.getFirstElementByClassName("titleBar","div");if(this.titleBar.hasClassName("open")){this.opened=true}else{if(this.titleBar.hasClassName("closed")){this.opened=false}else{log.error("titleBar missing required class")}}this.panelMessageElement=this.element.getFirstElementByClassName("panelMessage","div");this.panelMessage="";if(this.panelMessageElement!=null){this.panelMessage=this.panelMessageElement.innerHTML}this.dirtyFieldsMessage="";this.fieldsDirty=false;if(this.panelMessageElement!=null){var E=this.panelMessageElement.getParams();if((E!=null)&&(E.dirtyFieldsMessage!=null)){this.dirtyFieldsMessage=E.dirtyFieldsMessage}}this.fieldsToObserve=[];if(this.dirtyFieldsMessage!=""){var C=$A(this.element.getElementsByTagName("input"));var A=$A(this.element.getElementsByTagName("select"));var D=$A(this.element.getElementsByTagName("textArea"));this.fieldsToObserve=C.concat(A,D)}log.info(this.type+".fieldsToObserve: "+this.fieldsToObserve.length);for(var B=0;B<this.fieldsToObserve.length;B++){Event.observe(this.fieldsToObserve[B],"change",this.setFieldsDirty.bindAsEventListener(this))}Event.observe(this.titleBar,"click",this.collapse.bindAsEventListener(this));Event.observe(this.titleBar,"mouseover",this.highlight.bindAsEventListener(this));Event.observe(this.titleBar,"mouseout",this.unhighlight.bindAsEventListener(this))},setFieldsDirty:function(){this.fieldsDirty=true;log.info("fields dirtied")},collapse:function(){this.titleBar.toggleClasses("open","closed");this.opened=!(this.opened);this.element.removeClassName("hover");if(this.fieldsDirty){if(this.opened){this.panelMessageElement.innerHTML=this.panelMessage}else{this.panelMessageElement.innerHTML=this.dirtyFieldsMessage}}},highlight:function(){if(!(this.opened)&&!(this.element.hasClassName("hover"))){this.element.addClassName("hover")}},unhighlight:function(){if(!(this.opened)&&this.element.hasClassName("hover")){this.element.removeClassName("hover")}}});var CollapseRemoteControl=Class.create();CollapseRemoteControl.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.collapseAgent;this.hideRevealAgent;this.anchor;if(this.params.anchorName!=null||this.params.anchorName!=""){this.anchor=document.anchors.namedItem(this.params.anchorName);if(this.anchor!=null){var B=this.anchor;var C=Page.agents.Collapse;while(B.parentNode!=document&&this.collapseAgent==null){B=B.parentNode;for(i=0;i<C.length;i++){if(C[i].element==B){this.collapseAgent=C[i];break}}}var A=Page.agents.HideReveal;while(this.hideRevealAgent==null){for(i=0;i<A.length;i++){if(A[i].element==this.collapseAgent.titleBar){this.hideRevealAgent=A[i];break}}}Event.observe(this.element,"click",this.expandTargetPanel.bindAsEventListener(this))}else{log.error("CollapseRemoteControl: could not find anchor named '"+this.params.anchorName+"', unable to initialize")}}else{log.error("CollapseRemoteControl: missing required param 'anchorName', unable to initialize")}},expandTargetPanel:function(){if(this.collapseAgent.opened==false){this.collapseAgent.collapse();this.hideRevealAgent.toggle()}}});var TabMenu=Class.create();TabMenu.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.tabs=$A();var C={};this.parent=Element.extend(this.element.parentNode);this.container=Element.extend(this.parent.parentNode);this.parent.addClassName("tabBar");var B=this.element.getElementsByTagName("li");for(var D=0,A=B.length;D<A;D++){this.tabs.push(new Tab(B[D],this.container,this))}},selectTabByKey:function(A){this.tabs.each(function(B){if(B.key==A){B.selectTab();throw $break}})}});var Tab=Class.create();Tab.prototype={agentsInitialized:false,initialize:function(B,A,C){var D=B.getElementsByTagName("A")[0];this.element=B;this.key=D.href.substring((D.href.indexOf("#")+1));this.parent=C;this.contentWrapper=A;this.selected=false;this.externalLinks=$A();Event.observe(this.element,"click",this.mouseDown.bindAsEventListener(this));if(this.element.hasClassName("currentTab")){this.selected=true;this.externalLinks.each(function(E){E.selectLink()})}},mouseDown:function(A){this.parent.tabs.each((function(B){if(B.selected){B.deselectTab()}}).bind(this));this.selectTab();if(A){A.preventDefault()}},findContent:function(){var C=this.contentWrapper.getElementsByTagName("A");for(var D=0,A=C.length;D<A;D++){var B=C[D];if(B.name&&B.name==this.key){this.contentBlock=Element.extend(B.parentNode)}}},selectTab:function(){if(!this.contentBlock){this.findContent()}this.selected=true;this.element.addClassName("currentTab");if(this.contentBlock&&!this.contentBlock.visibleByClass()){this.contentBlock.showByClass()}if(!this.agentsInitialized){var D=this.contentBlock.getElementsByAttribute("agent");for(var E=0;D[E];E++){var A=D[E];var B=A.getAgents();for(var C=0;B[C];C++){if(B[C].lazy=="true"){Page.initAgent(A,B[C])}}}this.agentsInitialized=true}this.externalLinks.each(function(F){F.selectLink()})},deselectTab:function(){this.selected=false;this.element.removeClassName("currentTab");if(!this.contentBlock){this.findContent()}if(this.contentBlock&&this.contentBlock.visibleByClass()){this.contentBlock.hideByClass()}this.externalLinks.each(function(A){A.deselectLink()})}};var TabMenuControl=Class.create();TabMenuControl.prototype=Object.extend(new Abstract.Agent("TabMenuControl"),{initExtend:function(){if(this.element.href&&this.element.href.indexOf("#")!=-1){this.key=this.element.href.substring((this.element.href.indexOf("#")+1))}if(!this.key){return}this.tab=this.findTabByKey(this.key);Event.observe(this.element,"click",this.mouseDown.bindAsEventListener(this));this.tab.externalLinks.push(this);if(this.tab.selected){this.selectLink()}},mouseDown:function(A){this.tab.mouseDown(A)},selectLink:function(){this.element.addClassName("selected")},deselectLink:function(){this.element.removeClassName("selected")},findTabByKey:function(B){var A=null;Page.agents.TabMenu.each(function(C){C.tabs.each(function(D){if(D.key==B){A=D;throw $break}});if(A!=null){throw $break}});return A}});var Interstitial=Class.create(Abstract.Agent,{interstitialResponseTimeout:2000,interstitialAssetsTimeout:1200,url:"/helper/interstitial",initExtend:function(){var A=this.element.tagName;this.isFramed=this.element.getParentByTagName("iframe");this.bodyWrapper=this.isFramed?Element.extend(top.document.getElementById("bodyWrapper")):Element.extend(document.getElementById("bodyWrapper"));if(A==="INPUT"){Event.observe(this.element,"click",function(){Event.observe(this.element.form,"submit",this.requestFormInterstitial.bind(this))}.bind(this))}else{if(A==="A"){Event.observe(this.element,"click",this.requestLinkInterstitial.bindAsEventListener(this))}else{if(A==="TABLE"||A==="TBODY"){Event.observe(this.element,"click",this.requestTableInterstitial.bindAsEventListener(this))}else{log.warning("Interstitial tried to initialize, but failed on element.tagName")}}}},requestFormInterstitial:function(B){log.debug("form interstitial");B.preventDefault();Form.HiddenField.add(this.element.form,this.element.name,this.element.value);var A=Form.serialize(this.element.form);this.action=function(){log.debug("interstitial: submitting form");this.element.form.submit()}.bind(this);this.getInterstitial(A.deleteQueryStringParam("_flowExecutionKey"))},requestLinkInterstitial:function(A){log.debug("link interstitial");A.preventDefault();var B=this.element.href.split("?")[1]||"";this.action=function(){log.debug("interstitial: following link");top.document.location=this.element.href}.bind(this);this.getInterstitial(B.deleteQueryStringParam("_flowExecutionKey"))},requestTableInterstitial:function(B){B.preventDefault();var A=Event.element(B);if(A.tagName!=="A"){A=Event.findElement(B,"TD");if(A!==document){A=A.getElementsByTagName("A")[0]}}if(A&&A.tagName==="A"){this.element=A;this.requestLinkInterstitial(B)}else{return false}},getInterstitial:function(D){var A=setTimeout(this.action,this.interstitialResponseTimeout);Event.observe(top,"pageshow",this.hideInterstitial.bindAsEventListener(this));var C=new Ajax.Request(this.url,{parameters:D,onSuccess:this.showInterstitial.bind(this,A)});this.bodyWrapper.addClassName("hideFromBrowser");var B=this.isFramed?Element.extend(top.document.body):Element.extend(document.body);B.addClassName("interstitial")},showInterstitial:function(A,B){clearTimeout(A);if(B.responseText.indexOf('status:"failed"')>-1){return}else{setTimeout((function(){this.bodyWrapper.insert({before:B.responseText})}).bind(this),0)}setTimeout(this.action,this.interstitialAssetsTimeout)},hideInterstitial:function(){var A=Element.extend(top.document.getElementById("interBody"));if(A){A.remove()}if(this.bodyWrapper){this.bodyWrapper.removeClassName("hideFromBrowser")}if(Page.agents.ChangeSearchLightboxAgent){$(Page.agents.ChangeSearchLightboxAgent).each(function(B){B.dialogObject.close()})}}});var PopupWindow=Class.create();PopupWindow.prototype=Object.extend(new Abstract.Agent(),{windowProps:"width=620,height=400,left=20,top=20,resizable=yes,scrollbars=yes,status=yes",windowName:"popWin",initExtend:function(){Event.observe(this.element,"click",this.popWindow.bindAsEventListener(this))},popWindow:function(B){var A=window.open(this.element.href,this.windowName,this.windowProps);A.focus();if(B){Event.stop(B)}}});PopupWindow.FullSize=Class.create();PopupWindow.FullSize.prototype=Object.extend(new PopupWindow(),{windowProps:"width=720,height=500,left=0,top=0,resizable=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes",windowName:"popWinFullSize"});PopupWindow.FullWindow=Class.create();PopupWindow.FullWindow.prototype=Object.extend(new PopupWindow(),{windowProps:"width="+screen.availWidth+",height="+screen.availHeight+",left=0,top=0,resizable=yes,toolbar=no,location=yes,scrollbars=yes,directories=no,status=no",windowName:"popWinFullScreen"});var RedirectOpenerOnClose=Class.create();RedirectOpenerOnClose.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.popupWindow=self;this.popupOpener=self.opener;if(this.popupOpener!=null&&this.params!=null&&this.params.sendOpenerTo!=null&&this.params.sendOpenerTo!=""){this.redirectOpenerURL=this.params.sendOpenerTo;Event.observe(self,"unload",this.redirectOpener.bindAsEventListener(this))}else{log.error(this.popupWindow+" missing sendOpenerTo param, or window is not a popup")}},redirectOpener:function(){if(this.redirectOpenerURL!=null){this.popupOpener.location.href=this.redirectOpenerURL}}});var ExitApp=Class.create();ExitApp.prototype=Object.extend(new Abstract.Agent(),{windowProps:"width=620,height=400,left=20,top=20,resizable=yes,scrollbars=yes,status=yes",windowName:"exitApp",popupEnabled:true,initExtend:function(){this.url="/info/bookingPathExitApp";var A=this.element.getElementsByTagName("input")[0];Event.observe(A,"click",this.disablePopup.bindAsEventListener(this));Event.observe(window,"unload",this.popExitApp.bindAsEventListener(this))},popExitApp:function(B){if(this.popupEnabled){var A=window.open(this.url,this.windowName,this.windowProps);A.blur();window.focus()}},disablePopup:function(A){ExitApp.prototype.popupEnabled=false}});var cancelExitApp=Class.create();cancelExitApp.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){Event.observe(this.element,"click",this.disableExitApp.bindAsEventListener(this))},disableExitApp:function(A){ExitApp.prototype.disablePopup()}});var ScriptContent=Class.create();ScriptContent.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(!this.params.multiContent&&!this.params.content){log.warning("ScriptContent.initExtend: exiting because required params missing or invalid");return}this.insertionsToProcess=(this.params.multiContent?this.params.multiContent:[this.params]);this.insertionsToProcess.each(function(C){var D=C.targetClass?this.element.getFirstElementByClassName(C.targetClass):this.element;if(!D){log.warning("ScriptContent.initExtend: exiting because target node [class: "+C.targetClass+"] was not valid")}else{var B=document.createElement(C.containerType?C.containerType:"div");B.innerHTML=C.content;if(C.containerClass){B.className=C.containerClass}var A=C.insertAtTop?D.insertBefore(B,D.firstChild):D.appendChild(B);if(C.clickHandler){Event.observe(A,"click",C.clickHandler.bindAsEventListener(this))}Page.initializeDOMFragment(A)}}.bind(this))}});var AmenitiesList=Class.create();AmenitiesList.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.count=0;this.amenities=$A();var B=$A(this.element.getElementsByTagName("INPUT"));B.each(function(C){if(C.type!="checkbox"){return}this.amenities.push(C);if(C.checked){this.count++}}.bind(this));var A=this.params.maxSelections;this.maxSelectionsMinusOne=(A)?A-1:this.amenities.length;Event.observe(this.element,"click",this.amenityClick.bindAsEventListener(this));this.disableAmenities()},amenityClick:function(B){var A=Event.element(B);if(A.type!="checkbox"||A.disabled){return}if(A.checked){this.count++;this.disableAmenities()}else{this.count--;if(this.count==this.maxSelectionsMinusOne){this.amenities.each(function(C){C.disabled=false})}}},disableAmenities:function(){if(this.count>this.maxSelectionsMinusOne){this.amenities.each(function(A){if(!A.checked){A.disabled=true}})}}});var PreferenceModule=Class.create();PreferenceModule.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){Profiler.start("PreferenceModuleNameEvents");var A=this.getAgentRef("WhosTraveling");if(A){this.savedTravelers=A.params?A.params.savedTravelers:null;$A(A.element.getElementsByClassName("whosTravelingName")).each(function(C,B){$A(C.getElementsByClassName("radio")).each(function(E){var D=E.getElementsByTagName("input")[0];if(Element.extend(E.parentNode).hasClassName("nameSelect")){Event.observe(D,"click",this.eventClearPreferences.bindAsEventListener(this,B,A));if(D.checked==true&&D.value=="true"){this.clearPreferences(B);this.setPreferences(B,A)}}}.bind(this));$A(C.getElementsByClassName("select")).each(function(E){var D=E.getElementsByTagName("select")[0];if(Element.extend(E.parentNode).hasClassName("whosTravelingNameSelectFromList")){Event.observe(D,"change",this.eventClearPreferences.bindAsEventListener(this,B,A))}}.bind(this))}.bind(this));this.initExtendPref()}Profiler.stop("PreferenceModuleNameEvents")},initExtendPref:function(){},getAgentRef:function(A){if(Page.agents[A]){var B=Page.agents[A][Page.agents[A].length-1]}return B},eventClearPreferences:function(B,C,A){Profiler.start("eventClearPreferences");this.clearPreferences(C);this.doSetPreferences(C,A);Profiler.stop("eventClearPreferences")},clearPreferences:function(A){log.info("PreferenceModule.clearPreferences("+A+")");if(this.element.hasClassName("travelerPrefs")){if(this.element.getParams().nameIndex==A){Form.Element.resetValue(this.element)}}else{$A(this.element.getElementsByClassName("travelerPrefs")).each(function(B){if(B.getParams().nameIndex==A){Form.Element.resetValue(B)}}.bind(this))}},doSetPreferences:function(B,A){log.info("PreferenceModule.doSetPreferences("+B+")");Profiler.start("PreferenceModuleDoSetPreferences");var C=A.element.getNthElementByClassName("whosTravelingName",(B+1));$A(C.getElementsByClassName("nameSelect")).each(function(E){var D=E.getElementsByTagName("input")[0];if(D.type=="radio"&&D.checked==true&&D.value=="true"){this.setPreferences(B,A)}}.bind(this));Profiler.stop("PreferenceModuleDoSetPreferences")},setPreferences:function(B,A){}});var SearchForm=Class.create(Abstract.Agent,{initExtend:function(){this.formWrapper=this.element.getFirstElementByClassName("formWrapper");this.form=this.formWrapper.getFirstElementByClassName("searchFormForm","form");var A=this;this.initializeChildren()},showIntrastitial:function(){this.form.style.visibility="hidden";this.formWrapper.addClassName("intrastitial")},hideIntrastitial:function(B){this.formWrapper.removeClassName("intrastitial");this.formWrapper.update(B.stripNoScripts());try{Page.initializeDOMFragment(this.element);this.initialize(this.element,this)}catch(A){Errors.capture(A,"SearchForm Ajax initialization failed")}}});SearchForm.FlightTypes=Class.create();SearchForm.FlightTypes.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(B,A){this.searchForm=A;this.radios=$A(this.element.getElementsByTagName("input"));this.radios.each(function(C){Element.extend(C.parentNode);Event.observe(C,"click",this.onClick.bind(this));if(C.checked){this.currentType=C.value}}.bind(this))},onClick:function(){var A;this.radios.each(function(C){if(C.checked){A=C.value}});if(A!=this.currentType){this.radios.each(function(C){C.parentNode.removeClassName("checked");if(C.checked){C.parentNode.addClassName("checked")}});var B=new Ajax.Request("/shop/searchForm",{parameters:"type=air&ar.type="+A,onSuccess:this.success.bind(this),onFailure:this.failure});this.currentType=A;this.element.remove();this.searchForm.showIntrastitial()}},success:function(A){log.info("Successful response from /shop/searchForm");this.searchForm.hideIntrastitial(A.responseText)},failure:function(){log.error("No response from /shop/searchForm")}});SearchForm.MultiroomGuests=Class.create();SearchForm.MultiroomGuests.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(C,A){this.guestLabels=this.element.select("label");this.guestDropdowns=this.element.select("label select");this.guestDropdowns.each(function(D,E){if(E!=0){D.removeChild(D.down("option"))}});this.dialogManager=new DialogManager(this.element);this.multipleRoomsOptionText=this.params.multipleRoomsText;this.visibilityClass=this.params.visibilityClass;var B=$(A.form).down("div.rooms select");this.showGuestCounts(B);Event.observe(B,"change",this.onChange.bindAsEventListener(this))},onChange:function(B){var A=Event.element(B);this.showGuestCounts(A);if(A.value<=1){this.dialogManager.close()}},showGuestCounts:function(B){var E=(B)?parseInt(B.value):1;var A=(E<=this.guestLabels.length)?E:1;var C=this.element.down(".room1Msg");var D=this.visibilityClass;var F=this.multipleRoomsOptionText;this.guestLabels.each(function(I,H){var G=I.down("span");if(A==1&&G){G.addClassName(D)}else{G.removeClassName(D)}if((A==F)||(H<A)){I.removeClassName("hidden")}else{I.addClassName("hidden")}});if((A==1||A==F)&&C){C.addClassName("hidden")}else{C.removeClassName("hidden")}}});SearchForm.ProductNav=Class.create();SearchForm.ProductNav.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(B,A){if(A.isInitialized){return}this.searchForm=A;this.manager=new DialogManager(B.parentNode);this.radios=$A(this.element.getElementsByTagName("input"));this.radios.each(function(C){if(C.type=="radio"){Event.observe(C,"click",this.onClick.bindAsEventListener(this));if(C.checked){this.currentType=C.value}}}.bind(this));this.searchForm.isInitialized=true},onClick:function(D){if(!this.element.hasClassName("quickSearchNav")){location.href=Event.element(D).getAttribute("linkURL")}else{var B=Event.element(D).value;if(B!=this.currentType){this.manager.close();var A=B.substring(0,10)=="thirdParty";var E=A?"/helper/searchFormThirdParty":"/shop/searchForm";var C=new Ajax.Request(E,{parameters:"quickSearch=true&pathId=home&type="+B,onSuccess:this.success.bind(this),onFailure:this.failure});this.searchForm.showIntrastitial();this.currentType=B}}},success:function(A){log.info("Response received from /shop/searchForm");this.searchForm.hideIntrastitial(A.responseText)},failure:function(){log.error("No response from /shop/searchForm")}});SearchForm.ChildTravelers=Class.create();SearchForm.ChildTravelers.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(C,B){this.childAgeDropdowns=this.element.getElementsByClassName("select");this.searchForm=Element.extend(B.form);var A=this.searchForm.getFirstElementByClassName("travelers");this.childDropdown=A.getElementsByTagName("select")[A.getElementsByTagName("select").length-1];this.showChildAges(this.childDropdown);this.childDropdownChange=this.onChange.bindAsEventListener(this);Event.observe(this.childDropdown,"change",this.childDropdownChange)},onChange:function(B){var A=Event.element(B);this.showChildAges(A)},showChildAges:function(B){var A=B.value;for(var C=0;C<this.childAgeDropdowns.length;C++){if(C<A){this.childAgeDropdowns[C].removeClassName("noneBlock")}else{this.childAgeDropdowns[C].addClassName("noneBlock")}}if(A>0){this.element.removeClassName("noneBlock")}else{this.element.addClassName("noneBlock")}}});SearchForm.APHButton=Class.create();SearchForm.APHButton.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(B,A){var C=this.element;var D=function(F){if(F&&C.disabled){return}C.disabled=F;C[(F)?"addClassName":"removeClassName"]("disabled")};var E=A.form.select(this.params.selectors);E.each(function(F){F.observe("click",function(){var G=false;if(this.checked){D(true)}else{E.each(function(H){if(H.checked){G=true;throw $break}});D(G)}})})}});SearchForm.CarLocationTypes=Class.create();SearchForm.CarLocationTypes.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(B,A){this.searchForm=A;this.pickup=B.getElementsBySelector('[name="car.pickupType"]')[0];this.dropoff=B.getElementsBySelector('[name="car.dropoffType"]')[0];Event.observe(this.pickup,"change",this.requestForm.bindAsEventListener(this));Event.observe(this.dropoff,"change",this.requestForm.bindAsEventListener(this))},requestForm:function(E){var B="";if(/\/home/.test(location.pathname)){B="&quickSearch=true"}var D="/shop/searchForm";if(/\/book/.test(location.pathname)){D="/book/bookingpath";var A=this.searchForm.form.elements._flowExecutionKey.value;B="&quickSearch=true&changeSearch=true&_eventId=changeSearchXSellCar&_flowExecutionKey="+A}var C=new Ajax.Request(D,{parameters:"type=car"+B+"&car.pickupType="+this.pickup.value+"&car.dropoffType="+this.dropoff.value,onSuccess:this.success.bind(this),onFailure:this.failure});this.searchForm.showIntrastitial()},success:function(A){log.info("Response received from /shop/searchForm");this.searchForm.hideIntrastitial(A.responseText)},failure:function(){log.error("No response from /shop/searchForm")}});SearchForm.CarDriverAgeNote=Class.create();SearchForm.CarDriverAgeNote.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(C,B){var A=C.getElementsByTagName("select")[0];this.ageNote=C.getNthElementByClassName("alert",[1],"p");if(A.value=="21"){this.toggleNoteDisplay()}Event.observe(A,"change",this.toggleNoteDisplay.bindAsEventListener(this))},toggleNoteDisplay:function(){this.ageNote.toggleByClass()}});SearchForm.FauxRoomsDropdown=Class.create();SearchForm.FauxRoomsDropdown.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(C,B){this.formSubmits=$A();$A(B.element.getElementsByClassName("submit")).each(function(H){this.formSubmits.push(H.getElementsByTagName("input")[0])}.bind(this));this.multiBookingAlert=C.getFirstElementByClassName("alert","p");this.multipleRoomsOptionText=this.params.multipleRoomsText;if(this.multipleRoomsOptionText!=null&&this.formSubmits.length>0){if(C.getFirstElementByClassName("readOnlyValue","span")){var G=C.getFirstElementByClassName("readOnlyValue","span");var F=G.innerHTML;var A=Element.extend(C.getElementsByTagName("input")[0]);if(A){var D=A.name;var E=A.value;A.remove()}else{D="fakeRoomsSelect";E=F}optionText=F;this.fauxSelect=Element.extend(document.createElement("select"));this.fauxSelect.name=D;this.addOptionToSelect(this.fauxSelect,E,optionText);G.parentNode.appendChild(this.fauxSelect);G.remove()}else{if(C.getElementsByTagName("select")[0]){this.fauxSelect=C.getElementsByTagName("select")[0]}else{log.error("fauxRoomsDropdown: nothing to convert to a select");return false}}this.addOptionToSelect(this.fauxSelect,this.multipleRoomsOptionText,this.multipleRoomsOptionText);this.checkForFauxSelection();Event.observe(this.fauxSelect,"change",this.checkForFauxSelection.bindAsEventListener(this))}},addOptionToSelect:function(B,C,D){var A=Element.extend(document.createElement("option"));A.value=C;A.update(D);B.appendChild(A)},checkForFauxSelection:function(){if(this.fauxSelect.options[this.fauxSelect.selectedIndex].value==this.multipleRoomsOptionText){this.formSubmits.each(function(A){if(!A.disabled){this.toggleSubmitEnabled(A)}}.bind(this));this.multiBookingAlert.showByClass()}else{this.formSubmits.each(function(A){if(A.disabled){this.toggleSubmitEnabled(A)}}.bind(this));this.multiBookingAlert.hideByClass()}},toggleSubmitEnabled:function(A){A=$(A);A.disabled=!A.disabled;A.toggleClassName("disabled")}});SearchForm.SerializerLink=Class.create();SearchForm.SerializerLink.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(A,B){this.anchorTag=A;this.searchForm=B;Event.observe(A,"click",this.onClick.bindAsEventListener(this))},onClick:function(){var D=$A();var B=$A();var E="?";if(this.anchorTag.search!=""){var C=$A(this.anchorTag.search.substring(1,this.anchorTag.search.length).split("&"));C.each(function(F){B.push(F.split("=").first())});E="&"}Form.getElements(this.searchForm.form).each(function(G){if(B.indexOf(G.name)>-1){return}if(G.tagName.toLowerCase()=="input"&&G.type.toLowerCase()=="submit"){return}Calendar.prototype.clearField(this,G);var F=Form.Element.serialize(G);if(F){D.push(F)}});var A=E+D.join("&");this.anchorTag.href+=A}});SearchForm.RailFlyCheckbox=Class.create();SearchForm.RailFlyCheckbox.prototype=Object.extend(new Abstract.ChildAgent(),{initExtend:function(B,A){this.element=B;this.checkbox=this.element.down('input[type="checkbox"]');this.textField=this.element.getParentByTagName("form").getElementsByClassName("originText")[0].down('input[type="text"]');if(!this.checkbox){log.error("SearchForm.RailFlyCheckbox: checkbox not found");return}else{if(!this.textField){log.error("SearchForm.RailFlyCheckbox: text field not found");return}}if(this.checkbox.checked){this.checkbox.value="";this.disableTextField()}Event.observe(this.checkbox,"click",this.toggleTextField.bindAsEventListener(this))},toggleTextField:function(){this.checkbox.checked?this.disableTextField():this.enableTextField()},disableTextField:function(){this.oldTextFieldValue=this.textField.value;this.textField.value=this.params.railAndFlyText?this.params.railAndFlyText:"";this.textField.disabled=true;log.info("RailFlyCheckbox: disabled departure text")},enableTextField:function(){this.textField.value=this.oldTextFieldValue?this.oldTextFieldValue:"";this.textField.disabled=false;log.info("RailFlyCheckbox: enabled departure text")}});var ChangeSearch=Class.create();ChangeSearch.prototype=Object.extend(new Abstract.Agent("ChangeSearch"),{initExtend:function(){this.visible=false;Event.observe(this.element,"click",this.requestForm.bindAsEventListener(this))},showSelectBoxes:function(){var A=$A(document.getElementsByTagName("select"));A.each(function(B){B.style.visibility="visible"})},hideSelectBoxes:function(){var A=$A(document.getElementsByTagName("select"));A.each(function(B){B.style.visibility="hidden"})},requestForm:function(B){Event.stop(B);this.getPageDimensionsAndScroll();this.hideSelectBoxes();this.visible=true;this.modalDiv=document.createElement("div");this.modalDiv.className="modal";this.bodyWrapper=$("bodyWrapper");this.bodyWrapper.appendChild(this.modalDiv);this.modalDiv.style.height=this.pageHeight+"px";this.modalDiv.style.width=this.pageWidth+"px";this.modalDiv.style.filter="alpha(opacity=50)";this.modalDiv.style.opacity=0.5;this.modalDiv.style.MozOpacity=0.5;this.agentDiv=Element.extend(document.createElement("div"));this.bodyWrapper.appendChild(this.agentDiv);this.agentDiv.update(this.params.markup);this.closeWindowLink=this.agentDiv.getFirstElementByClassName("closeWindowLink");Event.observe(this.closeWindowLink,"click",this.close.bindAsEventListener(this));this.changeSearchDiv=this.agentDiv.getFirstElementByClassName("changeSearch");this.changeSearchDivHeight=this.changeSearchDiv.getHeight();this.changeSearchDivWidth=this.changeSearchDiv.getWidth();this.changeSearchDivTopMargin=0;if(this.changeSearchDivHeight<this.windowHeight){this.changeSearchDivTopMargin=(this.windowHeight-this.changeSearchDivHeight)*0.5}this.changeSearchDiv.style.marginTop=this.yScroll+this.changeSearchDivTopMargin+"px";this.changeSearchDivLeftMargin=0;if(this.changeSearchDivWidth<this.windowWidth){this.changeSearchDivLeftMargin=(this.windowWidth-this.changeSearchDivWidth)*0.5}this.changeSearchDiv.style.marginLeft=this.xScroll+this.changeSearchDivLeftMargin+"px";var C="";if(this.params.url){C=this.params.url;C="&"+C.substr(C.indexOf("?")+1)}else{C="&"+location.search.substring(1)}if(this.params.url&&this.params.url.indexOf("book")!=-1){C=C.replace("&amp%3B","&");C=C.replace("&amp;","&");var A=new Ajax.Request("/book/bookingpath",{parameters:"changeSearch=true"+C,onSuccess:this.success.bind(this),onFailure:this.failure})}else{var A=new Ajax.Request("/shop/searchForm",{parameters:"changeSearch=true"+C,onSuccess:this.success.bind(this),onFailure:this.failure})}},getPageDimensionsAndScroll:function(){if(window.innerHeight&&window.scrollMaxY){this.yScroll=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){this.yScroll=document.body.scrollHeight}else{this.yScroll=document.body.offsetHeight}}if(self.innerHeight){this.windowHeight=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){this.windowHeight=document.documentElement.clientHeight}else{if(document.body){this.windowHeight=document.body.clientHeight}}}if(this.yScroll<this.windowHeight){this.pageHeight=this.windowHeight}else{this.pageHeight=this.yScroll}if(self.pageYOffset){this.yScroll=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.yScroll=document.documentElement.scrollTop}else{if(document.body){this.yScroll=document.body.scrollTop}}}if(window.innerWidth&&window.scrollMaxX){this.xScroll=window.innerWidth+window.scrollMaxX}else{if(document.body.scrollWidth>document.body.offsetWidth){this.xScroll=document.body.scrollWidth}else{this.xScroll=document.body.offsetWidth}}if(self.innerWidth){this.windowWidth=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){this.windowWidth=document.documentElement.clientWidth}else{if(document.body){this.windowWidth=document.body.clientWidth}}}if(this.xScroll<this.windowWidth){this.pageWidth=this.windowWidth}else{this.pageWidth=this.xScroll}if(self.pageXOffset){this.xScroll=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){this.xScroll=document.documentElement.scrollLeft}else{if(document.body){this.xScroll=document.body.scrollLeft}}}},close:function(A){Event.stop(A);this.visible=false;this.bodyWrapper.removeChild(this.modalDiv);this.bodyWrapper.removeChild(this.agentDiv);this.showSelectBoxes()},success:function(B){log.info("Response received from /shop/searchForm");if(this.visible){var A=this.agentDiv.getFirstElementByClassName("intrastitial");A.removeClassName("intrastitial");A.update(B.responseText);Page.initializeDOMFragment(A.parentNode.parentNode)}},failure:function(){log.error("No response from /shop/searchForm")}});var ResultsCard=Class.create();ResultsCard.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.airCarToggle=this.element.getFirstElementByClassName("airCarToggle");this.itinerary=this.element.getFirstElementByClassName("airCarResultInnerShell");this.mouseOverFlag=false;this.attachToggle()},attachToggle:function(){this.airCarToggleLink=this.airCarToggle.getFirstElementByClassName("toggleLink");var _agents=this.airCarToggleLink.getAgents();this.airCarToggleLinkHideReveal=_agents.detect(function(agent){return agent.type=="HideReveal"});this.hideRevealChild=eval("new "+this.airCarToggleLinkHideReveal.type+"(this.airCarToggleLink, this.airCarToggleLinkHideReveal)");Event.observe(this.itinerary,"click",this.toggleCard.bindAsEventListener(this));Event.observe(this.itinerary,"mouseover",this.highlight.bindAsEventListener(this));Event.observe(this.itinerary,"mouseout",this.resetCard.bindAsEventListener(this));Event.observe(this.element,"mouseout",this.resetCard.bindAsEventListener(this));Event.observe(this.airCarToggle,"mouseover",this.highlight.bindAsEventListener(this));Event.observe(this.airCarToggle,"mouseout",this.resetCard.bindAsEventListener(this))},highlight:function(A){this.mouseOverFlag=true;this.element.addClassName("airCarHighlight")},resetCard:function(A){this.mouseOverFlag=false;this.clearAll()},toggleCard:function(A){var B=Element.extend(Event.element(A));if(B.tagName!="A"&&!B.hasClassName("linkAsButton")){log.info("resultsCard triggering hideReveal toggle");this.hideRevealChild.toggle(A)}else{log.info("resultsCard allowing the click event to continue");log.info("tag name: "+B.tagName)}},clearTimer:function(A){clearTimeout(A)},clearAll:function(){if(!this.mouseOverFlag){this.element.removeClassName("airCarHighlight")}}});var miniHotelForm=Class.create();miniHotelForm.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.triggerElement=this.element;this.triggerElement.pos=this.triggerElement.getPosition();this.paramsHash=$H(this.params);Event.observe(this.triggerElement,"click",this.showForm.bindAsEventListener(this));this.makeMiniForm()},makeMiniForm:function(){if($("miniHotelFormContainer")==null&&this.params.formMarkup){var B=Element.extend(document.createElement("div"));B.id="miniHotelFormContainer";B.className="noneBlock";var C=this.params.formMarkup.stripNoScripts();B.innerHTML=C;$("main").appendChild(B);var D=B.getFirstElementByClassName("closeFlyOut","span");Event.observe(D,"click",this.hideForm.bindAsEventListener(this));try{Page.initializeDOMFragment(B)}catch(A){Errors.capture(A,"initializeDOMFragment() failed for miniHotelForm();")}}},showForm:function(C){var A=$("miniHotelFormContainer");this.fixIE7Positioning();var B=A.getElementsByTagName("form")[0];Position.putInViewport(this.triggerElement,A);A.showByClass();this.paramsHash.each(function(E){if(E.key!="formMarkup"){var D=B.getInputs("hidden",E.key)[0];if(D==null){D=new Element("input",{type:"hidden",name:E.key})}D.value=E.value;B.appendChild(D)}}.bind(this));Event.stop(C)},fixIE7Positioning:function(B){var A=this.triggerElement.getParentByClassName("column1");if(A){A.style.position="relative"}},hideForm:function(A){$("miniHotelFormContainer").hideByClass();Event.stop(A)}});var GroupedMiniHotelForm=Class.create(Object.extend(new miniHotelForm(),{initExtend:function(){this.makeMiniForm();Event.observe(this.element,"click",function(A){try{var C=Event.element(A);var B="";if(C.tagName.toLowerCase()=="a"&&(B=C.getAgents()[0])&&B.type=="MiniHotelFormData"){Event.stop(A);this.paramsHash=$H(B.params);this.triggerElement=C;this.triggerElement.pos=this.triggerElement.getPosition();this.showForm()}}catch(D){Errors.capture(D,"in capture click for miniHotelForm")}}.bind(this))}}));var SelectFromPopup=Class.create();SelectFromPopup.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=this.element;Event.observe(A,"click",this.loadLinkInOpener.bindAsEventListener(this))},loadLinkInOpener:function(A){self.opener.location.href=this.element.href;Event.stop(A);self.close()}});var PhotoGallery=Class.create();PhotoGallery.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var C=this.element.parentNode;this.images=$A();this.imageIndex=0;$A(C.getElementsByTagName("A")).each(function(D){this.images.push(D)}.bind(this));C.removeChild(this.element);this.image=document.createElement("IMG");this.header=document.createElement("P");this.image.src=this.images[this.imageIndex].href;this.image.alt="";this.header.appendChild(document.createTextNode("1"));this.header.appendChild(document.createTextNode(" "+this.params.numText.strip()+" "+this.images.length));if(this.images.length>1){this.header.appendChild(document.createTextNode(" : "));var A=document.createElement("A");var B=document.createElement("A");A.appendChild(document.createTextNode(this.params.nextLink.strip()));B.appendChild(document.createTextNode(this.params.previousLink.strip()));A.href="#";B.href="#";this.header.appendChild(B);this.header.appendChild(document.createTextNode(" | "));this.header.appendChild(A);Event.observe(A,"click",this.nextClick.bind(this));Event.observe(B,"click",this.previousClick.bind(this))}C.appendChild(this.header);C.appendChild(this.image)},nextClick:function(A){this.imageIndex=(this.imageIndex+1>=this.images.length)?0:this.imageIndex+1;this.image.src=this.images[this.imageIndex].href;this.image.alt=this.images[this.imageIndex].title;this.header.firstChild.nodeValue=this.imageIndex+1;Event.stop(A)},previousClick:function(A){this.imageIndex=(this.imageIndex-1<0)?this.images.length-1:this.imageIndex-1;this.image.src=this.images[this.imageIndex].href;this.image.alt=this.images[this.imageIndex].title;this.header.firstChild.nodeValue=this.imageIndex+1;Event.stop(A)}});var UserReviewOverviewGraph=Class.create();UserReviewOverviewGraph.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){$A(this.element.getElementsByClassName("score")).each(function(D){var C=D.innerHTML.replace(/,/g,".");D.style.width=(C*1.5)+"em"});var A='<dt class="hidden graphHeading">&nbsp;</dt><dd class="graphHeading"><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span></dd>';var B=this.element.getElementsByTagName("dl")[0].innerHTML;this.element.getElementsByTagName("dl")[0].innerHTML=A+B;this.element.addClassName("graph")}});var MemberSignin=Class.create();MemberSignin.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.isMember=false;this.signInModule=this.element.getElementsBySelector("div.signIn")[0];this.nonMemberText=this.element.getElementsBySelector("p.nonMemberIntroText")[0];$A(this.element.getElementsByTagName("input")).each(function(B){if(B.type=="radio"){Event.observe(B,"click",this.click.bindAsEventListener(this));if((B.checked)&&(B.value=="true")){this.isMember=true;this.nonMemberText.hideByClass();this.signInModule.showByClass()}}}.bind(this));var A=this.element.getParentByTagName("form");Event.observe(A,"submit",this.submit.bindAsEventListener(this))},click:function(A){if(Event.element(A).value=="true"){this.isMember=true;this.nonMemberText.hideByClass();this.signInModule.showByClass()}else{this.isMember=false;this.signInModule.hideByClass();this.nonMemberText.showByClass()}},submit:function(A){if(!this.isMember){log.info('Stopping submit event on Login form since user has selected "I am not a member."');Event.stop(A)}}});var WhosTraveling=Class.create();WhosTraveling.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){log.info("WhosTraveling.initExtend()");this.travelerNamesArray=$A();this.travelerNamesTargetsArray=$A();this.travelerNamesTargetsSelectArray=$A();Profiler.start("travelerName");$A($("main").getElementsByClassName("travelerName")).each(function(A){if(A.hasClassName("travelerNameSelect")){var F=$A();var H=A.getElementsByTagName("select")[0];var G=H.options.length;for(var E=0;H.options[E];E++){var B=H.options[E].value;if(B!=""&&B!=undefined){F[B]=H.options[E].text}}this.travelerNamesTargetsSelectArray.push({target:A,options:F})}else{var C=A.getParams();var D=C.nameIndex;if(D!=null){if(this.travelerNamesTargetsArray[D]==null){this.travelerNamesTargetsArray[D]=$A()}this.travelerNamesTargetsArray[D].push(A)}}}.bind(this));Profiler.stop("travelerName");Profiler.start("whosTravelingNameEvents");$A(this.element.getElementsByClassName("whosTravelingName")).each(function(B,A){this.travelerNamesArray[A]=B;$A(B.getElementsByClassName("radio")).each(function(D){var C=D.getElementsByTagName("input")[0];Event.observe(C,"click",this.eventChangeTravelerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("select")).each(function(D){var C=D.getElementsByTagName("select")[0];Event.observe(C,"change",this.eventChangeTravelerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("textInput")).each(function(C){var D=C.getElementsByTagName("input")[0];Event.observe(D,"blur",this.eventChangeTravelerName.bindAsEventListener(this,A))}.bind(this));this.changeTravelerName(A)}.bind(this));Profiler.stop("whosTravelingNameEvents");Profiler.start("whosBooking");this.bookerIsTravelerInput=null;this.whosBooking=this.element.getFirstElementByClassName("whosBooking");if(this.whosBooking!=null&&this.whosBooking!="undefined"){$A(this.whosBooking.getFirstElementByClassName("notTravelingInput").getFirstElementByClassName("checkbox").getElementsByTagName("input")).each(function(A){if(A.type=="checkbox"){this.bookerIsTravelerInput=A;throw $break}}.bind(this));this.bookerIsTraveling=!this.bookerIsTravelerInput.checked;Event.observe(this.bookerIsTravelerInput,"click",this.eventChangeBookerState.bindAsEventListener(this));Event.observe(this.bookerIsTravelerInput,"change",this.eventChangeBookerState.bindAsEventListener(this));$A(this.whosBooking.getElementsByClassName("whosBookingNameNotInList")).each(function(B,A){$A(B.getElementsByClassName("radio")).each(function(D){var C=D.getElementsByTagName("input")[0];Event.observe(C,"click",this.eventChangeBookerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("select")).each(function(D){var C=D.getElementsByTagName("select")[0];Event.observe(C,"change",this.eventChangeBookerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("textInput")).each(function(C){var D=C.getElementsByTagName("input")[0];Event.observe(D,"blur",this.eventChangeBookerName.bindAsEventListener(this,A))}.bind(this));if(this.bookerIsTraveling){this.changeTravelerName(A)}}.bind(this))}Profiler.stop("whosBooking")},eventChangeBookerState:function(){if(!this.whosBookingElements){log.info("Collecting Traveler 1 related fields to show");this.whosBookingElements=$A();this.element.getElementsBySelector(".whosBookingContent").each(function(A){this.whosBookingElements.push(A)}.bind(this));this.element.getElementsBySelector(".firstTraveler .travelerInfoEmail").each(function(A){this.whosBookingElements.push(A)}.bind(this));this.element.getElementsBySelector(".firstTraveler .whosTravelingName").each(function(A){this.whosBookingElements.push(A)}.bind(this));this.element.getElementsBySelector(".firstTraveler .ftLegend").each(function(A){this.whosBookingElements.push(A)}.bind(this));this.element.getElementsBySelector(".whosBookingHeading").each(function(A){this.whosBookingElements.push(A)}.bind(this))}this.bookerIsTraveling=!this.bookerIsTravelerInput.checked;this.whosBookingElements.each(function(B){var A=this.bookerIsTraveling;if(B.hasClassName("whosBookingHeading")){A=!A}if(A){B.hideByClass()}else{B.showByClass()}}.bind(this));if(this.bookerIsTraveling){this.changeBookerName(0)}else{this.changeTravelerName(0)}},eventChangeBookerName:function(A,B){if(this.bookerIsTraveling){this.changeBookerName(B)}},eventChangeTravelerName:function(A,B){this.changeTravelerName(B)},changeBookerName:function(A){log.info("WhosTraveling.changeBookerName("+A+")");if(A>-1){fullName=this.getName(A);for(target in this.travelerNamesTargetsArray[A]){this.travelerNamesTargetsArray[A][target].innerHTML=" "+fullName}this.travelerNamesTargetsSelectArray.each(function(C){var B=C.target.getElementsByTagName("select")[0].options[A];if(B){B.text=C.options[A]+" "+fullName}})}},changeTravelerName:function(A){log.info("WhosTraveling.changeTravelerName("+A+")");if(A>-1){fullName=this.getName(A);for(target in this.travelerNamesTargetsArray[A]){this.travelerNamesTargetsArray[A][target].innerHTML=" "+fullName}this.travelerNamesTargetsSelectArray.each(function(C){var B=C.target.getElementsByTagName("select")[0].options[A];if(B){B.text=C.options[A]+" "+fullName}})}},getName:function(B){log.info("WhosTraveling.getName("+B+")");var E=this.travelerNamesArray[B].getFirstElementByClassName("memberSavedTravelerIndexUsed");if(E!=null&&E.getElementsByTagName("input")[0].checked==true){var C="";$A(this.travelerNamesArray[B].getElementsByClassName("whosTravelingNameSelectFromList"+B)).each(function(G){var F=G.getFirstElementByClassName("select").getElementsByTagName("select")[0];if(F.name=="models['travelersInput'].travelers["+B+"].memberSavedTravelerIndex"){if(F.options[F.selectedIndex].value!=""){C=F.options[F.selectedIndex].text}else{C=""}}}.bind(this))}else{if(this.bookerIsTraveling&&B==0){var A="";var D="";var C="";$A(this.whosBooking.getElementsByClassName("whosBookingNameNotInList")).each(function(F){$A(F.getElementsByClassName("select")).each(function(H){var G=H.getElementsByTagName("select")[0];if(G.name=="models['bookingInput'].name.prefix"&&G.selectedIndex!=0){A=G.options[G.selectedIndex].text}if(G.name=="models['bookingInput'].name.suffix"&&G.selectedIndex!=0){D=G.options[G.selectedIndex].text}}.bind(this));C=A+" ";$A(F.getElementsByClassName("textInput")).each(function(G){var H=G.getElementsByTagName("input")[0];C=C+H.value+" "}.bind(this));C=C+D}.bind(this))}else{var A="";var D="";var C="";$A(this.travelerNamesArray[B].getElementsByClassName("whosTravelingNameNotInList"+B)).each(function(F){$A(F.getElementsByClassName("select")).each(function(H){var G=H.getElementsByTagName("select")[0];if(G.name=="models['travelersInput'].travelers["+B+"].name.prefix"&&G.selectedIndex!=0){A=G.options[G.selectedIndex].text}if(G.name=="models['travelersInput'].travelers["+B+"].name.suffix"&&G.selectedIndex!=0){D=G.options[G.selectedIndex].text}}.bind(this));C=A+" ";$A(F.getElementsByClassName("textInput")).each(function(G){var H=G.getElementsByTagName("input")[0];C=C+H.value+" "}.bind(this));C=C+D}.bind(this))}}return C}});var LoyaltyProgramsTI=Class.create();LoyaltyProgramsTI.prototype=Object.extend(new PreferenceModule("LoyaltyProgramsTI"),{initExtendPref:function(){if(this.element.containsElementWithClassName("loyaltyPrefCar")){var A=this.getAgentRef("WhosTraveling");if(A){$A(A.element.getElementsByClassName("carDriverNotSame")).each(function(B){$A(B.getElementsByClassName("select")).each(function(D){var C=D.getElementsByTagName("select")[0];Event.observe(C,"change",this.setPrefLoyaltyCar.bindAsEventListener(this))}.bind(this))}.bind(this))}}},setPreferences:function(C,B){log.info("LoyaltyProgramsTI.setPreferences("+C+")");var D=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(C+1)).getElementsByTagName("select")[0];var A=D.options[D.selectedIndex].value;if(this.element.containsElementWithClassName("loyaltyPrefAir")){this.setPrefLoyaltyAir(C,A)}if(this.element.containsElementWithClassName("loyaltyPrefCar")){this.setPrefLoyaltyCar()}},setPrefLoyaltyAir:function(B,A){log.info("LoyaltyProgramsTI.setPrefAirLoyalty("+B+")");var D=this.element.getNthElementByClassName("loyaltyPrefAir",(B+1)).getElementsByTagName("input");for(var C=0;D[C];C++){D[C].value=this.savedTravelers[A]["airLoyalty"][C].programNumber}},setPrefLoyaltyCar:function(){log.info("LoyaltyProgramsTI.setPrefCarLoyalty()");var B=this.getAgentRef("WhosTraveling");if(B){var G=B.element.getFirstElementByClassName("carDriverNotSame");if(G){var E=G.getElementsByTagName("select")[0];var C=E.options[E.selectedIndex].value;var A=this.getSelIndex(B,C)}else{var A=this.getSelIndex(B,0)}if(A&&(this.element.containsElementWithClassName("loyaltyPrefCar"))){var F=this.element.getFirstElementByClassName("loyaltyPrefCar").getElementsByTagName("input");for(var D=0;F[D];D++){F[D].value=this.savedTravelers[A]["carLoyalty"][D].programNumber}}}},getSelIndex:function(B,D){var C=$A(B.element.getNthElementByClassName("whosTravelingName",(D+1).getElementsByClassName("radio")));for(var E=0;C[E];E++){var A=C[E].getElementsByTagName("input")[0];if(Element.extend(C[E].parentNode).hasClassName("nameSelect")&&A.checked==true&&A.value=="true"){return B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(D+1)).getElementsByTagName("select")[0].selectedIndex}}}});var AirSpecialRequests=Class.create();AirSpecialRequests.prototype=Object.extend(new PreferenceModule("AirSpecialRequests"),{setPreferences:function(C,B){log.info("AirSpecialRequests.setPreferences("+C+")");Profiler.start("AirSpecialRequests");var D=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(C+1)).getElementsByTagName("select")[0];var A=D.options[D.selectedIndex].value;$A(this.element.getElementsByClassName("travelerPrefs")).each(function(E){if(E.getParams().nameIndex==C){if(E.hasClassName("flightPrefSeat")){this.setPrefFlightSeat(E,A)}if(E.hasClassName("flightPrefMeal")){this.setPrefFlightMeal(E,A)}if(E.hasClassName("flightPrefSpecialRequest")){this.setPrefFlightSpecialRequest(E,A)}}}.bind(this));Profiler.stop("AirSpecialRequests")},setPrefFlightSeat:function(C,A){var D=C.getElementsByTagName("input");for(var B=0;D[B];B++){if(D[B].value==this.savedTravelers[A].flightPreferences.seat){D[B].checked=true}}},setPrefFlightMeal:function(D,A){var B=D.getElementsByTagName("select")[0];for(var C=0;B.options[C];C++){if(B.options[C].value==this.savedTravelers[A].flightPreferences.meal){B.selectedIndex=C}}},setPrefFlightSpecialRequest:function(D,A){var B=D.getElementsByTagName("select")[0];for(var C=0;B.options[C];C++){if(B.options[C].value==this.savedTravelers[A].flightPreferences.specialRequest){B.selectedIndex=C}}}});var TravelerInfoPhone=Class.create();TravelerInfoPhone.prototype=Object.extend(new PreferenceModule("TravelerInfoPhone"),{setPreferences:function(C,B){log.info("TravelerInfoPhone.setPreferences("+C+")");Profiler.start("TravelerInfoPhone");var D=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(C+1)).getElementsByTagName("select")[0];var A=D.options[D.selectedIndex].value;if(this.element.getParams().nameIndex==C){this.setPrefPhone(this.element,C,A)}Profiler.stop("TravelerInfoPhone")},setPrefPhone:function(F,C,A){log.info("TravelerInfoPhone.setPrefPhone("+C+")");var E=F.getFirstElementByClassName("phoneNumber").getElementsByTagName("input")[0];if(A!=""){E.value=this.savedTravelers[A].phone.phoneNumber}else{E.value=""}var G=F.getFirstElementByClassName("countryCode").getElementsByTagName("select")[0];var H=0;for(var D=0;G.options[D];D++){if(A!=""&&G.options[D].value==this.savedTravelers[A].phone.countryCode){H=D}}G.selectedIndex=H;if(F.getFirstElementByClassName("phoneExtension")){var B=F.getFirstElementByClassName("phoneExtension").getElementsByTagName("input")[0];if(A!=""){B.value=this.savedTravelers[A].phone.extension}else{B.value=""}}}});var TravelerInfoEmail=Class.create();TravelerInfoEmail.prototype=Object.extend(new PreferenceModule("TravelerInfoEmail"),{setPreferences:function(C,B){log.info("TravelerInfoEmail.setPreferences("+C+")");Profiler.start("TravelerInfoEmail");var D=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(C+1)).getElementsByTagName("select")[0];var A=D.options[D.selectedIndex].value;if(this.element.getParams().nameIndex==C){this.setPrefEmail(this.element,C,A)}Profiler.stop("TravelerInfoEmail")},setPrefEmail:function(C,B,A){log.info("TravelerInfoPhone.setPrefPhone("+B+")");var D=C.getElementsByTagName("input")[0];if(A!=""&&this.savedTravelers[A].email!=undefined){D.value=this.savedTravelers[A].email}else{D.value=""}}});var SubmitSelectOnChange=Class.create();SubmitSelectOnChange.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=this.element.getElementsByTagName("select")[0];if(A){Event.observe(A,"change",this.onChange.bindAsEventListener(this))}},onChange:function(A){if(this.element.getElementsByTagName("select")[0].value!=""){this.element.getFirstElementByClassName("changeSelectSubmit").getElementsByTagName("input")[0].click()}}});var CCVImage=Class.create();CCVImage.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.creditCardList=this.params.cardsInList;this.image=Element.extend(this.element.parentNode).getFirstElementByClassName("ccvImg");this.textBlock=Element.extend(this.element.parentNode).getFirstElementByClassName("ccvText");this.displayBlock=Element.extend(this.element.parentNode).getFirstElementByClassName("ccvDisplay");this.content3DSBlock=$A(this.element.parentNode.getElementsByClassName("cc3DSContent"));this.display3DSBlock=Element.extend(this.element.parentNode).getFirstElementByClassName("cc3DSDisplay");$A(this.element.getElementsByTagName("input")).each(function(A){if(A.type=="radio"){if(this.image!=null){Event.observe(A,"click",this.swapCCVImage.bindAsEventListener(this))}if(this.content3DSBlock!=null&&this.content3DSBlock.length>=3){Event.observe(A,"click",this.swap3DSContent.bindAsEventListener(this))}}}.bind(this));this.swapCCVImage();this.swap3DSContent()},swapCCVImage:function(A){for(i=0;i<this.creditCardList.length;i++){if(this.creditCardList[i].code==Event.element(A).value){this.image.innerHTML=this.creditCardList[i].img;if(this.creditCardList[i].img==""){this.displayBlock.hideByClass()}else{this.displayBlock.showByClass()}this.textBlock.innerHTML=this.creditCardList[i].text;break}}},swap3DSContent:function(D){for(i=0;i<this.creditCardList.length;i++){if(this.creditCardList[i].code==Event.element(D).value){var A=Element.extend(this.content3DSBlock[1]).getElementsBySelector(".cc3DSContentItem");var C="cc3DSContentItem"+this.creditCardList[i].code;for(var B=0;B<A.length;B++){if(C.match(A[B].id)){A[B].showByClass()}else{A[B].hideByClass()}}this.content3DSBlock[0].hideByClass();this.content3DSBlock[2].innerHTML="<p>"+this.creditCardList[i].securetext+"</p>";this.content3DSBlock[2].showByClass();if(this.creditCardList[i].securetext){this.display3DSBlock.showByClass()}else{this.display3DSBlock.hideByClass()}break}}}});var TagCloud=Class.create();TagCloud.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){Event.observe(this.element,"click",this.addTagToInput.bindAsEventListener(this))},addTagToInput:function(B){if(!this.textInput){this.textInput=this.element.up("form").down("label.keywords input")}if(!this.textInput){log.error("TagCloud: No text box found");return}var A=B.findElement("A");if(A){if(this.textInput.value.length>0){if(!this.textInput.value.strip().endsWith(",")){this.textInput.value+=","}if(!this.textInput.value.endsWith(" ")){this.textInput.value+=" "}}if(A.textContent){this.textInput.value+=A.textContent}else{if(A.innerText){this.textInput.value+=A.innerText}}}B.preventDefault()}});var SelectHideReveal=Class.create();SelectHideReveal.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.dropDown=this.element;this.parentNode=this.element.getParentByClassName(this.params.parentClass);Event.observe(this.dropDown,"change",this.toggleElements.bindAsEventListener(this))},toggleElements:function(){var A=(this.dropDown[this.dropDown.selectedIndex].value!=="")?this.dropDown[this.dropDown.selectedIndex].value:this.params.blankOptionName;for(var C=0;C<this.params.paymentOptions[A].showClasses.length;C++){$A(this.parentNode.getElementsByClassName(this.params.paymentOptions[A].showClasses[C])).each(function(D){D.showByClass()})}for(var B=0;B<this.params.paymentOptions[A].hideClasses.length;B++){$A(this.parentNode.getElementsByClassName(this.params.paymentOptions[A].hideClasses[B])).each(function(D){D.hideByClass()})}}});var AutoSubmitter=Class.create();AutoSubmitter.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){setTimeout(function(){this.element.click()}.bind(this),500)}});var CCSpecialFields=Class.create();CCSpecialFields.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.container=this.element.getParentByClassName("editBillingProfileInclude");this.targetFields=$A(this.container.getElementsByClassName(this.params.targetClassname));this.cardIDsRequiringFields=[];this.params.cardIDs.each(function(A){log.info("Adding "+A.code+" to special card array for "+this.params.targetClassname+" classed objects.");this.cardIDsRequiringFields[A.code]=true}.bind(this));$A(this.element.getElementsByTagName("input")).each(function(A){if(A.type=="radio"){Event.observe(A,"click",this.showHideFields.bindAsEventListener(this))}}.bind(this))},showHideFields:function(B){var A=Event.element(B).value;if(this.cardIDsRequiringFields[A]){this.targetFields.each(function(C){C.showByClass()}.bind(this))}else{this.targetFields.each(function(C){C.hideByClass()}.bind(this))}}});var CustomerAddressForm=Class.create();CustomerAddressForm.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.countryInput=null;this.countrySelect=null;this.countryWrapper=this.element.getFirstElementByClassName("addressCountryField");this.cityWrapper=this.element.getFirstElementByClassName("addressCityField");if(this.countryWrapper.getElementsByTagName("input").length>0){this.countryInput=this.element.getElementsByTagName("input")[0]}if(this.countryWrapper.getElementsByTagName("select").length>0){this.countrySelect=this.element.getElementsByTagName("select")[0]}this.stateProvince=this.element.getFirstElementByClassName("stateProvince");this.initialHTML=this.stateProvince.innerHTML;this.initialValue="";this.stateProvince.hasError=Element.extend(this.stateProvince.getElementsByTagName("label")[0]).hasClassName("error");if(this.stateProvince.getElementsByTagName("input").length>0){this.initialValue=this.stateProvince.getElementsByTagName("input")[0].value}if(this.stateProvince.getElementsByTagName("select").length>0){this.initialValue=this.stateProvince.getElementsByTagName("select")[0][this.stateProvince.getElementsByTagName("select")[0].selectedIndex].value}this.postalCodeWrapper=this.element.getFirstElementByClassName("postalCode");this.countriesWithoutPostalCode=$A(this.params.countriesWithoutPostalCode.split(","));this.getListAjax();this.setPostalCode();if(this.countrySelect!=null){Event.observe(this.countrySelect,"change",this.getListAjax.bindAsEventListener(this));Event.observe(this.countrySelect,"change",this.setPostalCode.bindAsEventListener(this))}},setPostalCode:function(){var A=null;if(this.countryInput!=null){A=this.countryInput.value}if(this.countrySelect!=null){A=this.countrySelect[this.countrySelect.selectedIndex].value}var B=false;for(i=0;i<this.countriesWithoutPostalCode.length;i++){if(this.countriesWithoutPostalCode[i]==A){B=true;break}}if(B){this.postalCodeWrapper.hideByClass()}else{this.postalCodeWrapper.showByClass()}},getListAjax:function(){this.stateProvince.addClassName("intrastitial");var A=null;if(this.countryInput!=null){A=this.countryInput.value}if(this.countrySelect!=null){A=this.countrySelect[this.countrySelect.selectedIndex].value}var B=new Ajax.Request("/helper/populateStateList",{parameters:"models[countryCode].countryCode="+A,onSuccess:this.success.bind(this),onFailure:this.failure.bind(this),onException:this.failure.bind(this)})},success:function(A){log.info("Response recieved from stateProvince AJAX");this.fillDiv(A.responseText);this.stateProvince.removeClassName("intrastitial")},failure:function(A){log.error("No response from stateProvince AJAX");this.initialFill(this.initialHTML);this.stateProvince.removeClassName("intrastitial")},fillDiv:function(D){var F="";var E=new RegExp('name="[^"]*"');F=D.replace(E,'name="'+this.params.stateProvinceBindNode+'"');var A=new RegExp('value="[^"]*"');F=F.replace(A,'value="'+this.initialValue+'"');this.stateProvince.update(F);if(this.stateProvince.hasError){this.stateProvince.getElementsByTagName("label")[0].addClassName("error")}if(this.stateProvince.getElementsByTagName("select").length>0){var B=this.stateProvince.getElementsByTagName("select")[0];for(var C=0;B.options[C];C++){if(B.options[C].value==this.initialValue){B.selectedIndex=C}}}},initialFill:function(A){this.stateProvince.innerHTML=A}});var ChangeShippingAddress=Class.create();ChangeShippingAddress.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=$A(this.element.getElementsByTagName("input"));this.radios=$A();A.each(function(B){if(B.type=="radio"){this.radios.push(B)}}.bind(this));this.newAddressForm=this.element.getElementsBySelector(".profileAddressNew .editShipping");this.useBillingAddressSelected=true;this.useNewAddressSelected=false;this.radios.each(function(B){if(Element.extend(B.parentNode.parentNode).hasClassName("useBillingAddress")){if(!B.checked){this.useBillingAddressSelected=false}Event.observe(B,"click",this.useBillingAddress.bindAsEventListener(this))}}.bind(this));this.radios.each(function(B){if(Element.extend(B.parentNode.parentNode).hasClassName("profileAddressNew")){if(this.useBillingAddressSelected){B.checked=false}if(B.checked){this.useNewAddressSelected=true}Event.observe(B,"click",this.useNewAddress.bindAsEventListener(this))}else{if(Element.extend(B.parentNode.parentNode).hasClassName("profileAddress")){if(this.useBillingAddressSelected){B.checked=false}Event.observe(B,"click",this.useOtherAddress.bindAsEventListener(this))}}}.bind(this));this.existingAddressAlert=this.element.getElementsByClassName("existingAddressAlert")[0];if(this.useNewAddressSelected){this.useNewAddress()}},useNewAddress:function(){this.showNewAddress();this.radios.each(function(A){if(Element.extend(A.parentNode.parentNode).hasClassName("useOtherAddress")){A.checked=true;throw $break}})},useOtherAddress:function(){this.hideNewAddress();this.radios.each(function(A){if(Element.extend(A.parentNode.parentNode).hasClassName("useOtherAddress")){A.checked=true;throw $break}})},useBillingAddress:function(){this.hideNewAddress();this.radios.each(function(A){if(Element.extend(A.parentNode.parentNode).hasClassName("profileAddress")){A.checked=false}})},showNewAddress:function(){this.newAddressForm.each(function(A){A.showByClass()}.bind(this));if(this.existingAddressAlert){this.existingAddressAlert.hideByClass()}},hideNewAddress:function(){this.newAddressForm.each(function(A){A.hideByClass()}.bind(this));if(this.existingAddressAlert){this.existingAddressAlert.showByClass()}}});var LoyaltyProgram=Class.create();LoyaltyProgram.prototype={initialize:function(A){this.containerElement=A;this.isVisible=A.visibleByClass();if(this.isVisible){this.completeInitialization()}},completeInitialization:function(){var B=this.containerElement.getElementsByTagName("label");this.clearableFields=$A();for(var A=0;A<B.length;A++){var C=B[A].getElementsByTagName("input")[0];if(C==null){C=B[A].getElementsByTagName("select")[0]}if(C){this.clearableFields.push(C)}}this.deleteLink=this.containerElement.getLastElementByClassName("deleteProgram","span");Event.observe(this.deleteLink,"click",this.deleteProgram.bindAsEventListener(this))},addProgram:function(){this.containerElement.showByClass();this.completeInitialization()},deleteProgram:function(){this.clearableFields.each(function(B){B.value="";if(document.fireEvent){B.fireEvent("onchange")}else{var A=document.createEvent("HTMLEvents");A.initEvent("change",true,true);B.dispatchEvent(A)}});this.containerElement.hideByClass()}};var LoyaltyPrograms=Class.create();LoyaltyPrograms.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.loyaltyPrograms=$A();this.nextAvailableLoyaltyProgram=0;var A=this.element.getElementsByTagAndClass("div","loyaltyProgram");for(var B=0;B<A.length;B++){var C=new LoyaltyProgram(A[B]);if(C.isVisible){this.nextAvailableLoyaltyProgram++}this.loyaltyPrograms.push(C)}this.numLoyaltyPrograms=this.loyaltyPrograms.length;this.addProgramLink=this.element.getLastElementByClassName("addProgramLink","p");Event.observe(this.addProgramLink,"click",this.addAnotherProgram.bindAsEventListener(this))},addAnotherProgram:function(){if(this.nextAvailableLoyaltyProgram<this.loyaltyPrograms.length){this.loyaltyPrograms[this.nextAvailableLoyaltyProgram].addProgram();this.nextAvailableLoyaltyProgram++;if(this.nextAvailableLoyaltyProgram>=this.loyaltyPrograms.length){this.addProgramLink.remove()}}else{log.error("no more to show")}}});var WebTrends=Class.create();WebTrends.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(this.enabled){this.webTrendsFuncCall="dcsSetVar('DCS.dcsuri', '"+location.pathname+"', 'WT.ti', '"+this.title+"', ";for(i in this.nameValuePairs){this.webTrendsFuncCall+="'"+this.webTrendsPrefix+i+"', '"+this.nameValuePairs[i]+"', "}this.webTrendsFuncCall=this.webTrendsFuncCall.substring(0,this.webTrendsFuncCall.length-2)+")";this.webTrendsCallback=this.webTrendsClick.bind(this);Event.observe(this.element,this.eventType,this.webTrendsCallback)}},webTrendsClick:function(){eval(this.webTrendsFuncCall);if(!this.persistent){Event.stopObserving(this.element,this.eventType,this.webTrendsCallback)}}});var RemoveLinks=Class.create();RemoveLinks.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){$A(this.element.getElementsByTagName("a")).each(function(B){var C=document.createElement("span");C.innerHTML=B.innerHTML;var A=B.parentNode;A.replaceChild(C,B)})}});var FlightDetailsMicrocontent=Class.create();FlightDetailsMicrocontent.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.content={string:this.params.content};this.options={heading:this.params.heading,headerless:this.params.headerless,triggerEvent:"click",closeEvent:this.params.closeEvent};this.microcontent=new Microcontent([this.element],this.content,this.options)}});var CarItineraryMicrocontent=Class.create();CarItineraryMicrocontent.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=this.element.ancestors();var D,B;var E="carItinerary";var C=false;for(B=0;B<A.length;B++){D=A[B].readAttribute("class");if(D!=null){D=D.split(" ");for(j=0;j<D.length;j++){if(D[j]==E){C=true;break}}if(C){break}}}if(B==A.length){log.error("Cannot find element with class "+E);return}this.content={domNode:A[B].getElementsBySelector(".includesExcludes")[0]};this.options={heading:this.params.heading,headerless:this.params.headerless,triggerEvent:this.params.triggerEvent,closeEvent:this.params.closeEvent};this.microcontent=new Microcontent([this.element],this.content,this.options)}});var MicrocontentAgent=Class.create();MicrocontentAgent.prototype=Object.extend(new Abstract.Agent(),{initialize:function(A,C){Object.extend(this,C);this.element=Element.extend(A);var B=$A();B.push(this.element);if(C.params.additionalTriggers){C.params.additionalTriggers.each(function(D){$$(D).each(function(E){B.push(E)})})}this.dialogObject=new Microcontent(B,C.params.content,C.params.options)}});var LightboxAgent=Class.create();LightboxAgent.prototype=Object.extend(new Abstract.Agent(),{initialize:function(A,B){Object.extend(this,B);this.element=Element.extend(A);this.dialogObject=new Lightbox([this.element],B.params.content,B.params.options)}});var DialogPositioningContextAgent=Class.create();DialogPositioningContextAgent.prototype=Object.extend(new Abstract.Agent(),{initialize:function(A,B){Object.extend(this,B);this.element=Element.extend(A);this.dialogPositioningContextObject=new DialogPositioningContext(this.element)}});var ChangeSearchLightboxAgent=Class.create(Abstract.Agent,{initialize:function(A,B){Object.extend(this,B);this.element=Element.extend(A);this.dialogObject=new ChangeSearchLightbox([this.element],B.params.content,B.params.options,B.params.wrapperMarkup)}});var ElementUpdateTrigger=Class.create();ElementUpdateTrigger.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=this.params.event?this.params.event:"click";Event.observe(this.element,A,this.updateSummary.bindAsEventListener(this))},updateSummary:function(B){if(D(B,this.element)){document.fire("contentUpdate:started");var C=this.element.form;var E=Form.serialize(C).deleteQueryStringParam("_eventId",true)+"&"+this.params.eventId+"=true";var A=new Ajax.Request(C.action,{method:"post",parameters:E,onSuccess:function(F){document.fire("content:update",F.responseText.unescapeJSON().evalJSON())},onFailure:function(){log.error("No response from application for Element Updates")}})}function D(G,F){var H=true;if(F.tagName.toLowerCase()==="label"&&G.target.tagName.toLowerCase()!=="input"){H=false}return H}}});var ElementUpdater=Class.create();ElementUpdater.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){document.observe("content:update",this.updateContent.bindAsEventListener(this))},updateContent:function(A){if(this.params.sourceKey in A.memo){this.hideContent(this.element,function(){try{this.element.update(A.memo[this.params.sourceKey].unescapeXML());Page.initializeDOMFragment(this.element);document.fire("contentUpdate:succeeded")}catch(B){Errors.capture(B)}this.showContent(this.element)}.bind(this))}},hideContent:function(A,B){document.body.style.cursor="wait";new Effect.Fade(A,{duration:0.2,to:0.2,afterFinish:B})},showContent:function(A){new Effect.Appear(A,{duration:0.2,from:0.2,to:1});document.body.style.cursor="default"}});var AjaxStatusFlagManager=Class.create();AjaxStatusFlagManager.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){document.observe("contentUpdate:started",this.ajaxStarted.bindAsEventListener(this));document.observe("contentUpdate:succeeded",this.ajaxSucceeded.bindAsEventListener(this));this.element.value="true"},ajaxStarted:function(A){log.debug("setting ajax response status to false");this.element.value="false"},ajaxSucceeded:function(A){log.debug("setting ajax response status to true");this.element.value="true"}});var NonLocalizedContentManager=Class.create();NonLocalizedContentManager.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){Event.observe(this.element,"click",this.updateContent.bindAsEventListener(this))},updateContent:function(D){var A=document.createDocumentFragment();var C=A.appendChild(Element.extend(document.createElement("div")));C.innerHTML=this.params.content.unescapeHTML();var B=this.element.parentNode.parentNode;B.innerHTML="";B.appendChild(A);Event.stop(D)}});var AbstractSlider=Class.create();AbstractSlider.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.min=this.params.min;this.max=this.params.max;this.numberOfIntervals=this.params.numberOfIntervals||0;this.sliderValue=this.params.sliderValue||this.min;this.sliderValue=this.sliderValue<this.min?this.min:this.sliderValue;this.sliderLabel=this.params.sliderLabel||null;this.intrastitialMessage=this.params.intrastitialMessage||"";this.form=this.element.up("form");this.sliderBody=this.element.getElementsBySelector(".sliderBody")[0];this.hiddenInput=this.element.getElementsByTagName("input")[0];if(this.intrastitial==null){this.intrastitial=new Intrastitial(this.intrastitialMessage,$("main").select(".main")[0])}this.options={};this.options.range=$R(this.min,this.max);this.options.sliderValue=this.sliderValue;this.options.onChange=null;if(this.numberOfIntervals>0){var A=new Array();var B=(this.max-this.min)/this.numberOfIntervals;for(i=this.min;i<=this.max;i=i+B){A.push(this.min+i)}this.options.values=A}this.templateOneHandle=new Template('<div class="hotelSliderWrapper #{sliderPrefix}Wrapper"><div class="filterOutput"><div class="changedFeedback">#{feedback}</div></div><h2>'+this.sliderLabel+'</h2><div class="sliderIntervals"><div id="#{sliderPrefix}Wrap" class="wrap"><div id="#{sliderPrefix}Span" class="span"><div id="#{sliderPrefix}Track" class="track"><div id="#{sliderPrefix}Handle" class="selected handle"></div></div></div></div></div><div class="intervalMin">#{intervalMin}</div><div class="intervalMax">#{intervalMax}</div></div>');this.initSlider()}});var StarSlider=Class.create();StarSlider.prototype=Object.extend(new AbstractSlider(),{initSlider:function(){this.starRating=this.sliderValue+1;var A={sliderPrefix:"star",feedback:"<div class='stars"+this.starRating+"'>&nbsp;</div>"};this.sliderBody.innerHTML=this.templateOneHandle.evaluate(A);this.options.startSpan="starSpan";this.changedFeedback=this.sliderBody.getElementsBySelector(".changedFeedback")[0];this.options.onChange=function(B){this.element.fire("agent:sliderChange",{name:"starSlider"});var C=B+1;var D=this.starRating;this.starRating=C;this.hiddenInput.value=this.starRating;query=unescape(this.form.serialize());url=this.form.action;new Ajax.Request(url,{method:"get",parameters:query+"&rep=partial",onCreate:(function(){this.intrastitial.show()}).bind(this),onSuccess:function(F){Page.initializeAjaxResponse(F.responseText);var E=this.changedFeedback.getElementsByClassName("stars"+D)[0];E.removeClassName("stars"+D);E.addClassName("stars"+C);this.intrastitial.hide()}.bind(this)})}.bind(this);this.slider=new Control.Slider("starHandle","starTrack",this.options)}});var ReviewScoreSlider=Class.create();ReviewScoreSlider.prototype=Object.extend(new AbstractSlider(),{initSlider:function(){this.reviewScoreRating=this.sliderValue+1;var A={sliderPrefix:"reviewScore",feedback:this.reviewScoreRating};this.sliderBody.innerHTML=this.templateOneHandle.evaluate(A);this.options.startSpan="reviewScoreSpan";this.changedFeedback=this.sliderBody.getElementsBySelector(".changedFeedback")[0];this.options.onChange=function(B){this.element.fire("agent:sliderChange",{name:"reviewScoreSlider"});var D=B+1;var C=this.reviewScoreRating;this.reviewScoreRating=D;this.hiddenInput.value=this.reviewScoreRating;query=unescape(this.form.serialize());url=this.form.action;new Ajax.Request(url,{method:"get",parameters:query+"&rep=partial",onCreate:function(){this.intrastitial.show()}.bind(this),onSuccess:function(E){Page.initializeAjaxResponse(E.responseText);this.changedFeedback.innerHTML=D;this.intrastitial.hide()}.bind(this)})}.bind(this);this.slider=new Control.Slider("reviewScoreHandle","reviewScoreTrack",this.options)}});var PriceSlider=Class.create();PriceSlider.prototype=Object.extend(new AbstractSlider(),{initSlider:function(){this.maxPriceLabel=this.params.maxPriceLabel;this.minPriceLabel=this.params.minPriceLabel;this.max=Math.round(this.max);this.min=Math.round(this.min);this.sliderValue=Math.round(this.sliderValue);this.options.range=$R(0,this.max-this.min);this.options.sliderValue=this.sliderValue;this.maxPrice=this.max;var A={sliderPrefix:"price",feedback:this.minPriceLabel+" to "+this.maxPriceLabel,intervalMin:this.minPriceLabel,intervalMax:this.maxPriceLabel};this.sliderBody.innerHTML=this.templateOneHandle.evaluate(A);this.options.startSpan="priceSpan";this.changedFeedback=this.sliderBody.getElementsBySelector(".changedFeedback")[0];if(this.sliderValue>this.min&&this.sliderValue<this.max){this.changedFeedback.innerHTML=this.minPriceLabel+" to "+this.maxPriceLabel.replace(/\d+/,this.sliderValue)}this.options.onSlide=function(B){var C=B.round()+this.min;this.changedFeedback.innerHTML=this.minPriceLabel+" to "+this.maxPriceLabel.replace(/\d+/,C)}.bind(this);this.options.onChange=function(B){this.element.fire("agent:sliderChange",{name:"priceSlider"});var C=B.round()+this.min;this.maxPrice=C;this.hiddenInput.value=this.maxPrice;query=unescape(this.form.serialize());url=this.form.action;new Ajax.Request(url,{method:"get",parameters:query+"&rep=partial",onCreate:function(){this.intrastitial.show()}.bind(this),onSuccess:function(D){Page.initializeAjaxResponse(D.responseText);this.intrastitial.hide()}.bind(this)})}.bind(this);this.slider=new Control.Slider("priceHandle","priceTrack",this.options)}});var Autocomplete=Class.create();Autocomplete.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(!this.params.url){log.error("Autocomplete: No 'url' parameter was passed to agent");return}this.input=this.element.getElementsByTagName("input")[0];if(!this.input){log.error("Autocomplete: No input found inside element");return}this.suggestions=new Element("div",{className:"smartFillSuggestions"});this.element.parentNode.insertBefore(this.suggestions,this.element.nextSibling);this.params.parameters=Object.toQueryString(this.params.parameters);if(this.params.highlightMatches){this.params.transformResponse=this.highlightMatches.bind(this)}this.autocompleter=new Ajax.AutocompleterJSON(this.input,this.suggestions,this.params.url,this.params);if(this.params.additionalInfoParamName){Event.observe(this.element.form,"submit",this.matchResults.bindAsEventListener(this))}},highlightMatches:function(C){var B=this.input.value.strip();B=B.replace(/([\[|\\|\^|\$|\.|\||\?|\*|\+|\(|\)])/gm,"\\$1");B=new RegExp("("+B+")","im");var A=$(C).select("li");A.each(function(D){D.cleanWhitespace();$A(D.childNodes).each(function(F){if(F.nodeName=="#text"){var E=new Element("span").update(F.nodeValue.replace(B,'<span class="match">$1</span>'));D.replaceChild(E,F)}})});return C},matchResults:function(){if(this.autocompleter.results){if(!this.additionalInfo){this.additionalInfo=new Element("input",{type:"hidden",name:this.params.additionalInfoParamName});this.element.parentNode.insertBefore(this.additionalInfo,this.element.nextSibling)}var A=this.input.value.strip().toLowerCase();var C=this.autocompleter.results;for(var B=0;B<C.length;B++){if(A==C[B].suggestion.toLowerCase()){this.additionalInfo.value=C[B].additionalInfo;break}}}}});var Intrastitial=Class.create();Intrastitial.prototype={initialize:function(B,A){if(arguments.length>=2){this.targetElement=A;this.mask=new Element("div",{"class":"resultsIntrastitial"});var C=new Element("div",{"class":"message"});C.innerHTML="<span>"+B+"</span>";this.mask.appendChild(C);this.mask.setOpacity(0.8);C.setOpacity(1);this.mask.hide();this.targetElement.appendChild(this.mask)}else{log.error("Intrastitial.initialize: too few arguments!")}},show:function(){if(this.mask){var A=this.targetElement.getDimensions();this.mask.setStyle({width:A.width+"px",height:A.height+"px"});this.mask.show()}},hide:function(){if(this.mask){this.mask.hide()}}};var MultiNodeUpdaterTarget=Class.create(Abstract.Agent,{initExtend:function(){Page.multiNodeTargets=Page.multiNodeTargets||{};this.dialogManager=new DialogManager(this.element);if(Page.multiNodeTargets[this.params.targetId]){try{var B=Page.multiNodeTargets[this.params.targetId];B.dialogManager.destroy();B.element.parentNode.replaceChild(this.element,B.element);delete B}catch(A){Errors.capture(A)}}Page.multiNodeTargets[this.params.targetId]=this}});var WebTrendsMultiTrackListener=Class.create();WebTrendsMultiTrackListener.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.defaultTags=$H({"DCS.dcsuri":"","DCS.dcsqry":"","WT.ti":"","WT.ad":"","WT.mc_id":"","WT.sp":""});document.observe("webtrends:multiTrackEvent",function(D){var F=D;var E=F.pathname?((F.pathname.indexOf("/")!=0)?"/"+F.pathname:F.pathname):"/";var C=F.textContent||F.innerText||F.innerHTML||"";var B=this.defaultTags.clone();B.set("DCS.dcsuri",E);B.set("DCS.dcsqry",F.search||"");B.update($H(D.memo));var A=[];B.each(function(G){A.push(G.key);A.push(G.value)});log.debug("WebTrends, sending: dcsMultiTrack() with parameters: "+A);dcsMultiTrack.apply(undefined,A);dcsCleanUp("WT.co_f",WT.co_f,"WT.vt_sid",WT.vt_sid,"DCSext.hostname",DCSext.hostname,"DCSext.b",DCSext.b,"DCSext.wtEvtSrc",DCSext.wtEvtSrc)}.bind(this))}});var WebTrendsTrackElement=Class.create();WebTrendsTrackElement.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=this.element.tagName.toLowerCase();if(A!="a"){this.tags=this.params.tags;Event.observe(this.element,this.params.event,function(B){this.element.fire("webtrends:multiTrackEvent",this.params.tags)}.bind(this))}}});var WebTrendsTrackSliderChange=Class.create();WebTrendsTrackSliderChange.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.tags=this.params.tags;this.element.observe("agent:sliderChange",function(A){this.element.fire("webtrends:multiTrackEvent",this.tags)}.bind(this))}});var WebTrendsTrackCheckboxList=Class.create();WebTrendsTrackCheckboxList.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.tags=this.params.tags;this.checkboxes=this.element.select("input[type=checkbox]");this.tagPrefixes=$H();this.params.dynamicallyAddValue.each(function(A){this.tagPrefixes.set(A,this.tags[A])}.bind(this));this.checkboxes.each(function(A){A.observe("click",function(B){elem=B.element();if(elem.checked){if(this.params.dynamicallyAddValue!=null){this.params.dynamicallyAddValue.each(function(C){this.tags[C]=this.tagPrefixes.get(C)+elem.value}.bind(this))}this.element.fire("webtrends:multiTrackEvent",this.tags)}}.bind(this))}.bind(this))}});var WebTrendsTrackSelectBox=Class.create();WebTrendsTrackSelectBox.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.tags=this.params.tags;var A=this.element.select("select");for(i=0;i<A.length;i++){Event.observe(A[i],"change",function(B){elem=B.element();if(this.params.dynamicallyAddValue!=null){this.params.dynamicallyAddValue.each(function(C){this.tags[C]+=elem.value}.bind(this))}elem.fire("webtrends:multiTrackEvent",this.tags)}.bind(this))}}});var GoogleCSESearchBox=Class.create(Abstract.Agent,{initExtend:function(){var A=new Template('<form id="searchbox_#{cx}" action="/App/PrepareSearchResult"><input type="hidden" name="cx" value="#{cx}" /><input type="hidden" name="safe" value="active" /><input type="hidden" name="cof" value="FORID:9" /><input type="hidden" class="searchValue" name="ve_kw" value="" /><input class="searchBox" name="q" size="36" value="" type="search" autosave="#{autosave}" results="10" /><span class="control submit"><input class="button" type="submit" value="#{buttonText}" /></span></form>');this.element.update(A.evaluate({cx:this.params.cx,buttonText:this.params.buttonText,autosave:this.params.autosave}));Event.observe(this.element.down("form"),"submit",this.handleSubmit.bind(this));var B=document.createElement("script");B.type="text/javascript";B.src="http://www.google.com/coop/cse/brand?form=searchbox_"+this.params.cx;this.element.appendChild(B)},handleSubmit:function(C){var B=this.element.down("input.searchBox");var D=this.element.down("input.searchValue");var A=(B)?B.value:"";A=A.replace(/^\s+/,"");A=A.replace(/\s+$/,"");if(D){D.value=A}if(A==""){if(C){Event.stop(C)}return false}}});var OasOptionsToggle=Class.create(Abstract.Agent,{initExtend:function(){this.oasOptions=null;Event.observe(this.element,"click",function(A){if(!this.oasOptions){this.oasOptions=this.element.up("div.oasProductOptions")}if(this.oasOptions.hasClassName("collapsedView")){this.element.update(this.params.hideDetailsText);this.oasOptions.removeClassName("collapsedView")}else{this.element.update(this.params.showDetailsText);this.oasOptions.addClassName("collapsedView")}A.preventDefault()}.bindAsEventListener(this))}});var ProgressIndicator=Class.create();ProgressIndicator.prototype={initialize:function(C,I){var F=I?I:"&#8226;";var A=C?C*0.75:0.75;this.container=new Element("div").addClassName("progressIndicator").setStyle({position:"relative"});this.spinners=$A();for(var G=0;G<12;G++){var B=1-((G*83333)/1000000);var K=new Element("span").update(F).setOpacity(B);var E=(Math.PI*G)/6;var H=Math.sin(E)*A;var D=Math.cos(E)*A;log.error("x: "+H+", y: "+D);K.setStyle({position:"absolute",top:H+"em",left:D+"em"});this.spinners.push(K);this.container.appendChild(K)}var J=function(){this.spinners.each(function(N){var M=N.getOpacity();var L=M+0.083;if(L>=0.99){L=0}N.setOpacity(L)}.bind(this))}.bind(this);setInterval(J,83)}};var ProgressIndicatorAgent=Class.create(Abstract.Agent,{initExtend:function(){var B,A;if(this.params){B=this.params.radius;A=this.params.symbol}var C=new ProgressIndicator(B,A);this.element.appendChild(C.container)}});var Filter=Class.create(Object.extend(new Abstract.Agent(),{initExtend:function(){this.intrastitialMessage=this.params.intrastitialMessage||"";if(this.intrastitial==null){this.intrastitial=new Intrastitial(this.intrastitialMessage,$("main").select(".main")[0])}Event.observe(this.element,"click",function(B){this.processEvent(B)}.bind(this));var A=this.element.select("select");for(i=0;i<A.length;i++){Event.observe(A[i],"change",function(B){var D=(typeof this.form!="undefined")?this.form:$(Event.findElement(B,"form"));var E=unescape(D.serialize())+"&rep=partial";var C=D.action;this.fetch(C,E)}.bind(this))}},processEvent:function(A){var D=Event.element(A);if(D.tagName.toLowerCase()=="input"&&D.getAttribute("type")=="checkbox"){var C=(typeof this.form!="undefined")?this.form:$(Event.findElement(A,"form"));var E=unescape(C.serialize());var B=C.action;this.fetch(B,E)}else{if(D.tagName.toLowerCase()=="a"){Event.stop(A);var B=Event.element(A).href.toString();this.fetch(B,E)}}},fetch:function(A,B){B=B||"";new Ajax.Request(A,{method:"get",parameters:B+"&rep=partial",onCreate:(function(){this.intrastitial.show()}).bind(this),onSuccess:(function(C){Page.initializeAjaxResponse(C.responseText);this.intrastitial.hide()}).bind(this)})}}));var GoogleHotelMap=Class.create();GoogleHotelMap.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(!window.google){log.error("GoogleHotelMap: Google JS API not found");return}this.element.update();this.element.removeClassName("staticMap");this.element.addClassName("intrastitial");google.load("maps","2",{callback:this.initMap.bind(this),language:this.params.locale,other_params:"client=gme-orbitz&sensor=false"})},initMap:function(){this.element.removeClassName("intrastitial");this.element.addClassName("dynamicMap");this.mapElement=new Element("div",{"class":"standardMap"});this.element.appendChild(this.mapElement);this.location=new google.maps.LatLng(this.params.location.latitude,this.params.location.longitude);this.map=new google.maps.Map2(this.mapElement);this.map.setCenter(this.location,this.params.zoom);var A=this.map.getDefaultUI();A.zoom.scrollwheel=false;A.controls.maptypecontrol=false;A.controls.menumaptypecontrol=false;this.map.setUI(A);var B=new google.maps.HierarchicalMapTypeControl();this.map.addControl(B,new google.maps.ControlPosition(G_ANCHOR_TOP_RIGHT,new google.maps.Size(7,7)));this.marker=new google.maps.Marker(this.location,{clickable:false});this.map.addOverlay(this.marker);if(this.params.streetview){var C=new google.maps.StreetviewClient();C.getNearestPanorama(this.location,this.enableStreetview.bind(this))}},enableStreetview:function(A){if(A){this.panoData=A}if(this.panoData.code==600){log.info("GoogleHotelMap: Streetview unavailable for this location")}else{if(this.panoData.code==500){log.error("GoogleHotelMap: Streetview server error")}else{if(this.panoData.code==200){this.toggleLink=new Element("a",{"class":"link toggleLink"});this.element.insertBefore(this.toggleLink,this.mapElement);this.toggleLink.update(this.params.switchToStreetviewText);Event.observe(this.toggleLink,"click",this.toggleMaps.bindAsEventListener(this))}else{log.error("GoogleHotelMap: Streetview unknown error")}}}},toggleMaps:function(){if(!this.currentMap){this.currentMap=this.mapElement}if(this.currentMap==this.streetviewElement){this.showMap()}else{this.showStreetview()}},showMap:function(){this.currentMap.hide();this.mapElement.show();this.map.checkResize();this.currentMap=this.mapElement;this.toggleLink.update(this.params.switchToStreetviewText)},showStreetview:function(){if(!this.streetviewElement){this.streetviewElement=new Element("div",{"class":"streetview"});this.element.appendChild(this.streetviewElement);this.streetviewElement.show();this.streetview=new google.maps.StreetviewPanorama(this.streetviewElement);this.streetview.setLocationAndPOV(this.panoData.location.latlng,{yaw:this.calculateBearing(this.panoData.location.latlng,this.location),pitch:-8});google.maps.Event.addListener(this.streetview,"error",this.handleNoFlash.bind(this))}this.currentMap.hide();this.streetviewElement.show();this.streetview.checkResize();this.currentMap=this.streetviewElement;this.toggleLink.update(this.params.switchToMapText)},calculateBearing:function(B,E){var F=E.lat()-B.lat();var A=E.lng()-B.lng();var C=Math.atan2(A,F);var D=C*180/Math.PI;if(D<0){D+=360}return D},handleNoFlash:function(){this.streetviewElement.update("You must download Adobe Flash Player to view this content.")}});var MapQuestHotelMap=Class.create();MapQuestHotelMap.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){if(!window.MQA){log.error("MapQuestHotelMap: MapQuest script not found");return}this.element.update();this.element.removeClassName("staticMap");this.element.addClassName("dynamicMap");this.mapElement=new Element("div",{"class":"standardMap"});this.element.appendChild(this.mapElement);var A=this.mapElement.getDimensions();A.height+="px";A.width+="px";this.mapElement.setStyle(A);this.location=new MQA.LatLng(this.params.location.latitude,this.params.location.longitude);this.map=new MQA.TileMap(this.mapElement,this.params.zoom,this.location,"map");this.map.addShape(new MQA.Poi(this.location));var B=new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(25,18));this.map.addControl(new MQA.PanControl(),B);B=new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(19,68));this.map.addControl(new MQA.ZoomControl(),B);B=new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT,new MQA.Size(126,0));this.map.addControl(new MQA.ViewControl(),B)}});var opinionLabAgent=Class.create();opinionLabAgent.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){log.debug("opinionLabAgent");try{if(_fW&&O_LC&&_Sh){Event.observe(this.element,"click",this.open.bindAsEventListener(this))}}catch(A){log.error("third party javascript library for opinionlab not loaded or is incompatible: "+A)}},open:function(A){_fW(_ht,1);_hdn=1;O_LC();_Sh("O_o",0);A.preventDefault()}});var SavedHotelsTotal=Class.create(Abstract.Agent,{initExtend:function(){this.totalsContent=this.element.select("span.savedHotelsTotal")[0];Event.observe($(document.body),"savedHotel:saveRequestReturned",this.onSavedHotelUpdated.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:removed",this.onSavedHotelUpdated.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:listUpdated",this.onSavedHotelUpdated.bindAsEventListener(this))},onSavedHotelUpdated:function(A){if(navigator.cookieEnabled){this.totalsContent.innerHTML=A.memo.savedHotelsTotal.innerHTML}}});var SavedHotelsList=Class.create(Abstract.Agent,{initExtend:function(){if(this.params){this.noCookiesMessage=this.params.noCookiesMessage;this.updateListURL=this.params.updateListURL}else{this.noCookiesMessage="";this.updateListURL=null}this.removeLinks=new ManagedEventObservers();Event.observe(this.element,"savedHotel:removeAgentCreated",this.addRemoveLink.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:saveRequestReturned",this.onSaveRequestOrRemove.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:removed",this.onSaveRequestOrRemove.bindAsEventListener(this));if(this.updateListURL){var A=new Ajax.Request(this.updateListURL,{method:"get",parameters:{cacheBuster:new Date().getTime()},onSuccess:function(C){var B=parseSavedHotelsResponse(C);B.element=this.element;log.debug("saved hotels: "+B.savedHotelsData.savedHotels);this.update(B.savedHotelsContent);$(document.body).fire("savedHotel:listUpdated",B)}.bind(this)})}},addRemoveLink:function(C){if(C.memo.length>=3){var B=C.memo[0];var A=C.memo[1];var D=C.memo[2];this.removeLinks.add(B,A,D)}},onSaveRequestOrRemove:function(A){this.update(A.memo.savedHotelsContent)},update:function(A){this.destroy();if(!navigator.cookieEnabled&&this.noCookiesMessage!=""){this.element.innerHTML=this.noCookiesMessage}else{this.element.innerHTML=A.innerHTML;Page.initializeDOMFragment(this.element)}},destroy:function(){this.removeLinks.clear()}});var SavedHotelsStatus=Class.create(Abstract.Agent,{initExtend:function(){if(this.params){this.noCookiesMessage=this.params.noCookiesMessage}else{this.noCookiesMessage=""}this.statusMessage=this.element.select("div.savedHotelsStatus")[0];this.statusMessageTitle=this.statusMessage.select(".dialogTitle a")[0];this.statusMessageContent=this.statusMessage.select("div.savedHotelsStatusContent")[0];this.savedHotelsTotal=this.element.select("")[0];this.displayDuration=6000;this.displayTimer=null;Event.observe($(document.body),"savedHotel:saveRequestReturned",this.onSaveRequestReturned.bindAsEventListener(this))},onSaveRequestReturned:function(A){if(!navigator.cookieEnabled&&this.noCookiesMessage!=""){this.statusMessageContent.innerHTML=this.noCookiesMessage}else{this.statusMessageContent.innerHTML=A.memo.savedHotelsStatusContent.innerHTML}this.statusMessageTitle.innerHTML=A.memo.savedHotelsTotal.innerHTML;this.displayMessage()},displayMessage:function(){this.element.removeClassName("noneBlock");if(this.displayTimer!=null){window.clearTimeout(this.displayTimer)}this.displayTimer=window.setTimeout(this.hideMessage.bind(this),this.displayDuration)},hideMessage:function(){this.element.addClassName("noneBlock");this.statusMessageContent.innerHTML="";this.displayTimer=null}});var AddSavedHotel=Class.create(Abstract.Agent,{initExtend:function(A){if(this.params){this.hotelId=this.params.hotelId;this.url=this.params.url;this.notSavedLabel=this.params.notSavedLabel;this.savedLabel=this.params.savedLabel;this.saved=this.params.saved;delete this.params;Event.observe(this.element,"click",this.add.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:removed_"+this.hotelId,this.displayAsNotSaved.bindAsEventListener(this));Event.observe($(document.body),"savedHotel:listUpdated",this.onSavedHotelListUpdated.bindAsEventListener(this))}else{log.error("AddSavedHotel.initExtend: too few parameters to initialize")}},add:function(A){A.preventDefault();this.request=new Ajax.Request(this.url,{method:"get",parameters:{cacheBuster:new Date().getTime()},onSuccess:function(C){var B=parseSavedHotelsResponse(C);B.addSavedHotelAgent=this;$(document.body).fire("savedHotel:saveRequestReturned",B);if(this.hotelId==B.savedHotelsData.hotelId&&B.savedHotelsData.status=="SAVED"&&navigator.cookieEnabled){this.displayAsSaved();$(document.body).fire("savedHotel:saved",B)}else{if(this.hotelId==B.savedHotelsData.hotelId&&B.savedHotelsData.status=="DUPLICATE"&&navigator.cookieEnabled){$(document.body).fire("savedHotel:alreadySaved",B)}}}.bind(this)})},onSavedHotelListUpdated:function(B){var A=$A(B.memo.savedHotelsData.savedHotels);if(A.include(this.hotelId)){this.displayAsSaved()}else{this.displayAsNotSaved()}},displayAsSaved:function(){this.element.innerHTML=this.savedLabel;this.element.removeClassName("saveHotel");this.element.addClassName("savedHotel");this.saved=true},displayAsNotSaved:function(){this.element.innerHTML=this.notSavedLabel;this.element.removeClassName("savedHotel");this.element.addClassName("saveHotel");this.saved=false}});var RemoveSavedHotel=Class.create(Abstract.Agent,{initExtend:function(A){if(this.params){this.hotelId=this.params.hotelId;this.url=this.params.url;delete this.params;this.element.fire("savedHotel:removeAgentCreated",[this.element,"click",this.remove.bindAsEventListener(this)])}else{log.error("RemoveSavedHotel.initExtend: too few parameters to initialize")}},remove:function(A){A.preventDefault();this.request=new Ajax.Request(this.url,{method:"get",parameters:{cacheBuster:new Date().getTime()},onSuccess:function(C){var B=parseSavedHotelsResponse(C);B.element=this.element;$(document.body).fire("savedHotel:removed",B);$(document.body).fire("savedHotel:removed_"+this.hotelId,B)}.bind(this)})}});var parseSavedHotelsResponse=function(F){if(F&&F.responseText){var C=new Element("div");C.innerHTML=F.responseText;var D=C.select("div.savedHotelsData")[0].innerHTML;var G=C.select("span.savedHotelsTotal")[0];var E=C.select("div.savedHotelsStatusContent")[0];var B=C.select("div.savedHotelsContent")[0];var A={savedHotelsData:D.evalJSON(),savedHotelsTotal:G,savedHotelsStatusContent:E,savedHotelsContent:B};return A}};var SavedHotelsWebtrendsEventSender=new function(){this.onHotelSaved=function(A){var B=A.memo.addSavedHotelAgent;A.memo.addSavedHotelAgent.element.fire("webtrends:multiTrackEvent",{"DCS.dcsuri":B.url,"WT.dl":"1","WT.ti":"Link:"+B.notSavedLabel,"DCSext.fhid":B.hotelId})};this.onHotelAlreadySaved=function(A){var B=A.memo.addSavedHotelAgent;A.memo.addSavedHotelAgent.element.fire("webtrends:multiTrackEvent",{"DCS.dcsuri":B.url,"WT.dl":"1","WT.ti":"Link:"+B.savedLabel})};this.onSavedHotelsListViewed=function(C,E,F){if(arguments.length==3){var A;if(E=="SEARCH"){A="HP"}else{if(E=="RESULTS"){A="SR"}}if(F){var B=Event.findElement(F,"A");var D=B.innerText||B.textContent;var G=new RegExp("\\s*\\d+\\s*","g");D=D.strip();D=D.replace(G,"");B.fire("webtrends:multiTrackEvent",{"DCS.dcsuri":C,"WT.dl":"0","WT.si_n":"FH","WT.ti":"Link:"+D,"DCSext.fhl":A})}}else{log.error("SavedHotelsWebtrendsEventSender.onSavedHotelsListViewed(): too few parameters to execute")}};document.observe("savedHotel:saved",this.onHotelSaved.bindAsEventListener(this));document.observe("savedHotel:alreadySaved",this.onHotelAlreadySaved.bindAsEventListener(this))};
