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,D=$A(arguments);if(Object.isFunction(D[0])){B=D.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=B;A.subclasses=[];if(B){var F=function(){};F.prototype=B.prototype;A.prototype=new F;B.subclasses.push(A)}for(var E=0;E<D.length;E++){A.addMethods(D[E])}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(B){var F=this.superclass&&this.superclass.prototype;var E=Object.keys(B);if(!Object.keys({toString:true}).length){E.push("toString","valueOf")}for(var G=0,D=E.length;G<D;G++){var A=E[G],H=B[A];if(F&&Object.isFunction(H)&&H.argumentNames().first()=="$super"){var I=H;H=(function(J){return function(){return F[J].apply(this,arguments)}})(A).wrap(I);H.valueOf=I.valueOf.bind(I);H.toString=I.toString.bind(I)}this.prototype[A]=H}return this}};var Abstract={};Object.extend=function(D,B){for(var A in B){D[A]=B[A]}return D};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(D){var E=typeof D;switch(E){case"undefined":case"function":case"unknown":return;case"boolean":return D.toString()}if(D===null){return"null"}if(D.toJSON){return D.toJSON()}if(Object.isElement(D)){return}var B=[];for(var A in D){var F=Object.toJSON(D[A]);if(!Object.isUndefined(F)){B.push(A.toJSON()+": "+F)}}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 D=[];for(var A in B){D.push(A)}return D},values:function(B){var D=[];for(var A in B){D.push(B[A])}return D},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 D=this,A=$A(arguments),B=A.shift();return function(){return D.apply(B,A.concat($A(arguments)))}},bindAsEventListener:function(){var D=this,A=$A(arguments),B=A.shift();return function(E){return D.apply(B,[E||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 D=this,B=$A(arguments),A=B.shift()*1000;return window.setTimeout(function(){return D.apply(D,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 D=0,A=arguments.length;D<A;D++){var E=arguments[D];try{B=E();break}catch(F){}}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,E){var F="",A=this,D;E=arguments.callee.prepareReplacement(E);while(A.length>0){if(D=A.match(B)){F+=A.slice(0,D.index);F+=String.interpret(E(D));A=A.slice(D.index+D[0].length)}else{F+=A,A=""}}return F},sub:function(A,B,D){B=this.gsub.prepareReplacement(B);D=Object.isUndefined(D)?1:D;return this.gsub(A,function(E){if(--D<0){return E[0]}return B(E)})},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(D){return(D.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,D){return B+D.nodeValue}):A.childNodes[0].nodeValue):""},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);if(!A){return{}}return A[1].split(B||"&").inject({},function(F,G){if((G=G.split("="))[0]){var D=decodeURIComponent(G.shift());var E=G.length>1?G.join("="):G[0];if(E!=undefined){E=decodeURIComponent(E)}if(D in F){if(!Object.isArray(F[D])){F[D]=[F[D]]}F[D].push(E)}else{F[D]=E}}return F})},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 E=this.split("-"),A=E.length;if(A==1){return E[0]}var B=this.charAt(0)=="-"?E[0].charAt(0).toUpperCase()+E[0].substring(1):E[0];for(var D=1;D<A;D++){B+=E[D].charAt(0).toUpperCase()+E[D].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(D){var E=String.specialChar[D[0]];return E?E:"\\u00"+D[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(D){return A.evaluate(D)}};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(G){if(A==null){return""}var D=G[1]||"";if(D=="\\"){return G[2]}var E=A,H=G[3];var B=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;G=B.exec(H);if(G==null){return D}while(G!=null){var F=G[1].startsWith("[")?G[2].gsub("\\\\]","]"):G[1];E=E[F];if(null==E||""==G[3]){break}H=H.substring("["==G[3]?G[1].length:G[0].length);G=B.exec(H)}return D+String.interpret(E)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(D,B){var A=0;try{this._each(function(F){D.call(B,F,A++)})}catch(E){if(E!=$break){throw E}}return this},eachSlice:function(A,E,D){var B=-A,F=[],G=this.toArray();if(A<1){return G}while((B+=A)<G.length){F.push(G.slice(B,B+A))}return F.collect(E,D)},all:function(B,A){B=B||Prototype.K;var D=true;this.each(function(F,E){D=D&&!!B.call(A,F,E);if(!D){throw $break}});return D},any:function(B,A){B=B||Prototype.K;var D=false;this.each(function(F,E){if(D=!!B.call(A,F,E)){throw $break}});return D},collect:function(D,B){D=D||Prototype.K;var A=[];this.each(function(F,E){A.push(D.call(B,F,E))});return A},detect:function(B,A){var D;this.each(function(F,E){if(B.call(A,F,E)){D=F;throw $break}});return D},findAll:function(D,B){var A=[];this.each(function(F,E){if(D.call(B,F,E)){A.push(F)}});return A},grep:function(A,E,D){E=E||Prototype.K;var B=[];if(Object.isString(A)){A=new RegExp(A)}this.each(function(G,F){if(A.match(G)){B.push(E.call(D,G,F))}});return B},include:function(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(D){if(D==A){B=true;throw $break}});return B},inGroupsOf:function(A,B){B=Object.isUndefined(B)?null:B;return this.eachSlice(A,function(D){while(D.length<A){D.push(B)}return D})},inject:function(A,D,B){this.each(function(F,E){A=D.call(B,A,F,E)});return A},invoke:function(B){var A=$A(arguments).slice(1);return this.map(function(D){return D[B].apply(D,A)})},max:function(B,A){B=B||Prototype.K;var D;this.each(function(F,E){F=B.call(A,F,E);if(D==null||F>=D){D=F}});return D},min:function(B,A){B=B||Prototype.K;var D;this.each(function(F,E){F=B.call(A,F,E);if(D==null||F<D){D=F}});return D},partition:function(E,B){E=E||Prototype.K;var D=[],A=[];this.each(function(G,F){(E.call(B,G,F)?D:A).push(G)});return[D,A]},pluck:function(A){var B=[];this.each(function(D){B.push(D[A])});return B},reject:function(D,B){var A=[];this.each(function(F,E){if(!D.call(B,F,E)){A.push(F)}});return A},sortBy:function(B,A){return this.map(function(E,D){return{value:E,criteria:B.call(A,E,D)}}).sort(function(G,F){var E=G.criteria,D=F.criteria;return E<D?-1:E>D?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 D=[this].concat(A).map($A);return this.map(function(F,E){return B(D.pluck(E))})},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(D){if(!D){return[]}if(D.toArray){return D.toArray()}var A=D.length||0,B=new Array(A);while(A--){B[A]=D[A]}return B}if(Prototype.Browser.WebKit){$A=function(D){if(!D){return[]}if(!(typeof D==="function"&&typeof D.length==="number"&&typeof D.item==="function")&&D.toArray){return D.toArray()}var A=D.length||0,B=new Array(A);while(A--){B[A]=D[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(D){for(var B=0,A=this.length;B<A;B++){D(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(E,D,B){if(0==B||(A?E.last()!=D:!E.include(D))){E.push(D)}return E})},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(D){return B===D})})},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 D=Object.toJSON(B);if(!Object.isUndefined(D)){A.push(D)}});return"["+A.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(D,B){B||(B=0);var A=this.length;if(B<0){B=A+B}for(;B<A;B++){if(this[B]===D){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 D=this.slice(0,A).reverse().indexOf(B);return(D<0)?D:A-D-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 F=[];for(var D=0,A=this.length;D<A;D++){F.push(this[D])}for(var D=0,A=arguments.length;D<A;D++){if(Object.isArray(arguments[D])){for(var B=0,E=arguments[D].length;B<E;B++){F.push(arguments[D][B])}}else{F.push(arguments[D])}}return F}}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,D){var B=this.toString(D||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,D){if(Object.isUndefined(D)){return B}return B+"="+encodeURIComponent(String.interpret(D))}return{initialize:function(B){this._object=Object.isHash(B)?B.toObject():Object.clone(B)},_each:function(D){for(var B in this._object){var E=this._object[B],F=[B,E];F.key=B;F.value=E;D(F)}},set:function(B,D){return this._object[B]=D},get:function(B){if(this._object[B]!==Object.prototype[B]){return this._object[B]}},unset:function(B){var D=this._object[B];delete this._object[B];return D},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(D){var B=this.detect(function(E){return E.value===D});return B&&B.key},merge:function(B){return this.clone().update(B)},update:function(B){return new Hash(B).inject(this,function(D,E){D.set(E.key,E.value);return D})},toQueryString:function(){return this.inject([],function(D,F){var B=encodeURIComponent(F.key),E=F.value;if(E&&typeof E=="object"){if(Object.isArray(E)){return D.concat(E.map(A.curry(B)))}}else{D.push(A(B,E))}return D}).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(D,A,B){this.start=D;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(D,A,B){return new ObjectRange(D,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(D,B,E,A){this.each(function(F){if(Object.isFunction(F[D])){try{F[D].apply(F,[B,E,A])}catch(G){}}})}};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 E=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){E._method=this.method;this.method="post"}this.parameters=E;if(E=Object.toQueryString(E)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+E}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){E+="&_="}}}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||E):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(D){this.dispatchException(D)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var F={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){F["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){F.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var B=this.options.requestHeaders;if(Object.isFunction(B.push)){for(var E=0,A=B.length;E<A;E+=2){F[B[E]]=B[E+1]}}else{$H(B).each(function(G){F[G.key]=G.value})}}for(var D in F){this.transport.setRequestHeader(D,F[D])}},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 D=Ajax.Request.Events[A],B=new Ajax.Response(this);if(D=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(F){this.dispatchException(F)}var E=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+D]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+D,this,B,B.headerJSON)}catch(F){this.dispatchException(F)}if(D=="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(D){this.request=D;var E=this.transport=D.transport,A=this.readyState=E.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(E.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=E.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,D,A,B){this.container={success:(D.success||D),failure:(D.failure||(D.success?null:D))};B=Object.clone(B);var E=B.onComplete;B.onComplete=(function(G,F){this.updateContent(G.responseText);if(Object.isFunction(E)){E(G,F)}}).bind(this);$super(A,B)},updateContent:function(E){var B=this.container[this.success()?"success":"failure"],D=this.options;if(!D.evalScripts){E=E.stripScripts()}if(B=$(B)){if(D.insertion){if(Object.isString(D.insertion)){var A={};A[D.insertion]=E;B.insert(A)}else{D.insertion(B,E)}}else{B.update(E)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,D,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=D;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 $(D){if(arguments.length>1){for(var E=0,A=[],B=arguments.length;E<B;E++){A.push($(arguments[E]))}return A}if(Object.isString(D)){D=document.getElementById(D)}return Element.extend(D)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(G,E){var D=[];var F=document.evaluate(G,$(E)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,A=F.snapshotLength;B<A;B++){D.push(Element.extend(F.snapshotItem(B)))}return D}}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(E,D){D=D||{};E=E.toLowerCase();var B=Element.cache;if(Prototype.Browser.IE&&D.name){E="<"+E+' name="'+D.name+'">';delete D.name;return Element.writeAttribute(document.createElement(E),D)}if(!B[E]){B[E]=Element.extend(document.createElement(E))}return Element.writeAttribute(B[E].cloneNode(false),D)};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,D){B=$(B);if(D&&D.toElement){D=D.toElement()}else{if(!Object.isElement(D)){D=Object.toHTML(D);var A=B.ownerDocument.createRange();A.selectNode(B);D.evalScripts.bind(D).defer();D=A.createContextualFragment(D.stripScripts())}}B.parentNode.replaceChild(D,B);return B},insert:function(E,G){E=$(E);if(Object.isString(G)||Object.isNumber(G)||Object.isElement(G)||(G&&(G.toElement||G.toHTML))){G={bottom:G}}var F,B,D,H;for(var A in G){F=G[A];A=A.toLowerCase();B=Element._insertionTranslations[A];if(F&&F.toElement){F=F.toElement()}if(Object.isElement(F)){B(E,F);continue}F=Object.toHTML(F);D=((A=="before"||A=="after")?E.parentNode:E).tagName.toUpperCase();H=Element._getContentFromAnonymousElement(D,F.stripScripts());if(A=="top"||A=="after"){H.reverse()}H.each(B.curry(E));F.evalScripts.bind(F).defer()}return E},wrap:function(B,D,A){B=$(B);if(Object.isElement(D)){$(D).writeAttribute(A||{})}else{if(Object.isString(D)){D=new Element(D,A)}else{D=new Element("div",D)}}if(B.parentNode){B.parentNode.replaceChild(D,B)}D.appendChild(B);return D},inspect:function(A){A=$(A);var B="<"+A.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(G){var D=G.first(),E=G.last();var F=(A[D]||"").toString();if(F){B+=" "+E+"="+F.inspect(true)}});return B+">"},recursivelyCollect:function(D,B){D=$(D);var A=[];while(D=D[B]){if(D.nodeType==1){A.push(Element.extend(D))}}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(D,E,B){D=$(D);if(arguments.length==1){return $(D.parentNode)}var A=D.ancestors();return Object.isNumber(E)?A[E]:Selector.findElement(A,E,B)},down:function(B,D,A){B=$(B);if(arguments.length==1){return B.firstDescendant()}return Object.isNumber(D)?B.descendants()[D]:Element.select(B,D)[A||0]},previous:function(B,E,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var D=B.previousSiblings();return Object.isNumber(E)?D[E]:Selector.findElement(D,E,A)},next:function(B,E,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(B))}var D=B.nextSiblings();return Object.isNumber(E)?D[E]:Selector.findElement(D,E,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 D=B.readAttribute("id"),A=arguments.callee;if(D){return D}do{D="anonymous_element_"+A.counter++}while($(D));B.writeAttribute("id",D);return D},readAttribute:function(B,A){B=$(B);if(Prototype.Browser.IE){var D=Element._attributeTranslations.read;if(D.values[A]){return D.values[A](B,A)}if(D.names[A]){A=D.names[A]}if(A.include(":")){return(!B.attributes||!B.attributes[A])?null:B.attributes[A].value}}return B.getAttribute(A)},writeAttribute:function(E,D,G){E=$(E);var B={},F=Element._attributeTranslations.write;if(typeof D=="object"){B=D}else{B[D]=Object.isUndefined(G)?true:G}for(var A in B){D=F.names[A]||A;G=B[A];if(F.values[A]){D=F.values[A](E,G)}if(G===false||G===null){E.removeAttribute(D)}else{if(G===true){E.setAttribute(D,D)}else{E.setAttribute(D,G)}}}return E},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 D=B.className;return(D.length>0&&(D==A||new RegExp("(^|\\s)"+A+"(\\s|$)").test(D)))},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 D=B.firstChild;while(D){var A=D.nextSibling;if(D.nodeType==3&&!/\S/.test(D.nodeValue)){B.removeChild(D)}D=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,D){A=$(A);D=D=="float"?"cssFloat":D.camelize();var E=A.style[D];if(!E||E=="auto"){var B=document.defaultView.getComputedStyle(A,null);E=B?B[D]:null}if(D=="opacity"){return E?parseFloat(E):1}return E=="auto"?null:E},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(F,D){F=$(F);var B=F.style,E;if(Object.isString(D)){F.style.cssText+=";"+D;return D.include("opacity")?F.setOpacity(D.match(/opacity:\s*(\d?\.?\d*)/)[1]):F}for(var A in D){if(A=="opacity"){F.setOpacity(D[A])}else{B[(A=="float"||A=="cssFloat")?(Object.isUndefined(B.styleFloat)?"cssFloat":"styleFloat"):A]=D[A]}}return F},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(D){D=$(D);var H=D.getStyle("display");if(H!="none"&&H!=null){return{width:D.offsetWidth,height:D.offsetHeight}}var F=D.style;var A=F.visibility;var B=F.position;var E=F.display;F.visibility="hidden";F.position="absolute";F.display="block";var I=D.clientWidth;var G=D.clientHeight;F.display=E;F.position=B;F.visibility=A;return{width:I,height:G}},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,D=0;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;A=A.offsetParent}while(A);return Element._returnOffset(D,B)},positionedOffset:function(A){var B=0,E=0;do{B+=A.offsetTop||0;E+=A.offsetLeft||0;A=A.offsetParent;if(A){if(A.tagName.toUpperCase()=="BODY"){break}var D=Element.getStyle(A,"position");if(D!=="static"){break}}}while(A);return Element._returnOffset(E,B)},absolutize:function(B){B=$(B);if(B.getStyle("position")=="absolute"){return B}var A=B.positionedOffset();var G=A[1];var F=A[0];var D=B.clientWidth;var E=B.clientHeight;B._originalLeft=F-parseFloat(B.style.left||0);B._originalTop=G-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=G+"px";B.style.left=F+"px";B.style.width=D+"px";B.style.height=E+"px";return B},relativize:function(A){A=$(A);if(A.getStyle("position")=="relative"){return A}A.style.position="relative";var D=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=D+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(A){var B=0,D=0;do{B+=A.scrollTop||0;D+=A.scrollLeft||0;A=A.parentNode}while(A);return Element._returnOffset(D,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(D){var B=0,E=0;var A=D;do{B+=A.offsetTop||0;E+=A.offsetLeft||0;if(A.offsetParent==document.body&&Element.getStyle(A,"position")=="absolute"){break}}while(A=A.offsetParent);A=D;do{if(!Prototype.Browser.Opera||(A.tagName&&(A.tagName.toUpperCase()=="BODY"))){B-=A.scrollTop||0;E-=A.scrollLeft||0}}while(A=A.parentNode);return Element._returnOffset(E,B)},clonePosition:function(D,A){var E=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});A=$(A);var F=A.viewportOffset();D=$(D);var G=[0,0];var B=null;if(Element.getStyle(D,"position")=="absolute"){B=D.getOffsetParent();G=B.viewportOffset()}if(B==document.body){G[0]-=document.body.offsetLeft;G[1]-=document.body.offsetTop}if(E.setLeft){D.style.left=(F[0]-G[0]+E.offsetLeft)+"px"}if(E.setTop){D.style.top=(F[1]-G[1]+E.offsetTop)+"px"}if(E.setWidth){D.style.width=A.offsetWidth+"px"}if(E.setHeight){D.style.height=A.offsetHeight+"px"}return D}};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,D,E){switch(E){case"left":case"top":case"right":case"bottom":if(A(D,"position")==="static"){return null}case"height":case"width":if(!Element.visible(D)){return null}var F=parseInt(A(D,E),10);if(F!==D["offset"+E.capitalize()]){return F+"px"}var B;if(E==="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(F,function(H,G){var I=A(D,G);return I===null?H:H-parseInt(I,10)})+"px";default:return A(D,E)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(A,B,D){if(D==="title"){return B.title}return A(B,D)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(B,D){D=$(D);try{D.offsetParent}catch(F){return $(document.body)}var A=D.getStyle("position");if(A!=="static"){return B(D)}D.setStyle({position:"relative"});var E=B(D);D.setStyle({position:A});return E});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(D,E){E=$(E);try{E.offsetParent}catch(H){return Element._returnOffset(0,0)}var B=E.getStyle("position");if(B!=="static"){return D(E)}var F=E.getOffsetParent();if(F&&F.getStyle("position")==="fixed"){F.setStyle({zoom:1})}E.setStyle({position:"relative"});var G=D(E);E.setStyle({position:B});return G})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(A,B){try{B.offsetParent}catch(D){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 D=A.style[B];if(!D&&A.currentStyle){D=A.currentStyle[B]}if(B=="opacity"){if(D=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(D[1]){return parseFloat(D[1])/100}}return 1}if(D=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return D};Element.Methods.setOpacity=function(D,F){function G(H){return H.replace(/alpha\([^\)]*\)/gi,"")}D=$(D);var B=D.currentStyle;if((B&&!B.hasLayout)||(!B&&D.style.zoom=="normal")){D.style.zoom=1}var A=D.getStyle("filter"),E=D.style;if(F==1||F===""){(A=G(A))?E.filter=A:E.removeAttribute("filter");return D}else{if(F<0.00001){F=0}}E.filter=G(A)+"alpha(opacity="+(F*100)+")";return D};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)},_getAttrNode:function(A,D){var B=A.getAttributeNode(D);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 E=document.createTextNode(" ");A.appendChild(E);A.removeChild(E)}catch(D){}}}return A};Element.Methods.cumulativeOffset=function(A){var B=0,D=0;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;if(A.offsetParent==document.body){if(Element.getStyle(A,"position")=="absolute"){break}}A=A.offsetParent}while(A);return Element._returnOffset(D,B)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,D){B=$(B);if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){return B.update().insert(D)}D=Object.toHTML(D);var A=B.tagName.toUpperCase();if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(E){B.removeChild(E)});Element._getContentFromAnonymousElement(A,D.stripScripts()).each(function(E){B.appendChild(E)})}else{B.innerHTML=D.stripScripts()}D.evalScripts.bind(D).defer();return B}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(F,G){F=$(F);if(G&&G.toElement){G=G.toElement()}if(Object.isElement(G)){F.parentNode.replaceChild(G,F);return F}G=Object.toHTML(G);var D=F.parentNode,E=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[E]){var B=F.next();var A=Element._getContentFromAnonymousElement(E,G.stripScripts());D.removeChild(F);if(B){A.each(function(H){D.insertBefore(H,B)})}else{A.each(function(H){D.appendChild(H)})}}else{F.outerHTML=G.stripScripts()}G.evalScripts.bind(G).defer();return F}}Element._returnOffset=function(A,B){var D=[A,B];D.left=A;D.top=B;return D};Element._getContentFromAnonymousElement=function(A,D){var E=new Element("div"),B=Element._insertionTranslations.tags[A];if(B){E.innerHTML=B[0]+D+B[1];B[2].times(function(){E=E.firstChild})}else{E.innerHTML=D}return $A(E.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,D){D=Element._attributeTranslations.has[D]||D;var B=$(A).getAttributeNode(D);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 D=Object.extend(function(H){if(!H||H._extendedByPrototype||H.nodeType!=1||H==window){return H}var F=Object.clone(B),G=H.tagName.toUpperCase(),E,I;if(A[G]){Object.extend(F,A[G])}for(E in F){I=F[E];if(Object.isFunction(I)&&!(E in H)){H[E]=I.methodize()}}H._extendedByPrototype=Prototype.emptyFunction;return H},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(B,Element.Methods);Object.extend(B,Element.Methods.Simulated)}}});D.refresh();return D})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(D){var J=Prototype.BrowserFeatures,E=Element.Methods.ByTag;if(!D){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 H=D;D=arguments[1]}if(!H){Object.extend(Element.Methods,D||{})}else{if(Object.isArray(H)){H.each(A)}else{A(H)}}function A(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],D)}function B(L,O,N){N=N||false;for(var F in L){var M=L[F];if(!Object.isFunction(M)){continue}if(!N||!(F in O)){O[F]=M.methodize()}}}function G(L){var F;var M={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(M[L]){F="HTML"+M[L]+"Element"}if(window[F]){return window[F]}F="HTML"+L+"Element";if(window[F]){return window[F]}F="HTML"+L.capitalize()+"Element";if(window[F]){return window[F]}window[F]={};window[F].prototype=document.createElement(L)["__proto__"];return window[F]}if(J.ElementExtensions){B(Element.Methods,HTMLElement.prototype);B(Element.Methods.Simulated,HTMLElement.prototype,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var I=G(K);if(Object.isUndefined(I)){continue}B(E[K],I.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var A={},D=Prototype.Browser;$w("width height").each(function(E){var B=E.capitalize();if(D.WebKit&&!document.evaluate){A[E]=self["inner"+B]}else{if(D.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 F=this.expression,G=Selector.patterns,B=Selector.xpath,E,A;if(Selector._cache[F]){this.xpath=Selector._cache[F];return}this.matcher=[".//*"];while(F&&E!=F&&(/\S/).test(F)){E=F;for(var D in G){if(A=F.match(G[D])){this.matcher.push(Object.isFunction(B[D])?B[D](A):new Template(B[D]).evaluate(A));F=F.replace(A[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var D=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var E=A.id,F=$(A).identify();D="#"+F+" "+D}B=$A(A.querySelectorAll(D)).map(Element.extend);A.id=E;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(I){this.tokens=[];var M=this.expression,B=Selector.patterns,G=Selector.assertions;var A,E,F;while(M&&A!==M&&(/\S/).test(M)){A=M;for(var J in B){E=B[J];if(F=M.match(E)){if(G[J]){this.tokens.push([J,Object.clone(F)]);M=M.replace(F[0],"")}else{return this.findElements(document).include(I)}}}}var L=true,D,K;for(var J=0,H;H=this.tokens[J];J++){D=H[0],K=H[1];if(!Selector.assertions[D](I,K)){L=false;break}}return L},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 I=B[6],H=Selector.patterns,A=Selector.xpath,F,D;var G=[];while(I&&F!=I&&(/\S/).test(I)){F=I;for(var E in H){if(B=I.match(H[E])){D=Object.isFunction(A[E])?A[E](B):new Template(A[E]).evaluate(B);G.push("("+D.substring(1,D.length-1)+")");I=I.replace(B[0],"");break}}}return"[not("+G.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(E,B){var H,G=B[6],F;if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}if(H=G.match(/^(\d+)$/)){return"["+E+"= "+H[1]+"]"}if(H=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(H[1]=="-"){H[1]=-1}var D=H[1]?Number(H[1]):1;var A=H[2]?Number(H[2]):0;F="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(F).evaluate({fragment:E,a:D,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,D){var A=Element.readAttribute(B,D[1]);return A&&Selector.operators[D[2]](A,D[5]||D[6])}},handlers:{concat:function(B,A){for(var D=0,E;E=A[D];D++){B.push(E)}return B},mark:function(A){var E=Prototype.emptyFunction;for(var B=0,D;D=A[B];B++){D._countedByPrototype=E}return A},unmark:function(A){for(var B=0,D;D=A[B];B++){D._countedByPrototype=undefined}return A},index:function(G,D,H){G._countedByPrototype=Prototype.emptyFunction;if(D){for(var A=G.childNodes,E=A.length-1,B=1;E>=0;E--){var F=A[E];if(F.nodeType==1&&(!H||F._countedByPrototype)){F.nodeIndex=B++}}}else{for(var E=0,B=1,A=G.childNodes;F=A[E];E++){if(F.nodeType==1&&(!H||F._countedByPrototype)){F.nodeIndex=B++}}}},unique:function(B){if(B.length==0){return B}var E=[],F;for(var D=0,A=B.length;D<A;D++){if(!(F=B[D])._countedByPrototype){F._countedByPrototype=Prototype.emptyFunction;E.push(Element.extend(F))}}return Selector.handlers.unmark(E)},descendant:function(A){var E=Selector.handlers;for(var D=0,B=[],F;F=A[D];D++){E.concat(B,F.getElementsByTagName("*"))}return B},child:function(A){var F=Selector.handlers;for(var E=0,D=[],G;G=A[E];E++){for(var B=0,H;H=G.childNodes[B];B++){if(H.nodeType==1&&H.tagName!="!"){D.push(H)}}}return D},adjacent:function(A){for(var D=0,B=[],F;F=A[D];D++){var E=this.nextElementSibling(F);if(E){B.push(E)}}return B},laterSibling:function(A){var E=Selector.handlers;for(var D=0,B=[],F;F=A[D];D++){E.concat(B,Element.nextSiblings(F))}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,I,G,H){var J=G.toUpperCase();var E=[],F=Selector.handlers;if(A){if(H){if(H=="descendant"){for(var D=0,B;B=A[D];D++){F.concat(E,B.getElementsByTagName(G))}return E}else{A=this[H](A)}if(G=="*"){return A}}for(var D=0,B;B=A[D];D++){if(B.tagName.toUpperCase()===J){E.push(B)}}return E}else{return I.getElementsByTagName(G)}},id:function(D,B,I,A){var H=$(I),F=Selector.handlers;if(!H){return[]}if(!D&&B==document){return[H]}if(D){if(A){if(A=="child"){for(var E=0,G;G=D[E];E++){if(H.parentNode==G){return[H]}}}else{if(A=="descendant"){for(var E=0,G;G=D[E];E++){if(Element.descendantOf(H,G)){return[H]}}}else{if(A=="adjacent"){for(var E=0,G;G=D[E];E++){if(Selector.handlers.previousElementSibling(H)==G){return[H]}}}else{D=F[A](D)}}}}for(var E=0,G;G=D[E];E++){if(G==H){return[H]}}return[]}return(H&&Element.descendantOf(H,B))?[H]:[]},className:function(E,B,D,A){if(E&&A){E=this[A](E)}return Selector.handlers.byClassName(E,B,D)},byClassName:function(D,A,B){if(!D){D=Selector.handlers.descendant([A])}var I=" "+B+" ";for(var F=0,E=[],H,G;H=D[F];F++){G=H.className;if(G.length==0){continue}if(G==B||(" "+G+" ").include(I)){E.push(H)}}return E},attrPresence:function(E,D,A,B){if(!E){E=D.getElementsByTagName("*")}if(E&&B){E=this[B](E)}var G=[];for(var F=0,H;H=E[F];F++){if(Element.hasAttribute(H,A)){G.push(H)}}return G},attr:function(A,J,I,K,H,G){if(!A){A=J.getElementsByTagName("*")}if(A&&G){A=this[G](A)}var L=Selector.operators[H],E=[];for(var D=0,B;B=A[D];D++){var F=Element.readAttribute(B,I);if(F===null){continue}if(L(F,K)){E.push(B)}}return E},pseudo:function(D,E,F,B,A){if(D&&A){D=this[A](D)}if(!D){D=B.getElementsByTagName("*")}return Selector.pseudos[E](D,F,B)}},pseudos:{"first-child":function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(Selector.handlers.previousElementSibling(F)){continue}D.push(F)}return D},"last-child":function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(Selector.handlers.nextElementSibling(F)){continue}D.push(F)}return D},"only-child":function(B,H,A){var F=Selector.handlers;for(var E=0,D=[],G;G=B[E];E++){if(!F.previousElementSibling(G)&&!F.nextElementSibling(G)){D.push(G)}}return D},"nth-child":function(B,D,A){return Selector.pseudos.nth(B,D,A)},"nth-last-child":function(B,D,A){return Selector.pseudos.nth(B,D,A,true)},"nth-of-type":function(B,D,A){return Selector.pseudos.nth(B,D,A,false,true)},"nth-last-of-type":function(B,D,A){return Selector.pseudos.nth(B,D,A,true,true)},"first-of-type":function(B,D,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,D,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,E,A){var D=Selector.pseudos;return D["last-of-type"](D["first-of-type"](B,E,A),E,A)},getIndices:function(B,A,D){if(B==0){return A>0?[A]:[]}return $R(1,D).inject([],function(E,F){if(0==(F-A)%B&&(F-A)/B>=0){E.push(F)}return E})},nth:function(A,B,O,M,L){if(A.length==0){return[]}if(B=="even"){B="2n+0"}if(B=="odd"){B="2n+1"}var K=Selector.handlers,J=[],D=[],F;K.mark(A);for(var I=0,E;E=A[I];I++){if(!E.parentNode._countedByPrototype){K.index(E.parentNode,M,L);D.push(E.parentNode)}}if(B.match(/^\d+$/)){B=Number(B);for(var I=0,E;E=A[I];I++){if(E.nodeIndex==B){J.push(E)}}}else{if(F=B.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1}var P=F[1]?Number(F[1]):1;var N=F[2]?Number(F[2]):0;var Q=Selector.pseudos.getIndices(P,N,A.length);for(var I=0,E,G=Q.length;E=A[I];I++){for(var H=0;H<G;H++){if(E.nodeIndex==Q[H]){J.push(E)}}}}}K.unmark(A);K.unmark(D);return J},empty:function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(F.tagName=="!"||F.firstChild){continue}D.push(F)}return D},not:function(A,E,J){var H=Selector.handlers,K,D;var I=new Selector(E).findElements(J);H.mark(I);for(var G=0,F=[],B;B=A[G];G++){if(!B._countedByPrototype){F.push(B)}}H.unmark(I);return F},enabled:function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(!F.disabled&&(!F.type||F.type!=="hidden")){D.push(F)}}return D},disabled:function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(F.disabled){D.push(F)}}return D},checked:function(B,G,A){for(var E=0,D=[],F;F=B[E];E++){if(F.checked){D.push(F)}}return D}},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(D){A.push(D[1].strip())});return A},matchElements:function(A,H){var G=$$(H),F=Selector.handlers;F.mark(G);for(var E=0,D=[],B;B=A[E];E++){if(B._countedByPrototype){D.push(B)}}F.unmark(G);return D},findElement:function(A,D,B){if(Object.isNumber(D)){B=D;D=false}return Selector.matchElements(A,D||"*")[B||0]},findChildElements:function(D,H){H=Selector.split(H.join(","));var F=[],G=Selector.handlers;for(var E=0,B=H.length,A;E<B;E++){A=new Selector(H[E].strip());G.concat(F,A.findElements(D))}return(B>1)?G.unique(F):F}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var D=0,E;E=A[D];D++){if(E.tagName!=="!"){B.push(E)}}return B},unmark:function(A){for(var B=0,D;D=A[B];B++){D.removeAttribute("_countedByPrototype")}return A}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){$(A).reset();return A},serializeElements:function(D,F){if(typeof F!="object"){F={hash:!!F}}else{if(Object.isUndefined(F.hash)){F.hash=true}}var E,H,B=false,A=F.submit;var G=D.inject({},function(J,I){if(!I.disabled&&I.name){E=I.name;H=$(I).getValue();if(H!=null&&I.type!="file"&&(I.type!="submit"||(!B&&A!==false&&(!A||E==A)&&(B=true)))){if(E in J){if(!Object.isArray(J[E])){J[E]=[J[E]]}J[E].push(H)}else{J[E]=H}}}return J});return F.hash?G:Object.toQueryString(G)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,D){if(Form.Element.Serializers[D.tagName.toLowerCase()]){B.push(Element.extend(D))}return B})},getInputs:function(H,F,D){H=$(H);var G=H.getElementsByTagName("input");if(!F&&!D){return $A(G).map(Element.extend)}for(var E=0,I=[],A=G.length;E<A;E++){var B=G[E];if((F&&B.type!=F)||(D&&B.name!=D)){continue}I.push(Element.extend(B))}return I},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(D){var A=$(D).getElements().findAll(function(E){return"hidden"!=E.type&&!E.disabled});var B=A.findAll(function(E){return E.hasAttribute("tabIndex")&&E.tabIndex>=0}).sortBy(function(E){return E.tabIndex}).first();return B?B:A.find(function(E){return["input","select","textarea"].include(E.tagName.toLowerCase())})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(D,B){D=$(D),B=Object.clone(B||{});var E=B.parameters,A=D.readAttribute("action")||"";if(A.blank()){A=window.location.href}B.parameters=D.serialize(true);if(E){if(Object.isString(E)){E=E.toQueryParams()}Object.extend(B.parameters,E)}if(D.hasAttribute("method")&&!B.method){B.method=D.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 D={};D[A.name]=B;return Object.toQueryString(D)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var D=A.tagName.toLowerCase();Form.Element.Serializers[D](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,G){if(Object.isUndefined(G)){return this[B.type=="select-one"?"selectOne":"selectMany"](B)}else{var E,F,H=!Object.isArray(G);for(var D=0,A=B.length;D<A;D++){E=B.options[D];F=this.optionValue(E);if(H){if(F==G){E.selected=true;return}}else{E.selected=G.include(F)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(B){var F,A=B.length;if(!A){return null}for(var E=0,F=[];E<A;E++){var D=B.options[E];if(D.selected){F.push(this.optionValue(D))}}return F},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,D,B){$super(B,D);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(E,D){return E.button==A[D]}}else{if(Prototype.Browser.WebKit){B=function(E,D){switch(D){case 0:return E.which==1&&!E.metaKey;case 1:return E.which==1&&E.metaKey;default:return false}}}else{B=function(E,D){return E.which?(E.which===D+1):(E.button===D)}}}return{isLeftClick:function(D){return B(D,0)},isMiddleClick:function(D){return B(D,1)},isRightClick:function(D){return B(D,2)},element:function(F){F=Event.extend(F);var E=F.target,D=F.type,G=F.currentTarget;if(G&&G.tagName){if(D==="load"||D==="error"||(D==="click"&&G.tagName.toLowerCase()==="input"&&G.type==="radio")){E=G}}if(E.nodeType==Node.TEXT_NODE){E=E.parentNode}return Element.extend(E)},findElement:function(F,G){var E=Event.element(F);if(!G){return E}var D=[E].concat(E.ancestors());return Selector.findElement(D,G,0)},pointer:function(F){var E=document.documentElement,D=document.body||{scrollLeft:0,scrollTop:0};return{x:F.pageX||(F.clientX+(E.scrollLeft||D.scrollLeft)-(E.clientLeft||0)),y:F.pageY||(F.clientY+(E.scrollTop||D.scrollTop)-(E.clientTop||0))}},pointerX:function(D){return Event.pointer(D).x},pointerY:function(D){return Event.pointer(D).y},stop:function(D){Event.extend(D);D.preventDefault();D.stopPropagation();D.stopped=true}}})();Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,D){B[D]=Event.Methods[D].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 D=Event.pointer(B);Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:D.x,pageY:D.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 E(K){if(K._prototypeEventID){return K._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return K._prototypeEventID=[++arguments.callee.id]}function F(K){if(K&&K.include(":")){return"dataavailable"}return K}function H(K){return A[K]=A[K]||{}}function G(M,K){var L=H(M);return L[K]=L[K]||[]}function J(L,K,M){var P=E(L);var O=G(P,K);if(O.pluck("handler").include(M)){return false}var N=function(Q){if(!Event||!Event.extend||(Q.eventName&&Q.eventName!=K)){return false}Event.extend(Q);M.call(L,Q)};N.handler=M;O.push(N);return N}function I(N,K,L){var M=G(N,K);return M.find(function(O){return O.handler==L})}function B(N,K,L){var M=H(N);if(!M[K]){return false}M[K]=M[K].without(I(N,K,L))}function D(){for(var L in A){for(var K in A[L]){A[L][K]=null}}}if(window.attachEvent){window.attachEvent("onunload",D)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}return{observe:function(M,K,N){M=$(M);var L=F(K);var O=J(M,K,N);if(!O){return M}if(M.addEventListener){M.addEventListener(L,O,false)}else{M.attachEvent("on"+L,O)}return M},stopObserving:function(M,K,N){M=$(M);var P=E(M),L=F(K);if(!N&&K){G(P,K).each(function(Q){M.stopObserving(K,Q.handler)});return M}else{if(!K){Object.keys(H(P)).each(function(Q){M.stopObserving(Q)});return M}}var O=I(P,K,N);if(!O){return M}if(M.removeEventListener){M.removeEventListener(L,O,false)}else{M.detachEvent("on"+L,O)}B(P,K,N);return M},fire:function(M,L,K){M=$(M);if(M==document&&document.createEvent&&!M.dispatchEvent){M=document.documentElement}var N;if(document.createEvent){N=document.createEvent("HTMLEvents");N.initEvent("dataavailable",true,true)}else{N=document.createEventObject();N.eventType="ondataavailable"}N.eventName=L;N.memo=K||{};if(document.createEvent){M.dispatchEvent(N)}else{M.fireEvent(N.eventType,N)}return Event.extend(N)}}})());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,D){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,D)}this.xcomp=A;this.ycomp=D;this.offset=Element.cumulativeOffset(B);return(D>=this.offset[1]&&D<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,E){var D=Element.cumulativeScrollOffset(B);this.xcomp=A+D[0]-this.deltaX;this.ycomp=E+D[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,D,B){B=B||{};return Element.clonePosition(D,A,B)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(D){return D.blank()?null:"[contains(concat(' ', @class, ' '), ' "+D+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(E,D){D=D.toString().strip();var F=/\s/.test(D)?$w(D).map(A).join(""):A(D);return F?document._getElementsByXPath(".//*"+F,E):[]}:function(G,F){F=F.toString().strip();var D=[],I=(/\s/.test(F)?$w(F):null);if(!I&&!F){return D}var E=$(G).getElementsByTagName("*");F=" "+F+" ";for(var H=0,K,J;K=E[H];H++){if(K.className&&(J=" "+K.className+" ")&&(J.include(F)||(I&&I.all(function(L){return !L.toString().blank()&&J.include(" "+L+" ")})))){D.push(Element.extend(K))}}return D};return function(D,E){return $(E||document.body).getElementsByClassName(D)}}(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(D,A){var B=arguments[0];var D=arguments[1];var A=arguments[2];var E=B.getElementsByTagName(D);return $A(E).inject([],function(G,F){if(F.className.match(new RegExp("(^|\\s)"+A+"(\\s|$)"))){G.push(Element.extend(F))}return G})},getNthElementByClassName:function(){if(arguments.length<3){return Element.exception}var E=arguments[0];var B=arguments[1];var A=parseInt(arguments[2]);var D=(arguments[3]?arguments[3]:"*");if(isNaN(A)){return Element.exception}var G=$A((E||document.body).getElementsByTagName(D));if(A==0){return Element.exception}else{if(A<0){G.reverse(true);A=Math.abs(A)}}var H=0;var I=null;for(var F=0;F<G.length;F++){if(G[F].className.match(new RegExp("(^|\\s)"+B+"(\\s|$)"))){H++;if(H==A){I=Element.extend(G[F]);break}}}return I},getFirstElementByClassName:function(){var D=arguments[0];var A=arguments[1];var B=arguments[2];if(B){return D.getNthElementByClassName(A,1,B)}else{return D.getNthElementByClassName(A,1)}},getLastElementByClassName:function(){var D=arguments[0];var A=arguments[1];var B=arguments[2];if(B){return D.getNthElementByClassName(A,-1,B)}else{return D.getNthElementByClassName(A,-1)}},containsElementWithClassName:function(){if(arguments.length<2){return null}var D=arguments[0];var A=arguments[1];var B=arguments[2];var E=null;if(B){E=D.getNthElementByClassName(A,1,arguments[2])}else{E=D.getNthElementByClassName(A,1)}if(E){return true}else{return false}},getElementsByAttribute:function(){if(arguments.length<2){return null}var D=arguments[0];var G=arguments[1];if(G.toLowerCase()=="class"||G.toLowerCase()=="classname"){log.error("getElementsByAttribute does not support 'class' or 'className' as the attribute parameter");return null}var B=D.getElementsByTagName(arguments[2]||"*");var F=$A();var H=B.length;for(var E=0;E<H;E++){var A=B[E];if(A.getAttribute(G)){F.push(Element.extend(A))}}return F},getParentByTagName:function(){var D=$A(arguments),B=D.shift(),A=D[0].toUpperCase();while(B.parentNode){if(B.tagName==A){return Element.extend(B)}B=B.parentNode}return null},getParentByClassName:function(){var D=$A(arguments),B=D.shift(),A=D[0];while(B.tagName!="HTML"){if(B.hasClassName(A)){return Element.extend(B)}B=$(B.parentNode)}return null},toggleClasses:function(E,D){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(E){log.debug("updateAndFocus - updating");var D=arguments[0];var F=arguments[1]?arguments[1]:1000;if(D){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(D);if(window.virtualBufferManager){window.virtualBufferManager.update();clearTimeout(window.virtualBufferManager.timeout)}else{log.error("Element.updateAndFocus(): virtualBufferManager does not exist!")}var A=setTimeout(B,F);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,E){var D=document.createElement("INPUT");D.setAttribute("name",A);D.setAttribute("type","hidden");D.setAttribute("value",E);log.debug("adding hidden field:"+A+":"+E);B.appendChild(D)}};Form.Element.resetValue=function(B){var A=B.getElementsByTagName("select")[0];if(A){A.selectedIndex=0}var E=B.getElementsByTagName("input");if(E){for(var D=0;E[D];D++){switch(E[D].type){case"radio":case"checkbox":E[D].checked=false;break;case"text":case"password":E[D].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 D=this,A=$A(arguments),B=A.shift();return function(E){return D.apply(B,[(E||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(D,B){var A=Event.element(D);while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode}return A}});var Units={PX_TO_EM:12,EM_TO_PX:1/12,TYPE:"px"};Position.putInViewport=function(A,G){var F=Position.calculateViewport();var J=Position.calculateScroll();var D=Position.calculatePageHeight();G.dim=G.getDimensions();G.pos=G.getPosition();A.pos=Position.cumulativeOffset(A);A.dim=A.getDimensions();A.pos=A.getPosition();var B=A.pos.x-G.dim.width;if(A.pos.x+A.dim.width+G.dim.width<=F.width||B<=0){B=A.dim.width+A.pos.x}var I=(parseInt(J.x)+F.width-(B+G.dim.width)>=0);if(Units.TYPE=="em"){B=B/Units.PX_TO_EM}G.setStyle({left:B+Units.TYPE});F=Position.calculateViewport();var H=A.pos.y+(A.dim.height/2);if(F.height<G.dim.height||parseInt(J.y)-H>=0){H=parseInt(J.y)}else{if(H+G.dim.height>=parseInt(J.y)+F.height){H=H-(H+G.dim.height-(parseInt(J.y)+F.height))}}var E=(parseInt(J.y)+F.height-(H+G.dim.height)>=0);if(Units.TYPE=="em"){H=H/Units.PX_TO_EM}G.setStyle({top:H+Units.TYPE});return{x:B,y:H,inViewport:(I&&E),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 D=document.documentElement;var B=window.innerHeight;var A=window.innerWidth;if(B!=null&&D.clientHeight!=null){B=(D.clientHeight<B&&D.clientHeight>0)?D.clientHeight:B;A=(D.clientWidth<window.innerWidth&&D.clientWidth>0)?D.clientWidth:A}else{if(D&&D.clientHeight){B=D.clientHeight;A=D.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 E=0,F=0;do{if(Element.getStyle(B,"position")=="fixed"){var D=Position.calculateScroll();E+=D.y+B.offsetTop;F+=D.x+B.offsetLeft;B=null}else{E+=B.offsetTop||0;F+=B.offsetLeft||0;B=$(B.offsetParent)}}while(B);return[F,E]};Ajax.Request.prototype.abort=function(){this.transport.onreadystatechange=Prototype.emptyFunction;this.transport.abort();Ajax.activeRequestCount--};Ajax.PartialRequest=function(A,B){try{var E=function(){var G=A.split("?")[1];var F=B.parameters;if(typeof F!="undefined"&&typeof G!="undefined"){throw new Error("Cannot resolve both parameters and queryString in Ajax.PartialRequest. Must choose either parameters or querystring.")}if(typeof F=="undefined"&&typeof G=="undefined"){return""}return F||G}();if(!E.match(/req=partial/)){var E=E.split("&");E.push("rep=partial");E=E.join("&")}B.parameters=E;new Ajax.Request(A.split("?")[0],B)}catch(D){Errors.capture(D)}};var ManagedEventObservers=Class.create();ManagedEventObservers.prototype={initialize:function(){this.observers=$A()},add:function(A,B,E,D){if(arguments.length>=3){A=$(A);D=D||false;Event.observe(A,B,E,D);this.observers.push([A,B,E,D])}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 D=false;if($(A)){for(var B=0;B<this.observers.length;B++){if(this.observers[B][0]==A){D=true}}}return D}};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),F=A.shift();var G=["name","message","description","number","fileName","sourceURL","lineNumber","line"];var E=A;for(var D=0;D<G.length;D++){if(F[G[D]]!==undefined){E.push(G[D]+":"+F[G[D]])}}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(E);log.error(""+E.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(E,D){var B=new RegExp("^&|&$","g");var A=new RegExp("&&","g");String.prototype.deleteQueryStringParam=function(I,G){var F=I+(G===true?"[^&]*":"=[^&]*");var H=new RegExp(F,"g");return this.replace(H,"").replace(A,"&").replace(B,"")};return this.deleteQueryStringParam(E,D)};var $QS=QueryString=function(A){A=A.replace(/&amp;/,"&");var B=A.split("&");return{addParam:function(F){for(var E=0,D=arguments.length;E<D;E++){B.push(arguments[E])}B=B.uniq();return this},removeParam:function(F){for(var E=0,D=arguments.length;E<D;E++){B=B.without(arguments[E])}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,D,A){this.type=B;this.content=D;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"}),topLeft:new Element("div",{"class":"dialogTopLeft"}),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"}),mainInfo:new Element("div",{"class":"dialogMainInfo"}),dialogTitle:new Element("div",{"class":"dialogTitle"}),dialogTitleH3:new Element("h3"),bottomContent:new Element("div",{"class":"dialogBottomContent"}),bottomLeft:new Element("div",{"class":"dialogBottomLeft"}),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);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.topLeft);this.markup.top.appendChild(this.markup.topRight);this.markup.main.appendChild(this.markup.mainRight);this.markup.mainRight.appendChild(this.markup.mainContent);this.markup.mainContent.appendChild(this.markup.topCloseLink);if(this.options.heading){this.markup.dialogTitleH3.innerHTML=this.options.heading;this.markup.dialogTitle.appendChild(this.markup.dialogTitleH3);this.markup.mainContent.appendChild(this.markup.dialogTitle)}this.markup.mainContent.appendChild(this.markup.mainInfo);this.markup.mainContent.appendChild(this.markup.bottomCloseLink);this.markup.bottom.appendChild(this.markup.bottomLeft);this.markup.bottom.appendChild(this.markup.bottomRight)},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 F=Element.extend(document.createElement("iframe"));F.style.display="none";this.markup.shim.appendChild(F);this.markup.shim.className="dialogShim "+this.options.classes;F.src="/script/empty.html";F.scrolling="no";F.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 D=this.markup.shim.currentStyle.paddingTop.replace("px","")*1;var E=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;F.style.width=(this.dialogBoundingBox.x2-this.dialogBoundingBox.x1-E-B)+"px";F.style.height=(this.dialogBoundingBox.y2-this.dialogBoundingBox.y1-D-A)+"px";F.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 D=this.markup.mainInfo.getElementsByClassName("closeListener");for(var A=0;D[A];A++){if(!D[A].isAttached){this.managedEventObservers.add(D[A],"click",B);D[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.mainInfo.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.mainInfo.appendChild(A[B])}}else{if(this.content.url&&this.response.responseText){this.markup.mainInfo.update(this.response.responseText);Page.initializeDOMFragment(this.markup.mainInfo)}else{if(this.content.string){this.markup.mainInfo.update(this.content.string);Page.initializeDOMFragment(this.markup.mainInfo)}else{log.error("Dialog.populateDialog: unable to determine response type")}}}this.markup.backToTopLink=this.markup.mainInfo.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.mainInfo){if(this.content.domNode){var A=this.markup.mainInfo.immediateDescendants();for(var B=0;B<A.length;B++){this.content.domNode.appendChild(A[B])}}this.markup.mainInfo.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.bottomRight=this.markup.bottomRight?this.markup.bottomRight.destroy():null;this.markup.bottomLeft=this.markup.bottomLeft?this.markup.bottomLeft.destroy():null;this.markup.bottomContent=this.markup.bottomContent?this.markup.bottomContent.destroy():null;this.markup.bottomCloseLink=this.markup.bottomCloseLink?this.markup.bottomCloseLink.destroy():null;this.markup.mainInfo=this.markup.mainInfo?this.markup.mainInfo.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.topLeft=this.markup.topLeft?this.markup.topLeft.destroy():null;this.markup.dialogTitleH3=this.markup.dialogTitleH3?this.markup.dialogTitleH3.destroy():null;this.markup.dialogTitle=this.markup.dialogTitle?this.markup.dialogTitle.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(D){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,E,F){var D={triggerEvent:"mouseover",triggerDelay:0,compact:false,displayBeak:true,preferredPosition:"bottomRight",debug:{enabled:false}};var A=$A(A);Object.extend(D,F||{});this.setProperties("Microcontent",E,D);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 D=this.trigger.pos.y;if(Units.TYPE=="em"){D=D/Units.PX_TO_EM}this.markup.dialogWrapper.setStyle({top:D+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 P={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 J={x:P.x1,y:P.y1+(this.trigger.dim.height/2)};var K={x:P.x2,y:P.y1+(this.trigger.dim.height/2)}}else{var J={x:P.x2,y:P.y1+(this.trigger.dim.height/2)};var K={x:P.x1,y:P.y1+(this.trigger.dim.height/2)}}var c=this.markup.dialogWrapper.getDimensions();var U=function(){var l=0;var k=0;var f;var e;if(this.markup.main.currentStyle){if(this.options.displayBeak){var d=this.markup.beak.currentStyle;var l=(d.height.replace("px",""))*1;var k=(d.width.replace("px",""))*1}var h=this.markup.main.currentStyle;var g=this.markup.mainRight.currentStyle;var f=(h.paddingLeft.replace("px",""))*1;var e=(g.paddingRight.replace("px",""))*1}else{if(this.options.displayBeak){var d=document.defaultView.getComputedStyle(this.markup.beak,"");var l=(d.getPropertyValue("height").replace("px",""))*1;var k=(d.getPropertyValue("width").replace("px",""))*1}var h=document.defaultView.getComputedStyle(this.markup.main,"");var g=document.defaultView.getComputedStyle(this.markup.mainRight,"");var f=(h.getPropertyValue("padding-left").replace("px",""))*1;var e=(g.getPropertyValue("padding-right").replace("px",""))*1}if(this.options.displayBeak){this.offsets={top:(this.markup.bottom.dim.height+(l/2)),right:k-f,bottom:(0-this.markup.top.dim.height-(l/2)),left:(0-(k-e))}}else{this.offsets={top:this.markup.bottom.dim.height,right:0-f*2,bottom:0-this.markup.top.dim.height/2,left:e*2}}this.beakHeight=l}.bind(this);var H=function(){if(this.options.displayBeak){this.markup.beak.className="microcontentBeakRight";this.markup.beak.setStyle({left:c.width+"px"})}U()}.bind(this);var b=function(){if(this.options.displayBeak){this.markup.beak.className="microcontentBeakLeft";this.markup.beak.setStyle({left:"0"})}U()}.bind(this);b();var A={x1:K.x+this.offsets.right+this.triggerContext.pos.x,y1:K.y-c.height+this.offsets.top+this.triggerContext.pos.y,x2:K.x+c.width+this.offsets.right+this.triggerContext.pos.x,y2:K.y+this.offsets.top+this.triggerContext.pos.y};var S={x1:K.x+this.offsets.right+this.triggerContext.pos.x,y1:K.y+this.offsets.bottom+this.triggerContext.pos.y,x2:K.x+c.width+this.offsets.right+this.triggerContext.pos.x,y2:K.y+c.height+this.offsets.bottom+this.triggerContext.pos.y};H();var I={x1:J.x-c.width+this.offsets.left+this.triggerContext.pos.x,y1:J.y-c.height+this.offsets.top+this.triggerContext.pos.y,x2:J.x+this.offsets.left+this.triggerContext.pos.x,y2:J.y+this.offsets.top+this.triggerContext.pos.y};var X={x1:J.x-c.width+this.offsets.left+this.triggerContext.pos.x,y1:J.y+this.offsets.bottom+this.triggerContext.pos.y,x2:J.x+this.offsets.left+this.triggerContext.pos.x,y2:J.y+c.height+this.offsets.bottom+this.triggerContext.pos.y};var W=Position.calculateViewport();var Q=Position.calculateScroll();var F={x1:Q.x,y1:Q.y,x2:(Q.x+W.width),y2:(Q.y+W.height)};var E=(S.x2<=F.x2)&&(S.y2<=F.y2);var N=(X.x1>=F.x1)&&(X.y2<=F.y2);var D=(A.x2<=F.x2)&&(A.y1>=F.y1);var a=(I.x1>=F.x1)&&(I.y1>=F.y1);this.debugPosition({dialogWrapperDimensions:c,topRightBoundingBox:A,topLeftBoundingBox:I,bottomRightBoundingBox:S,bottomLeftBoundingBox:X,bottomRightGood:E,bottomLeftGood:N,topRightGood:D,topLeftGood:a});this.dialogBoundingBox;var B=function(){H();this.markup.dialogWrapper.setStyle({left:((this.dialogBoundingBox.x1-this.triggerContext.pos.x)/Units.PX_TO_EM)+"em"})}.bind(this);var R=function(){b();this.markup.dialogWrapper.setStyle({left:((this.dialogBoundingBox.x1-this.triggerContext.pos.x)/Units.PX_TO_EM)+"em"})}.bind(this);var T=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 G=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 Y=function(){this.dialogBoundingBox=S;R();G()}.bind(this);var L=function(){this.dialogBoundingBox=A;R();T()}.bind(this);var Z=function(){this.dialogBoundingBox=X;B();G()}.bind(this);var M=function(){this.dialogBoundingBox=I;B();T()}.bind(this);var O=Y;var V=false;if(this.options.preferredPosition=="bottomRight"){if(E){V=true}O=Y}else{if(this.options.preferredPosition=="topRight"){if(D){V=true}O=L}else{if(this.options.preferredPosition=="bottomLeft"){if(N){V=true}O=Z}else{if(this.options.preferredPosition=="topLeft"){if(a){V=true}O=M}}}}if(V){O()}else{if(E){Y()}else{if(D){L()}else{if(N){Z()}else{if(a){M()}else{O()}}}}}},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,E,D){var B="Microcontent.inspectPositioningData:<br/>viewport.height: "+A.height+"<br/>scroll.y: "+E.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 H="border:3px solid green;";var E="border:3px dashed red;";var D=B.topRightGood?H:E;var A=B.topLeftGood?H:E;var F=B.bottomRightGood?H:E;var G=B.bottomLeftGood?H:E;if(this.options.debug.enabled){this.options.debug.topRightDebugBox=new Element("div",{style:D+"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:F+"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:G+"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,D,E){var B={triggerEvent:"click",interstitial:"",id:"",compact:false,openOnInit:false};Object.extend(B,E||{});this.setProperties("Lightbox",D,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,E){var D;if(arguments.length>1&&$(E).getElementsByClassName){D=$(E).getElementsByClassName("resizeListener")}else{D=this.markup.dialogWrapper.getElementsByClassName("resizeListener")}for(var A=0;D[A];A++){this.managedEventObservers.add(D[A],"click",B)}},displayLightbox:function(){if(this.content.url){this.markup.mainInfo.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,D){if(this.isOpen==true&&this.activated==false){this.activated=true;this.response=null;this.managedEventObservers.clear();this.markup.mainInfo.innerHTML=this.options.interstitial;this.resize();var E=Position.calculatePageHeight();this.markup.mask.dim=this.markup.mask.getDimensions();if(E.height>this.markup.mask.dim.height){this.markup.mask.setStyle({height:E.height+"px"})}if(arguments.length>1){var B=$H(D).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 D=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:D.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<D.y&&this.bottomOfDialog>(D.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(D.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((D.y+A.height)>this.bottomOfDialog){if(!this.isFixedAtBottom){this.markup.dialogWrapper.addClassName("fixed");this.isFixedAtBottom=true}if(this.positionFixedUnsupported()){this.markup.dialogWrapper.setStyle({top:(D.y-this.dialogViewportDiff)+"px"})}else{this.markup.dialogWrapper.setStyle({top:-(this.dialogViewportDiff)+"px"})}}}else{if(D.y<this.lastScroll.y){if(this.positionFixedUnsupported()&&D.y<=this.markup.dialogWrapper.pos.y){this.markup.dialogWrapper.setStyle({top:D.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(D.y<=this.markup.dialogWrapper.pos.y&&!this.isFixedAtTop){this.markup.dialogWrapper.addClassName("fixed");this.markup.dialogWrapper.setStyle({top:0});this.isFixedAtTop=true}}}}}}}this.lastScroll=D},inspectScrollData:function(A,E,D){var B="Lightbox.inspectScrollData:<br/>viewport.height: "+A.height+"<br/>scroll.y: "+E.y+"<br/>page.height: "+D.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,D,F,B){$super(A,D,F);this.wrapperMarkup=B;var E=this.content.url;if(E.indexOf("book")!=-1){this.content.url="/book/bookingpath"}else{this.content.url="/shop/searchForm"}E=E.substr(E.indexOf("?")+1);E=E.replace(/&amp(;|%3B)/g,"&");E=E.replace(/\+/g,"%20");E="changeSearch=true&"+E;this.options.ajaxParameters=E},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 D=this.slice(4,this.length-1).split(",");var B=0;do{A+=parseInt(D[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(D){return(D.nodeType==3?D.nodeValue:((D.hasChildNodes()&&!Element.hasClassName(D,A))?Element.collectTextNodesIgnoreClass(D,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 D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}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(D){if(D.nodeType==3){D.nodeValue.toArray().each(function(E){A.insertBefore(new Element("span",{style:B}).update(E==" "?String.fromCharCode(160):E),D)});Element.remove(D)}})},multiple:function(D,B){var A;if(((typeof D=="object")||Object.isFunction(D))&&(D.length)){A=D}else{A=$(D).childNodes}var E=Object.extend({speed:0.1,delay:0},arguments[2]||{});var F=E.delay;$A(A).each(function(H,G){new B(H,Object.extend(E,{delay:G*E.speed+F}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(B,A){B=$(B);A=(A||"appear").toLowerCase();var D=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,D)}};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 D=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(E){return E.state=="idle"}).each(function(E){E.startOn+=B.finishOn;E.finishOn+=B.finishOn});break;case"with-last":D=this.effects.pluck("startOn").max()||D;break;case"end":D=this.effects.pluck("finishOn").max()||D;break}B.startOn+=D;B.finishOn+=D;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 D=new Date().getTime();for(var B=0,A=this.effects.length;B<A;B++){this.effects[B]&&this.effects[B].loop(D)}}});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(E,D){return((E[D+"Internal"]?"this.options."+D+"Internal(this);":"")+(E[D]?"this.options."+D+"(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 D(F,E){if(F.options[E+"Internal"]){F.options[E+"Internal"](F)}if(F.options[E]){F.options[E](F)}}return function(E){if(this.state==="idle"){this.state="running";D(this,"beforeSetup");if(this.setup){this.setup()}D(this,"afterSetup")}if(this.state==="running"){E=(this.options.transition(E)*this.fromToDelta)+this.options.from;this.position=E;D(this,"beforeUpdate");if(this.update){this.update(E)}D(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 D=(A-this.startOn)/this.totalTime,B=(D*this.totalFrames).round();if(B>this.currentFrame){this.render(D);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(D,G,F){D=Object.isString(D)?$(D):D;var A=$A(arguments),E=A.last(),B=A.length==5?A[3]:null;this.method=Object.isFunction(E)?E.bind(D):Object.isFunction(D[E])?D[E].bind(D):function(H){D[E]=H};this.start(Object.extend({from:G,to:F},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,D,A){return new Effect.Move(B,Object.extend({x:A,y:D},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(B,A){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var D=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:A},arguments[2]||{});this.start(D)},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(E,D){var F={};if(this.options.scaleX){F.width=D.round()+"px"}if(this.options.scaleY){F.height=E.round()+"px"}if(this.options.scaleFromCenter){var B=(E-this.dims[0])/2;var A=(D-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){F.top=this.originalTop-B+"px"}if(this.options.scaleX){F.left=this.originalLeft-A+"px"}}else{if(this.options.scaleY){F.top=-B+"px"}if(this.options.scaleX){F.left=-A+"px"}}}this.element.setStyle(F)}});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,D,E){return B+((this._base[E]+(this._delta[E]*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]||{},E=document.viewport.getScrollOffsets(),D=$(A).cumulativeOffset();if(B.offset){D[1]+=B.offset}return new Effect.Tween(null,E.top,D[1],B,function(F){scrollTo(E.left,F.round())})};Effect.Fade=function(B){B=$(B);var A=B.getInlineOpacity();var D=Object.extend({from:B.getOpacity()||1,to:0,afterFinishInternal:function(E){if(E.options.to!=0){return}E.element.hide().setStyle({opacity:A})}},arguments[1]||{});return new Effect.Opacity(B,D)};Effect.Appear=function(A){A=$(A);var B=Object.extend({from:(A.getStyle("display")=="none"?0:A.getOpacity()||0),to:1,afterFinishInternal:function(D){D.element.forceRerendering()},beforeSetup:function(D){D.element.setOpacity(D.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(D){Position.absolutize(D.effects[0].element)},afterFinishInternal:function(D){D.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(D){D.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(D){D.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(D){new Effect.Scale(D.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(E){E.element.makePositioned().makeClipping()},afterFinishInternal:function(E){E.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(D){D.effects[0].element.makePositioned()},afterFinishInternal:function(D){D.effects[0].element.hide().undoPositioned().setStyle(A)}},arguments[1]||{}))};Effect.Shake=function(B){B=$(B);var E=Object.extend({distance:20,duration:0.5},arguments[1]||{});var F=parseFloat(E.distance);var D=parseFloat(E.duration)/10;var A={top:B.getStyle("top"),left:B.getStyle("left")};return new Effect.Move(B,{x:F,y:0,duration:D,afterFinishInternal:function(G){new Effect.Move(G.element,{x:-F*2,y:0,duration:D*2,afterFinishInternal:function(H){new Effect.Move(H.element,{x:F*2,y:0,duration:D*2,afterFinishInternal:function(I){new Effect.Move(I.element,{x:-F*2,y:0,duration:D*2,afterFinishInternal:function(J){new Effect.Move(J.element,{x:F*2,y:0,duration:D*2,afterFinishInternal:function(K){new Effect.Move(K.element,{x:-F,y:0,duration:D,afterFinishInternal:function(L){L.element.undoPositioned().setStyle(A)}})}})}})}})}})}})};Effect.SlideDown=function(B){B=$(B).cleanWhitespace();var D=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(E){E.element.makePositioned();E.element.down().makePositioned();if(window.opera){E.element.setStyle({top:""})}E.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(E){E.element.down().setStyle({bottom:(E.dims[0]-E.element.clientHeight)+"px"})},afterFinishInternal:function(E){E.element.undoClipping().undoPositioned();E.element.down().undoPositioned().setStyle({bottom:D})}},arguments[1]||{}))};Effect.SlideUp=function(B){B=$(B).cleanWhitespace();var D=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(E){E.element.makePositioned();E.element.down().makePositioned();if(window.opera){E.element.setStyle({top:""})}E.element.makeClipping().show()},afterUpdateInternal:function(E){E.element.down().setStyle({bottom:(E.dims[0]-E.element.clientHeight)+"px"})},afterFinishInternal:function(E){E.element.hide().undoClipping().undoPositioned();E.element.down().undoPositioned().setStyle({bottom:D})}},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 D=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 I=B.getDimensions();var G,H;var F,E;switch(D.direction){case"top-left":G=H=F=E=0;break;case"top-right":G=I.width;H=E=0;F=-I.width;break;case"bottom-left":G=F=0;H=I.height;E=-I.height;break;case"bottom-right":G=I.width;H=I.height;F=-I.width;E=-I.height;break;case"center":G=I.width/2;H=I.height/2;F=-I.width/2;E=-I.height/2;break}return new Effect.Move(B,{x:G,y:H,duration:0.01,beforeSetup:function(J){J.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(J){new Effect.Parallel([new Effect.Opacity(J.element,{sync:true,to:1,from:0,transition:D.opacityTransition}),new Effect.Move(J.element,{x:F,y:E,sync:true,transition:D.moveTransition}),new Effect.Scale(J.element,100,{scaleMode:{originalHeight:I.height,originalWidth:I.width},sync:true,scaleFrom:window.opera?1:0,transition:D.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(K){K.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(K){K.effects[0].element.undoClipping().undoPositioned().setStyle(A)}},D))}})};Effect.Shrink=function(B){B=$(B);var D=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 G=B.getDimensions();var F,E;switch(D.direction){case"top-left":F=E=0;break;case"top-right":F=G.width;E=0;break;case"bottom-left":F=0;E=G.height;break;case"bottom-right":F=G.width;E=G.height;break;case"center":F=G.width/2;E=G.height/2;break}return new Effect.Parallel([new Effect.Opacity(B,{sync:true,to:0,from:1,transition:D.opacityTransition}),new Effect.Scale(B,window.opera?1:0,{sync:true,transition:D.scaleTransition,restoreAfterFinish:true}),new Effect.Move(B,{x:F,y:E,sync:true,transition:D.moveTransition})],Object.extend({beforeStartInternal:function(H){H.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(H){H.effects[0].element.hide().undoClipping().undoPositioned().setStyle(A)}},D))};Effect.Pulsate=function(D){D=$(D);var E=arguments[1]||{},B=D.getInlineOpacity(),F=E.transition||Effect.Transitions.linear,A=function(G){return 1-F((-Math.cos((G*(E.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(D,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(G){G.element.setStyle({opacity:B})}},E),{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(D){new Effect.Scale(B,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(E){E.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 D=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(D.style)){this.style=$H(D.style)}else{if(D.style.include(":")){this.style=D.style.parseStyle()}else{this.element.addClassName(D.style);this.style=$H(this.element.getStyles());this.element.removeClassName(D.style);var B=this.element.getStyles();this.style=this.style.reject(function(E){return E.value==B[E.key]});D.afterFinishInternal=function(E){E.element.addClassName(E.options.style);E.transforms.each(function(F){E.element.style[F.style]=""})}}}this.start(D)},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(D){return parseInt(B.slice(D*2+1,D*2+3),16)})}this.transforms=this.style.map(function(H){var B=H[0],G=H[1],F=null;if(G.parseColor("#zzzzzz")!="#zzzzzz"){G=G.parseColor();F="color"}else{if(B=="opacity"){G=parseFloat(G);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(G)){var E=G.match(/^([\+\-]?[0-9\.]+)(.*)$/);G=parseFloat(E[1]);F=(E.length==3)?E[2]:null}}}var D=this.element.getStyle(B);return{style:B.camelize(),originalValue:F=="color"?A(D):parseFloat(D||0),targetValue:F=="color"?A(G):G,unit:F}}.bind(this)).reject(function(B){return((B.originalValue==B.targetValue)||(B.unit!="color"&&(isNaN(B.originalValue)||isNaN(B.targetValue))))})},update:function(A){var E={},B,D=this.transforms.length;while(D--){E[(B=this.transforms[D]).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(E,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 D=B.values().first();this.tracks.push($H({ids:B.keys().first(),effect:Effect.Morph,options:{style:D}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(B){var F=B.get("ids"),D=B.get("effect"),E=B.get("options");var A=[$(F)||$$(F)].flatten();return A.map(function(G){return new D(G,Object.extend({sync:true},E))})}).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(D){if(B[D]){A.set(D,B[D])}});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(E,D){E[D]=B[D];return E})}}else{Element.getStyles=function(B){B=$(B);var D=B.currentStyle,A;A=Element.CSS_PROPERTIES.inject({},function(F,E){F[E]=D[E];return F});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(D,B,E){D=$(D);var F=B.dasherize().camelize(),A=F.charAt(0).toUpperCase()+F.substring(1);new Effect[A](D,E);return D},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,D){B=$(B);Effect[A.charAt(0).toUpperCase()+A.substring(1)](B,D);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,D,E){var B=this;if(Object.isArray(A)){this.handles=A.collect(function(F){return $(F)})}else{this.handles=[$(A)]}this.track=$(D);this.options=E||{};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(F){return $(F)}):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(G,F){F=B.handles.length-1-F;B.setValue(parseFloat((Object.isArray(B.options.sliderValue)?B.options.sliderValue[F]:B.options.sliderValue)||B.range.start),F);G.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 D=Math.abs(this.allowedValues[0]-A);var B=this.allowedValues[0];this.allowedValues.each(function(E){var F=Math.abs(E-A);if(F<=D){B=E;D=F}});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(E){if(Event.isLeftClick(E)){if(!this.disabled){this.active=true;var A=Event.element(E);var F=[Event.pointerX(E),Event.pointerY(E)];var D=A;if(D==this.track){var B=Position.cumulativeOffset(this.track);this.event=E;this.setValue(this.translateToValue((this.isVertical()?F[1]-B[1]:F[0]-B[0])-(this.handleLength/2)));var B=Position.cumulativeOffset(this.activeHandle);this.offsetX=(F[0]-B[0]);this.offsetY=(F[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=(F[0]-B[0]);this.offsetY=(F[1]-B[1])}}}Event.stop(E)}},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 D=[Event.pointerX(B),Event.pointerY(B)];var A=Position.cumulativeOffset(this.track);D[0]-=this.offsetX+A[0];D[1]-=this.offsetY+A[1];this.event=B;this.setValue(this.translateToValue(this.isVertical()?D[1]:D[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,D,B){A=$(A);this.element=A;this.update=$(D);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(E,F){if(!F.style.position||F.style.position=="absolute"){F.style.position="absolute";Position.clone(E,F,{setHeight:false,offsetTop:E.offsetHeight})}Effect.Appear(F,{duration:0.15})};this.options.onHide=this.options.onHide||function(E,F){new Effect.Fade(F,{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(G){if(this.options.updateElement){this.options.updateElement(G);return}var E="";if(this.options.select){var B=$(G).select("."+this.options.select)||[];if(B.length>0){E=Element.collectTextNodes(B[0],this.options.select)}}else{E=Element.collectTextNodesIgnoreClass(G,"informal")}var A=this.getTokenBounds();if(A[0]!=-1){var F=this.element.value.substr(0,A[0]);var D=this.element.value.substr(A[0]).match(/^\s+/);if(D){F+=D[0]}this.element.value=F+E+this.element.value.substr(A[1])}else{this.element.value=E}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,G)}},updateChoices:function(D){if(!this.changed&&this.hasFocus){this.update.innerHTML=D;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 F=this.element.value;if(F.strip().empty()){return[-1,0]}var G=arguments.callee.getFirstDifferencePos(F,this.oldElementValue);var I=(G==this.oldElementValue.length?1:0);var E=-1,D=F.length;var H;for(var B=0,A=this.options.tokens.length;B<A;++B){H=F.lastIndexOf(this.options.tokens[B],G+I-1);if(H>E){E=H}H=F.indexOf(this.options.tokens[B],G+I);if(-1!=H&&H<D){D=H}}return(this.tokenBounds=[E+1,D])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(D,A){var E=Math.min(D.length,A.length);for(var B=0;B<E;++B){if(D[B]!=A[B]){return B}}return E};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(B,E,A,D){this.baseInitialize(B,E,D);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,D,E,B){this.baseInitialize(A,D,B);this.options.array=E},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 D=[];var F=[];var I=B.getToken();var H=0;for(var E=0;E<B.options.array.length&&D.length<B.options.choices;E++){var G=B.options.array[E];var J=B.options.ignoreCase?G.toLowerCase().indexOf(I.toLowerCase()):G.indexOf(I);while(J!=-1){if(J==0&&G.length!=I.length){D.push("<li><strong>"+G.substr(0,I.length)+"</strong>"+G.substr(I.length)+"</li>");break}else{if(I.length>=B.options.partialChars&&B.options.partialSearch&&J!=-1){if(B.options.fullSearch||/\s/.test(G.substr(J-1,1))){F.push("<li>"+G.substr(0,J)+"<strong>"+G.substr(J,I.length)+"</strong>"+G.substr(J+I.length)+"</li>");break}}}J=B.options.ignoreCase?G.toLowerCase().indexOf(I.toLowerCase(),J+1):G.indexOf(I,J+1)}}if(F.length){D=D.concat(F.slice(0,B.options.choices-D.length))}return"<ul>"+D.join("")+"</ul>"}},A||{})}});Field.scrollFreeActivate=function(A){setTimeout(function(){Field.activate(A)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(B,A,D){this.url=A;this.element=B=$(B);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(D);Object.extend(this.options,D||{});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(H,D,B){var F=this.options[H+"Control"];var G=this.options[H+"Text"];if("button"==F){var A=document.createElement("input");A.type="submit";A.value=G;A.className="editor_"+H+"_button";if("cancel"==H){A.onclick=this._boundCancelHandler}this._form.appendChild(A);this._controls[H]=A}else{if("link"==F){var E=document.createElement("a");E.href="#";E.appendChild(document.createTextNode(G));E.onclick="cancel"==H?this._boundCancelHandler:this._boundSubmitHandler;E.className="editor_"+H+"_link";if(B){E.className+=" "+B}this._form.appendChild(E);this._controls[H]=E}}},createEditField:function(){var D=(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=D;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(F,D){var E=B.options["text"+F+"Controls"];if(!E||D===false){return}B._form.appendChild(document.createTextNode(E))}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(E){var B=this._form;var D=$F(this._controls.editor);this.prepareSubmission();var F=this.options.callback(B,D)||"";if(Object.isString(F)){F=F.toQueryParams()}F.editorId=this.element.id;if(this.options.htmlResponse){var A=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(A,{parameters:F,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:F,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,A)}if(E){Event.stop(E)}},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(D){this._form.removeClassName(this.options.loadingClassName);var B=D.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,D){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(B,A,D)},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(E){return 2===E.length?E:[E,E].flatten()});var B=("value" in this.options)?this.options.value:this._text;var D=this._collection.any(function(E){return E[0]==B}.bind(this));this._controls.editor.update("");var A;this._collection.each(function(F,E){A=document.createElement("option");A.value=F[0];A.selected=D?F[0]==B:0==E;A.appendChild(document.createTextNode(F[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(D,E){if(D in A||E===undefined){return}A[D]=E}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,D){this.delay=A||0.5;this.element=$(B);this.callback=D;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,E,A,D){this.baseInitialize(B,E,D);this.options.asynchronous=true;this.options.onShow=this.onShow.bind(this);this.options.onSuccess=this.onSuccess.bind(this);this.options.onFailure=this.onFailure.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=A},onShow:function(A,B){if(!B.style.position||B.style.position=="absolute"){B.style.position="absolute";if(Prototype.Browser.IE&&/MSIE\s8\.0/.test(navigator.userAgent)){B.show()}Position.clone(A,B,{setHeight:false,offsetTop:A.offsetHeight});B.hide()}Effect.Appear(B,{duration:0.15})},onSuccess:function(A){this.updateChoices(A.responseText)},onFailure:function(A){log.error("Ajax.Autocompleter: request failed")}});Ajax.AutocompleterJSON=Class.create(Ajax.Autocompleter,{onSuccess:function(F){try{var B=F.responseText.evalJSON(true);if(B.length>0){this.results=B}}catch(H){log.error("Ajax.Autocompleter: invalid response")}var D=new Element("div");var G=new Element("ul");D.appendChild(G);for(var A=0;A<B.length;A++){var E=new Element("li").update(B[A].suggestion);if(A%2==0){E.setAttribute("class","odd")}else{E.setAttribute("class","even")}G.appendChild(E)}if(this.options.transformResponse){G=this.options.transformResponse(G)}this.updateChoices(D.innerHTML)}});Abstract.Agent=Class.create();Abstract.Agent.prototype={initialize:function(B,D){if(typeof(B)=="object"){try{Profiler.start(D.type);log.debug(D.type+".initialize() *");Object.extend(this,D);this.element=Element.extend(B);this.initExtend();Profiler.stop(D.type)}catch(A){Errors.capture(A,"Initialization failure : "+D.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(D,A){if(typeof(D)=="object"){try{this.parent=A;this.element=Element.extend(D);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 : "+D)}}},initExtend:function(){}};var Page={agents:[],childAgents:[],hideRevealRadios:[],init:function(){Persist.remove("cookie");Persist.remove("flash");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(D){Profiler.start("Page.init");var D=Element.extend(D);var A=D.getElementsByAttribute("agent");var B=[];var I=$A();for(var G=0;A[G];G++){var J=A[G];var H=J.getAgents();for(var F=0;H[F];F++){if(H[F].deferred=="true"){B.push({element:J,agent:H[F]})}else{if(H[F].childOf!=""&&H[F].childOf!=undefined){if(this.childAgents[H[F].childOf]==null){this.childAgents[H[F].childOf]=[]}this.childAgents[H[F].childOf].push({element:J,agent:H[F]})}else{if(H[F].lazy!="true"){this.initAgent(J,H[F])}}}}}for(var E=0;B[E];E++){this.initAgent(B[E].element,B[E].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;this.previousString=this.params.previous;this.nextString=this.params.next;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 D=0;D<A.length;D++){if(A[D].indexOf("y")!=-1){this.pattern.yearStringLength=A[D].length;A[D]="y"}if(A[D].indexOf("m")!=-1){A[D]="m"}if(A[D].indexOf("d")!=-1){A[D]="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(D){var B=this.pattern;var F=B.simpleString;var A=D.split("_");var E=(A[0]/1)+1+"";if(E.length!=2){E="0"+E}F=F.replace("m",E);var H=A[1]+"";if(H.length!=2){H="0"+H}F=F.replace("d",H);var G=A[2]+"";if(G.length!=B.yearStringLength){while(G.length>B.yearStringLength){G=G.substr(1)}}F=F.replace("y",G);return F},buildMarkupWithObservers:function(){Event.observe(this.body,"mousedown",this.setCalendarFocus.bindAsEventListener(this));var L=$A();var F='<table cellpadding="0" cellspacing="0" border="0"><thead><tr>';F+='<th colspan="'+this.dayNames.length+'">'+this.previousString+this.nextString;F+='<span class="monthName"></span></th></tr></thead>';F+="<tbody><tr>";for(var H=0;this.dayNames[H];H++){var I=(H+this.firstDayOfWeekIndex)%this.dayNames.length;F+="<th>"+this.dayNames[I]+"</th>"}F+="</tr>";for(var D=0;D<this.NUM_WEEKS;D++){if(D==this.NUM_WEEKS-1){F+='<tr class="week last"></tr>'}else{F+='<tr class="week"></tr>'}}F+="</tbody></table>";F+='<div class="closeBar"><span>'+this.closeString+"</span></div>";this.body.update(F);var K=this.body.getElementsByClassName("arrow");this.previousArrow=K[0];this.nextArrow=K[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 J=B.getElementsByTagName("span")[0];Event.observe(J,"click",this.hideCalendar.bindAsEventListener(this));var A=this.body.getElementsByClassName("week");for(var G=0;G<A.length;G++){for(var H=0;this.dayNames[H];H++){var E=document.createElement("td");A[G].appendChild(E);L.push(E);Event.observe(E,"click",this.selectDate.bindAsEventListener(this));Event.observe(E,"mouseover",this.highlight.bindAsEventListener(this));Event.observe(E,"mouseout",this.clearHighlight.bindAsEventListener(this))}}return L},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 J=0;this.selectors[J];J++){var I=this.ancestor.getElementsBySelector(this.selectors[J]);for(var G=0;I[G];G++){var D=I[G];var E=I[G].getElementsByTagName("input");for(var F=0;E[F];F++){var A=E[F];A.datePairParent=D;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(D)}}}for(var J=0;B[J];J++){Event.observe(B[J],"focus",this.showAndPosition.bindAsEventListener(this));Event.observe(B[J],"blur",this.setInputBlur.bindAsEventListener(this));if(B[J].form){var H=B[J].form.getInputs("submit");for(var G=0;H[G];G++){Event.observe(H[G],"click",this.clearField.bindAsEventListener(this,B[J]))}}}}},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 J=this.eventElement;log.info("previous event element="+J);this.eventElement=Event.element(B);if(J!=this.eventElement||!this.element.visibleByClass()){if(this.element.visibleByClass()){this.element.hideByClass()}var G=Position.positionedOffset(this.eventElement);var E=(G[0]+this.X_OFFSET)/Units.PX_TO_EM;var D=(G[1]+this.Y_OFFSET)/Units.PX_TO_EM;this.element.style.left=E+"em";this.element.style.top=D+"em";var K=this.validateDate();var F=true;var H=null;this.isFirstDate=true;for(i=1;i<this.dateInputArray.length;i++){if(this.dateInputArray[i]==this.eventElement){var I=null;var A=i-1;while(I==null&&A>=0){I=this.validateDate(this.dateInputArray[A].value);A--}this.userStartDate=I;this.isFirstDate=false}}if(this.isFirstDate){this.userStartDate=K;this.calDate=K;if(this.userStartDate==null){this.calDate=this.today;F=false}}else{this.userEndDate=K;this.calDate=K;if(this.userEndDate==null&&this.userStartDate!=null){this.calDate=this.userStartDate;H=this.userStartDate}else{if(this.userEndDate==null&&this.userStartDate==null){this.calDate=this.today;F=false}else{if(this.userStartDate!=null){if(this.compareDates(this.userEndDate,"<",this.userStartDate)){this.calDate=this.userStartDate;F=false}H=this.userStartDate}else{log.info("this.userStartDate is null, so not setting validStartDate")}}}}this.update(H,F);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(J){var B=null;var A=true;var E=(J==undefined?$F(this.eventElement):J);if(this.regExpPattern.test(E)){var H=E.split(this.dateSeparator);var F=H[this.pattern.dayPosition];var D=H[this.pattern.monthPosition];var G=H[this.pattern.yearPosition];if(G.length==2){G="20"+G}if(F<1||F>this.getTotalDays((D-1),G)){A=false}if(A&&(D<1||D>12)){A=false}if(A){var I=new Date(G,D-1,F,0,0,0);if(I<=this.maxDate&&I>=this.today){B=I}}}return B},update:function(K,J){log.info("calling calendar.update()");var A=false;if(K==null){K=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 G=this.element.getFirstElementByClassName("monthName");G.innerHTML=this.monthNames[this.calDate.getMonth()]+" "+this.calDate.getFullYear();var M=this.cloneDateObject(this.calDate);M.setDate(1);var D=M.getDay()-this.firstDayOfWeekIndex;var B=(D<0?D+7:D);var F=false;var O=1;var N=this.calDate.getMonth()==K.getMonth()&&this.calDate.getFullYear()==K.getFullYear();var I=this.calDate.getMonth()==this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear();var E=(this.calDate.getFullYear()<K.getFullYear())||(this.calDate.getMonth()<K.getMonth()&&this.calDate.getFullYear()==K.getFullYear());var L=(this.calDate.getFullYear()>this.maxDate.getFullYear())||(this.calDate.getMonth()>this.maxDate.getMonth()&&this.calDate.getFullYear()==this.maxDate.getFullYear());var P=this.getTotalDays(this.calDate.getMonth(),this.calDate.getFullYear());for(var H=0;this.days[H];H++){this.days[H].className="";this.days[H].setAttribute("date","");if(F==false){this.days[H].innerHTML="&nbsp;";if(H==B){F=true}}if(F){this.days[H].innerHTML=O;if((E||(O<K.getDate()&&N))||(L||(O>this.maxDate.getDate()&&I))){this.days[H].addClassName("inactive")}else{if(O==K.getDate()&&N&&A){this.days[H].addClassName("today")}if(O==this.calDate.getDate()&&J){this.days[H].addClassName("selected")}this.days[H].setAttribute("date",this.calDate.getMonth()+"_"+O+"_"+this.calDate.getFullYear())}if(O>=P){F=false}O++}}},selectDate:function(D){var B=Event.element(D);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(E,B){var D=((B%4==0&&B%100!=0)||B%400==0);var A=this.daysPerMonth[E];return(E==1&&D?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 D=Event.element(A);var B=this.cloneDateObject(this.calDate);var J=B.getMonth();var I=B.getFullYear();if(D.hasClassName("arrowPrev")){var E=J-1;if(E<0){E=11;I=I-1}var K=this.getTotalDays(E,I);if(B.getDate()>K){B.setDate(K)}B.setMonth(B.getMonth()-1);B.setYear(I);if(B.getMonth()<this.today.getMonth()&&B.getFullYear()==this.today.getFullYear()){B=this.today}}else{if(D.hasClassName("arrowNext")){var H=J+1;if(H>11){H=0;I=I+1}var K=this.getTotalDays(H,I);if(B.getDate()>K){B.setDate(K)}B.setMonth(B.getMonth()+1);B.setYear(I);if(B.getMonth()>this.maxDate.getMonth()&&B.getFullYear()==this.maxDate.getFullYear()){B=this.maxDate}}}this.calDate=B;var F=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()){F=true}}else{if(!this.isFirstDate&&this.userEndDate!=null){if(this.calDate.getMonth()==this.userEndDate.getMonth()&&this.calDate.getFullYear()==this.userEndDate.getFullYear()){F=true}}}var G=null;if(!this.isFirstDate&&this.userStartDate!=null){G=this.userStartDate}this.update(G,F)},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 D=A.getFirstElementByClassName("readOnlyValue","span");D.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 G=this.element.getElementsByTagName("a")[0];var E=document.createElement("label");var D=G.href;this.element.removeClassName("radioAsLink");var F=this.element.className;var H=(G.getAttribute("checked"))?" checked":"";E.className="radio "+F+H;var A='<input type="radio" name="'+G.getAttribute("name")+'" value="'+G.getAttribute("value")+'" ';A+='class="'+G.getAttribute("classes")+'" ';if(G.getAttribute("checked")){A+='checked="checked" '}A+="/>";E.innerHTML=A+"<span>"+G.innerHTML+"</span>";B.replaceChild(E,this.element);E.childNodes[0].setAttribute("linkURL",D)}});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(D,E){if(E<A){return}if(D.title!=""){D.title=D.title.strip()}Element.extend(D);if(D.innerHTML==""||D.hasClassName("noHighlight")){return}Event.observe(D,"mouseover",this.colHeaderMouseEvent.bind(this,E));Event.observe(D,"mouseout",this.colHeaderMouseEvent.bind(this,E));Event.observe(D,"click",this.cellClickEvent.bind(this,"TH"))}.bind(this))}.bind(this));$A(this.table.tBodies[0].rows).each(function(B){$A(B.cells).each(function(D,E){if(D.title!=""){D.title=D.title.strip()}Element.extend(D);if(D.innerHTML==""||D.hasClassName("noHighlight")){return}if(D.tagName=="TH"){Event.observe(D,"mouseover",this.rowHeaderMouseEvent.bind(this));Event.observe(D,"mouseout",this.rowHeaderMouseEvent.bind(this));Event.observe(D,"click",this.cellClickEvent.bind(this,"TH"))}else{Event.observe(D,"mouseover",this.cellMouseEvent.bind(this,E));Event.observe(D,"mouseout",this.cellMouseEvent.bind(this,E));Event.observe(D,"click",this.cellClickEvent.bind(this,"TD"))}}.bind(this))}.bind(this))},cellMouseEvent:function(A,D){var B=Event.findElementByTagName(D,"TD");var E=(D.type=="mouseover");this.highlightCell(B,E);this.highlightRowHeader(B,E);this.highlightColumnHeader(A,E)},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(D,B){var A=Event.findElementByTagName(B,D);if(A.getElementsByTagName("a")[0]){window.location=A.getElementsByTagName("a")[0].href}},highlightRowHeader:function(A,B){$A(A.parentNode.cells).each(function(D){if(D.tagName!="TH"){throw $break}this.highlightCell(D,B)}.bind(this))},highlightColumnHeader:function(A,B){$A(this.table.tHead.rows).each(function(D){this.highlightCell(D.cells[A],B)}.bind(this))},highlightRow:function(A,D,B){$A(A.parentNode.cells).each(function(E){this.highlightCell(E,D)}.bind(this))},highlightColumn:function(B,D,A){$A(this.table.rows).each(function(E){this.highlightCell(E.cells[B],D)}.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 D=Page.hideRevealRadios[this.groupName];for(var B=0;D[B];B++){if(D[B].hrRadio.input.defaultChecked){D[B].hrRadio.toggle()}D[B].checked=false}this.hrRadio.toggle()}this.checked=true}},groupEvent:function(D){var A=Event.element(D);if(this.checked){return}var E=Page.hideRevealRadios[this.groupName];for(var B=0;E[B];B++){if(E[B].checked){E[B].hrRadio.toggle(D)}E[B].checked=false}this.hrRadio.toggle(D);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(D,B){var A=D?D:this.toggle;var E=B?B:this;Event.observe(this.element,this.eventType,A.bindAsEventListener(E));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(E){if(this.parentClass){var F=this.element.getParentByClassName(this.parentClass);var D=F.getElementsBySelector(E);for(var G=0;D[G];G++){B.push(D[G])}}else{if(this.parentTag){var F=this.element.getParentByTagName(this.parentTag);var D=F.getElementsBySelector(E);for(var G=0;D[G];G++){B.push(D[G])}}else{var D=$$(E);for(var G=0;D[G];G++){B.push(D[G])}}}}.bind(this));return B},changeRadio:function(){var B=this.radioValue;var A,D;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(F){var E=F.getElementsByTagName("input")[0];if(E.value==B){E.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(D){if(this.targets.length==0&&this.selectors.length>0){this.findTargets()}if(D){var A=Element.extend(Event.element(D));if(A.hasClassName("selected")){A.removeClassName("selected")}else{A.addClassName("selected")}if(this.hrType=="link"){Event.stop(D);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 D=0;D<this.params.validIndices.length;D++){var B=parseInt(this.params.validIndices[D]);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",width:this.element.getWidth()+"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(E){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(E){var D=this.element.getDimensions();var A=D.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.element.style.left=0;this.placeHolder.hideByClass();if(this.iFrame!=null){this.iFrame.removeClassName("fixedAgentLocked");this.iFrame.addClassName("fixedAgentInPage")}this.fixedState=false}}if(this.fixedState){if(this.element.getStyle("position")=="fixed"){this.horizontalDistance=this.initialXPos-this.getHorizontalScrolledDistance();this.element.style.left=this.horizontalDistance+"px"}else{this.element.style.left=this.initialXPos}}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}}log.info("left: "+A);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 PanelCollapse=Class.create();PanelCollapse.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.panelContent=this.element.getFirstElementByClassName("panelContent","div");this.instructionLink=this.titleBar.getFirstElementByClassName("panelCollapse");this.title=this.titleBar.getElementsByTagName("H2")[0];this.titleText=this.title.getElementsByTagName("span")[0];this.expandCollapseLink=new Element("a");this.expandCollapseLink.href="#";this.title.insertBefore(this.expandCollapseLink,this.titleText);this.expandCollapseLink.innerHTML=this.params.collapseIcon+this.params.expandIcon;this.collapseIcon=this.expandCollapseLink.childElements()[0];this.expandIcon=this.expandCollapseLink.childElements()[1];if(this.opened){this.expandIcon.hide()}else{this.collapseIcon.hide();this.panelContent.hideByClass()}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 F=this.panelMessageElement.getParams();if((F!=null)&&(F.dirtyFieldsMessage!=null)){this.dirtyFieldsMessage=F.dirtyFieldsMessage}}this.fieldsToObserve=[];if(this.dirtyFieldsMessage!=""){var D=$A(this.element.getElementsByTagName("input"));var A=$A(this.element.getElementsByTagName("select"));var E=$A(this.element.getElementsByTagName("textArea"));this.fieldsToObserve=D.concat(A,E)}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.expandCollapseLink,"click",this.toggleCollapse.bindAsEventListener(this));Event.observe(this.titleText,"click",this.toggleCollapse.bindAsEventListener(this));if(this.instructionLink){Event.observe(this.instructionLink,"click",this.toggleCollapse.bindAsEventListener(this))}},setFieldsDirty:function(){this.fieldsDirty=true;log.info("fields dirtied")},toggleCollapse:function(A){this.titleBar.toggleClasses("open","closed");this.opened=!(this.opened);if(this.opened){this.expandIcon.hide();this.collapseIcon.show();this.panelContent.showByClass()}else{this.collapseIcon.hide();this.expandIcon.show();this.panelContent.hideByClass()}if(this.fieldsDirty){if(this.opened){this.panelMessageElement.innerHTML=this.panelMessage}else{this.panelMessageElement.innerHTML=this.dirtyFieldsMessage}}A.preventDefault()}});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 D=Page.agents.Collapse;while(B.parentNode!=document&&this.collapseAgent==null){B=B.parentNode;for(i=0;i<D.length;i++){if(D[i].element==B){this.collapseAgent=D[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 D={};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 E=0,A=B.length;E<A;E++){this.tabs.push(new Tab(B[E],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,D){var E=B.getElementsByTagName("A")[0];this.element=B;this.key=E.href.substring((E.href.indexOf("#")+1));this.parent=D;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(F){F.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 D=this.contentWrapper.getElementsByTagName("A");for(var E=0,A=D.length;E<A;E++){var B=D[E];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 E=this.contentBlock.getElementsByAttribute("agent");for(var F=0;E[F];F++){var A=E[F];var B=A.getAgents();for(var D=0;B[D];D++){if(B[D].lazy=="true"){Page.initAgent(A,B[D])}}}this.agentsInitialized=true}this.externalLinks.each(function(G){G.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(D){D.tabs.each(function(E){if(E.key==B){A=E;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(E){var A=setTimeout(this.action,this.interstitialResponseTimeout);Event.observe(top,"pageshow",this.hideInterstitial.bindAsEventListener(this));var D=new Ajax.Request(this.url,{parameters:E,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(){var D=$(document.createElement("DIV"));D.innerHTML=B.responseText;Page.initializeDOMFragment(D);this.bodyWrapper.insert({before:D})}).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(D){var E=D.targetClass?this.element.getFirstElementByClassName(D.targetClass):this.element;if(!E){log.warning("ScriptContent.initExtend: exiting because target node [class: "+D.targetClass+"] was not valid")}else{var B=document.createElement(D.containerType?D.containerType:"div");B.innerHTML=D.content;if(D.containerClass){B.className=D.containerClass}var A=D.insertAtTop?E.insertBefore(B,E.firstChild):E.appendChild(B);if(D.clickHandler){Event.observe(A,"click",D.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(D){if(D.type!="checkbox"){return}this.amenities.push(D);if(D.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(D){D.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(D,B){$A(D.getElementsByClassName("radio")).each(function(F){var E=F.getElementsByTagName("input")[0];if(Element.extend(F.parentNode).hasClassName("nameSelect")){Event.observe(E,"click",this.eventClearPreferences.bindAsEventListener(this,B,A));if(E.checked==true&&E.value=="true"){this.clearPreferences(B);this.setPreferences(B,A)}}}.bind(this));$A(D.getElementsByClassName("select")).each(function(F){var E=F.getElementsByTagName("select")[0];if(Element.extend(F.parentNode).hasClassName("whosTravelingNameSelectFromList")){Event.observe(E,"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,D,A){Profiler.start("eventClearPreferences");this.clearPreferences(D);this.doSetPreferences(D,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 D=A.element.getNthElementByClassName("whosTravelingName",(B+1));$A(D.getElementsByClassName("nameSelect")).each(function(F){var E=F.getElementsByTagName("input")[0];if(E.type=="radio"&&E.checked==true&&E.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");if(!this.pi){this.pi=new ProgressIndicator();this.form.insert({before:this.pi.container})}},hideIntrastitial:function(B){if(this.pi){this.pi.stop()}this.formWrapper.removeClassName("intrastitial");this.formWrapper.update(B.stripNoScripts());this.pi=null;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(D){Element.extend(D.parentNode);Event.observe(D,"click",this.onClick.bind(this));if(D.checked){this.currentType=D.value}}.bind(this))},onClick:function(){var A;this.radios.each(function(D){if(D.checked){A=D.value}});if(A!=this.currentType){this.radios.each(function(D){D.parentNode.removeClassName("checked");if(D.checked){D.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(D,A){this.guestLabels=this.element.select("label");this.guestDropdowns=this.element.select("label select");this.guestDropdowns.each(function(E,F){if(F!=0){E.removeChild(E.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 F=(B)?parseInt(B.value):1;var A=(F<=this.guestLabels.length)?F:1;var D=this.element.down(".room1Msg");var E=this.visibilityClass;var G=this.multipleRoomsOptionText;this.guestLabels.each(function(J,I){var H=J.down("span");if(A==1&&H){H.addClassName(E)}else{H.removeClassName(E)}if((A==G)||(I<A)){J.removeClassName("hidden")}else{J.addClassName("hidden")}});if((A==1||A==G)&&D){D.hide()}else{D.show()}}});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(D){if(D.type=="radio"){Event.observe(D,"click",this.onClick.bindAsEventListener(this));if(D.checked){this.currentType=D.value}}}.bind(this));this.searchForm.isInitialized=true},onClick:function(E){if(!this.element.hasClassName("quickSearchNav")){location.href=Event.element(E).getAttribute("linkURL")}else{var B=Event.element(E).value;if(B!=this.currentType){this.manager.close();var A=B.substring(0,10)=="thirdParty";var F=A?"/helper/searchFormThirdParty":"/shop/searchForm";var D=new Ajax.Request(F,{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(D,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 D=0;D<this.childAgeDropdowns.length;D++){if(D<A){this.childAgeDropdowns[D].removeClassName("noneBlock")}else{this.childAgeDropdowns[D].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 D=this.element;var E=function(G){if(G&&D.disabled){return}D.disabled=G;D[(G)?"addClassName":"removeClassName"]("disabled")};var F=A.form.select(this.params.selectors);F.each(function(G){G.observe("click",function(){var H=false;if(this.checked){E(true)}else{F.each(function(I){if(I.checked){H=true;throw $break}});E(H)}})})}});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(F){var B="";if(/\/home/.test(location.pathname)){B="&quickSearch=true"}var E="/shop/searchForm";if(/\/book/.test(location.pathname)){E="/book/bookingpath";var A=this.searchForm.form.elements._flowExecutionKey.value;B="&quickSearch=true&changeSearch=true&_eventId=changeSearchXSellCar&_flowExecutionKey="+A}var D=new Ajax.Request(E,{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(D,B){var A=D.getElementsByTagName("select")[0];this.ageNote=D.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(D,B){this.formSubmits=$A();$A(B.element.getElementsByClassName("submit")).each(function(I){this.formSubmits.push(I.getElementsByTagName("input")[0])}.bind(this));this.multiBookingAlert=D.getFirstElementByClassName("alert","p");this.multipleRoomsOptionText=this.params.multipleRoomsText;if(this.multipleRoomsOptionText!=null&&this.formSubmits.length>0){if(D.getFirstElementByClassName("readOnlyValue","span")){var H=D.getFirstElementByClassName("readOnlyValue","span");var G=H.innerHTML;var A=Element.extend(D.getElementsByTagName("input")[0]);if(A){var E=A.name;var F=A.value;A.remove()}else{E="fakeRoomsSelect";F=G}optionText=G;this.fauxSelect=Element.extend(document.createElement("select"));this.fauxSelect.name=E;this.addOptionToSelect(this.fauxSelect,F,optionText);H.parentNode.appendChild(this.fauxSelect);H.remove()}else{if(D.getElementsByTagName("select")[0]){this.fauxSelect=D.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,D,E){var A=Element.extend(document.createElement("option"));A.value=D;A.update(E);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 E=$A();var B=$A();var F="?";if(this.anchorTag.search!=""){var D=$A(this.anchorTag.search.substring(1,this.anchorTag.search.length).split("&"));D.each(function(G){B.push(G.split("=").first())});F="&"}Form.getElements(this.searchForm.form).each(function(H){if(B.indexOf(H.name)>-1){return}if(H.tagName.toLowerCase()=="input"&&H.type.toLowerCase()=="submit"){return}Calendar.prototype.clearField(this,H);var G=Form.Element.serialize(H);if(G){E.push(G)}});var A=F+E.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 D="";if(this.params.url){D=this.params.url;D="&"+D.substr(D.indexOf("?")+1)}else{D="&"+location.search.substring(1)}if(this.params.url&&this.params.url.indexOf("book")!=-1){D=D.replace("&amp%3B","&");D=D.replace("&amp;","&");var A=new Ajax.Request("/book/bookingpath",{parameters:"changeSearch=true"+D,onSuccess:this.success.bind(this),onFailure:this.failure})}else{var A=new Ajax.Request("/shop/searchForm",{parameters:"changeSearch=true"+D,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 D=this.params.formMarkup.stripNoScripts();B.innerHTML=D;$("main").appendChild(B);var E=B.getFirstElementByClassName("closeFlyOut","span");Event.observe(E,"click",this.hideForm.bindAsEventListener(this));try{Page.initializeDOMFragment(B)}catch(A){Errors.capture(A,"initializeDOMFragment() failed for miniHotelForm();")}}},showForm:function(D){var A=$("miniHotelFormContainer");this.fixIE7Positioning();var B=A.getElementsByTagName("form")[0];Position.putInViewport(this.triggerElement,A);A.showByClass();this.paramsHash.each(function(F){if(F.key!="formMarkup"){var E=B.getInputs("hidden",F.key)[0];if(E==null){E=new Element("input",{type:"hidden",name:F.key})}E.value=F.value;B.appendChild(E)}}.bind(this));Event.stop(D)},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 D=Event.element(A);var B="";if(D.tagName.toLowerCase()=="a"&&(B=D.getAgents()[0])&&B.type=="MiniHotelFormData"){Event.stop(A);this.paramsHash=$H(B.params);this.triggerElement=D;this.triggerElement.pos=this.triggerElement.getPosition();this.showForm()}}catch(E){Errors.capture(E,"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 D=this.element.parentNode;this.images=$A();this.imageIndex=0;$A(D.getElementsByTagName("A")).each(function(E){this.images.push(E)}.bind(this));D.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))}D.appendChild(this.header);D.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(),{pxPerUnit:27,initExtend:function(){$A(this.element.getElementsByClassName("score")).each(function(D){var F=D.innerHTML.replace(/,/g,".");var E=Math.floor(F*this.pxPerUnit);D.style.width=(E/Units.PX_TO_EM)+"em"}.bind(this));var A='<dt class="noneBlock 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("userReviewGraph")}});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 G=$A();var I=A.getElementsByTagName("select")[0];var H=I.options.length;for(var F=0;I.options[F];F++){var B=I.options[F].value;if(B!=""&&B!=undefined){G[B]=I.options[F].text}}this.travelerNamesTargetsSelectArray.push({target:A,options:G})}else{var D=A.getParams();var E=D.nameIndex;if(E!=null){if(this.travelerNamesTargetsArray[E]==null){this.travelerNamesTargetsArray[E]=$A()}this.travelerNamesTargetsArray[E].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(E){var D=E.getElementsByTagName("input")[0];Event.observe(D,"click",this.eventChangeTravelerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("select")).each(function(E){var D=E.getElementsByTagName("select")[0];Event.observe(D,"change",this.eventChangeTravelerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("textInput")).each(function(D){var E=D.getElementsByTagName("input")[0];Event.observe(E,"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(E){var D=E.getElementsByTagName("input")[0];Event.observe(D,"click",this.eventChangeBookerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("select")).each(function(E){var D=E.getElementsByTagName("select")[0];Event.observe(D,"change",this.eventChangeBookerName.bindAsEventListener(this,A))}.bind(this));$A(B.getElementsByClassName("textInput")).each(function(D){var E=D.getElementsByTagName("input")[0];Event.observe(E,"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(D){var B=D.target.getElementsByTagName("select")[0].options[A];if(B){B.text=D.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(D){var B=D.target.getElementsByTagName("select")[0].options[A];if(B){B.text=D.options[A]+" "+fullName}})}},getName:function(B){log.info("WhosTraveling.getName("+B+")");var F=this.travelerNamesArray[B].getFirstElementByClassName("memberSavedTravelerIndexUsed");if(F!=null&&F.getElementsByTagName("input")[0].checked==true){var D="";$A(this.travelerNamesArray[B].getElementsByClassName("whosTravelingNameSelectFromList"+B)).each(function(H){var G=H.getFirstElementByClassName("select").getElementsByTagName("select")[0];if(G.name=="models['travelersInput'].travelers["+B+"].memberSavedTravelerIndex"){if(G.options[G.selectedIndex].value!=""){D=G.options[G.selectedIndex].text}else{D=""}}}.bind(this))}else{if(this.bookerIsTraveling&&B==0){var A="";var E="";var D="";$A(this.whosBooking.getElementsByClassName("whosBookingNameNotInList")).each(function(G){$A(G.getElementsByClassName("select")).each(function(I){var H=I.getElementsByTagName("select")[0];if(H.name=="models['bookingInput'].name.prefix"&&H.selectedIndex!=0){A=H.options[H.selectedIndex].text}if(H.name=="models['bookingInput'].name.suffix"&&H.selectedIndex!=0){E=H.options[H.selectedIndex].text}}.bind(this));D=A+" ";$A(G.getElementsByClassName("textInput")).each(function(H){var I=H.getElementsByTagName("input")[0];D=D+I.value+" "}.bind(this));D=D+E}.bind(this))}else{var A="";var E="";var D="";$A(this.travelerNamesArray[B].getElementsByClassName("whosTravelingNameNotInList"+B)).each(function(G){$A(G.getElementsByClassName("select")).each(function(I){var H=I.getElementsByTagName("select")[0];if(H.name=="models['travelersInput'].travelers["+B+"].name.prefix"&&H.selectedIndex!=0){A=H.options[H.selectedIndex].text}if(H.name=="models['travelersInput'].travelers["+B+"].name.suffix"&&H.selectedIndex!=0){E=H.options[H.selectedIndex].text}}.bind(this));D=A+" ";$A(G.getElementsByClassName("textInput")).each(function(H){var I=H.getElementsByTagName("input")[0];D=D+I.value+" "}.bind(this));D=D+E}.bind(this))}}return D}});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(E){var D=E.getElementsByTagName("select")[0];Event.observe(D,"change",this.setPrefLoyaltyCar.bindAsEventListener(this))}.bind(this))}.bind(this))}}},setPreferences:function(D,B){log.info("LoyaltyProgramsTI.setPreferences("+D+")");var E=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(D+1)).getElementsByTagName("select")[0];var A=E.options[E.selectedIndex].value;if(this.element.containsElementWithClassName("loyaltyPrefAir")){this.setPrefLoyaltyAir(D,A)}if(this.element.containsElementWithClassName("loyaltyPrefCar")){this.setPrefLoyaltyCar()}},setPrefLoyaltyAir:function(B,A){log.info("LoyaltyProgramsTI.setPrefAirLoyalty("+B+")");var E=this.element.getNthElementByClassName("loyaltyPrefAir",(B+1)).getElementsByTagName("input");for(var D=0;E[D];D++){E[D].value=this.savedTravelers[A]["airLoyalty"][D].programNumber}},setPrefLoyaltyCar:function(){log.info("LoyaltyProgramsTI.setPrefCarLoyalty()");var B=this.getAgentRef("WhosTraveling");if(B){var H=B.element.getFirstElementByClassName("carDriverNotSame");if(H){var F=H.getElementsByTagName("select")[0];var D=F.options[F.selectedIndex].value;var A=this.getSelIndex(B,D)}else{var A=this.getSelIndex(B,0)}if(A&&(this.element.containsElementWithClassName("loyaltyPrefCar"))){var G=this.element.getFirstElementByClassName("loyaltyPrefCar").getElementsByTagName("input");for(var E=0;G[E];E++){G[E].value=this.savedTravelers[A]["carLoyalty"][E].programNumber}}}},getSelIndex:function(B,E){var D=$A(B.element.getNthElementByClassName("whosTravelingName",(E+1).getElementsByClassName("radio")));for(var F=0;D[F];F++){var A=D[F].getElementsByTagName("input")[0];if(Element.extend(D[F].parentNode).hasClassName("nameSelect")&&A.checked==true&&A.value=="true"){return B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(E+1)).getElementsByTagName("select")[0].selectedIndex}}}});var AirSpecialRequests=Class.create();AirSpecialRequests.prototype=Object.extend(new PreferenceModule("AirSpecialRequests"),{setPreferences:function(D,B){log.info("AirSpecialRequests.setPreferences("+D+")");Profiler.start("AirSpecialRequests");var E=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(D+1)).getElementsByTagName("select")[0];var A=E.options[E.selectedIndex].value;$A(this.element.getElementsByClassName("travelerPrefs")).each(function(F){if(F.getParams().nameIndex==D){if(F.hasClassName("flightPrefSeat")){this.setPrefFlightSeat(F,A)}if(F.hasClassName("flightPrefMeal")){this.setPrefFlightMeal(F,A)}if(F.hasClassName("flightPrefSpecialRequest")){this.setPrefFlightSpecialRequest(F,A)}}}.bind(this));Profiler.stop("AirSpecialRequests")},setPrefFlightSeat:function(D,A){var E=D.getElementsByTagName("input");for(var B=0;E[B];B++){if(E[B].value==this.savedTravelers[A].flightPreferences.seat){E[B].checked=true}}},setPrefFlightMeal:function(E,A){var B=E.getElementsByTagName("select")[0];for(var D=0;B.options[D];D++){if(B.options[D].value==this.savedTravelers[A].flightPreferences.meal){B.selectedIndex=D}}},setPrefFlightSpecialRequest:function(E,A){var B=E.getElementsByTagName("select")[0];for(var D=0;B.options[D];D++){if(B.options[D].value==this.savedTravelers[A].flightPreferences.specialRequest){B.selectedIndex=D}}}});var TravelerInfoPhone=Class.create();TravelerInfoPhone.prototype=Object.extend(new PreferenceModule("TravelerInfoPhone"),{setPreferences:function(D,B){log.info("TravelerInfoPhone.setPreferences("+D+")");Profiler.start("TravelerInfoPhone");var E=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(D+1)).getElementsByTagName("select")[0];var A=E.options[E.selectedIndex].value;if(this.element.getParams().nameIndex==D){this.setPrefPhone(this.element,D,A)}Profiler.stop("TravelerInfoPhone")},setPrefPhone:function(G,D,A){log.info("TravelerInfoPhone.setPrefPhone("+D+")");var F=G.getFirstElementByClassName("phoneNumber").getElementsByTagName("input")[0];if(A!=""){F.value=this.savedTravelers[A].phone.phoneNumber}else{F.value=""}var H=G.getFirstElementByClassName("countryCode").getElementsByTagName("select")[0];var I=0;for(var E=0;H.options[E];E++){if(A!=""&&H.options[E].value==this.savedTravelers[A].phone.countryCode){I=E}}H.selectedIndex=I;if(G.getFirstElementByClassName("phoneExtension")){var B=G.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(D,B){log.info("TravelerInfoEmail.setPreferences("+D+")");Profiler.start("TravelerInfoEmail");var E=B.element.getNthElementByClassName("whosTravelingNameSelectFromList",(D+1)).getElementsByTagName("select")[0];var A=E.options[E.selectedIndex].value;if(this.element.getParams().nameIndex==D){this.setPrefEmail(this.element,D,A)}Profiler.stop("TravelerInfoEmail")},setPrefEmail:function(D,B,A){log.info("TravelerInfoPhone.setPrefPhone("+B+")");var E=D.getElementsByTagName("input")[0];if(A!=""&&this.savedTravelers[A].email!=undefined){E.value=this.savedTravelers[A].email}else{E.value=""}}});var SubmitSelectOnChange=Class.create();SubmitSelectOnChange.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.select=this.element.getElementsByTagName("select")[0];this.submit=this.element.getFirstElementByClassName("submit").getElementsByTagName("input")[0];if(!this.select||!this.submit){log.error("Could not find required element");return}Event.observe(this.select,"change",this.onChange.bindAsEventListener(this))},onChange:function(A){if(this.select.value){this.submit.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(E){for(i=0;i<this.creditCardList.length;i++){if(this.creditCardList[i].code==Event.element(E).value){var A=Element.extend(this.content3DSBlock[1]).getElementsBySelector(".cc3DSContentItem");var D="cc3DSContentItem"+this.creditCardList[i].code;for(var B=0;B<A.length;B++){if(D.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 D=0;D<this.params.paymentOptions[A].showClasses.length;D++){$A(this.parentNode.getElementsByClassName(this.params.paymentOptions[A].showClasses[D])).each(function(E){E.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(E){E.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(D){D.showByClass()}.bind(this))}else{this.targetFields.each(function(D){D.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(E){var G="";var F=new RegExp('name="[^"]*"');G=E.replace(F,'name="'+this.params.stateProvinceBindNode+'"');var A=new RegExp('value="[^"]*"');G=G.replace(A,'value="'+this.initialValue+'"');this.stateProvince.update(G);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 D=0;B.options[D];D++){if(B.options[D].value==this.initialValue){B.selectedIndex=D}}}},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 D=B[A].getElementsByTagName("input")[0];if(D==null){D=B[A].getElementsByTagName("select")[0]}if(D){this.clearableFields.push(D)}}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 D=new LoyaltyProgram(A[B]);if(D.isVisible){this.nextAvailableLoyaltyProgram++}this.loyaltyPrograms.push(D)}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 D=document.createElement("span");D.innerHTML=B.innerHTML;var A=B.parentNode;A.replaceChild(D,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 MicrocontentAgent=Class.create();MicrocontentAgent.prototype=Object.extend(new Abstract.Agent(),{initialize:function(A,D){Object.extend(this,D);this.element=Element.extend(A);var B=$A();B.push(this.element);if(D.params.additionalTriggers){D.params.additionalTriggers.each(function(E){$$(E).each(function(F){B.push(F)})})}this.dialogObject=new Microcontent(B,D.params.content,D.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(E(B,this.element)){document.fire("contentUpdate:started");var D=this.element.form;var F=Form.serialize(D).deleteQueryStringParam("_eventId",true)+"&"+this.params.eventId+"=true";var A=new Ajax.Request(D.action,{method:"post",parameters:F,onSuccess:function(G){document.fire("content:update",G.responseText.unescapeJSON().evalJSON())},onFailure:function(){log.error("No response from application for Element Updates")}})}function E(H,G){var I=true;if(G.tagName.toLowerCase()==="label"&&H.target.tagName.toLowerCase()!=="input"){I=false}return I}}});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(E){var A=document.createDocumentFragment();var D=A.appendChild(Element.extend(document.createElement("div")));D.innerHTML=this.params.content.unescapeHTML();var B=this.element.parentNode.parentNode;B.innerHTML="";B.appendChild(A);Event.stop(E)}});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><h3>'+this.sliderLabel+'</h3><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 D=B+1;var E=this.starRating;this.starRating=D;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(G){Page.initializeAjaxResponse(G.responseText);var F=this.changedFeedback.getElementsByClassName("stars"+E)[0];F.removeClassName("stars"+E);F.addClassName("stars"+D);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 E=B+1;var D=this.reviewScoreRating;this.reviewScoreRating=E;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(F){Page.initializeAjaxResponse(F.responseText);this.changedFeedback.innerHTML=E;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 D=B.round()+this.min;this.changedFeedback.innerHTML=this.minPriceLabel+" to "+this.maxPriceLabel.replace(/\d+/,D)}.bind(this);this.options.onChange=function(B){this.element.fire("agent:sliderChange",{name:"priceSlider"});var D=B.round()+this.min;this.maxPrice=D;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(E){Page.initializeAjaxResponse(E.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.input).writeAttribute("autocomplete","off");this.suggestions=new Element("div",{className:"smartFill"});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(D){var B=this.input.value.strip();B=B.replace(/([\[|\\|\^|\$|\.|\||\?|\*|\+|\(|\)])/gm,"\\$1");B=new RegExp("("+B+")","im");var A=$(D).select("li");A.each(function(E){E.cleanWhitespace();$A(E.childNodes).each(function(G){if(G.nodeName=="#text"){var F=new Element("span").update(G.nodeValue.replace(B,'<span class="match">$1</span>'));E.replaceChild(F,G)}})});return D},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 D=this.autocompleter.results;for(var B=0;B<D.length;B++){if(A==D[B].suggestion.toLowerCase()){this.additionalInfo.value=D[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 D=new Element("div",{"class":"message"});D.innerHTML="<span>"+B+"</span>";this.mask.appendChild(D);this.mask.setOpacity(0.8);D.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(E){var G=E;var F=G.pathname?((G.pathname.indexOf("/")!=0)?"/"+G.pathname:G.pathname):"/";var D=G.textContent||G.innerText||G.innerHTML||"";var B=this.defaultTags.clone();B.set("DCS.dcsuri",F);B.set("DCS.dcsqry",G.search||"");B.update($H(E.memo));var A=[];B.each(function(H){A.push(H.key);A.push(H.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(D){this.tags[D]=this.tagPrefixes.get(D)+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(D){this.tags[D]+=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;NB:1" /><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))},handleSubmit:function(D){var B=this.element.down("input.searchBox");var E=this.element.down("input.searchValue");var A=(B)?B.value:"";A=A.replace(/^\s+/,"");A=A.replace(/\s+$/,"");if(E){E.value=A}if(A==""){if(D){Event.stop(D)}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(D,J){var G=J?J:"&#8226;";var A=D?D*0.75:0.75;this.container=new Element("div").addClassName("progressIndicator").setStyle({position:"relative"});this.spinners=$A();for(var H=0;H<12;H++){var B=1-((H*83333)/1000000);var L=new Element("span").update(G).setOpacity(B);var F=(Math.PI*H)/6;var I=Math.sin(F)*A;var E=Math.cos(F)*A;log.error("x: "+I+", y: "+E);L.setStyle({position:"absolute",top:I+"em",left:E+"em"});this.spinners.push(L);this.container.appendChild(L)}var K=function(){this.spinners.each(function(O){var N=O.getOpacity();var M=N+0.083;if(M>=0.99){M=0}O.setOpacity(M)}.bind(this))}.bind(this);this.interval=setInterval(K,83)},stop:function(){clearInterval(this.interval)}};var ProgressIndicatorAgent=Class.create(Abstract.Agent,{initExtend:function(){var B,A;if(this.params){B=this.params.radius;A=this.params.symbol}var D=new ProgressIndicator(B,A);this.element.appendChild(D.container)}});var RevealReadMore=Class.create();RevealReadMore.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.element.addClassName("revealReadLess");var A=new Element("div",{"class":"readMore"});this.collapseIcon=this.params.collapseIcon;this.expandIcon=this.params.expandIcon;A.update(this.expandIcon+"<p>"+this.params.readMoreLink+"</p>");this.element.insert({after:A});A.observe("click",function(){if(this.element.hasClassName("revealReadMore")==true){this.element.removeClassName("revealReadMore");A.update(this.expandIcon+"<p>"+this.params.readMoreLink+"</p>")}else{this.element.addClassName("revealReadMore");A.update(this.collapseIcon+"<p>"+this.params.readLessLink+"</p>")}}.bind(this))}});var AnyCheckbox=Class.create();AnyCheckbox.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){var A=new Template('<label class="control checkbox anyCheckbox">			<input name="" value="ANY" type="checkbox" />			<span>#{label}</span>		</label>');A=A.evaluate({label:this.params.label});this.checkboxes=this.element.select("input[type=checkbox]");if(!this.checkboxes||this.checkboxes.length<2){log.error("AnyCheckbox: Could not find checkboxes");return}this.checkboxes[0].up("label").insert({before:A});this.anyCheckbox=this.element.select("input[type=checkbox]")[0];if(this.shouldCheckAny()){this.checkAny()}this.element.observe("click",this.checkStatus.bindAsEventListener(this))},checkStatus:function(B){var A=B.element();if(A==this.anyCheckbox){if(A.checked){this.checkAny()}else{this.uncheckOthers()}}else{if(this.shouldCheckAny()){this.checkAny()}else{this.uncheckAny()}}},shouldCheckAny:function(){var A=this.checkboxes.length;var D=this.checkboxes[0].checked;for(var B=1;B<A;B++){if(this.checkboxes[B].checked!=D){return false}}return true},checkAny:function(){this.anyCheckbox.checked="checked";this.anyCheckbox.disabled="disabled";this.uncheckOthers()},uncheckAny:function(){this.anyCheckbox.disabled="";this.anyCheckbox.checked=""},uncheckOthers:function(){this.checkboxes.each(function(A){A.checked=""})}});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])}this.mostRecentRequest=null;this.element.observe("click",this.processEvent.bindAsEventListener(this,"click"));this.element.observe("agent:filter",this.processEvent.bindAsEventListener(this,"agent:filter"));var A=this.element.select("select");for(i=0;i<A.length;i++){Event.observe(A[i],"change",function(E){var D=(typeof this.form!="undefined")?this.form:$(Event.findElement(E,"form"));var F=unescape(D.serialize())+"&rep=partial";var B=D.action;this.fetch(B,F)}.bind(this))}},processEvent:function(F,B){var E=Event.element(F);if(B=="agent:filter"||(E.tagName.toLowerCase()=="input"&&E.getAttribute("type")=="checkbox")){var D=(typeof this.form!="undefined")?this.form:$(Event.findElement(F,"form"));var G=unescape(D.serialize());var A=D.action;this.fetch(A,G)}else{if(E.tagName.toLowerCase()=="a"){Event.stop(F);var A=Event.element(F).href.toString();this.fetch(A,G)}}},fetch:function(A,B){B=B||"";new Ajax.Request(A,{method:"get",parameters:B+"&rep=partial",onCreate:(function(D){if(!this.mostRecentRequest){this.intrastitial.show()}this.mostRecentRequest=D.transport}).bind(this),onSuccess:(function(D){if(D.transport==this.mostRecentRequest){Page.initializeAjaxResponse(D.responseText);this.intrastitial.hide();this.mostRecentRequest=null;document.fire("agent:resultsUpdated")}}).bind(this),onFailure:(function(D){if(D.transport==this.mostRecentRequest){this.intrastitial.hide();this.mostRecentRequest=null;window.location.reload()}}).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");if(!this.pi){this.pi=new ProgressIndicator();this.element.appendChild(this.pi.container)}var A={callback:this.initMap.bind(this),other_params:"client=gme-orbitz&sensor=false"};if(this.params.locale){A.language=this.params.locale}google.load("maps","2",A)},initMap:function(){this.element.removeClassName("intrastitial");if(this.pi){this.pi.stop();this.pi.container.remove();this.pi=null}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 D=new google.maps.StreetviewClient();D.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,F){var G=F.lat()-B.lat();var A=F.lng()-B.lng();var D=Math.atan2(A,G);var E=D*180/Math.PI;if(E<0){E+=360}return E},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 OpinionLabsInitializer=Class.create(Abstract.Agent,{initExtend:function(){if(!this.params.displayLink){this.removeHeaderListItem()}this.OOobj=new OnlineOpinion.ocode();this.OOobj.Preferences.Persistence={enabled:true,cookie_name:"oo_r",cookie_type:"page",expiration:3600};this.OOobj.Preferences.Render={type:"floating",main_div_id:"oo_feedback_float",up_div_id:"olUp",over_div_id:"olOver",img_path:this.params.imagePath,feedback_span_id:"fbText",feedback_html:this.params.feedbackText,click_html:this.params.clickText};this.OOobj.Preferences.Plugins.URLRewrite={active:true,regex_search_pattern:"://",regex_replace_pattern:"://"+this.params.locale+"."};OnlineOpinion.util.SafeAddOnUnLoadEvent(function(){this.OOobj.onExit()}.bindAsEventListener(this));this.OOobj.render(function(){this.OOobj.show();this.removeHeaderListItem()}.bindAsEventListener(this));if(!this.OOobj.Cookie.matchurl(this.OOobj.Metrics.core.referer,this.OOobj.Preferences.Persistence.cookie_type)){if(this.params.displayLink){this.attachHeaderLink()}else{this.removeHeaderListItem()}}else{this.removeHeaderListItem()}},attachHeaderLink:function(){var A=new Element("a",{"class":"link",href:"#"}).update(this.params.feedbackText);var D=function(E){this.OOobj.show();Event.stopObserving(A,"click",B);this.removeHeaderListItem();E.preventDefault()};var B=D.bindAsEventListener(this);Event.observe(A,"click",B);this.element.appendChild(A)},removeHeaderListItem:function(){var A=this.element.next(0);if(typeof A=="undefined"&&this.element.tagName.toLowerCase()=="li"){this.element.previous(0).addClassName("last")}this.element.parentNode.removeChild(this.element)}});var GoogleResultsMap=Class.create();GoogleResultsMap.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.mapState="collapsed";this.expandedSelector="#main div.resultsMainPanel";this.toggleMapState=function(){var B=["collapsed","expanded"];return function(){this.mapState=B.reverse()[0]}}();try{this.persistStore=new Persist.Store("GoogleResultsMap");this.persistStore.get("mapData",function(B,E){if(B&&E){var D=("("+E+")").evalJSON();if(D.searchKey==this.params.searchKey){if(D.state==="expanded"){this.persistMapDetails=function(){return/selectHotelDetails=true/.test(document.referrer)}();if(this.persistMapDetails){this.persistStore.mapData=D}this.toggleMapState()}}}this.loadMap()}.bind(this))}catch(A){this.loadMap()}},loadMap:function(){if(!window.google){log.error("GoogleResultsMap: Google JS API not found");return}google.load("maps","2",{callback:this.mapLoadCallback.bind(this),language:this.params.locale,other_params:"client=gme-orbitz&sensor=false"})},getWebTrendsTags:function(A){return{"DCSext.wtNav":"srmap","DCSext.srmap":1,"WT.dl":1,"WT.ti":A}},mapLoadCallback:function(){google.maps.Event.addDomListener(window,"unload",this.unload.bind(this));var F=this;google.maps.Map2.prototype.openMarkerToolTip=function(I){if(!this.markerToolTip){this.markerToolTip=new MarkerToolTip();this.addOverlay(this.markerToolTip)}this.markerToolTip.open(I)};google.maps.Map2.prototype.closeMarkerToolTip=function(){if(this.markerToolTip){this.markerToolTip.hide()}};google.maps.Map2.prototype.openCustomInfoWindow=function(I){if(!this.infoWindow){this.infoWindow=new MapInfoWindow(F);this.addOverlay(this.infoWindow)}this.infoWindow.open(I)};google.maps.Map2.prototype.closeCustomInfoWindow=function(){if(this.infoWindow){this.infoWindow.close()}};google.maps.Map2.prototype.destroyCustomInfoWindow=function(){if(this.infoWindow){this.infoWindow.close();this.removeOverlay(this.infoWindow);delete this.infoWindow}};var D=Element.extend(document.body);this.container={collapsed:this.element.parentNode,expanded:D.down(this.expandedSelector)};if(!this.container.expanded){log.error("Expanded container not found");return false}if(this.mapState==="expanded"){this.container[this.mapState].insertBefore(this.element,this.container[this.mapState].firstChild)}this.element.addClassName(this.mapState+"ResultsMap");this.element.appendChild(new Element("H3",{className:"mapLabel"})).appendChild(document.createTextNode(this.params.mapHeader));this.toggleElement=this.element.appendChild(new Element("A",{className:"mapLink",href:"javascript:void(0);",delegatedTracking:"true"}));this.toggleElement.appendChild(document.createTextNode(this.params.linkText[this.mapState]));var H=new google.maps.Map2(this.element.appendChild(new Element("DIV",{className:"mapContainer"})));var B=H.getDefaultUI();B.controls.largemapcontrol3d=true;B.controls.maptypecontrol=false;B.controls.menumaptypecontrol=false;B.zoom.scrollwheel=false;H.setUI(B);H.addControl(new google.maps.HierarchicalMapTypeControl(),new google.maps.ControlPosition(G_ANCHOR_TOP_RIGHT,new google.maps.Size(7,7)));google.maps.Event.addDomListener(this.toggleElement,"click",this.resizeMap.bind(this));document.observe("agent:resultsUpdated",this.initState.bind(this));this.infoWindowData=this.params.infoWindowData;this.datedSearch=this.params.datedSearch;this.map=H;this.initState();var A=$(this.element.down(".mapContainer").childNodes[2]);A.addClassName("legalText");if(this.persistMapDetails){var E=this.persistStore.mapData;H.setCenter(new google.maps.LatLng(E.position.lat,E.position.lng),E.zoom);if(this.persistStore.mapData.infoWindowHotelId){var G=this.getMapMarker(this.persistStore.mapData.infoWindowHotelId);if(G){this.markerClick(G)}}}},unload:function(){var B=this.map.getCenter();var A;if(this.map.infoWindow&&this.map.infoWindow.hotelId){A=this.map.infoWindow.hotelId}var D={searchKey:this.params.searchKey,state:this.mapState,zoom:this.map.getZoom(),position:{lat:B.lat(),lng:B.lng()},infoWindowHotelId:A};this.persistStore.set("mapData",Object.toJSON(D));google.maps.Unload()},initState:function(){if(this.map.infoWindow){this.map.destroyCustomInfoWindow()}this.setMapMarkers();this.setZoomLevel();this.setMapState[this.mapState].call(this)},resizeMap:function(){this.toggleMapState();this.element.fire("webtrends:multiTrackEvent",this.getWebTrendsTags(this.mapState+" map"));this.container[this.mapState].insertBefore(this.element,this.container[this.mapState].firstChild);this.setMapState[this.mapState].call(this);this.map.checkResize();this.map.setCenter(this.bounds.getCenter(),this.map.getBoundsZoomLevel(this.bounds));this.setZoomLevel();this.map.savePosition();this.toggleElement.replaceChild(document.createTextNode(this.params.linkText[this.mapState]),this.toggleElement.firstChild)},setMapMarkers:function(){if(this.locationMarkers){this.clearMapMarkers()}var I=this.bounds=new google.maps.LatLngBounds();var D=this.locationMarkers=[];var A=this.map;var J=$("main").select("div.hotelResultsCard");for(var E=0,H=J.length;E<H;E++){var F=J[E].getAttribute("data-hotelInfo").evalJSON();var B=new PriceMarker(F,this);I.extend(B.location);A.addOverlay(B);var G=B.markup;google.maps.Event.addDomListener(G,"click",this.markerClick.bind(this,B));google.maps.Event.addDomListener(G,"mouseover",this.markerMouseover.bind(this,B));google.maps.Event.addDomListener(G,"mouseout",this.markerMouseout.bind(this,B));D[E]=B}this.map.setCenter(this.bounds.getCenter(),this.map.getBoundsZoomLevel(this.bounds),G_NORMAL_MAP)},clearMapMarkers:function(){var E=this.locationMarkers;var F=this.map;for(var B=0,A=E.length;B<A;B++){var D=E[B];google.maps.Event.clearInstanceListeners(D.markup);F.removeOverlay(D)}this.locationMarkers=null;this.bounds=null},getMapMarker:function(D){var G=this.locationMarkers;var F;for(var B=0,A=G.length;B<A;B++){var E=G[B];if(E.data.id==D){F=E;break}}return F},markerClick:function(B,A){if(this.mapState=="collapsed"){return false}this.map.openCustomInfoWindow(B);if(A){this.element.fire("webtrends:multiTrackEvent",this.getWebTrendsTags("Hotel pin"))}this.repositionMap()},markerMouseover:function(A){if(this.mapState=="collapsed"){return false}A.markup.style.zIndex=100;this.map.openMarkerToolTip(A)},markerMouseout:function(A){if(this.mapState=="collapsed"){return false}A.markup.style.zIndex="";this.map.closeMarkerToolTip()},setMapState:{collapsed:function(){if(this.map.infoWindow){this.map.destroyCustomInfoWindow()}this.map.setMapType(G_NORMAL_MAP);if(!this.mapListener){this.mapListener=google.maps.Event.addListener(this.map,"click",this.resizeMap.bind(this))}this.element.removeClassName("expandedResultsMap").addClassName("collapsedResultsMap");this.map.hideControls();this.map.disableDragging();this.map.disableInfoWindow();this.map.disableDoubleClickZoom();this.map.disablePinchToZoom();this.map.disableContinuousZoom()},expanded:function(){if(this.mapListener){google.maps.Event.removeListener(this.mapListener);delete this.mapListener}this.element.removeClassName("collapsedResultsMap").addClassName("expandedResultsMap");this.map.showControls();this.map.enableDragging();this.map.enableInfoWindow();this.map.enableDoubleClickZoom();this.map.enablePinchToZoom();this.map.enableContinuousZoom()}},repositionMap:function(){var D=this.map.infoWindow.getPoints(true);var B=width=0;var A=this.map.getSize().width;if(D.top<30){B=30-D.top}if(D.left<75){width=75-D.left}if(D.right>A){width=-(D.right-A)}this.map.panBy(new google.maps.Size(width,B))},setZoomLevel:function(){var B=this.map.getSize().width;for(var D=0,A=this.locationMarkers.length;D<A;D++){var F=this.locationMarkers[D];var G=F.markup;var E=this.map.fromLatLngToContainerPixel(F.location);if(((E.y-G.offsetHeight)<0)||((E.x-5)<0)||(E.x+(G.offsetWidth-5)>B)){this.map.zoomOut();return}}}});var PriceMarker=function(B,A){PriceMarker=function(E,D){this.location=new google.maps.LatLng(E.lat,E.lng);this.data=E;this.mapAgent=D};PriceMarker.prototype=Object.extend(new google.maps.Overlay(),{initialize:function(G){this.map=G;var E=this.markup=new Element("DIV");var F=E.appendChild(new Element("SPAN"));var D=F.appendChild(new Element("SPAN"));E.appendChild(new Element("DIV")).className="beakBorder";E.appendChild(new Element("DIV")).className="beak";E.className="priceMarker";F.className="content";D.className="label";if(!this.data.rates.rateAvailable){D.addClassName("icon")}D.innerHTML=this.getLabel[(this.mapAgent.datedSearch)?"dated":"dateless"].call(this);E.style.position="absolute";G.getPane(G_MAP_MARKER_PANE).appendChild(E)},remove:function(){this.markup.parentNode.removeChild(this.markup)},copy:function(){return new PriceMarker(this.data)},redraw:function(D){if(!D){return}var E=this.getPoints();this.markup.style.left=E.left+"px";this.markup.style.top=E.top+"px"},getPoints:function(E){var D=this.map[(E)?"fromLatLngToContainerPixel":"fromLatLngToDivPixel"](this.location);return{top:D.y-this.markup.offsetHeight,right:(D.x+this.markup.offsetWidth)-5,bottom:D.y,left:D.x-5}},getLabel:{dated:function(){if(this.data.rates.rateAvailable){return this.data.rates.leadPrice}else{if(this.data.rates.rateUnknown){return this.mapAgent.infoWindowData.checkRatesButton}else{return this.mapAgent.infoWindowData.noRates}}},dateless:function(){if(this.data.rates.rateAvailable){return this.data.rates.averageNightlyRate}else{return this.mapAgent.infoWindowData.checkAvailabilityButton}}}});return new PriceMarker(B,A)};var MarkerToolTip=function(){MarkerToolTip=function(){};MarkerToolTip.prototype=Object.extend(new google.maps.Overlay(),{initialize:function(B){var A=this.markup=new Element("DIV");A.style.position="absolute";A.className="markerToolTip";B.getPane(G_MAP_MARKER_PANE).appendChild(A)},remove:function(){this.markup.parentNode.removeChild(this.markup)},copy:function(){return new MarkerToolTip()},redraw:function(A){if(!A){return}},getContent:function(){var A=this.marker.data;A.name=$("details_"+A.id).innerHTML},populateToolTip:function(){var B=this.marker.data;var A='<strong class="name">'+B.name+"</strong>"+((B.stars)?'<img class="stars" src="/style/global/img/star'+B.stars+'.png" alt="'+B.stars+' stars" height="13" width="70" />':"")+((B.rating)?'<span class="rating"><strong><span>'+B.rating+"</span></strong></span>":"");this.markup.update(A)},showToolTip:function(){this.setPosition();this.markup.setStyle({display:""})},open:function(A){this.marker=A;if(!A.data.name){this.getContent()}this.populateToolTip();this.showToolTip()},hide:function(){this.markup.style.display="none"},setPosition:function(){var A=this.marker.getPoints();this.markup.style.left=A.right-5+"px";this.markup.style.top=A.top-5+"px"}});return new MarkerToolTip()};var MapInfoWindow=function(A){MapInfoWindow=function(B){this.mapAgent=B};MapInfoWindow.prototype=Object.extend(new google.maps.Overlay(),Object.extend(Dialog.Base,{initialize:function(D){this.map=D;this.opened=false;this.setProperties("MapInfoWindow",{},{closeLabel:this.mapAgent.infoWindowData.closeLabel,heading:true});this.createDialogDivs();var B=this.markup.dialogWrapper;B.setStyle({display:"none"});this.markup.beak=B.appendChild(new Element("div",{"class":"microcontentBeakBottom"}));this.attachCloseListeners(this.close.bindAsEventListener(this));google.maps.Event.addDomListener(B,"mousedown",this.eventCapture);google.maps.Event.addDomListener(B,"mouseover",this.eventCapture);google.maps.Event.addDomListener(B,"mouseout",this.eventCapture);D.getPane(G_MAP_FLOAT_PANE).appendChild(B)},eventCapture:function(B){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false}else{B.stopPropagation()}},remove:function(){this.markup.dialogWrapper.parentNode.removeChild(this.markup.dialogWrapper)},copy:function(){return new MapInfoWindow()},redraw:function(B){if(!B){return}this.positionInViewport()},showDialog:function(){this.positionInViewport();this.markup.dialogWrapper.setStyle({display:""})},positionInViewport:function(){if(!this.marker){return}var B=this.markup.dialogWrapper;var D=this.getPoints();B.style.left=D.left+"px";B.style.top=D.top+"px"},getContent:function(){var E=this.marker.data;var F=E.id;var B=$("thumb_"+F);var D=$("button_"+F);if(!E.name){E.name=$("details_"+F).innerHTML}E.detailsURL=$("details_"+F).href;if(B){E.thumbNail={src:B.src,height:B.height,width:B.width}}if(D){E.button={url:D.href,label:D.innerHTML}}if(!this.mapAgent.datedSearch){E.datelessForm=D.getAgents()[0].params.content.string}E.rate=this.getRate();E.initialized=true},populateDialog:function(){var G=this.marker.data;var E=this.mapAgent.infoWindowData;var D=G.button;var B=G.thumbNail;var F=((B)?'<a href="'+G.detailsURL+'" class="thumbLink"><img src="'+B.src+'" height="'+B.height+'" width="'+B.width+'" alt="" /></a>':"")+'<div class="infoWindowContent">'+G.rate+((G.rating)?'<p class="userRating"><span class="label">'+E.overallScoreLabel+'</span> <span class="rating">'+E.userRatingsLabel.replace("{0}","<strong><span>"+G.rating+"</span></strong>")+"</span></p>":"")+'<a class="detailsLink" href="'+G.detailsURL+'">'+E.detailsLinkText+"</a></div>"+((this.mapAgent.datedSearch&&D)?'<div class="control linkAsButton"><a href="'+D.url+'" class="link" rel="nofollow" agent="{type:\'Interstitial\'}">'+D.label+"</a></div>":"")+((!this.mapAgent.datedSearch)?G.datelessForm:"");this.markup.mainInfo.update(F);Page.initializeDOMFragment(this.markup.mainInfo)},addWebTrendsEventListeners:function(){var G=$(this.markup.dialogTitle).down("h3 a");if(G){G.delegatedTracking="true";google.maps.Event.addDomListener(G,"click",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("Hotel name"))}.bindAsEventListener(this))}var F=this.markup.mainInfo.down("a.thumbLink");if(F){F.delegatedTracking="true";google.maps.Event.addDomListener(F,"click",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("Hotel photo"))}.bindAsEventListener(this))}var B=this.markup.mainInfo.down("a.detailsLink");if(B){B.delegatedTracking="true";google.maps.Event.addDomListener(B,"click",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("More hotel details"))}.bindAsEventListener(this))}var H=this.markup.mainInfo.down(".linkAsButton a");var D=this.markup.mainInfo.down("form");if(H){H.delegatedTracking="true";var E;if(this.marker.data.rate){google.maps.Event.addDomListener(H,"click",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("Select"))}.bindAsEventListener(this))}else{google.maps.Event.addDomListener(H,"click",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("Check rates"))}.bindAsEventListener(this))}}else{if(D){D.down("input[type=submit]").delegatedTracking="true";google.maps.Event.addDomListener(D,"submit",function(){this.mapAgent.element.fire("webtrends:multiTrackEvent",this.mapAgent.getWebTrendsTags("Check availability"))}.bindAsEventListener(this))}}},open:function(B){this.marker=B;if(!B.data.initialized){this.getContent()}this.setHeading();this.populateDialog();this.addWebTrendsEventListeners();this.showDialog();this.hotelId=B.data.id},close:function(B){this.markup.dialogWrapper.setStyle({display:"none"});delete this.hotelId},setHeading:function(){var D=this.mapAgent.infoWindowData;var B=this.marker.data;this.markup.dialogTitle.innerHTML='<h3><a href="'+B.detailsURL+'">'+B.name+"</a></h3>"+((B.stars)?'<img src="/style/global/img/star'+B.stars+'.png" class="stars" alt="'+B.stars+' stars" height="13" width="70" />':"")},getPoints:function(G){var F=this.marker.getPoints(G);var B=this.markup.dialogWrapper;var H=B.getDimensions();var D=(F.left+((F.right-F.left)/2))-(H.width/2);var E=F.top-H.height;return{top:E,right:D+H.width,bottom:F.top,left:D}},getRate:function(){var E="";var H,G,B,F="";var D=this.marker.data;if(this.mapAgent.datedSearch){if(D.rates.rateAvailable){if(D.rates.strikeRate&&!this.map.multiRoom){F="<strike>"+D.rates.strikeRate+"</strike>"}if(D.rates.displayAvgNightly){H='<p class="leadPrice">'+this.mapAgent.infoWindowData.priceText+' <span class="unitPrice">'+F+D.rates.leadPrice+"<span>*</span></span>";if(this.mapAgent.infoWindowData.pricingDisplayConfig.retailHotelPosEstimateHeadlinePrice&&D.rates.displayGuidance){H+=' <span class="estimatedPrice">'+this.mapAgent.infoWindowData.estimatedPricePerNightText+"</span>";if(this.mapAgent.infoWindowData.pricingDisplayConfig.displayHotelSecondaryPrice){G=D.rates.secondaryPrice+"* "+this.mapAgent.infoWindowData.supplierCurrencyPriceText}}else{H+=' <span class="perNight">'+this.mapAgent.infoWindowData.pricePer+"</span>";if(D.rates.secondaryPrice){G=this.mapAgent.infoWindowData.localCurrencyEstimate.replace("{0}",D.rates.secondaryPrice)}}H+="</p>"}else{H='<p class="leadPrice"><span class="unitPrice">'+F+D.rates.leadPrice+"<span>*</span></span>";if(this.mapAgent.infoWindowData.pricingDisplayConfig.retailHotelPosEstimateHeadlinePrice&&D.rates.displayGuidance){H+=' <span class="estimatedPrice">'+this.mapAgent.infoWindowData.estimatedTotalCostText+"</span>";if(this.mapAgent.infoWindowData.pricingDisplayConfig.displayHotelSecondaryPrice){G=D.rates.secondaryPrice+" "+this.mapAgent.infoWindowData.supplierCurrencyPriceText}}else{H+=' <span class="perRoom">'+this.mapAgent.infoWindowData.totalCostText+"</span>";if(D.rates.secondaryPrice){G=this.mapAgent.infoWindowData.localCurrencyEstimate.replace("{0}",D.rates.secondaryPrice)}}H+="</p>";B='<ul class="priceDisclaimers">';if(D.rates.merchantHotel){if(D.rates.totalHotelChargesDueAtBooking&&D.rates.totalHotelChargesDueAtCheckOut){B+="<li>"+this.mapAgent.infoWindowData.includesTaxesAndChargesDisclaimer+"</li>";B+="<li>"+this.mapAgent.infoWindowData.excludesHotelCharges.replace("{0}",D.rates.totalHotelChargesDueAtCheckOut)+"</li>"}else{if(D.rates.totalHotelChargesDueAtBooking){B+="<li>"+this.mapAgent.infoWindowData.includesTaxesAndChargesDisclaimer+"</li>"}else{if(D.rates.totalHotelChargesDueAtCheckOut){B+="<li>"+this.mapAgent.infoWindowData.includesTaxesText+"</li>";B+="<li>"+this.mapAgent.infoWindowData.excludesHotelCharges.replace("{0}",D.rates.totalHotelChargesDueAtCheckOut)+"</li>"}else{B+="<li>"+this.mapAgent.infoWindowData.totalPriceMerchantCostDisclaimer+"</li>"}}}}else{B+="<li>"+this.mapAgent.infoWindowData.totalPriceRetailCostDisclaimer.unescapeXML()+"</li>"}B+="</ul>"}E+=H;if(G){E+='<div class="secondaryPrice">'+G+"</div>"}if(B){E+=B}}else{if(D.rates.rateUnavailable){E=this.mapAgent.infoWindowData.noRates}}}else{if(D.rates.rateAvailable){E='<p class="leadPrice">'+this.mapAgent.infoWindowData.priceText+' <span class="unitPrice">'+D.rates.averageNightlyRate+'<span>*</span></span> <span class="perNight">'+this.mapAgent.infoWindowData.pricePer+"</span></p>"}}return E}}));return new MapInfoWindow(A)};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(D){var B=parseSavedHotelsResponse(D);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(D){if(D.memo.length>=3){var B=D.memo[0];var A=D.memo[1];var E=D.memo[2];this.removeLinks.add(B,A,E)}},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(D){var B=parseSavedHotelsResponse(D);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(D){var B=parseSavedHotelsResponse(D);B.element=this.element;$(document.body).fire("savedHotel:removed",B);$(document.body).fire("savedHotel:removed_"+this.hotelId,B)}.bind(this)})}});var parseSavedHotelsResponse=function(G){if(G&&G.responseText){var D=new Element("div");D.innerHTML=G.responseText;var E=D.select("div.savedHotelsData")[0].innerHTML;var H=D.select("span.savedHotelsTotal")[0];var F=D.select("div.savedHotelsStatusContent")[0];var B=D.select("div.savedHotelsContent")[0];var A={savedHotelsData:E.evalJSON(),savedHotelsTotal:H,savedHotelsStatusContent:F,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(D,F,G){if(arguments.length==3){var A;if(F=="SEARCH"){A="HP"}else{if(F=="RESULTS"){A="SR"}}if(G){var B=Event.findElement(G,"A");var E=B.innerText||B.textContent;var H=new RegExp("\\s*\\d+\\s*","g");E=E.strip();E=E.replace(H,"");B.fire("webtrends:multiTrackEvent",{"DCS.dcsuri":D,"WT.dl":"0","WT.si_n":"FH","WT.ti":"Link:"+E,"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))};var Slider=Class.create();Slider.prototype=Object.extend(new Abstract.Agent(),{initExtend:function(){this.min=this.params.min;this.max=this.params.max;this.snapInterval=this.params.snapInterval||false;this.tickSubdivisions=this.params.tickSubdivisions||1;this.tickInterval=this.params.tickInterval?this.params.tickInterval/this.tickSubdivisions:false;this.placesAfterDecimal=this.params.placesAfterDecimal||0;this.webTrendsTags=this.params.webTrendsTags||false;if(this.params.restricted===undefined){this.restricted=true}else{this.restricted=this.params.restricted}if(this.min===undefined||this.max===undefined){log.error("Required value missing");return}var B=$A(this.element.getElementsByTagName("input"));if(B.length==0){log.error("No inputs found");return}for(var F=0;F<B.length;F++){var L=parseFloat(B[F].value);B[F].value=this.correctValue(L).toFixed(this.placesAfterDecimal)}this.inputTimestamp=new Date();this.element.addClassName("slider"+B.length+"Handled");this.track=new Element("div",{"class":"sliderTrack"});this.track.setStyle({position:"relative"});this.element.insert(this.track);var A=document.createDocumentFragment();this.ticks=[];if(this.tickInterval){var H=(Math.floor(this.min/this.tickInterval)+1)*this.tickInterval;var E=(Math.ceil(this.max/this.tickInterval)-1)*this.tickInterval;var M=Math.ceil((E-H)/this.tickInterval)+3;var K=(Math.floor(this.min/this.tickSubdivisions/this.tickInterval)+1)*this.tickInterval*this.tickSubdivisions;var J=(Math.round((K-H)/this.tickInterval)+1)%this.tickSubdivisions}else{var M=2}for(var F=0;F<M;F++){var N;if(F==0){N="tick lowRange"}else{if(F==M-1){N="tick highRange"}else{if(F%this.tickSubdivisions==J){N="tick"}else{N="minorTick"}}}var G=new Element("div",{"class":N});this.ticks.push(G);A.appendChild(G)}this.trackLeft=new Element("div",{"class":"trackLeft"});A.appendChild(this.trackLeft);this.trackRight=new Element("div",{"class":"trackRight"});A.appendChild(this.trackRight);this.handles=[];for(var F=0;F<B.length;F++){var D=new Element("div",{"class":"handle handle"+F});D.style.cursor="pointer";this.handles[F]={element:D,index:F,input:B[F],lastValue:B[F].value};A.appendChild(D)}this.track.appendChild(A);var I=new Element("div",{"class":"sliderRange"});I.appendChild((new Element("span",{"class":"rangeLow"})).insert(this.min));I.appendChild((new Element("span",{"class":"rangeHigh"})).insert(this.max));this.element.appendChild(I);this.update();this.element.observe("mousedown",this.startDrag.bindAsEventListener(this));for(var F=0;F<B.length;F++){$(B[F]).observe("blur",this.checkInputAndUpdate.bindAsEventListener(this))}},startDrag:function(F){var B=F.element();for(var D=0;D<this.handles.length;D++){if(this.handles[D].element==B){var A=this.handles[D];break}}if(!A||!Event.isLeftClick(F)){return}document.body.style.cursor="pointer";var G=0;if(this.restricted&&A.index>0){var E=this.handles[A.index-1].element;G=parseInt(E.getStyle("marginLeft"))}var H=this.width;if(this.restricted&&A.index<this.handles.length-1){var E=this.handles[A.index+1].element;H=parseInt(E.getStyle("marginLeft"))}this.drag={handle:A,mousePos:Event.pointerX(F),handlePos:parseInt(B.getStyle("marginLeft")),minimum:G,maximum:H};this.eventListeners={mousemove:this.continueDrag.bindAsEventListener(this),mouseup:this.stopDrag.bindAsEventListener(this),selectstart:this.preventTextSelection.bindAsEventListener(this)};for(var D in this.eventListeners){document.observe(D,this.eventListeners[D])}F.preventDefault()},continueDrag:function(A){if(!this.drag){return}var D=Event.pointerX(A)-this.drag.mousePos+this.drag.handlePos;if(D<this.drag.minimum){D=this.drag.minimum}else{if(D>this.drag.maximum){D=this.drag.maximum}}var B=this.pixelsToValue(D);if(this.snapInterval){var B=this.snapValue(B);D=this.valueToPixels(B)}this.moveHandle(this.drag.handle,D);this.updateInput(this.drag.handle,B);A.preventDefault()},stopDrag:function(B){if(!this.drag){return}var E=parseInt(this.drag.handle.element.getStyle("marginLeft"));var D=this.pixelsToValue(E);this.updateInput(this.drag.handle,D,true);this.drag=false;document.body.style.cursor="auto";for(var A in this.eventListeners){document.stopObserving(A,this.eventListeners[A])}this.eventListeners=null;B.preventDefault()},moveHandle:function(A,B){A.element.style.marginLeft=B+"px";if(A.index==0){this.trackLeft.style.width=B+"px"}if(A.index==this.handles.length-1){this.trackRight.style.width=this.width-B+"px"}},updateInput:function(A,B){var D=arguments[2];if(new Date()-this.inputTimestamp<50&&!D){return}B=parseFloat(B).toFixed(this.placesAfterDecimal);if(A.input.value!=B){A.input.value=B;this.inputTimestamp=new Date()}if(D&&A.lastValue!=B){A.lastValue=B;if(this.webTrendsTags){this.element.fire("webtrends:multiTrackEvent",this.webTrendsTags)}this.element.fire("agent:filter")}},checkInputAndUpdate:function(E){var B=E.element();for(var D=0;D<this.handles.length;D++){if(this.handles[D].input==B){var A=this.handles[D];break}}if(!A){return}var G=this.correctValue(A.input.value);var F=this.min;if(this.restricted&&A.index>0){F=this.handles[A.index-1].input.value}var H=this.max;if(this.restricted&&A.index<this.handles.length-1){H=this.handles[A.index+1].input.value}if(G<F){G=F}else{if(G>H){G=H}}if(this.snapInterval){G=this.snapValue(G)}this.updateInput(A,G,true);this.moveHandle(A,this.valueToPixels(G))},update:function(){this.width=this.track.getWidth();for(var A=0;A<this.handles.length;A++){this.moveHandle(this.handles[A],this.valueToPixels(this.correctValue(this.handles[A].input.value)))}this.ticks[0].setStyle({marginLeft:this.valueToPixels(this.min)+"px"});var B=(Math.floor(this.min/this.tickInterval)+1)*this.tickInterval;for(var A=1;A<this.ticks.length-1;A++){this.ticks[A].setStyle({marginLeft:this.valueToPixels(B)+"px"});B+=this.tickInterval}this.ticks[this.ticks.length-1].setStyle({marginLeft:this.valueToPixels(this.max)+"px"})},pixelsToValue:function(B){var A=((this.max-this.min)*B/this.width)+this.min;return this.correctValue(A)},valueToPixels:function(A){A=this.correctValue(A);return Math.round((A-this.min)/(this.max-this.min)*this.width)},correctValue:function(A){if(isNaN(A)){A=this.min}if(A<this.min){A=this.min}else{if(A>this.max){A=this.max}}return A},snapValue:function(A){var B=Math.round(A/this.snapInterval)*this.snapInterval;if(this.max-A<A-B){B=this.max}else{if(A-this.min<B-A){B=this.min}}return B},preventTextSelection:function(A){A.preventDefault()}});(function(){if(window.google&&google.gears){return}var A=null;if(typeof GearsFactory!="undefined"){A=new GearsFactory()}else{try{A=new ActiveXObject("Gears.Factory");if(A.getBuildInfo().indexOf("ie_mobile")!=-1){A.privateSetGlobalObject(this)}}catch(B){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){A=document.createElement("object");A.style.display="none";A.width=0;A.height=0;A.type="application/x-googlegears";document.documentElement.appendChild(A)}}}if(!A){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:A}}})();Persist=(function(){var H="0.2.0",G,J,A,I,F,D;D=(function(){var S="Thu, 01-Jan-1970 00:00:01 GMT",K=1000*60*60*24,R=["expires","path","domain"],M=escape,L=unescape,Q=document,N;var O=function(){var T=new Date();T.setTime(T.getTime());return T};var B=function(W,Z){var V,U,Y,X=[],T=(arguments.length>2)?arguments[2]:{};X.push(M(W)+"="+M(Z));for(V=0;V<R.length;V++){U=R[V];if(Y=T[U]){X.push(U+"="+Y)}}if(T.secure){X.push("secure")}return X.join("; ")};var P=function(){var U="__EC_TEST__",T=new Date();T=T.toGMTString();this.set(U,T);this.enabled=(this.remove(U)==T);return this.enabled};N={set:function(a,W){var V=(arguments.length>2)?arguments[2]:{},U=O(),Z,X={};if(V.expires){var Y=V.expires*K;X.expires=new Date(U.getTime()+Y);X.expires=X.expires.toGMTString()}var b=["path","domain","secure"];for(i=0;i<b.length;i++){if(V[b[i]]){X[b[i]]=V[b[i]]}}var T=B(a,W,X);Q.cookie=T;return W},has:function(U){U=M(U);var X=Q.cookie,W=X.indexOf(U+"="),T=W+U.length+1,V=X.substring(0,U.length);return((!W&&U!=V)||W<0)?false:true},get:function(V){V=M(V);var Y=Q.cookie,X=Y.indexOf(V+"="),T=X+V.length+1,W=Y.substring(0,V.length),U;if((!X&&V!=W)||X<0){return null}U=Y.indexOf(";",T);if(U<0){U=Y.length}return L(Y.substring(T,U))},remove:function(T){var V=N.get(T),U={expires:S};Q.cookie=B(T,"",U);return V},keys:function(){var X=Q.cookie,W=X.split("; "),T,V,U=[];for(T=0;T<W.length;T++){V=W[T].split("=");U.push(L(V[0]))}return U},all:function(){var X=Q.cookie,W=X.split("; "),T,V,U=[];for(T=0;T<W.length;T++){V=W[T].split("=");U.push([L(V[0]),L(V[1])])}return U},version:"0.2.1",enabled:false};N.enabled=P.call(N);return N}());var E=(function(){if(Array.prototype.indexOf){return function(B,K){return Array.prototype.indexOf.call(B,K)}}else{return function(L,M){var K,B;for(K=0,B=L.length;K<B;K++){if(L[K]==M){return K}}return -1}}})();F=function(){};A=function(B){return"PS"+B.replace(/_/g,"__").replace(/ /g,"_s")};C={search_order:["localstorage","globalstorage","gears","whatwg_db","cookie","ie","flash"],name_re:/^[a-z][a-z0-9_ -]+$/i,methods:["init","get","set","remove","load","save"],sql:{version:"1",create:"CREATE TABLE IF NOT EXISTS persist_data (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)",get:"SELECT v FROM persist_data WHERE k = ?",set:"INSERT INTO persist_data(k, v) VALUES (?, ?)",remove:"DELETE FROM persist_data WHERE k = ?"},flash:{div_id:"_persist_flash_wrap",id:"_persist_flash",path:"persist.swf",size:{w:1,h:1},args:{autostart:true}}};J={gears:{size:-1,test:function(){return(window.google&&window.google.gears)?true:false},methods:{transaction:function(K){var B=this.db;B.execute("BEGIN").close();K.call(this,B);B.execute("COMMIT").close()},init:function(){var B;B=this.db=google.gears.factory.create("beta.database");B.open(A(this.name));B.execute(C.sql.create).close()},get:function(B,L,K){var M,N=C.sql.get;if(!L){return}this.transaction(function(P){var O,Q;M=P.execute(N,[B]);O=M.isValidRow();Q=O?M.field(0):null;M.close();L.call(K||this,O,Q)})},set:function(B,P,M,L){var K=C.sql.remove,O=C.sql.set,N;this.transaction(function(Q){Q.execute(K,[B]).close();Q.execute(O,[B,P]).close();if(M){M.call(L||this,true,P)}})},remove:function(K,M,L){var B=C.sql.get;sql=C.sql.remove,r,val=null,is_valid=false;this.transaction(function(N){if(M){r=N.execute(B,[K]);is_valid=r.isValidRow();val=is_valid?r.field(0):null;r.close()}if(!M||is_valid){N.execute(sql,[K]).close()}if(M){M.call(L||this,is_valid,val)}})}}},whatwg_db:{size:200*1024,test:function(){var B="PersistJS Test",K="Persistent database test.";if(!window.openDatabase){return false}if(!window.openDatabase(B,C.sql.version,K,J.whatwg_db.size)){return false}return true},methods:{transaction:function(B){if(!this.db_created){this.db.transaction(function(K){K.executeSql(C.sql.create,[],function(){this.db_created=true})},F)}this.db.transaction(B)},init:function(){this.db=openDatabase(this.name,C.sql.version,this.o.about||("Persistent storage for "+this.name),this.o.size||J.whatwg_db.size)},get:function(B,L,K){var M=C.sql.get;if(!L){return}K=K||this;this.transaction(function(N){N.executeSql(M,[B],function(O,P){if(P.rows.length>0){L.call(K,true,P.rows.item(0)["v"])}else{L.call(K,false,null)}})})},set:function(B,O,M,L){var K=C.sql.remove,N=C.sql.set;this.transaction(function(P){P.executeSql(K,[B],function(){P.executeSql(N,[B,O],function(Q,R){if(M){M.call(L||this,true,O)}})})});return O},remove:function(K,M,L){var B=C.sql.get;sql=C.sql.remove;this.transaction(function(N){if(M){N.executeSql(B,[K],function(O,P){if(P.rows.length>0){var Q=P.rows.item(0)["v"];O.executeSql(sql,[K],function(R,S){M.call(L||this,true,Q)})}else{M.call(L||this,false,null)}})}else{N.executeSql(sql,[K])}})}}},globalstorage:{size:5*1024*1024,test:function(){return window.globalStorage?true:false},methods:{key:function(B){return A(this.name)+A(B)},init:function(){this.store=globalStorage[this.o.domain]},get:function(B,L,K){B=this.key(B);if(L){L.call(K||this,true,this.store.getItem(B))}},set:function(B,M,L,K){B=this.key(B);this.store.setItem(B,M);if(L){L.call(K||this,true,M)}},remove:function(B,L,K){var M;B=this.key(B);M=this.store[B];this.store.removeItem(B);if(L){L.call(K||this,(M!==null),M)}}}},localstorage:{size:-1,test:function(){return window.localStorage?true:false},methods:{key:function(B){return A(this.name)+A(B)},init:function(){this.store=localStorage},get:function(B,L,K){B=this.key(B);if(L){L.call(K||this,true,this.store.getItem(B))}},set:function(B,M,L,K){B=this.key(B);this.store.setItem(B,M);if(L){L.call(K||this,true,M)}},remove:function(B,L,K){var M;B=this.key(B);M=this.getItem(B);this.store.removeItem(B);if(L){L.call(K||this,(M!==null),M)}}}},ie:{prefix:"_persist_data-",size:64*1024,test:function(){return window.ActiveXObject?true:false},make_userdata:function(K){var B=document.createElement("div");B.id=K;B.style.display="none";B.addBehavior("#default#userdata");document.body.appendChild(B);return B},methods:{init:function(){var B=J.ie.prefix+A(this.name);this.el=J.ie.make_userdata(B);if(this.o.defer){this.load()}},get:function(B,L,K){var M;B=A(B);if(!this.o.defer){this.load()}M=this.el.getAttribute(B);if(L){L.call(K||this,M?true:false,M)}},set:function(B,M,L,K){B=A(B);this.el.setAttribute(B,M);if(!this.o.defer){this.save()}if(L){L.call(K||this,true,M)}},remove:function(B,L,K){var M;B=A(B);if(!this.o.defer){this.load()}M=this.el.getAttribute(B);this.el.removeAttribute(B);if(!this.o.defer){this.save()}if(L){L.call(K||this,M?true:false,M)}},load:function(){this.el.load(A(this.name))},save:function(){this.el.save(A(this.name))}}},cookie:{delim:":",size:4000,test:function(){return G.Cookie.enabled?true:false},methods:{key:function(B){return this.name+J.cookie.delim+B},get:function(B,L,K){var M;B=this.key(B);M=D.get(B);if(L){L.call(K||this,M!=null,M)}},set:function(B,M,L,K){B=this.key(B);D.set(B,M,this.o);if(L){L.call(K||this,true,M)}},remove:function(B,M,L,K){var M;B=this.key(B);M=D.remove(B);if(L){L.call(K||this,M!=null,M)}}}},flash:{test:function(){if(!deconcept||!deconcept.SWFObjectUtil){return false}var B=deconcept.SWFObjectUtil.getPlayerVersion().major;return(B>=8)?true:false},methods:{init:function(){if(!J.flash.el){var M,K,L,B=C.flash;L=document.createElement("div");L.id=B.div_id;document.body.appendChild(L);M=new deconcept.SWFObject(this.o.swf_path||B.path,B.id,B.size.w,B.size.h,"8");for(K in B.args){M.addVariable(K,B.args[K])}M.write(L);J.flash.el=document.getElementById(B.id)}this.el=J.flash.el},get:function(B,L,K){var M;B=A(B);M=this.el.get(this.name,B);if(L){L.call(K||this,M!==null,M)}},set:function(K,N,M,L){var B;K=A(K);B=this.el.set(this.name,K,N);if(M){M.call(L||this,true,N)}},remove:function(B,L,K){var M;B=A(B);M=this.el.remove(this.name,B);if(L){L.call(K||this,true,M)}}}}};var I=function(){var N,K,B,M,L=C.methods,O=C.search_order;for(N=0,K=L.length;N<K;N++){G.Store.prototype[L[N]]=F}G.type=null;G.size=-1;for(N=0,K=O.length;!G.type&&N<K;N++){B=J[O[N]];if(B.test()){G.type=O[N];G.size=B.size;for(M in B.methods){G.Store.prototype[M]=B.methods[M]}}}G._init=true};G={VERSION:H,type:null,size:0,add:function(B){J[B.id]=B;C.search_order=[B.id].concat(C.search_order);I()},remove:function(K){var B=E(C.search_order,K);if(B<0){return}C.search_order.splice(B,1);delete J[K];I()},Cookie:D,Store:function(B,K){if(!C.name_re.exec(B)){throw new Error("Invalid name")}if(!G.type){throw new Error("No suitable storage found")}K=K||{};this.name=B;K.domain=K.domain||location.host||"localhost";K.domain=K.domain.replace(/:\d+$/,"");K.domain=(K.domain=="localhost")?"":K.domain;this.o=K;K.expires=K.expires||365*2;K.path=K.path||"/";this.init()}};I();return G})();var OnlineOpinion=new Object();OnlineOpinion.util={SafeAddOnLoadEvent:function(B){if(!document.getElementById|!document.getElementsByTagName){return}var A=window.onload;if(typeof window.onload!="function"){window.onload=B}else{window.onload=function(){A();B()}}},SafeAddOnUnLoadEvent:function(A){if(!document.getElementById|!document.getElementsByTagName){return}var B=window.onunload;if(typeof window.onunload!="function"){window.onunload=A}else{window.onunload=function(){A();B()}}},popup:function(F,A,B){var E=window.open(F,A,B);if(typeof E=="undefined"){if(document.all){document.getElementById("test").href=F;document.getElementById("test").click()}else{var D=window.open(F,"_blank");D.focus()}}return false},walkAnchors:function(H,F,I,B){var G=1000;var E=0;while(H&&F>0){E++;if(E>=G){var A=function(){OnlineOpinion.util.walkAnchors(H,F,I,B)};setTimeout(A,50);return}if(H.tagName=="A"){if(I.test(H.href)){H.onmousedown=function(){B.Preferences.Plugins.Events.poX=0}}}if(H.tagName=="INPUT"){if(H.type=="submit"||H.type=="image"){H.onmousedown=function(){B.Preferences.Plugins.Events.poX=0}}}if(H.tagName=="FORM"){if(typeof H.onsubmit!="function"){H.onsubmit=function(){B.Preferences.Plugins.Events.poX=0}}else{var J=H.onsubmit;H.onsubmit=function(){B.Preferences.Plugins.Events.poX=0;J()}}}if(H.nodeType==1){var D=/^(script|style|textarea)/i;if(!D.test(H.tagName)&&H.childNodes.length>0){H=H.childNodes[0];F++;continue}}if(H.nextSibling){H=H.nextSibling}else{while(F>0){H=H.parentNode;F--;if(H==null){break}if(H.nextSibling){H=H.nextSibling;break}}}}}};OnlineOpinion.cookie=function(){this.cookie_name="oo_r";this.expiration=24*60*60*1000;this.rhex=function(num){var hex_chr="0123456789abcdef",_s="";for(var j=0;j<=3;j++){_s+=hex_chr.charAt((num>>(j*8+4))&15)+hex_chr.charAt((num>>(j*8))&15)}return _s};this.str2blks_MD5=function(_s){var nblk=((_s.length+8)>>6)+1,blks=new Array(nblk*16);var i=0;for(;i<nblk*16;i++){blks[i]=0}for(i=0;i<_s.length;i++){blks[i>>2]|=_s.charCodeAt(i)<<((i%4)*8)}blks[i>>2]|=128<<((i%4)*8);blks[nblk*16-2]=_s.length*8;return blks};this._fSa=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&65535)};this.rol=function(num,cnt){return(num<<cnt)|(num>>>(32-cnt))};this.cmn=function(q,a,b,x,s,t){return this._fSa(this.rol(this._fSa(this._fSa(a,q),this._fSa(x,t)),s),b)};this._fF=function(a,b,c,d,x,s){return this.cmn((b&c)|((~b)&d),a,0,x,s,0)};this._fG=function(a,b,c,d,x,s){return this.cmn((b&c)|(b&d)|(c&d),a,0,x,s,1518500249)};this._fH=function(a,b,c,d,x,s){return this.cmn(b^c^d,a,0,x,s,1859775393)};this._MD4=function(_s){var x=this.str2blks_MD5(_s),a=1732584193,b=-271733879,c=-1732584194,d=271733878;for(var i=0;i<x.length;i+=16){var olda=a,oldb=b,oldc=c,oldd=d;a=this._fF(a,b,c,d,x[i+0],3);d=this._fF(d,a,b,c,x[i+1],7);c=this._fF(c,d,a,b,x[i+2],11);b=this._fF(b,c,d,a,x[i+3],19);a=this._fF(a,b,c,d,x[i+4],3);d=this._fF(d,a,b,c,x[i+5],7);c=this._fF(c,d,a,b,x[i+6],11);b=this._fF(b,c,d,a,x[i+7],19);a=this._fF(a,b,c,d,x[i+8],3);d=this._fF(d,a,b,c,x[i+9],7);c=this._fF(c,d,a,b,x[i+10],11);b=this._fF(b,c,d,a,x[i+11],19);a=this._fF(a,b,c,d,x[i+12],3);d=this._fF(d,a,b,c,x[i+13],7);c=this._fF(c,d,a,b,x[i+14],11);b=this._fF(b,c,d,a,x[i+15],19);a=this._fG(a,b,c,d,x[i+0],3);d=this._fG(d,a,b,c,x[i+4],5);c=this._fG(c,d,a,b,x[i+8],9);b=this._fG(b,c,d,a,x[i+12],13);a=this._fG(a,b,c,d,x[i+1],3);d=this._fG(d,a,b,c,x[i+5],5);c=this._fG(c,d,a,b,x[i+9],9);b=this._fG(b,c,d,a,x[i+13],13);a=this._fG(a,b,c,d,x[i+2],3);d=this._fG(d,a,b,c,x[i+6],5);c=this._fG(c,d,a,b,x[i+10],9);b=this._fG(b,c,d,a,x[i+14],13);a=this._fG(a,b,c,d,x[i+3],3);d=this._fG(d,a,b,c,x[i+7],5);c=this._fG(c,d,a,b,x[i+11],9);b=this._fG(b,c,d,a,x[i+15],13);a=this._fH(a,b,c,d,x[i+0],3);d=this._fH(d,a,b,c,x[i+8],9);c=this._fH(c,d,a,b,x[i+4],11);b=this._fH(b,c,d,a,x[i+12],15);a=this._fH(a,b,c,d,x[i+2],3);d=this._fH(d,a,b,c,x[i+10],9);c=this._fH(c,d,a,b,x[i+6],11);b=this._fH(b,c,d,a,x[i+14],15);a=this._fH(a,b,c,d,x[i+1],3);d=this._fH(d,a,b,c,x[i+9],9);c=this._fH(c,d,a,b,x[i+5],11);b=this._fH(b,c,d,a,x[i+13],15);a=this._fH(a,b,c,d,x[i+3],3);d=this._fH(d,a,b,c,x[i+11],9);c=this._fH(c,d,a,b,x[i+7],11);b=this._fH(b,c,d,a,x[i+15],15);a=this._fSa(a,olda);b=this._fSa(b,oldb);c=this._fSa(c,oldc);d=this._fSa(d,oldd)}return this.rhex(a)+this.rhex(b)+this.rhex(c)+this.rhex(d)};this.read=function(n){var neq=n+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(neq)==0){return unescape(c.substring(neq.length,c.length))}}return null};this.write=function(n,v){document.cookie=n+"="+v+";path=/;expires="+(new Date((new Date()).getTime()+this.expiration)).toGMTString()};this.matchurl=function(u,type){var i=0,c=this.read(this.cookie_name);if(type=="domain"){u=/(:\/\/)[\w\d\:\.]+/g.exec(u)[0].replace("://","")}n=this._MD4(u);if(c==null){return false}while(i<c.length){j=i+n.length;if(c.substring(i,j)==n){return(unescape(c.substring(j+1,j+2))==1)}i++}return false};this.tagurl=function(u,type){if(type=="domain"){u=/(:\/\/)[\w\d\:\.]+/g.exec(u)[0].replace("://","")}var prev_val="";if(this.read(this.cookie_name)!=null){prev_val=this.read(this.cookie_name).replace(eval("/"+escape(this._MD4(u))+"~1:/g"),"")}this.write(this.cookie_name,prev_val+(prev_val!=""?":":"")+escape(this._MD4(u))+"~1")}};OnlineOpinion.ocode=function(name){this.name=name;function rematch(val,restr){var re=new RegExp(restr);var m=re.exec(val);if(m==null||m==""){return""}else{var s="";for(i=0;i<m.length;i++){s=s+m[i]}return s}}this._fC=function(_u){_aT=this._sp+",\\/,\\.,-,_,"+this._rp+",%2F,%2E,%2D,%5F";_aA=_aT.split(",");for(i=0;i<5;i++){eval("_u=_u.replace(/"+_aA[i]+"/g,_aA[i+5])")}return _u};this._browser=function(){this.engine=null;this.version=null;var useragent=navigator.userAgent.toLowerCase();if(window.ActiveXObject){this.engine="ie";this.version=rematch(useragent,"msie\\s[0-9].[0-9]+").replace("msie ","")}else{if(window.opera){this.engine="opera";this.version=rematch(useragent,"opera.[0-9].[0-9]+").replace("opera","").replace("/","")}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){if(rematch(useragent,"applewebkit/[0-9]+")!=null){this.engine="webkit";this.version=rematch(useragent,"applewebkit/[0-9]+").replace("applewebkit/","")}else{this.engine="khtml";this.version=rematch(useragent,"khtml/[0-9].[0-9].[0-9]+").replace("khtml/","")}}else{if(document.getBoxObjectFor!=null){this.engine="gecko";this.version=rematch(useragent,"gecko/[0-9]+").replace("gecko/","")}}}}};this.serialize=function(obj,option){var str_out="",inc=0;for(var i in obj){if(typeof obj[i]!="function"&&typeof obj[i]!="undefined"&&obj[i]!=null&&obj[i]!=""){if(option==0){str_out+=(inc==0?"":"&")+i+"="+escape(obj[i])}else{if(option==1){str_out+=(inc==0?"":"|")+escape(obj[i])}}inc++}}return str_out};this.Preferences=new Object();this.Preferences.Persistence={enabled:true,cookie_type:"page",cookie_name:"oo_r",expiration:24*60*60*1000};this.Preferences.Render={type:"floating",main_div_id:"oo_feedback_float",up_div_id:"olUp",over_div_id:"olOver",img_path:"onlineopinion/oo_black.gif",feedback_span_id:"fbText",feedback_html:"FEEDBACK",click_html:"Click here to<br>rate this page",ty_html:"",float_style:"fixed"};this.Metrics=new Object();this.Metrics.core={width:screen.width,height:screen.height,referer:window.location.href,prev:document.referrer,time1:(new Date()).getTime(),time2:null};this.Metrics.custom=new Object();this.Preferences.Plugins=new Object();this.Preferences.Plugins.Events={poE:0,poX:0,poC:{id:"",value:0},poWC:0};this.onEntry=function(){if(Math.random()>=1-this.Preferences.Plugins.Events.poE){this.show();this.Preferences.Plugins.Events.poX=0}};this.onExit=function(){if(Math.random()>=1-this.Preferences.Plugins.Events.poX){this.show()}};this.OnClick=function(){if(Math.random()>=1-this.Preferences.Plugins.Events.poC){this.show();this.Preferences.Plugins.Events.poX=0;this.Preferences.Plugins.Events.poC=0}};this.Preferences.Plugins.URLRewrite={active:false,regex_search_pattern:"",regex_replace_pattern:""};this.Preferences.Plugins.CardOnPage={enabled:false,div_id:"onlineopinion_cc_window",iframe_id:"onlineopinion_cc_frame"};this.init=function(){this.resetReferer();if(typeof OnlineOpinion.cookie!="undefined"&&this.Preferences.Persistence.cookie_type!=null){this.Cookie=new OnlineOpinion.cookie();if(typeof this.Preferences.Persistence.cookie_name!="undefined"){this.Cookie.cookie_name=this.Preferences.Persistence.cookie_name}this.Cookie.expiration=1000*this.Preferences.Persistence.expiration;if(this.Cookie.matchurl(this.Metrics.core.referer,this.Preferences.Persistence.cookie_type)==1){this.Preferences.Plugins.Events.poX=0;this.Preferences.Plugins.Events.poE=0;return false}}else{this.Cookie=null}return true};this.render=function(onclick_func){this.init();var b=new this._browser();var d=document;var de=d.documentElement;var db=d.body;var w=window;var divID=this.Preferences.Render.main_div_id;var bVersion=parseFloat(b.version);var compliant=d.compatMode=="CSS1Compat";var sObj=compliant?de:db;if(b.engine=="webkit"){sObj=db}if(b.engine==null||b.version==null||isNaN(parseInt(b.version,10))||(b.engine=="ie"&&parseFloat(b.version)<6)||(b.engine=="opera"&&parseInt(b.version,10)<8)||(b.engine=="gecko"&&parseInt(b.version,10)<20041107)){return false}var mainDivObj=d.getElementById(divID);if(mainDivObj==null){if(this.Preferences.Render.type=="floating"){mainDivObj=db.appendChild(d.createElement("div"));mainDivObj.id=divID}}if(mainDivObj.innerHTML==""){if(this.Preferences.Render.type=="floating"){if(this.Preferences.Persistence.enabled&&this.Preferences.Persistence.cookie_type!=null){if(this.Cookie.matchurl(this.Metrics.core.referer,this.Preferences.Persistence.cookie_type)==1){return false}}var olUpObj=mainDivObj.appendChild(d.createElement("div"));olUpObj.id=this.Preferences.Render.up_div_id;var olOverObj=mainDivObj.appendChild(d.createElement("div"));olOverObj.id=this.Preferences.Render.over_div_id;olOverObj.style.display="none";olUpObj.onmouseover=function(){d.getElementById(olOverObj.id).style.display="block";document.getElementById(olUpObj.id).style.display="none"};olOverObj.onmouseout=function(){d.getElementById(olOverObj.id).style.display="none";document.getElementById(olUpObj.id).style.display="block"};var ooImg=olUpObj.appendChild(d.createElement("img"));ooImg.src=this.Preferences.Render.img_path;var fbText=olUpObj.appendChild(d.createElement("span"));fbText.id=this.Preferences.Render.feedback_span_id;fbText.innerHTML=this.Preferences.Render.feedback_html;var feedback_text=null;if(this.Preferences.Render.div_alt_text){feedback_text=this.Preferences.Render.div_alt_text}else{if(document.all){feedback_text=fbText.innerText}else{feedback_text=fbText.textContent}}mainDivObj.alt=feedback_text;mainDivObj.title=feedback_text;olOverObj.innerHTML=this.Preferences.Render.click_html}if(this.Preferences.Render.type=="static"){mainDivObj.innerHTML=this.Preferences.Render.main_html}}if(this.Preferences.Render.type=="floating"){if(!this.Preferences.Render.float_style){this.Preferences.Render.float_style="fixed"}var mdoStyle=mainDivObj.style;var _this=this;if(this.Preferences.Render.float_style=="rightOfContent"){function getRightOfContent(){return contentDiv.offsetWidth+contentDiv.offsetLeft+1}var contentDiv=d.getElementById(_this.Preferences.Render.main_content_id||"content");if(contentDiv==null){contentDiv=db.firstChild;while(contentDiv&&contentDiv.nodeType!=Node.ELEMENT_NODE){contentDiv=contentDiv.nextSibling}}function fixBackground(){if(_this.Preferences.Render.fix_background){db.style.backgroundAttachment="scroll";var margin=null;if(document.defaultView&&document.defaultView.getComputedStyle){margin=parseInt(document.defaultView.getComputedStyle(contentDiv,null).getPropertyValue("margin-left"),10)}else{margin=parseInt(contentDiv.currentStyle.marginLeft,10)}if(isNaN(margin)||margin==0){margin=contentDiv.offsetLeft||0}db.style.backgroundPosition=(Math.floor(contentDiv.scrollWidth*-0.5)-2+margin)+"px 0"}}}var ieSix=function(e){if(_this.Preferences.Render.float_style=="fixed"){mdoStyle.left=sObj.scrollLeft+sObj.clientWidth-mainDivObj.clientWidth}else{if(_this.Preferences.Render.float_style=="rightOfContent"){mdoStyle.left=getRightOfContent()+"px"}}mdoStyle.top=sObj.scrollTop+sObj.clientHeight-mainDivObj.clientHeight;if(e==null||e.type=="load"){mdoStyle.visibility="visible"}if(e==null||e.type=="load"||e.type=="resize"){fixBackground()}};if(b.engine=="ie"&&(bVersion<7||!compliant)){mdoStyle.position="absolute";function mapEvents(target,events){for(var idx=0;idx<events.length;idx++){var curevent=events[idx];target.attachEvent("on"+curevent,ieSix)}}mapEvents(mainDivObj,["mouseover","mouseout"]);mapEvents(w,["resize","scroll","mousewheel","load"]);ieSix()}else{mdoStyle.position="fixed";if(this.Preferences.Render.float_style=="fixed"){mdoStyle.right="0px";mdoStyle.bottom="0px"}else{if(this.Preferences.Render.float_style=="rightOfContent"){var rightOfContent=getRightOfContent()-sObj.scrollLeft+"px";mdoStyle.bottom="0px";mdoStyle.left=rightOfContent;var gutter=d.createElement("div");db.replaceChild(gutter,mainDivObj);gutter.appendChild(mainDivObj);gutter.style.position="absolute";gutter.style.width=mainDivObj.offsetWidth+"px";gutter.style.left=rightOfContent;gutter.style.top="0px";gutter.style.height=sObj.scrollHeight+"px";fixBackground();var resizeMove=function(e){var right=getRightOfContent();mdoStyle.left=right-sObj.scrollLeft+"px";if(e.type=="resize"){gutter.style.left=right+"px";fixBackground()}};if(b.engine=="ie"){w.attachEvent("onresize",resizeMove);w.attachEvent("onscroll",resizeMove)}else{w.addEventListener("resize",resizeMove,false);w.addEventListener("scroll",resizeMove,false)}}}mainDivObj.style.visibility="visible"}}mainDivObj.onclick=onclick_func;try{if(this.Preferences.Plugins.CardOnPage.enabled==true){var onPageCCdiv=db.appendChild(d.createElement("div"));onPageCCdiv.id=this.Preferences.Plugins.CardOnPage.div_id;var onPageCCiframe=onPageCCdiv.appendChild(d.createElement("iframe"));onPageCCiframe.id=this.Preferences.Plugins.CardOnPage.iframe_id;var W=(b.engine=="webkit")?w.innerWidth:(b.engine=="opera"?db.clientWidth:de.clientWidth);var H=(b.engine=="webkit")?w.innerHeight:(b.engine=="opera"?db.clientHeight:de.clientHeight);var wx=585,hy=400;onPageCCdiv.style.left=parseInt((W-wx)/2,10)+"px";onPageCCdiv.style.top=parseInt((H-hy)/2,10)+"px";if(b.engine=="ie"&&bVersion<7){onPageCCdiv.style.position="absolute"}}}catch(e){}return true};this.launchCC=function(){try{if(this.Cookie.matchurl(this.Metrics.core.referer,this.Preferences.Persistence.cookie_type)!=1){if(this.Preferences.Plugins.CardOnPage.enabled==true){document.getElementById(this.Preferences.Plugins.CardOnPage.iframe_id).src="https://secure.opinionlab.com/ccc01/comment_card.asp?"+(this.Preferences.Render.type=="asm"?"asm=1&":"")+"static=1&"+this.serialize(this.Metrics.core,0)+"&custom_var="+this.serialize(this.Metrics.custom,1);document.getElementById(this.Preferences.Plugins.CardOnPage.div_id).style.display="block"}else{OnlineOpinion.util.popup("https://secure.opinionlab.com/ccc01/comment_card.asp?"+(this.Preferences.Render.type=="asm"?"asm=1&":"")+this.serialize(this.Metrics.core,0)+"&custom_var="+this.serialize(this.Metrics.custom,1),"OnlineOpinion","resizable=yes,copyhistory=yes,scrollbars="+(this.Preferences.Render.type=="asm"?"yes":"no")+",location=no,status=no,fullscreen=no,width=545,height=200,top="+parseInt((this.Metrics.core.height-200)/2,10)+",left="+parseInt((this.Metrics.core.width-545)/2,10))}}}catch(e){OnlineOpinion.util.popup("https://secure.opinionlab.com/ccc01/comment_card.asp?"+(this.Preferences.Render.type=="asm"?"asm=1&":"")+this.serialize(this.Metrics.core,0)+"&custom_var="+this.serialize(this.Metrics.custom,1),"OnlineOpinion","resizable=yes,copyhistory=yes,scrollbars="+(this.Preferences.Render.type=="asm"?"yes":"no")+",location=no,status=no,fullscreen=no,width=545,height=200,top="+parseInt((this.Metrics.core.height-200)/2,10)+",left="+parseInt((this.Metrics.core.width-545)/2,10))}};this.show=function(){this.Metrics.core.time2=(new Date()).getTime();this.launchCC();if(this.Preferences.Persistence.enabled){document.getElementById(this.Preferences.Render.main_div_id).style.display="none"}if(this.Cookie!=null&&this.Preferences.Persistence.cookie_type!=null){this.Cookie.tagurl(this.Metrics.core.referer,this.Preferences.Persistence.cookie_type)}this.resetReferer()};this.resetReferer=function(alt_referer){var location=window.location.href;if(alt_referer){location=alt_referer}var rewriter=this.Preferences.Plugins.URLRewrite;if(rewriter&&rewriter.active==true){this.Metrics.core.referer=location.replace(rewriter.regex_search_pattern,rewriter.regex_replace_pattern)}else{this.Metrics.core.referer=location}};this.post=function(){this.Metrics.core.time2=(new Date()).getTime();var mainDivObj=document.getElementById(this.Preferences.Render.main_div_id);var JSONP=mainDivObj.appendChild(document.createElement("script"));var odata=this.serialize(this.Metrics.core,0)+"&custom_var="+this.serialize(this.Metrics.custom,1);var elements=document.forms[this.Preferences.Render.main_div_id+"_form"].elements;var formdata=[];for(idx=0;idx<elements.length;idx++){var curElement=elements[idx];try{var name=curElement.name;if(name!=undefined&&curElement.value!=undefined){switch(curElement.type){case"radio":if(curElement.checked){formdata.push(curElement.name+"="+encodeURIComponent(curElement.value))}break;case"checkbox":if(curElement.checked){formdata.push(curElement.name+"="+encodeURIComponent(curElement.value))}break;default:formdata.push(curElement.name+"="+encodeURIComponent(curElement.value))}}}catch(e){}}var cdata=formdata.join("&");var osignature=this.Cookie!=null?this.Cookie._MD4(odata):"";JSONP.src="https://secure.opinionlab.com/rate36s.asp?"+odata+"&"+cdata+"&signature="+osignature;if(this.Preferences.Persistence.enabled){var mainFormDiv=document.getElementById(this.Preferences.Render.main_div_id+"_form");mainFormDiv.style.display="none"}if(this.Preferences.Render.ty_html!=""){var TYDivObj=document.getElementById(this.Preferences.Render.ty_div_id);TYDivObj.innerHTML=this.Preferences.Render.ty_html;TYDivObj.style.display="block"}if(this.Cookie!=null&&this.Preferences.Persistence.cookie_type!=null){this.Cookie.tagurl(this.Metrics.core.referer,this.Preferences.Persistence.cookie_type)}this.resetReferer()}};