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(b){return b}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var h=null,g=$A(arguments);if(Object.isFunction(g[0])){h=g.shift()}function b(){this.initialize.apply(this,arguments)}Object.extend(b,Class.Methods);b.superclass=h;b.subclasses=[];if(h){var c=function(){};c.prototype=h.prototype;b.prototype=new c;h.subclasses.push(b)}for(var e=0;e<g.length;e++){b.addMethods(g[e])}if(!b.prototype.initialize){b.prototype.initialize=Prototype.emptyFunction}b.prototype.constructor=b;return b}};Class.Methods={addMethods:function(l){var e=this.superclass&&this.superclass.prototype;var c=Object.keys(l);if(!Object.keys({toString:true}).length){c.push("toString","valueOf")}for(var b=0,g=c.length;b<g;b++){var k=c[b],h=l[k];if(e&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var m=h;h=(function(n){return function(){return e[n].apply(this,arguments)}})(k).wrap(m);h.valueOf=m.valueOf.bind(m);h.toString=m.toString.bind(m)}this.prototype[k]=h}return this}};var Abstract={};Object.extend=function(b,e){for(var c in e){b[c]=e[c]}return b};Object.extend(Object,{inspect:function(b){try{if(Object.isUndefined(b)){return"undefined"}if(b===null){return"null"}return b.inspect?b.inspect():String(b)}catch(c){if(c instanceof RangeError){return"..."}throw c}},toJSON:function(b){var e=typeof b;switch(e){case"undefined":case"function":case"unknown":return;case"boolean":return b.toString()}if(b===null){return"null"}if(b.toJSON){return b.toJSON()}if(Object.isElement(b)){return}var c=[];for(var h in b){var g=Object.toJSON(b[h]);if(!Object.isUndefined(g)){c.push(h.toJSON()+": "+g)}}return"{"+c.join(", ")+"}"},toQueryString:function(b){return $H(b).toQueryString()},toHTML:function(b){return b&&b.toHTML?b.toHTML():String.interpret(b)},keys:function(b){var c=[];for(var e in b){c.push(e)}return c},values:function(c){var b=[];for(var e in c){b.push(c[e])}return b},clone:function(b){return Object.extend({},b)},isElement:function(b){return !!(b&&b.nodeType==1)},isArray:function(b){return b!=null&&typeof b=="object"&&"splice" in b&&"join" in b},isHash:function(b){return b instanceof Hash},isFunction:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNumber:function(b){return typeof b=="number"},isUndefined:function(b){return typeof b=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var b=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return b.length==1&&!b[0]?[]:b},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var b=this,e=$A(arguments),c=e.shift();return function(){return b.apply(c,e.concat($A(arguments)))}},bindAsEventListener:function(){var b=this,e=$A(arguments),c=e.shift();return function(g){return b.apply(c,[g||window.event].concat(e))}},curry:function(){if(!arguments.length){return this}var b=this,c=$A(arguments);return function(){return b.apply(this,c.concat($A(arguments)))}},delay:function(){var b=this,c=$A(arguments),e=c.shift()*1000;return window.setTimeout(function(){return b.apply(b,c)},e)},defer:function(){var b=[0.01].concat($A(arguments));return this.delay.apply(this,b)},wrap:function(c){var b=this;return function(){return c.apply(this,[b.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var b=this;return this._methodized=function(){return b.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 g;for(var c=0,h=arguments.length;c<h;c++){var b=arguments[c];try{g=b();break}catch(k){}}return g}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(b){return String(b).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(c,b){this.callback=c;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(b){return b==null?"":String(b)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(h,e){var b="",g=this,c;e=arguments.callee.prepareReplacement(e);while(g.length>0){if(c=g.match(h)){b+=g.slice(0,c.index);b+=String.interpret(e(c));g=g.slice(c.index+c[0].length)}else{b+=g,g=""}}return b},sub:function(e,b,c){b=this.gsub.prepareReplacement(b);c=Object.isUndefined(c)?1:c;return this.gsub(e,function(g){if(--c<0){return g[0]}return b(g)})},scan:function(c,b){this.gsub(c,b);return String(this)},truncate:function(c,b){c=c||30;b=Object.isUndefined(b)?"...":b;return this.length>c?this.slice(0,c-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 c=new RegExp(Prototype.ScriptFragment,"img");var b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(c)||[]).map(function(e){return(e.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var b=arguments.callee;b.text.data=this;return b.div.innerHTML},unescapeHTML:function(){var b=new Element("div");b.innerHTML=this.stripTags();return b.childNodes[0]?(b.childNodes.length>1?$A(b.childNodes).inject("",function(c,e){return c+e.nodeValue}):b.childNodes[0].nodeValue):""},toQueryParams:function(c){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b){return{}}return b[1].split(c||"&").inject({},function(h,k){if((k=k.split("="))[0]){var e=decodeURIComponent(k.shift());var g=k.length>1?k.join("="):k[0];if(g!=undefined){g=decodeURIComponent(g)}if(e in h){if(!Object.isArray(h[e])){h[e]=[h[e]]}h[e].push(g)}else{h[e]=g}}return h})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(b){return b<1?"":new Array(b+1).join(this)},camelize:function(){var g=this.split("-"),b=g.length;if(b==1){return g[0]}var e=this.charAt(0)=="-"?g[0].charAt(0).toUpperCase()+g[0].substring(1):g[0];for(var c=1;c<b;c++){e+=g[c].charAt(0).toUpperCase()+g[c].substring(1)}return e},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(c){var b=this.gsub(/[\x00-\x1f\\]/,function(e){var g=String.specialChar[e[0]];return g?g:"\\u00"+e[0].charCodeAt().toPaddedString(2,16)});if(c){return'"'+b.replace(/"/g,'\\"')+'"'}return"'"+b.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(b){return this.sub(b||Prototype.JSONFilter,"#{1}")},isJSON:function(){var b=this;if(b.blank()){return false}b=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(b)},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(b){return this.indexOf(b)>-1},startsWith:function(b){return this.indexOf(b)===0},endsWith:function(b){var c=this.length-b.length;return c>=0&&this.lastIndexOf(b)===c},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(b,c){return new Template(this,c).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(c){if(Object.isFunction(c)){return c}var b=new Template(c);return function(e){return b.evaluate(e)}};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,c){this.template=b.toString();this.pattern=c||Template.Pattern},evaluate:function(b){if(Object.isFunction(b.toTemplateReplacements)){b=b.toTemplateReplacements()}return this.template.gsub(this.pattern,function(g){if(b==null){return""}var k=g[1]||"";if(k=="\\"){return g[2]}var c=b,l=g[3];var h=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;g=h.exec(l);if(g==null){return k}while(g!=null){var e=g[1].startsWith("[")?g[2].gsub("\\\\]","]"):g[1];c=c[e];if(null==c||""==g[3]){break}l=l.substring("["==g[3]?g[1].length:g[0].length);g=h.exec(l)}return k+String.interpret(c)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(g,c){var b=0;try{this._each(function(e){g.call(c,e,b++)})}catch(h){if(h!=$break){throw h}}return this},eachSlice:function(g,e,c){var b=-g,h=[],k=this.toArray();if(g<1){return k}while((b+=g)<k.length){h.push(k.slice(b,b+g))}return h.collect(e,c)},all:function(e,c){e=e||Prototype.K;var b=true;this.each(function(h,g){b=b&&!!e.call(c,h,g);if(!b){throw $break}});return b},any:function(e,c){e=e||Prototype.K;var b=false;this.each(function(h,g){if(b=!!e.call(c,h,g)){throw $break}});return b},collect:function(e,c){e=e||Prototype.K;var b=[];this.each(function(h,g){b.push(e.call(c,h,g))});return b},detect:function(e,c){var b;this.each(function(h,g){if(e.call(c,h,g)){b=h;throw $break}});return b},findAll:function(e,c){var b=[];this.each(function(h,g){if(e.call(c,h,g)){b.push(h)}});return b},grep:function(g,e,c){e=e||Prototype.K;var b=[];if(Object.isString(g)){g=new RegExp(g)}this.each(function(k,h){if(g.match(k)){b.push(e.call(c,k,h))}});return b},include:function(b){if(Object.isFunction(this.indexOf)){if(this.indexOf(b)!=-1){return true}}var c=false;this.each(function(e){if(e==b){c=true;throw $break}});return c},inGroupsOf:function(c,b){b=Object.isUndefined(b)?null:b;return this.eachSlice(c,function(e){while(e.length<c){e.push(b)}return e})},inject:function(b,e,c){this.each(function(h,g){b=e.call(c,b,h,g)});return b},invoke:function(c){var b=$A(arguments).slice(1);return this.map(function(e){return e[c].apply(e,b)})},max:function(e,c){e=e||Prototype.K;var b;this.each(function(h,g){h=e.call(c,h,g);if(b==null||h>=b){b=h}});return b},min:function(e,c){e=e||Prototype.K;var b;this.each(function(h,g){h=e.call(c,h,g);if(b==null||h<b){b=h}});return b},partition:function(g,c){g=g||Prototype.K;var e=[],b=[];this.each(function(k,h){(g.call(c,k,h)?e:b).push(k)});return[e,b]},pluck:function(c){var b=[];this.each(function(e){b.push(e[c])});return b},reject:function(e,c){var b=[];this.each(function(h,g){if(!e.call(c,h,g)){b.push(h)}});return b},sortBy:function(c,b){return this.map(function(g,e){return{value:g,criteria:c.call(b,g,e)}}).sort(function(k,h){var g=k.criteria,e=h.criteria;return g<e?-1:g>e?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var c=Prototype.K,b=$A(arguments);if(Object.isFunction(b.last())){c=b.pop()}var e=[this].concat(b).map($A);return this.map(function(h,g){return c(e.pluck(g))})},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(e){if(!e){return[]}if(e.toArray){return e.toArray()}var c=e.length||0,b=new Array(c);while(c--){b[c]=e[c]}return b}if(Prototype.Browser.WebKit){$A=function(e){if(!e){return[]}if(!(typeof e==="function"&&typeof e.length==="number"&&typeof e.item==="function")&&e.toArray){return e.toArray()}var c=e.length||0,b=new Array(c);while(c--){b[c]=e[c]}return b}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(c){for(var b=0,e=this.length;b<e;b++){c(this[b])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(b){return b!=null})},flatten:function(){return this.inject([],function(c,b){return c.concat(Object.isArray(b)?b.flatten():[b])})},without:function(){var b=$A(arguments);return this.select(function(c){return !b.include(c)})},reverse:function(b){return(b!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(b){return this.inject([],function(g,e,c){if(0==c||(b?g.last()!=e:!g.include(e))){g.push(e)}return g})},intersect:function(b){return this.uniq().findAll(function(c){return b.detect(function(e){return c===e})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var b=[];this.each(function(c){var e=Object.toJSON(c);if(!Object.isUndefined(e)){b.push(e)}});return"["+b.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(e,b){b||(b=0);var c=this.length;if(b<0){b=c+b}for(;b<c;b++){if(this[b]===e){return b}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(c,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;var e=this.slice(0,b).reverse().indexOf(c);return(e<0)?e:b-e-1}}Array.prototype.toArray=Array.prototype.clone;function $w(b){if(!Object.isString(b)){return[]}b=b.strip();return b?b.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var h=[];for(var c=0,e=this.length;c<e;c++){h.push(this[c])}for(var c=0,e=arguments.length;c<e;c++){if(Object.isArray(arguments[c])){for(var b=0,g=arguments[c].length;b<g;b++){h.push(arguments[c][b])}}else{h.push(arguments[c])}}return h}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(c,b){$R(0,this,true).each(c,b);return this},toPaddedString:function(e,c){var b=this.toString(c||10);return"0".times(e-b.length)+b},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(b){Number.prototype[b]=Math[b].methodize()});function $H(b){return new Hash(b)}var Hash=Class.create(Enumerable,(function(){function b(c,e){if(Object.isUndefined(e)){return c}return c+"="+encodeURIComponent(String.interpret(e))}return{initialize:function(c){this._object=Object.isHash(c)?c.toObject():Object.clone(c)},_each:function(e){for(var c in this._object){var g=this._object[c],h=[c,g];h.key=c;h.value=g;e(h)}},set:function(c,e){return this._object[c]=e},get:function(c){if(this._object[c]!==Object.prototype[c]){return this._object[c]}},unset:function(c){var e=this._object[c];delete this._object[c];return e},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(e){var c=this.detect(function(g){return g.value===e});return c&&c.key},merge:function(c){return this.clone().update(c)},update:function(c){return new Hash(c).inject(this,function(e,g){e.set(g.key,g.value);return e})},toQueryString:function(){return this.inject([],function(g,h){var e=encodeURIComponent(h.key),c=h.value;if(c&&typeof c=="object"){if(Object.isArray(c)){return g.concat(c.map(b.curry(e)))}}else{g.push(b(e,c))}return g}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(c){return c.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(e,b,c){this.start=e;this.end=b;this.exclusive=c},_each:function(b){var c=this.start;while(this.include(c)){b(c);c=c.succ()}},include:function(b){if(b<this.start){return false}if(this.exclusive){return b<this.end}return b<=this.end}});var $R=function(e,b,c){return new ObjectRange(e,b,c)};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(b){this.responders._each(b)},register:function(b){if(!this.include(b)){this.responders.push(b)}},unregister:function(b){this.responders=this.responders.without(b)},dispatch:function(g,c,e,b){this.each(function(h){if(Object.isFunction(h[g])){try{h[g].apply(h,[c,e,b])}catch(k){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(b){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,b||{});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,c,b){$super(b);this.transport=Ajax.getTransport();this.request(c)},request:function(c){this.url=c;this.method=this.options.method;var h=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){h._method=this.method;this.method="post"}this.parameters=h;if(h=Object.toQueryString(h)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+h}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){h+="&_="}}}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||h):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(g){this.dispatchException(g)}},onStateChange:function(){var b=this.transport.readyState;if(b>1&&!((b==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var h={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){h["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){h.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var e=this.options.requestHeaders;if(Object.isFunction(e.push)){for(var c=0,g=e.length;c<g;c+=2){h[e[c]]=e[c+1]}}else{$H(e).each(function(k){h[k.key]=k.value})}}for(var b in h){this.transport.setRequestHeader(b,h[b])}},success:function(){var b=this.getStatus();return !b||(b>=200&&b<300)},getStatus:function(){try{return this.transport.status||0}catch(b){return 0}},respondToReadyState:function(b){var g=Ajax.Request.Events[b],c=new Ajax.Response(this);if(g=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(h){this.dispatchException(h)}var k=c.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&k&&k.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+g]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+g,this,c,c.headerJSON)}catch(h){this.dispatchException(h)}if(g=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var b=this.url.match(/^\s*https?:\/\/[^\/]*/);return !b||(b[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(b){try{return this.transport.getResponseHeader(b)||null}catch(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(b){(this.options.onException||Prototype.emptyFunction)(this,b);Ajax.Responders.dispatch("onException",this,b)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(e){this.request=e;var g=this.transport=e.transport,b=this.readyState=g.readyState;if((b>2&&!Prototype.Browser.IE)||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(g.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){var c=g.responseXML;this.responseXML=Object.isUndefined(c)?null:c;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(b){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(b){return null}},getResponseHeader:function(b){return this.transport.getResponseHeader(b)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var b=this.getHeader("X-JSON");if(!b){return null}b=decodeURIComponent(escape(b));try{return b.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}},_getResponseJSON:function(){var b=this.request.options;if(!b.evalJSON||(b.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(b.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,b,e,c){this.container={success:(b.success||b),failure:(b.failure||(b.success?null:b))};c=Object.clone(c);var g=c.onComplete;c.onComplete=(function(h,k){this.updateContent(h.responseText);if(Object.isFunction(g)){g(h,k)}}).bind(this);$super(e,c)},updateContent:function(g){var e=this.container[this.success()?"success":"failure"],b=this.options;if(!b.evalScripts){g=g.stripScripts()}if(e=$(e)){if(b.insertion){if(Object.isString(b.insertion)){var c={};c[b.insertion]=g;e.insert(c)}else{b.insertion(e,g)}}else{e.update(g)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,e,c){$super(c);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=b;this.url=e;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(b){if(this.options.decay){this.decay=(b.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=b.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(c){if(arguments.length>1){for(var b=0,g=[],e=arguments.length;b<e;b++){g.push($(arguments[b]))}return g}if(Object.isString(c)){c=document.getElementById(c)}return Element.extend(c)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(k,b){var e=[];var h=document.evaluate(k,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var c=0,g=h.snapshotLength;c<g;c++){e.push(Element.extend(h.snapshotItem(c)))}return e}}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 b=this.Element;this.Element=function(g,e){e=e||{};g=g.toLowerCase();var c=Element.cache;if(Prototype.Browser.IE&&e.name){g="<"+g+' name="'+e.name+'">';delete e.name;return Element.writeAttribute(document.createElement(g),e)}if(!c[g]){c[g]=Element.extend(document.createElement(g))}return Element.writeAttribute(c[g].cloneNode(false),e)};Object.extend(this.Element,b||{});if(b){this.Element.prototype=b.prototype}}).call(window);Element.cache={};Element.Methods={visible:function(b){return $(b).style.display!="none"},toggle:function(b){b=$(b);Element[Element.visible(b)?"hide":"show"](b);return b},hide:function(b){b=$(b);b.style.display="none";return b},show:function(b){b=$(b);b.style.display="";return b},remove:function(b){b=$(b);b.parentNode.removeChild(b);return b},update:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}if(Object.isElement(c)){return b.update().insert(c)}c=Object.toHTML(c);b.innerHTML=c.stripScripts();c.evalScripts.bind(c).defer();return b},replace:function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}else{if(!Object.isElement(e)){e=Object.toHTML(e);var b=c.ownerDocument.createRange();b.selectNode(c);e.evalScripts.bind(e).defer();e=b.createContextualFragment(e.stripScripts())}}c.parentNode.replaceChild(e,c);return c},insert:function(e,h){e=$(e);if(Object.isString(h)||Object.isNumber(h)||Object.isElement(h)||(h&&(h.toElement||h.toHTML))){h={bottom:h}}var g,k,c,l;for(var b in h){g=h[b];b=b.toLowerCase();k=Element._insertionTranslations[b];if(g&&g.toElement){g=g.toElement()}if(Object.isElement(g)){k(e,g);continue}g=Object.toHTML(g);c=((b=="before"||b=="after")?e.parentNode:e).tagName.toUpperCase();l=Element._getContentFromAnonymousElement(c,g.stripScripts());if(b=="top"||b=="after"){l.reverse()}l.each(k.curry(e));g.evalScripts.bind(g).defer()}return e},wrap:function(c,e,b){c=$(c);if(Object.isElement(e)){$(e).writeAttribute(b||{})}else{if(Object.isString(e)){e=new Element(e,b)}else{e=new Element("div",e)}}if(c.parentNode){c.parentNode.replaceChild(e,c)}e.appendChild(c);return e},inspect:function(c){c=$(c);var b="<"+c.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(k){var h=k.first(),e=k.last();var g=(c[h]||"").toString();if(g){b+=" "+e+"="+g.inspect(true)}});return b+">"},recursivelyCollect:function(b,e){b=$(b);var c=[];while(b=b[e]){if(b.nodeType==1){c.push(Element.extend(b))}}return c},ancestors:function(b){return $(b).recursivelyCollect("parentNode")},descendants:function(b){return $(b).select("*")},firstDescendant:function(b){b=$(b).firstChild;while(b&&b.nodeType!=1){b=b.nextSibling}return $(b)},immediateDescendants:function(b){if(!(b=$(b).firstChild)){return[]}while(b&&b.nodeType!=1){b=b.nextSibling}if(b){return[b].concat($(b).nextSiblings())}return[]},previousSiblings:function(b){return $(b).recursivelyCollect("previousSibling")},nextSiblings:function(b){return $(b).recursivelyCollect("nextSibling")},siblings:function(b){b=$(b);return b.previousSiblings().reverse().concat(b.nextSiblings())},match:function(c,b){if(Object.isString(b)){b=new Selector(b)}return b.match($(c))},up:function(c,g,b){c=$(c);if(arguments.length==1){return $(c.parentNode)}var e=c.ancestors();return Object.isNumber(g)?e[g]:Selector.findElement(e,g,b)},down:function(c,e,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(e)?c.descendants()[e]:Element.select(c,e)[b||0]},previous:function(c,g,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(c))}var e=c.previousSiblings();return Object.isNumber(g)?e[g]:Selector.findElement(e,g,b)},next:function(e,g,c){e=$(e);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(e))}var b=e.nextSiblings();return Object.isNumber(g)?b[g]:Selector.findElement(b,g,c)},select:function(){var b=$A(arguments),c=$(b.shift());return Selector.findChildElements(c,b)},adjacent:function(){var b=$A(arguments),c=$(b.shift());return Selector.findChildElements(c.parentNode,b).without(c)},identify:function(c){c=$(c);var e=c.readAttribute("id"),b=arguments.callee;if(e){return e}do{e="anonymous_element_"+b.counter++}while($(e));c.writeAttribute("id",e);return e},readAttribute:function(e,b){e=$(e);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b]){return c.values[b](e,b)}if(c.names[b]){b=c.names[b]}if(b.include(":")){return(!e.attributes||!e.attributes[b])?null:e.attributes[b].value}}return e.getAttribute(b)},writeAttribute:function(h,e,k){h=$(h);var c={},g=Element._attributeTranslations.write;if(typeof e=="object"){c=e}else{c[e]=Object.isUndefined(k)?true:k}for(var b in c){e=g.names[b]||b;k=c[b];if(g.values[b]){e=g.values[b](h,k)}if(k===false||k===null){h.removeAttribute(e)}else{if(k===true){h.setAttribute(e,e)}else{h.setAttribute(e,k)}}}return h},getHeight:function(b){return $(b).getDimensions().height},getWidth:function(b){return $(b).getDimensions().width},classNames:function(b){return new Element.ClassNames(b)},hasClassName:function(b,c){if(!(b=$(b))){return}var e=b.className;return(e.length>0&&(e==c||new RegExp("(^|\\s)"+c+"(\\s|$)").test(e)))},addClassName:function(b,c){if(!(b=$(b))){return}if(!b.hasClassName(c)){b.className+=(b.className?" ":"")+c}return b},removeClassName:function(b,c){if(!(b=$(b))){return}b.className=b.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return b},toggleClassName:function(b,c){if(!(b=$(b))){return}return b[b.hasClassName(c)?"removeClassName":"addClassName"](c)},cleanWhitespace:function(c){c=$(c);var e=c.firstChild;while(e){var b=e.nextSibling;if(e.nodeType==3&&!/\S/.test(e.nodeValue)){c.removeChild(e)}e=b}return c},empty:function(b){return $(b).innerHTML.blank()},descendantOf:function(c,b){c=$(c),b=$(b);if(c.compareDocumentPosition){return(c.compareDocumentPosition(b)&8)===8}if(b.contains){return b.contains(c)&&b!==c}while(c=c.parentNode){if(c==b){return true}}return false},scrollTo:function(b){b=$(b);var c=b.cumulativeOffset();window.scrollTo(c[0],c[1]);return b},getStyle:function(c,e){c=$(c);e=e=="float"?"cssFloat":e.camelize();var g=c.style[e];if(!g||g=="auto"){var b=document.defaultView.getComputedStyle(c,null);g=b?b[e]:null}if(e=="opacity"){return g?parseFloat(g):1}return g=="auto"?null:g},getOpacity:function(b){return $(b).getStyle("opacity")},setStyle:function(c,e){c=$(c);var h=c.style,b;if(Object.isString(e)){c.style.cssText+=";"+e;return e.include("opacity")?c.setOpacity(e.match(/opacity:\s*(\d?\.?\d*)/)[1]):c}for(var g in e){if(g=="opacity"){c.setOpacity(e[g])}else{h[(g=="float"||g=="cssFloat")?(Object.isUndefined(h.styleFloat)?"cssFloat":"styleFloat"):g]=e[g]}}return c},setOpacity:function(b,c){b=$(b);b.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;return b},getDimensions:function(e){e=$(e);var l=e.getStyle("display");if(l!="none"&&l!=null){return{width:e.offsetWidth,height:e.offsetHeight}}var c=e.style;var k=c.visibility;var g=c.position;var b=c.display;c.visibility="hidden";c.position="absolute";c.display="block";var m=e.clientWidth;var h=e.clientHeight;c.display=b;c.position=g;c.visibility=k;return{width:m,height:h}},makePositioned:function(b){b=$(b);var c=Element.getStyle(b,"position");if(c=="static"||!c){b._madePositioned=true;b.style.position="relative";if(Prototype.Browser.Opera){b.style.top=0;b.style.left=0}}return b},undoPositioned:function(b){b=$(b);if(b._madePositioned){b._madePositioned=undefined;b.style.position=b.style.top=b.style.left=b.style.bottom=b.style.right=""}return b},makeClipping:function(b){b=$(b);if(b._overflow){return b}b._overflow=Element.getStyle(b,"overflow")||"auto";if(b._overflow!=="hidden"){b.style.overflow="hidden"}return b},undoClipping:function(b){b=$(b);if(!b._overflow){return b}b.style.overflow=b._overflow=="auto"?"":b._overflow;b._overflow=null;return b},cumulativeOffset:function(c){var b=0,e=0;do{b+=c.offsetTop||0;e+=c.offsetLeft||0;c=c.offsetParent}while(c);return Element._returnOffset(e,b)},positionedOffset:function(c){var b=0,g=0;do{b+=c.offsetTop||0;g+=c.offsetLeft||0;c=c.offsetParent;if(c){if(c.tagName.toUpperCase()=="BODY"){break}var e=Element.getStyle(c,"position");if(e!=="static"){break}}}while(c);return Element._returnOffset(g,b)},absolutize:function(c){c=$(c);if(c.getStyle("position")=="absolute"){return c}var g=c.positionedOffset();var k=g[1];var h=g[0];var e=c.clientWidth;var b=c.clientHeight;c._originalLeft=h-parseFloat(c.style.left||0);c._originalTop=k-parseFloat(c.style.top||0);c._originalWidth=c.style.width;c._originalHeight=c.style.height;c.style.position="absolute";c.style.top=k+"px";c.style.left=h+"px";c.style.width=e+"px";c.style.height=b+"px";return c},relativize:function(b){b=$(b);if(b.getStyle("position")=="relative"){return b}b.style.position="relative";var e=parseFloat(b.style.top||0)-(b._originalTop||0);var c=parseFloat(b.style.left||0)-(b._originalLeft||0);b.style.top=e+"px";b.style.left=c+"px";b.style.height=b._originalHeight;b.style.width=b._originalWidth;return b},cumulativeScrollOffset:function(c){var b=0,e=0;do{b+=c.scrollTop||0;e+=c.scrollLeft||0;c=c.parentNode}while(c);return Element._returnOffset(e,b)},getOffsetParent:function(b){if(b.offsetParent){return $(b.offsetParent)}if(b==document.body){return $(b)}while((b=b.parentNode)&&b!=document.body){if(Element.getStyle(b,"position")!="static"){return $(b)}}return $(document.body)},viewportOffset:function(g){var b=0,e=0;var c=g;do{b+=c.offsetTop||0;e+=c.offsetLeft||0;if(c.offsetParent==document.body&&Element.getStyle(c,"position")=="absolute"){break}}while(c=c.offsetParent);c=g;do{if(!Prototype.Browser.Opera||(c.tagName&&(c.tagName.toUpperCase()=="BODY"))){b-=c.scrollTop||0;e-=c.scrollLeft||0}}while(c=c.parentNode);return Element._returnOffset(e,b)},clonePosition:function(c,g){var b=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});g=$(g);var h=g.viewportOffset();c=$(c);var k=[0,0];var e=null;if(Element.getStyle(c,"position")=="absolute"){e=c.getOffsetParent();k=e.viewportOffset()}if(e==document.body){k[0]-=document.body.offsetLeft;k[1]-=document.body.offsetTop}if(b.setLeft){c.style.left=(h[0]-k[0]+b.offsetLeft)+"px"}if(b.setTop){c.style.top=(h[1]-k[1]+b.offsetTop)+"px"}if(b.setWidth){c.style.width=g.offsetWidth+"px"}if(b.setHeight){c.style.height=g.offsetHeight+"px"}return c}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(g,c,e){switch(e){case"left":case"top":case"right":case"bottom":if(g(c,"position")==="static"){return null}case"height":case"width":if(!Element.visible(c)){return null}var h=parseInt(g(c,e),10);if(h!==c["offset"+e.capitalize()]){return h+"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(h,function(k,l){var m=g(c,l);return m===null?k:k-parseInt(m,10)})+"px";default:return g(c,e)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(e,b,c){if(c==="title"){return b.title}return e(b,c)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(g,c){c=$(c);try{c.offsetParent}catch(k){return $(document.body)}var b=c.getStyle("position");if(b!=="static"){return g(c)}c.setStyle({position:"relative"});var h=g(c);c.setStyle({position:b});return h});$w("positionedOffset viewportOffset").each(function(b){Element.Methods[b]=Element.Methods[b].wrap(function(k,g){g=$(g);try{g.offsetParent}catch(m){return Element._returnOffset(0,0)}var c=g.getStyle("position");if(c!=="static"){return k(g)}var h=g.getOffsetParent();if(h&&h.getStyle("position")==="fixed"){h.setStyle({zoom:1})}g.setStyle({position:"relative"});var l=k(g);g.setStyle({position:c});return l})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(c,b){try{b.offsetParent}catch(g){return Element._returnOffset(0,0)}return c(b)});Element.Methods.getStyle=function(b,c){b=$(b);c=(c=="float"||c=="cssFloat")?"styleFloat":c.camelize();var e=b.style[c];if(!e&&b.currentStyle){e=b.currentStyle[c]}if(c=="opacity"){if(e=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(e[1]){return parseFloat(e[1])/100}}return 1}if(e=="auto"){if((c=="width"||c=="height")&&(b.getStyle("display")!="none")){return b["offset"+c.capitalize()]+"px"}return null}return e};Element.Methods.setOpacity=function(c,h){function k(l){return l.replace(/alpha\([^\)]*\)/gi,"")}c=$(c);var b=c.currentStyle;if((b&&!b.hasLayout)||(!b&&c.style.zoom=="normal")){c.style.zoom=1}var g=c.getStyle("filter"),e=c.style;if(h==1||h===""){(g=k(g))?e.filter=g:e.removeAttribute("filter");return c}else{if(h<0.00001){h=0}}e.filter=k(g)+"alpha(opacity="+(h*100)+")";return c};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(b,c){return b.getAttribute(c,2)},_getAttrNode:function(b,e){var c=b.getAttributeNode(e);return c?c.value:""},_getEv:function(b,c){c=b.getAttribute(c);return c?c.toString().slice(23,-2):null},_flag:function(b,c){return $(b).hasAttribute(c)?c:null},style:function(b){return b.style.cssText.toLowerCase()},title:function(b){return b.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(b,c){b.checked=!!c},style:function(b,c){b.style.cssText=c?c:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(b){Element._attributeTranslations.write.names[b.toLowerCase()]=b;Element._attributeTranslations.has[b.toLowerCase()]=b});(function(b){Object.extend(b,{href:b._getAttr,src:b._getAttr,type:b._getAttr,action:b._getAttrNode,disabled:b._flag,checked:b._flag,readonly:b._flag,multiple:b._flag,onload:b._getEv,onunload:b._getEv,onclick:b._getEv,ondblclick:b._getEv,onmousedown:b._getEv,onmouseup:b._getEv,onmouseover:b._getEv,onmousemove:b._getEv,onmouseout:b._getEv,onfocus:b._getEv,onblur:b._getEv,onkeypress:b._getEv,onkeydown:b._getEv,onkeyup:b._getEv,onsubmit:b._getEv,onreset:b._getEv,onselect:b._getEv,onchange:b._getEv})})(Element._attributeTranslations.read.values)}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=(c==1)?0.999999:(c==="")?"":(c<0.00001)?0:c;return b}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;if(c==1){if(b.tagName.toUpperCase()=="IMG"&&b.width){b.width++;b.width--}else{try{var h=document.createTextNode(" ");b.appendChild(h);b.removeChild(h)}catch(g){}}}return b};Element.Methods.cumulativeOffset=function(c){var b=0,e=0;do{b+=c.offsetTop||0;e+=c.offsetLeft||0;if(c.offsetParent==document.body){if(Element.getStyle(c,"position")=="absolute"){break}}c=c.offsetParent}while(c);return Element._returnOffset(e,b)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){return c.update().insert(e)}e=Object.toHTML(e);var b=c.tagName.toUpperCase();if(b in Element._insertionTranslations.tags){$A(c.childNodes).each(function(g){c.removeChild(g)});Element._getContentFromAnonymousElement(b,e.stripScripts()).each(function(g){c.appendChild(g)})}else{c.innerHTML=e.stripScripts()}e.evalScripts.bind(e).defer();return c}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(e,h){e=$(e);if(h&&h.toElement){h=h.toElement()}if(Object.isElement(h)){e.parentNode.replaceChild(h,e);return e}h=Object.toHTML(h);var g=e.parentNode,c=g.tagName.toUpperCase();if(Element._insertionTranslations.tags[c]){var k=e.next();var b=Element._getContentFromAnonymousElement(c,h.stripScripts());g.removeChild(e);if(k){b.each(function(l){g.insertBefore(l,k)})}else{b.each(function(l){g.appendChild(l)})}}else{e.outerHTML=h.stripScripts()}h.evalScripts.bind(h).defer();return e}}Element._returnOffset=function(c,e){var b=[c,e];b.left=c;b.top=e;return b};Element._getContentFromAnonymousElement=function(e,c){var g=new Element("div"),b=Element._insertionTranslations.tags[e];if(b){g.innerHTML=b[0]+c+b[1];b[2].times(function(){g=g.firstChild})}else{g.innerHTML=c}return $A(g.childNodes)};Element._insertionTranslations={before:function(b,c){b.parentNode.insertBefore(c,b)},top:function(b,c){b.insertBefore(c,b.firstChild)},bottom:function(b,c){b.appendChild(c)},after:function(b,c){b.parentNode.insertBefore(c,b.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(b,e){e=Element._attributeTranslations.has[e]||e;var c=$(b).getAttributeNode(e);return !!(c&&c.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={},c=Element.Methods.ByTag;var e=Object.extend(function(k){if(!k||k._extendedByPrototype||k.nodeType!=1||k==window){return k}var g=Object.clone(b),h=k.tagName.toUpperCase(),m,l;if(c[h]){Object.extend(g,c[h])}for(m in g){l=g[m];if(Object.isFunction(l)&&!(m in k)){k[m]=l.methodize()}}k._extendedByPrototype=Prototype.emptyFunction;return k},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(b,Element.Methods);Object.extend(b,Element.Methods.Simulated)}}});e.refresh();return e})();Element.hasAttribute=function(b,c){if(b.hasAttribute){return b.hasAttribute(c)}return Element.Methods.Simulated.hasAttribute(b,c)};Element.addMethods=function(e){var m=Prototype.BrowserFeatures,g=Element.Methods.ByTag;if(!e){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 c=e;e=arguments[1]}if(!c){Object.extend(Element.Methods,e||{})}else{if(Object.isArray(c)){c.each(l)}else{l(c)}}function l(o){o=o.toUpperCase();if(!Element.Methods.ByTag[o]){Element.Methods.ByTag[o]={}}Object.extend(Element.Methods.ByTag[o],e)}function b(q,p,o){o=o||false;for(var s in q){var r=q[s];if(!Object.isFunction(r)){continue}if(!o||!(s in p)){p[s]=r.methodize()}}}function h(q){var o;var p={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(p[q]){o="HTML"+p[q]+"Element"}if(window[o]){return window[o]}o="HTML"+q+"Element";if(window[o]){return window[o]}o="HTML"+q.capitalize()+"Element";if(window[o]){return window[o]}window[o]={};window[o].prototype=document.createElement(q)["__proto__"];return window[o]}if(m.ElementExtensions){b(Element.Methods,HTMLElement.prototype);b(Element.Methods.Simulated,HTMLElement.prototype,true)}if(m.SpecificElementExtensions){for(var n in Element.Methods.ByTag){var k=h(n);if(Object.isUndefined(k)){continue}b(g[n],k.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var b={},c=Prototype.Browser;$w("width height").each(function(g){var e=g.capitalize();if(c.WebKit&&!document.evaluate){b[g]=self["inner"+e]}else{if(c.Opera&&parseFloat(window.opera.version())<9.5){b[g]=document.body["client"+e]}else{b[g]=document.documentElement["client"+e]}}});return b},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(b){this.expression=b.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 b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(b)){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(b){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 k=this.expression,l=Selector.patterns,c=Selector.xpath,h,b;if(Selector._cache[k]){this.xpath=Selector._cache[k];return}this.matcher=[".//*"];while(k&&h!=k&&(/\S/).test(k)){h=k;for(var g in l){if(b=k.match(l[g])){this.matcher.push(Object.isFunction(c[g])?c[g](b):new Template(c[g]).evaluate(b));k=k.replace(b[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(b){b=b||document;var g=this.expression,c;switch(this.mode){case"selectorsAPI":if(b!==document){var h=b.id,k=$(b).identify();g="#"+k+" "+g}c=$A(b.querySelectorAll(g)).map(Element.extend);b.id=h;return c;case"xpath":return document._getElementsByXPath(this.xpath,b);default:return this.matcher(b)}},match:function(o){this.tokens=[];var t=this.expression,b=Selector.patterns,k=Selector.assertions;var c,h,l;while(t&&c!==t&&(/\S/).test(t)){c=t;for(var q in b){h=b[q];if(l=t.match(h)){if(k[q]){this.tokens.push([q,Object.clone(l)]);t=t.replace(l[0],"")}else{return this.findElements(document).include(o)}}}}var s=true,g,r;for(var q=0,n;n=this.tokens[q];q++){g=n[0],r=n[1];if(!Selector.assertions[g](o,r)){s=false;break}}return s},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(b){if(b[1]=="*"){return""}return"[local-name()='"+b[1].toLowerCase()+"' or local-name()='"+b[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(b){b[1]=b[1].toLowerCase();return new Template("[@#{1}]").evaluate(b)},attr:function(b){b[1]=b[1].toLowerCase();b[3]=b[5]||b[6];return new Template(Selector.xpath.operators[b[2]]).evaluate(b)},pseudo:function(b){var c=Selector.xpath.pseudos[b[1]];if(!c){return""}if(Object.isFunction(c)){return c(b)}return new Template(Selector.xpath.pseudos[b[1]]).evaluate(b)},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(c){var o=c[6],n=Selector.patterns,b=Selector.xpath,k,g;var l=[];while(o&&k!=o&&(/\S/).test(o)){k=o;for(var h in n){if(c=o.match(n[h])){g=Object.isFunction(b[h])?b[h](c):new Template(b[h]).evaluate(c);l.push("("+g.substring(1,g.length-1)+")");o=o.replace(c[0],"");break}}}return"[not("+l.join(" and ")+")]"},"nth-child":function(b){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",b)},"nth-last-child":function(b){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",b)},"nth-of-type":function(b){return Selector.xpath.pseudos.nth("position() ",b)},"nth-last-of-type":function(b){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",b)},"first-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-of-type"](b)},"last-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](b)},"only-of-type":function(b){var c=Selector.xpath.pseudos;return c["first-of-type"](b)+c["last-of-type"](b)},nth:function(k,g){var l,n=g[6],e;if(n=="even"){n="2n+0"}if(n=="odd"){n="2n+1"}if(l=n.match(/^(\d+)$/)){return"["+k+"= "+l[1]+"]"}if(l=n.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(l[1]=="-"){l[1]=-1}var h=l[1]?Number(l[1]):1;var c=l[2]?Number(l[2]):0;e="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(e).evaluate({fragment:k,a:h,b:c})}}}},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(b){b[3]=(b[5]||b[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(b)},pseudo:function(b){if(b[6]){b[6]=b[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(b)},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(b,c){return c[1].toUpperCase()==b.tagName.toUpperCase()},className:function(b,c){return Element.hasClassName(b,c[1])},id:function(b,c){return b.id===c[1]},attrPresence:function(b,c){return Element.hasAttribute(b,c[1])},attr:function(c,e){var b=Element.readAttribute(c,e[1]);return b&&Selector.operators[e[2]](b,e[5]||e[6])}},handlers:{concat:function(e,c){for(var g=0,h;h=c[g];g++){e.push(h)}return e},mark:function(b){var g=Prototype.emptyFunction;for(var c=0,e;e=b[c];c++){e._countedByPrototype=g}return b},unmark:function(b){for(var c=0,e;e=b[c];c++){e._countedByPrototype=undefined}return b},index:function(b,g,l){b._countedByPrototype=Prototype.emptyFunction;if(g){for(var c=b.childNodes,h=c.length-1,e=1;h>=0;h--){var k=c[h];if(k.nodeType==1&&(!l||k._countedByPrototype)){k.nodeIndex=e++}}}else{for(var h=0,e=1,c=b.childNodes;k=c[h];h++){if(k.nodeType==1&&(!l||k._countedByPrototype)){k.nodeIndex=e++}}}},unique:function(c){if(c.length==0){return c}var g=[],h;for(var e=0,b=c.length;e<b;e++){if(!(h=c[e])._countedByPrototype){h._countedByPrototype=Prototype.emptyFunction;g.push(Element.extend(h))}}return Selector.handlers.unmark(g)},descendant:function(b){var g=Selector.handlers;for(var e=0,c=[],k;k=b[e];e++){g.concat(c,k.getElementsByTagName("*"))}return c},child:function(b){var k=Selector.handlers;for(var g=0,e=[],l;l=b[g];g++){for(var c=0,m;m=l.childNodes[c];c++){if(m.nodeType==1&&m.tagName!="!"){e.push(m)}}}return e},adjacent:function(b){for(var e=0,c=[],h;h=b[e];e++){var g=this.nextElementSibling(h);if(g){c.push(g)}}return c},laterSibling:function(b){var g=Selector.handlers;for(var e=0,c=[],k;k=b[e];e++){g.concat(c,Element.nextSiblings(k))}return c},nextElementSibling:function(b){while(b=b.nextSibling){if(b.nodeType==1){return b}}return null},previousElementSibling:function(b){while(b=b.previousSibling){if(b.nodeType==1){return b}}return null},tagName:function(b,n,e,c){var o=e.toUpperCase();var k=[],m=Selector.handlers;if(b){if(c){if(c=="descendant"){for(var l=0,g;g=b[l];l++){m.concat(k,g.getElementsByTagName(e))}return k}else{b=this[c](b)}if(e=="*"){return b}}for(var l=0,g;g=b[l];l++){if(g.tagName.toUpperCase()===o){k.push(g)}}return k}else{return n.getElementsByTagName(e)}},id:function(c,b,n,l){var m=$(n),g=Selector.handlers;if(!m){return[]}if(!c&&b==document){return[m]}if(c){if(l){if(l=="child"){for(var e=0,k;k=c[e];e++){if(m.parentNode==k){return[m]}}}else{if(l=="descendant"){for(var e=0,k;k=c[e];e++){if(Element.descendantOf(m,k)){return[m]}}}else{if(l=="adjacent"){for(var e=0,k;k=c[e];e++){if(Selector.handlers.previousElementSibling(m)==k){return[m]}}}else{c=g[l](c)}}}}for(var e=0,k;k=c[e];e++){if(k==m){return[m]}}return[]}return(m&&Element.descendantOf(m,b))?[m]:[]},className:function(c,b,e,g){if(c&&g){c=this[g](c)}return Selector.handlers.byClassName(c,b,e)},byClassName:function(e,c,k){if(!e){e=Selector.handlers.descendant([c])}var m=" "+k+" ";for(var h=0,g=[],l,b;l=e[h];h++){b=l.className;if(b.length==0){continue}if(b==k||(" "+b+" ").include(m)){g.push(l)}}return g},attrPresence:function(e,c,b,l){if(!e){e=c.getElementsByTagName("*")}if(e&&l){e=this[l](e)}var h=[];for(var g=0,k;k=e[g];g++){if(Element.hasAttribute(k,b)){h.push(k)}}return h},attr:function(b,n,m,o,e,c){if(!b){b=n.getElementsByTagName("*")}if(b&&c){b=this[c](b)}var p=Selector.operators[e],k=[];for(var h=0,g;g=b[h];h++){var l=Element.readAttribute(g,m);if(l===null){continue}if(p(l,o)){k.push(g)}}return k},pseudo:function(c,e,h,b,g){if(c&&g){c=this[g](c)}if(!c){c=b.getElementsByTagName("*")}return Selector.pseudos[e](c,h,b)}},pseudos:{"first-child":function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(Selector.handlers.previousElementSibling(h)){continue}e.push(h)}return e},"last-child":function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(Selector.handlers.nextElementSibling(h)){continue}e.push(h)}return e},"only-child":function(c,m,b){var k=Selector.handlers;for(var g=0,e=[],l;l=c[g];g++){if(!k.previousElementSibling(l)&&!k.nextElementSibling(l)){e.push(l)}}return e},"nth-child":function(c,e,b){return Selector.pseudos.nth(c,e,b)},"nth-last-child":function(c,e,b){return Selector.pseudos.nth(c,e,b,true)},"nth-of-type":function(c,e,b){return Selector.pseudos.nth(c,e,b,false,true)},"nth-last-of-type":function(c,e,b){return Selector.pseudos.nth(c,e,b,true,true)},"first-of-type":function(c,e,b){return Selector.pseudos.nth(c,"1",b,false,true)},"last-of-type":function(c,e,b){return Selector.pseudos.nth(c,"1",b,true,true)},"only-of-type":function(c,g,b){var e=Selector.pseudos;return e["last-of-type"](e["first-of-type"](c,g,b),g,b)},getIndices:function(e,c,g){if(e==0){return c>0?[c]:[]}return $R(1,g).inject([],function(b,h){if(0==(h-c)%e&&(h-c)/e>=0){b.push(h)}return b})},nth:function(c,u,w,t,g){if(c.length==0){return[]}if(u=="even"){u="2n+0"}if(u=="odd"){u="2n+1"}var s=Selector.handlers,r=[],e=[],n;s.mark(c);for(var q=0,k;k=c[q];q++){if(!k.parentNode._countedByPrototype){s.index(k.parentNode,t,g);e.push(k.parentNode)}}if(u.match(/^\d+$/)){u=Number(u);for(var q=0,k;k=c[q];q++){if(k.nodeIndex==u){r.push(k)}}}else{if(n=u.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(n[1]=="-"){n[1]=-1}var z=n[1]?Number(n[1]):1;var v=n[2]?Number(n[2]):0;var A=Selector.pseudos.getIndices(z,v,c.length);for(var q=0,k,o=A.length;k=c[q];q++){for(var p=0;p<o;p++){if(k.nodeIndex==A[p]){r.push(k)}}}}}s.unmark(c);s.unmark(e);return r},empty:function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(h.tagName=="!"||h.firstChild){continue}e.push(h)}return e},not:function(b,g,p){var n=Selector.handlers,q,e;var o=new Selector(g).findElements(p);n.mark(o);for(var l=0,k=[],c;c=b[l];l++){if(!c._countedByPrototype){k.push(c)}}n.unmark(o);return k},enabled:function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(!h.disabled&&(!h.type||h.type!=="hidden")){e.push(h)}}return e},disabled:function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(h.disabled){e.push(h)}}return e},checked:function(c,k,b){for(var g=0,e=[],h;h=c[g];g++){if(h.checked){e.push(h)}}return e}},operators:{"=":function(c,b){return c==b},"!=":function(c,b){return c!=b},"^=":function(c,b){return c==b||c&&c.startsWith(b)},"$=":function(c,b){return c==b||c&&c.endsWith(b)},"*=":function(c,b){return c==b||c&&c.include(b)},"$=":function(c,b){return c.endsWith(b)},"*=":function(c,b){return c.include(b)},"~=":function(c,b){return(" "+c+" ").include(" "+b+" ")},"|=":function(c,b){return("-"+(c||"").toUpperCase()+"-").include("-"+(b||"").toUpperCase()+"-")}},split:function(c){var b=[];c.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(e){b.push(e[1].strip())});return b},matchElements:function(l,m){var k=$$(m),g=Selector.handlers;g.mark(k);for(var e=0,c=[],b;b=l[e];e++){if(b._countedByPrototype){c.push(b)}}g.unmark(k);return c},findElement:function(c,e,b){if(Object.isNumber(e)){b=e;e=false}return Selector.matchElements(c,e||"*")[b||0]},findChildElements:function(k,n){n=Selector.split(n.join(","));var g=[],m=Selector.handlers;for(var e=0,c=n.length,b;e<c;e++){b=new Selector(n[e].strip());m.concat(g,b.findElements(k))}return(c>1)?m.unique(g):g}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(e,c){for(var g=0,h;h=c[g];g++){if(h.tagName!=="!"){e.push(h)}}return e},unmark:function(b){for(var c=0,e;e=b[c];c++){e.removeAttribute("_countedByPrototype")}return b}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(b){$(b).reset();return b},serializeElements:function(l,c){if(typeof c!="object"){c={hash:!!c}}else{if(Object.isUndefined(c.hash)){c.hash=true}}var e,k,b=false,h=c.submit;var g=l.inject({},function(m,n){if(!n.disabled&&n.name){e=n.name;k=$(n).getValue();if(k!=null&&n.type!="file"&&(n.type!="submit"||(!b&&h!==false&&(!h||e==h)&&(b=true)))){if(e in m){if(!Object.isArray(m[e])){m[e]=[m[e]]}m[e].push(k)}else{m[e]=k}}}return m});return c.hash?g:Object.toQueryString(g)}};Form.Methods={serialize:function(c,b){return Form.serializeElements(Form.getElements(c),b)},getElements:function(b){return $A($(b).getElementsByTagName("*")).inject([],function(c,e){if(Form.Element.Serializers[e.tagName.toLowerCase()]){c.push(Element.extend(e))}return c})},getInputs:function(l,e,g){l=$(l);var b=l.getElementsByTagName("input");if(!e&&!g){return $A(b).map(Element.extend)}for(var h=0,m=[],k=b.length;h<k;h++){var c=b[h];if((e&&c.type!=e)||(g&&c.name!=g)){continue}m.push(Element.extend(c))}return m},disable:function(b){b=$(b);Form.getElements(b).invoke("disable");return b},enable:function(b){b=$(b);Form.getElements(b).invoke("enable");return b},findFirstElement:function(c){var e=$(c).getElements().findAll(function(g){return"hidden"!=g.type&&!g.disabled});var b=e.findAll(function(g){return g.hasAttribute("tabIndex")&&g.tabIndex>=0}).sortBy(function(g){return g.tabIndex}).first();return b?b:e.find(function(g){return["input","select","textarea"].include(g.tagName.toLowerCase())})},focusFirstElement:function(b){b=$(b);b.findFirstElement().activate();return b},request:function(c,b){c=$(c),b=Object.clone(b||{});var g=b.parameters,e=c.readAttribute("action")||"";if(e.blank()){e=window.location.href}b.parameters=c.serialize(true);if(g){if(Object.isString(g)){g=g.toQueryParams()}Object.extend(b.parameters,g)}if(c.hasAttribute("method")&&!b.method){b.method=c.method}return new Ajax.Request(e,b)}};Form.Element={focus:function(b){$(b).focus();return b},select:function(b){$(b).select();return b}};Form.Element.Methods={serialize:function(b){b=$(b);if(!b.disabled&&b.name){var c=b.getValue();if(c!=undefined){var e={};e[b.name]=c;return Object.toQueryString(e)}}return""},getValue:function(b){b=$(b);var c=b.tagName.toLowerCase();return Form.Element.Serializers[c](b)},setValue:function(b,c){b=$(b);var e=b.tagName.toLowerCase();Form.Element.Serializers[e](b,c);return b},clear:function(b){$(b).value="";return b},present:function(b){return $(b).value!=""},activate:function(b){b=$(b);try{b.focus();if(b.select&&(b.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(b.type))){b.select()}}catch(c){}return b},disable:function(b){b=$(b);b.disabled=true;return b},enable:function(b){b=$(b);b.disabled=false;return b}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(b,c){switch(b.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(b,c);default:return Form.Element.Serializers.textarea(b,c)}},inputSelector:function(b,c){if(Object.isUndefined(c)){return b.checked?b.value:null}else{b.checked=!!c}},textarea:function(b,c){if(Object.isUndefined(c)){return b.value}else{b.value=c}},select:function(e,k){if(Object.isUndefined(k)){return this[e.type=="select-one"?"selectOne":"selectMany"](e)}else{var c,g,l=!Object.isArray(k);for(var b=0,h=e.length;b<h;b++){c=e.options[b];g=this.optionValue(c);if(l){if(g==k){c.selected=true;return}}else{c.selected=k.include(g)}}}},selectOne:function(c){var b=c.selectedIndex;return b>=0?this.optionValue(c.options[b]):null},selectMany:function(g){var b,h=g.length;if(!h){return null}for(var e=0,b=[];e<h;e++){var c=g.options[e];if(c.selected){b.push(this.optionValue(c))}}return b},optionValue:function(b){return Element.extend(b).hasAttribute("value")?b.value:b.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,e){$super(e,c);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var b=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(b)?this.lastValue!=b:String(this.lastValue)!=String(b)){this.callback(this.element,b);this.lastValue=b}}});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(b,c){this.element=$(b);this.callback=c;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var b=this.getValue();if(this.lastValue!=b){this.callback(this.element,b);this.lastValue=b}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(b){if(b.type){switch(b.type.toLowerCase()){case"checkbox":case"radio":Event.observe(b,"click",this.onElementEvent.bind(this));break;default:Event.observe(b,"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(c){var b;switch(c.type){case"mouseover":b=c.fromElement;break;case"mouseout":b=c.toElement;break;default:return null}return Element.extend(b)}});Event.Methods=(function(){var b;if(Prototype.Browser.IE){var c={0:1,1:4,2:2};b=function(g,e){return g.button==c[e]}}else{if(Prototype.Browser.WebKit){b=function(g,e){switch(e){case 0:return g.which==1&&!g.metaKey;case 1:return g.which==1&&g.metaKey;default:return false}}}else{b=function(g,e){return g.which?(g.which===e+1):(g.button===e)}}}return{isLeftClick:function(e){return b(e,0)},isMiddleClick:function(e){return b(e,1)},isRightClick:function(e){return b(e,2)},element:function(h){h=Event.extend(h);var g=h.target,e=h.type,k=h.currentTarget;if(k&&k.tagName){if(e==="load"||e==="error"||(e==="click"&&k.tagName.toLowerCase()==="input"&&k.type==="radio")){g=k}}if(g.nodeType==Node.TEXT_NODE){g=g.parentNode}return Element.extend(g)},findElement:function(g,k){var e=Event.element(g);if(!k){return e}var h=[e].concat(e.ancestors());return Selector.findElement(h,k,0)},pointer:function(h){var g=document.documentElement,e=document.body||{scrollLeft:0,scrollTop:0};return{x:h.pageX||(h.clientX+(g.scrollLeft||e.scrollLeft)-(g.clientLeft||0)),y:h.pageY||(h.clientY+(g.scrollTop||e.scrollTop)-(g.clientTop||0))}},pointerX:function(e){return Event.pointer(e).x},pointerY:function(e){return Event.pointer(e).y},stop:function(e){Event.extend(e);e.preventDefault();e.stopPropagation();e.stopped=true}}})();Event.extend=(function(){var b=Object.keys(Event.Methods).inject({},function(c,e){c[e]=Event.Methods[e].methodize();return c});if(Prototype.Browser.IE){Object.extend(b,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(c){if(!c){return false}if(c._extendedByPrototype){return c}c._extendedByPrototype=Prototype.emptyFunction;var e=Event.pointer(c);Object.extend(c,{target:c.srcElement,relatedTarget:Event.relatedTarget(c),pageX:e.x,pageY:e.y});return Object.extend(c,b)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")["__proto__"];Object.extend(Event.prototype,b);return Prototype.K}})();Object.extend(Event,(function(){var c=Event.cache;function e(o){if(o._prototypeEventID){return o._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return o._prototypeEventID=[++arguments.callee.id]}function l(o){if(o&&o.include(":")){return"dataavailable"}return o}function b(o){return c[o]=c[o]||{}}function k(q,o){var p=b(q);return p[o]=p[o]||[]}function m(p,o,q){var t=e(p);var s=k(t,o);if(s.pluck("handler").include(q)){return false}var r=function(u){if(!Event||!Event.extend||(u.eventName&&u.eventName!=o)){return false}Event.extend(u);q.call(p,u)};r.handler=q;s.push(r);return r}function n(r,o,p){var q=k(r,o);return q.find(function(s){return s.handler==p})}function g(r,o,p){var q=b(r);if(!q[o]){return false}q[o]=q[o].without(n(r,o,p))}function h(){for(var p in c){for(var o in c[p]){c[p][o]=null}}}if(window.attachEvent){window.attachEvent("onunload",h)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}return{observe:function(q,o,r){q=$(q);var p=l(o);var s=m(q,o,r);if(!s){return q}if(q.addEventListener){q.addEventListener(p,s,false)}else{q.attachEvent("on"+p,s)}return q},stopObserving:function(q,o,r){q=$(q);var t=e(q),p=l(o);if(!r&&o){k(t,o).each(function(u){q.stopObserving(o,u.handler)});return q}else{if(!o){Object.keys(b(t)).each(function(u){q.stopObserving(u)});return q}}var s=n(t,o,r);if(!s){return q}if(q.removeEventListener){q.removeEventListener(p,s,false)}else{q.detachEvent("on"+p,s)}g(t,o,r);return q},fire:function(q,p,o){q=$(q);if(q==document&&document.createEvent&&!q.dispatchEvent){q=document.documentElement}var r;if(document.createEvent){r=document.createEvent("HTMLEvents");r.initEvent("dataavailable",true,true)}else{r=document.createEventObject();r.eventType="ondataavailable"}r.eventName=p;r.memo=o||{};if(document.createEvent){q.dispatchEvent(r)}else{q.fireEvent(r.eventType,r)}return Event.extend(r)}}})());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 c;function b(){if(document.loaded){return}if(c){window.clearInterval(c)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){c=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){b()}},0);Event.observe(window,"load",b)}else{document.addEventListener("DOMContentLoaded",b,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;b()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(b,c){return Element.insert(b,{before:c})},Top:function(b,c){return Element.insert(b,{top:c})},Bottom:function(b,c){return Element.insert(b,{bottom:c})},After:function(b,c){return Element.insert(b,{after:c})}};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(c,b,e){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(c,b,e)}this.xcomp=b;this.ycomp=e;this.offset=Element.cumulativeOffset(c);return(e>=this.offset[1]&&e<this.offset[1]+c.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+c.offsetWidth)},withinIncludingScrolloffsets:function(c,b,g){var e=Element.cumulativeScrollOffset(c);this.xcomp=b+e[0]-this.deltaX;this.ycomp=g+e[1]-this.deltaY;this.offset=Element.cumulativeOffset(c);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+c.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+c.offsetWidth)},overlap:function(c,b){if(!c){return 0}if(c=="vertical"){return((this.offset[1]+b.offsetHeight)-this.ycomp)/b.offsetHeight}if(c=="horizontal"){return((this.offset[0]+b.offsetWidth)-this.xcomp)/b.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(b){Position.prepare();return Element.absolutize(b)},relativize:function(b){Position.prepare();return Element.relativize(b)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(c,e,b){b=b||{};return Element.clonePosition(e,c,b)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(c){function b(e){return e.blank()?null:"[contains(concat(' ', @class, ' '), ' "+e+" ')]"}c.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(e,h){h=h.toString().strip();var g=/\s/.test(h)?$w(h).map(b).join(""):b(h);return g?document._getElementsByXPath(".//*"+g,e):[]}:function(h,k){k=k.toString().strip();var l=[],m=(/\s/.test(k)?$w(k):null);if(!m&&!k){return l}var e=$(h).getElementsByTagName("*");k=" "+k+" ";for(var g=0,o,n;o=e[g];g++){if(o.className&&(n=" "+o.className+" ")&&(n.include(k)||(m&&m.all(function(p){return !p.toString().blank()&&n.include(" "+p+" ")})))){l.push(Element.extend(o))}}return l};return function(g,e){return $(e||document.body).getElementsByClassName(g)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(b){this.element=$(b)},_each:function(b){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(b)},set:function(b){this.element.className=b},add:function(b){if(this.include(b)){return}this.set($A(this).concat(b).join(" "))},remove:function(b){if(!this.include(b)){return}this.set($A(this).without(b).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();var Scriptaculous={Version:"1.8.2",require:function(b){document.write('<script type="text/javascript" src="'+b+'"><\/script>')},REQUIRED_PROTOTYPE:"1.6.0.3",load:function(){function b(e){var g=e.replace(/_.*|\./g,"");g=parseInt(g+"0".times(4-g.length));return e.indexOf("_")>-1?g-1:g}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(b(Prototype.Version)<b(Scriptaculous.REQUIRED_PROTOTYPE))){throw ("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE)}var c=/scriptaculous\.js(\?.*)?$/;$$("head script[src]").findAll(function(e){return e.src.match(c)}).each(function(g){var h=g.src.replace(c,""),e=g.src.match(/\?.*load=([a-z,]*)/);(e?e[1]:"builder,effects,dragdrop,controls,slider,sound").split(",").each(function(k){Scriptaculous.require(h+k+".js")})})}};Scriptaculous.load();String.prototype.parseColor=function(){var b="#";if(this.slice(0,4)=="rgb("){var e=this.slice(4,this.length-1).split(",");var c=0;do{b+=parseInt(e[c]).toColorPart()}while(++c<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var c=1;c<4;c++){b+=(this.charAt(c)+this.charAt(c)).toLowerCase()}}if(this.length==7){b=this.toLowerCase()}}}return(b.length==7?b:(arguments[0]||this))};Element.collectTextNodes=function(b){return $A($(b).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:(c.hasChildNodes()?Element.collectTextNodes(c):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,c){return $A($(b).childNodes).collect(function(e){return(e.nodeType==3?e.nodeValue:((e.hasChildNodes()&&!Element.hasClassName(e,c))?Element.collectTextNodesIgnoreClass(e,c):""))}).flatten().join("")};Element.setContentZoom=function(b,c){b=$(b);b.setStyle({fontSize:(c/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return b};Element.getInlineOpacity=function(b){return $(b).style.opacity||""};Element.forceRerendering=function(b){try{b=$(b);var g=document.createTextNode(" ");b.appendChild(g);b.removeChild(g)}catch(c){}};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(b){return(-Math.cos(b*Math.PI)/2)+0.5},reverse:function(b){return 1-b},flicker:function(b){var b=((-Math.cos(b*Math.PI)/4)+0.75)+Math.random()/4;return b>1?1:b},wobble:function(b){return(-Math.cos(b*Math.PI*(9*b))/2)+0.5},pulse:function(c,b){return(-Math.cos((c*((b||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(b){return 1-(Math.cos(b*4.5*Math.PI)*Math.exp(-b*6))},none:function(b){return 0},full:function(b){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(b){var c="position:relative";if(Prototype.Browser.IE){c+=";zoom:1"}b=$(b);$A(b.childNodes).each(function(e){if(e.nodeType==3){e.nodeValue.toArray().each(function(g){b.insertBefore(new Element("span",{style:c}).update(g==" "?String.fromCharCode(160):g),e)});Element.remove(e)}})},multiple:function(c,e){var h;if(((typeof c=="object")||Object.isFunction(c))&&(c.length)){h=c}else{h=$(c).childNodes}var b=Object.extend({speed:0.1,delay:0},arguments[2]||{});var g=b.delay;$A(h).each(function(l,k){new e(l,Object.extend(b,{delay:k*b.speed+g}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(c,e){c=$(c);e=(e||"appear").toLowerCase();var b=Object.extend({queue:{position:"end",scope:(c.id||"global"),limit:1}},arguments[2]||{});Effect[c.visible()?Effect.PAIRS[e][1]:Effect.PAIRS[e][0]](c,b)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(b){this.effects._each(b)},add:function(c){var e=new Date().getTime();var b=Object.isString(c.options.queue)?c.options.queue:c.options.queue.position;switch(b){case"front":this.effects.findAll(function(g){return g.state=="idle"}).each(function(g){g.startOn+=c.finishOn;g.finishOn+=c.finishOn});break;case"with-last":e=this.effects.pluck("startOn").max()||e;break;case"end":e=this.effects.pluck("finishOn").max()||e;break}c.startOn+=e;c.finishOn+=e;if(!c.options.queue.limit||(this.effects.length<c.options.queue.limit)){this.effects.push(c)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(b){this.effects=this.effects.reject(function(c){return c==b});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var e=new Date().getTime();for(var c=0,b=this.effects.length;c<b;c++){this.effects[c]&&this.effects[c].loop(e)}}});Effect.Queues={instances:$H(),get:function(b){if(!Object.isString(b)){return b}return this.instances.get(b)||this.instances.set(b,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(b){function c(g,e){return((g[e+"Internal"]?"this.options."+e+"Internal(this);":"")+(g[e]?"this.options."+e+"(this);":""))}if(b&&b.transition===false){b.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),b||{});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 e(h,g){if(h.options[g+"Internal"]){h.options[g+"Internal"](h)}if(h.options[g]){h.options[g](h)}}return function(g){if(this.state==="idle"){this.state="running";e(this,"beforeSetup");if(this.setup){this.setup()}e(this,"afterSetup")}if(this.state==="running"){g=(this.options.transition(g)*this.fromToDelta)+this.options.from;this.position=g;e(this,"beforeUpdate");if(this.update){this.update(g)}e(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(e){if(e>=this.startOn){if(e>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var c=(e-this.startOn)/this.totalTime,b=(c*this.totalFrames).round();if(b>this.currentFrame){this.render(c);this.currentFrame=b}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(b){if(this.options[b+"Internal"]){this.options[b+"Internal"](this)}if(this.options[b]){this.options[b](this)}},inspect:function(){var b=$H();for(property in this){if(!Object.isFunction(this[property])){b.set(property,this[property])}}return"#<Effect:"+b.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(b){this.effects=b||[];this.start(arguments[1])},update:function(b){this.effects.invoke("render",b)},finish:function(b){this.effects.each(function(c){c.render(1);c.cancel();c.event("beforeFinish");if(c.finish){c.finish(b)}c.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(e,k,h){e=Object.isString(e)?$(e):e;var c=$A(arguments),g=c.last(),b=c.length==5?c[3]:null;this.method=Object.isFunction(g)?g.bind(e):Object.isFunction(e[g])?e[g].bind(e):function(l){e[g]=l};this.start(Object.extend({from:k,to:h},b||{}))},update:function(b){this.method(b)}});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(c){this.element=$(c);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(b){this.element.setOpacity(b)}});Effect.Move=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);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(b){this.element.setStyle({left:(this.options.x*b+this.originalLeft).round()+"px",top:(this.options.y*b+this.originalTop).round()+"px"})}});Effect.MoveBy=function(c,b,e){return new Effect.Move(c,Object.extend({x:e,y:b},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(c,e){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:e},arguments[2]||{});this.start(b)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(c){this.originalStyle[c]=this.element.style[c]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var b=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(c){if(b.indexOf(c)>0){this.fontSize=parseFloat(b);this.fontSizeType=c}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(b){var c=(this.options.scaleFrom/100)+(this.factor*b);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*c+this.fontSizeType})}this.setDimensions(this.dims[0]*c,this.dims[1]*c)},finish:function(b){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(b,g){var h={};if(this.options.scaleX){h.width=g.round()+"px"}if(this.options.scaleY){h.height=b.round()+"px"}if(this.options.scaleFromCenter){var e=(b-this.dims[0])/2;var c=(g-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){h.top=this.originalTop-e+"px"}if(this.options.scaleX){h.left=this.originalLeft-c+"px"}}else{if(this.options.scaleY){h.top=-e+"px"}if(this.options.scaleX){h.left=-c+"px"}}}this.element.setStyle(h)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);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(b){return parseInt(this.options.startcolor.slice(b*2+1,b*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(b){return parseInt(this.options.endcolor.slice(b*2+1,b*2+3),16)-this._base[b]}.bind(this))},update:function(b){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,e,g){return c+((this._base[g]+(this._delta[g]*b)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(e){var c=arguments[1]||{},b=document.viewport.getScrollOffsets(),g=$(e).cumulativeOffset();if(c.offset){g[1]+=c.offset}return new Effect.Tween(null,b.top,g[1],c,function(h){scrollTo(b.left,h.round())})};Effect.Fade=function(e){e=$(e);var b=e.getInlineOpacity();var c=Object.extend({from:e.getOpacity()||1,to:0,afterFinishInternal:function(g){if(g.options.to!=0){return}g.element.hide().setStyle({opacity:b})}},arguments[1]||{});return new Effect.Opacity(e,c)};Effect.Appear=function(c){c=$(c);var b=Object.extend({from:(c.getStyle("display")=="none"?0:c.getOpacity()||0),to:1,afterFinishInternal:function(e){e.element.forceRerendering()},beforeSetup:function(e){e.element.setOpacity(e.options.from).show()}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Puff=function(c){c=$(c);var b={opacity:c.getInlineOpacity(),position:c.getStyle("position"),top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};return new Effect.Parallel([new Effect.Scale(c,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(b)}},arguments[1]||{}))};Effect.BlindUp=function(b){b=$(b);b.makeClipping();return new Effect.Scale(b,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(c){c=$(c);var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(c){c=$(c);var b=c.getInlineOpacity();return new Effect.Appear(c,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(g){g.element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.element.hide().undoClipping().undoPositioned().setStyle({opacity:b})}})}},arguments[1]||{}))};Effect.DropOut=function(c){c=$(c);var b={top:c.getStyle("top"),left:c.getStyle("left"),opacity:c.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(c,{x:0,y:100,sync:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(b)}},arguments[1]||{}))};Effect.Shake=function(g){g=$(g);var c=Object.extend({distance:20,duration:0.5},arguments[1]||{});var h=parseFloat(c.distance);var e=parseFloat(c.duration)/10;var b={top:g.getStyle("top"),left:g.getStyle("left")};return new Effect.Move(g,{x:h,y:0,duration:e,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-h*2,y:0,duration:e*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:h*2,y:0,duration:e*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-h*2,y:0,duration:e*2,afterFinishInternal:function(n){new Effect.Move(n.element,{x:h*2,y:0,duration:e*2,afterFinishInternal:function(o){new Effect.Move(o.element,{x:-h,y:0,duration:e,afterFinishInternal:function(p){p.element.undoPositioned().setStyle(b)}})}})}})}})}})}})};Effect.SlideDown=function(e){e=$(e).cleanWhitespace();var b=e.down().getStyle("bottom");var c=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(g){g.element.makePositioned();g.element.down().makePositioned();if(window.opera){g.element.setStyle({top:""})}g.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(g){g.element.down().setStyle({bottom:(g.dims[0]-g.element.clientHeight)+"px"})},afterFinishInternal:function(g){g.element.undoClipping().undoPositioned();g.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.SlideUp=function(e){e=$(e).cleanWhitespace();var b=e.down().getStyle("bottom");var c=e.getDimensions();return new Effect.Scale(e,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(g){g.element.makePositioned();g.element.down().makePositioned();if(window.opera){g.element.setStyle({top:""})}g.element.makeClipping().show()},afterUpdateInternal:function(g){g.element.down().setStyle({bottom:(g.dims[0]-g.element.clientHeight)+"px"})},afterFinishInternal:function(g){g.element.hide().undoClipping().undoPositioned();g.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.Squish=function(b){return new Effect.Scale(b,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(c){c.element.makeClipping()},afterFinishInternal:function(c){c.element.hide().undoClipping()}})};Effect.Grow=function(e){e=$(e);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var b={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var l=e.getDimensions();var m,k;var h,g;switch(c.direction){case"top-left":m=k=h=g=0;break;case"top-right":m=l.width;k=g=0;h=-l.width;break;case"bottom-left":m=h=0;k=l.height;g=-l.height;break;case"bottom-right":m=l.width;k=l.height;h=-l.width;g=-l.height;break;case"center":m=l.width/2;k=l.height/2;h=-l.width/2;g=-l.height/2;break}return new Effect.Move(e,{x:m,y:k,duration:0.01,beforeSetup:function(n){n.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(n){new Effect.Parallel([new Effect.Opacity(n.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(n.element,{x:h,y:g,sync:true,transition:c.moveTransition}),new Effect.Scale(n.element,100,{scaleMode:{originalHeight:l.height,originalWidth:l.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(o){o.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(o){o.effects[0].element.undoClipping().undoPositioned().setStyle(b)}},c))}})};Effect.Shrink=function(e){e=$(e);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var b={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var k=e.getDimensions();var h,g;switch(c.direction){case"top-left":h=g=0;break;case"top-right":h=k.width;g=0;break;case"bottom-left":h=0;g=k.height;break;case"bottom-right":h=k.width;g=k.height;break;case"center":h=k.width/2;g=k.height/2;break}return new Effect.Parallel([new Effect.Opacity(e,{sync:true,to:0,from:1,transition:c.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:true,transition:c.scaleTransition,restoreAfterFinish:true}),new Effect.Move(e,{x:h,y:g,sync:true,transition:c.moveTransition})],Object.extend({beforeStartInternal:function(l){l.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(l){l.effects[0].element.hide().undoClipping().undoPositioned().setStyle(b)}},c))};Effect.Pulsate=function(e){e=$(e);var c=arguments[1]||{},b=e.getInlineOpacity(),h=c.transition||Effect.Transitions.linear,g=function(k){return 1-h((-Math.cos((k*(c.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(k){k.element.setStyle({opacity:b})}},c),{transition:g}))};Effect.Fold=function(c){c=$(c);var b={top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};c.makeClipping();return new Effect.Scale(c,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(e){new Effect.Scale(c,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(g){g.element.hide().undoClipping().setStyle(b)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(b.style)){this.style=$H(b.style)}else{if(b.style.include(":")){this.style=b.style.parseStyle()}else{this.element.addClassName(b.style);this.style=$H(this.element.getStyles());this.element.removeClassName(b.style);var c=this.element.getStyles();this.style=this.style.reject(function(g){return g.value==c[g.key]});b.afterFinishInternal=function(g){g.element.addClassName(g.options.style);g.transforms.each(function(h){g.element.style[h.style]=""})}}}this.start(b)},setup:function(){function b(c){if(!c||["rgba(0, 0, 0, 0)","transparent"].include(c)){c="#ffffff"}c=c.parseColor();return $R(0,2).map(function(e){return parseInt(c.slice(e*2+1,e*2+3),16)})}this.transforms=this.style.map(function(l){var k=l[0],h=l[1],g=null;if(h.parseColor("#zzzzzz")!="#zzzzzz"){h=h.parseColor();g="color"}else{if(k=="opacity"){h=parseFloat(h);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(h)){var e=h.match(/^([\+\-]?[0-9\.]+)(.*)$/);h=parseFloat(e[1]);g=(e.length==3)?e[2]:null}}}var c=this.element.getStyle(k);return{style:k.camelize(),originalValue:g=="color"?b(c):parseFloat(c||0),targetValue:g=="color"?b(h):h,unit:g}}.bind(this)).reject(function(c){return((c.originalValue==c.targetValue)||(c.unit!="color"&&(isNaN(c.originalValue)||isNaN(c.targetValue))))})},update:function(b){var g={},c,e=this.transforms.length;while(e--){g[(c=this.transforms[e]).style]=c.unit=="color"?"#"+(Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*b)).toColorPart()+(Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*b)).toColorPart()+(Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*b)).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*b).toFixed(3)+(c.unit===null?"":c.unit)}this.element.setStyle(g,true)}});Effect.Transform=Class.create({initialize:function(b){this.tracks=[];this.options=arguments[1]||{};this.addTracks(b)},addTracks:function(b){b.each(function(c){c=$H(c);var e=c.values().first();this.tracks.push($H({ids:c.keys().first(),effect:Effect.Morph,options:{style:e}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(b){var g=b.get("ids"),e=b.get("effect"),c=b.get("options");var h=[$(g)||$$(g)].flatten();return h.map(function(k){return new e(k,Object.extend({sync:true},c))})}).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 c,b=$H();if(Prototype.Browser.WebKit){c=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';c=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(e){if(c[e]){b.set(e,c[e])}});if(Prototype.Browser.IE&&this.include("opacity")){b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return b};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(c){var b=document.defaultView.getComputedStyle($(c),null);return Element.CSS_PROPERTIES.inject({},function(e,g){e[g]=b[g];return e})}}else{Element.getStyles=function(c){c=$(c);var b=c.currentStyle,e;e=Element.CSS_PROPERTIES.inject({},function(g,h){g[h]=b[h];return g});if(!e.opacity){e.opacity=c.getOpacity()}return e}}Effect.Methods={morph:function(b,c){b=$(b);new Effect.Morph(b,Object.extend({style:c},arguments[2]||{}));return b},visualEffect:function(e,h,c){e=$(e);var g=h.dasherize().camelize(),b=g.charAt(0).toUpperCase()+g.substring(1);new Effect[b](e,c);return e},highlight:function(c,b){c=$(c);new Effect.Highlight(c,b);return c}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(b){Effect.Methods[b]=function(e,c){e=$(e);Effect[b.charAt(0).toUpperCase()+b.substring(1)](e,c);return e}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(b){Effect.Methods[b]=Element[b]});Element.addMethods(Effect.Methods);var ccErrorNo=0;var ccErrors=new Array();ccErrors[0]="Unknown card type";ccErrors[1]="No card number provided";ccErrors[2]="Credit card number is in invalid format";ccErrors[3]="Credit card number is invalid";ccErrors[4]="Credit card number has an inappropriate number of digits";function checkCreditCard(r,e){var c=new Array();c[0]={name:"Visa",length:"13,16",prefixes:"4",checkdigit:true};c[1]={name:"MasterCard",length:"16",prefixes:"51,52,53,54,55",checkdigit:true};c[2]={name:"DinersClub",length:"14,16",prefixes:"300,301,302,303,304,305,36,38,55",checkdigit:true};c[3]={name:"CarteBlanche",length:"14",prefixes:"300,301,302,303,304,305,36,38",checkdigit:true};c[4]={name:"AmEx",length:"15",prefixes:"34,37",checkdigit:true};c[5]={name:"Discover",length:"16",prefixes:"6011,650",checkdigit:true};c[6]={name:"JCB",length:"15,16",prefixes:"3,1800,2131",checkdigit:true};c[7]={name:"enRoute",length:"15",prefixes:"2014,2149",checkdigit:true};c[8]={name:"Solo",length:"16,18,19",prefixes:"6334, 6767",checkdigit:true};c[9]={name:"Switch",length:"16,18,19",prefixes:"4903,4905,4911,4936,564182,633110,6333,6759",checkdigit:true};c[10]={name:"Maestro",length:"16",prefixes:"5020,6",checkdigit:true};c[11]={name:"VisaElectron",length:"16",prefixes:"417500,4917,4913",checkdigit:true};c[12]={name:"BahnCard",length:"16",prefixes:"1,2,3,4,5,6,7,8,9",checkdigit:true};var b=-1;for(var o=0;o<c.length;o++){if(e.toLowerCase()==c[o].name.toLowerCase()){b=o;break}}if(b==-1){ccErrorNo=0;return false}if(r.length==0){ccErrorNo=1;return false}r=r.replace(/\s/g,"");var v=r;var s=/^[0-9]{13,19}$/;if(!s.exec(v)){ccErrorNo=2;return false}if(c[b].checkdigit){var q=0;var u="";var n=1;var m;for(o=v.length-1;o>=0;o--){m=Number(v.charAt(o))*n;if(m>9){q=q+1;m=m-10}q=q+m;if(n==1){n=2}else{n=1}}if(q%10!=0){ccErrorNo=3;return false}}var l=false;var t=false;var g;var p=new Array();var h=new Array();p=c[b].prefixes.split(",");for(o=0;o<p.length;o++){var k=new RegExp("^"+p[o]);if(k.test(v)){t=true}}if(!t){ccErrorNo=3;return false}h=c[b].length.split(",");for(n=0;n<h.length;n++){if(v.length==h[n]){l=true}}if(!l){ccErrorNo=4;return false}return true}function alert(e){var b=function(){this.hide()};var c=new YAHOO.widget.SimpleDialog("alertBox",{width:"300px",fixedcenter:true,visible:false,draggable:true,close:true,modal:true,constraintoviewport:true,text:e,icon:"none",buttons:[{text:"Ok",handler:b,isDefault:true}]});c.setHeader("Germanwings.com");c.render(document.body);c.show()}function clearDefaultValue(obj){with(obj){if(value==defaultValue){value="";style.color="#666666"}}}function restoreDefaultValue(obj){with(obj){if(value==""){style.color="";value=defaultValue}}}function initDefaultValueBehavior(){$$("input.defaultValue").each(function(b){$(b).observe("click",function(){if(this.value==this.defaultValue){this.value="";$(this).removeClassName("defaultValue")}});$(b).observe("blur",function(){if((this.value==this.defaultValue)||(this.value=="")){this.value=this.defaultValue;$(this).addClassName("defaultValue")}})})}function initErrorInputBehavior(){$$("input.error").each(function(b){$(b).observe("click",function(){if(this.value==this.defaultValue){this.value="";$(this).addClassName("correcting")}});$(b).observe("blur",function(){if((this.value==this.defaultValue)||(this.value=="")){this.value=this.defaultValue;$(this).removeClassName("correcting")}})})}document.observe("dom:loaded",function(){initDefaultValueBehavior();initErrorInputBehavior()});function initFlightChoice(){var b=$$("#FlightChoice input[ type=radio ]");b.each(function(c){c.hiliteMyLine=function(){if(this.checked){var e=this.up("table").childElements();e.each(function(h){h.removeClassName("selected");var g=h.childElements();g.each(function(k){k.removeClassName("selected")})});this.up("tr").addClassName("selected");this.up("tbody").addClassName("selected")}};Event.observe(c,"click",function(){this.hiliteMyLine()});c.hiliteMyLine()})}function Tooltips(){var e=false;var k=false;var m=false;var n=false;var h=false;var b=false;var g=false;this.OpenToLeft=function(p){k=-215;n=-9;posFactor=0;o(p,"rightSide")};this.OpenToRight=function(p){k=18;n=-9;posFactor=1;o(p,"leftSide")};this.OpenToLeftNew=function(q){var r=new Array();r[0]=$$("div#InBoundMarket td.TableHeaderFareCenter");var p=r[0][0].getHeight();k=-140;n=p+5;posFactor=0;l(q,"rightSide")};this.Close=function(){$("IbeToolTip").down(".content").innerHTML="";$("IbeToolTip").style.visibility="hidden"};function o(p,q){tiptext=$(p).down(".toolTip");tipbox=$("IbeToolTip").down(".content");if(tiptext&&tipbox){tipbox.innerHTML=tiptext.innerHTML}else{return}c($(p));$("IbeToolTip").down(".arrow").className="arrow "+q;css={left:e+k+(posFactor*Element.getWidth($(p).down("div")))+"px",top:m+n+(Element.getHeight($(p).down("div"))/2)+"px",zIndex:2000,visibility:"visible"};$("IbeToolTip").setStyle(css);return}function l(p,q){tiptext=$(p).down(".toolTip");tipbox=$("IbeToolTip").down(".content");if(tiptext&&tipbox){tipbox.innerHTML=tiptext.innerHTML}else{return}c($(p));$("IbeToolTip").down(".arrow").className="arrow "+q;css={left:e+k+"px",top:m+n+"px",zIndex:2000,visibility:"visible"};$("IbeToolTip").setStyle(css);return}function c(p){pos=Position.cumulativeOffset(p);e=pos[0];m=pos[1]}}function initToolTips(){var b=new Array();b[0]=$$("#OutBound th");b[1]=$$("#InBound th");for(i=0;i<b.length;i++){b[i].each(function(c){if(c.className!=""){c.className=c.className+" resultList"}})}var b=new Array();b[0]=$$("#OutBound th.flexPlus");b[1]=$$("#OutBound th.basic");b[2]=$$("#OutBound th.via");b[3]=$$("#InBound th.flexPlus");b[4]=$$("#InBound th.basic");b[5]=$$("#InBound th.via");for(i=0;i<b.length;i++){b[i].each(function(c){var e=function(g){tooltipObj.OpenToLeft(this)};c.observe("mouseover",e);c.observe("mouseout",tooltipObj.Close)})}}function initToolTipsNew(){var b=new Array();b[0]=$$("div#OutBoundMarket td.TableHeaderFareCenter");for(i=0;i<b.length;i++){b[i].each(function(c){var e=function(g){tooltipObj.OpenToLeftNew(this)};c.observe("mouseover",e);c.observe("mouseout",tooltipObj.Close)})}var b=new Array();b[0]=$$("div#InBoundMarket td.TableHeaderFareCenter");for(i=0;i<b.length;i++){b[i].each(function(c){var e=function(g){tooltipObj.OpenToLeftNew(this)};c.observe("mouseover",e);c.observe("mouseout",tooltipObj.Close)})}}function initClassicTooltips(){setUpClassicTooltips($$("div#OutBoundMarket td.TableHeaderFareCenter"),true);setUpClassicTooltips($$("div#InBoundMarket td.TableHeaderFareCenter"),false)}function setUpClassicTooltips(c,b){c.each(function(h){var g=h.down("div.IbeToolTip");if(g!=null){var k=h.cumulativeOffset();var e;if(b){e=h.getWidth()+20}else{e=-220}g.setStyle({top:k.top+5+"px",left:k.left+e+"px"});h.observe("mouseover",function(l){g.show();l.stop()});h.observe("mouseout",function(l){g.hide();l.stop()});g.observe("mouseover",function(l){g.hide();l.stop()})}})}function containsDOM(b,e){var c=false;do{if((c=b==e)){break}e=e.parentNode}while(e!=null);return c}function checkMouseEnter(c,b){if(c.contains&&b.fromElement){return !c.contains(b.fromElement)}else{if(b.relatedTarget){return !containsDOM(c,b.relatedTarget)}}}function checkMouseLeave(c,b){if(c.contains&&b.toElement){return !c.contains(b.toElement)}else{if(b.relatedTarget){return !containsDOM(c,b.relatedTarget)}}}function initPassengerIcons(){if(document.getElementById&&document.getElementById("Passengers")){var g=document.getElementById("Passengers")}else{if(document.all&&document.all.Passengers){var g=document.all.Passengers}else{return}}var b=g.getElementsByTagName("P")||g.all.tags("P");for(i=0;i<b.length;i++){var e=b[i].getElementsByTagName("A")||b[i].all.tags("A");var c=b[i].getElementsByTagName("INPUT")[0]||b[i].all.tags("INPUT")[0];b[i].ageGrp=e;b[i].onmouseout=function(k){var k=k||window.event;if(checkMouseLeave(this,k)){var h=0;for(i=0;i<this.ageGrp.length;i++){if(this.ageGrp[i].className.indexOf("booked")>-1){this.ageGrp[i].className="booked";h=i}else{if(i<h+2){this.ageGrp[i].className="gray"}else{this.ageGrp[i].className="hidden"}}}}};c.ageGrp=e;if(i==0){c.minAmount=1}else{c.minAmount=0}c.onclick=function(){this.select()};c.onkeyup=function(l){var l=l||window.event;var k=l.which||l.keyCode;if(((k>47)&&(k<58))||((k>95)&&(k<106))){var h=k%48;this.value=h;if(this.value!=this.defaultValue){for(i=0;i<this.ageGrp.length;i++){if(h<this.minAmount){this.value=this.defaultValue;return false}else{if(i<h){this.ageGrp[i].className="booked"}else{if(i<h+1){this.ageGrp[i].className="gray"}else{this.ageGrp[i].className="hidden"}}}}this.defaultValue=this.value}}};for(j=0;j<e.length;j++){if(i!=0&&j==0){e[j].removable=true;if(e[j].className=="booked"){e[j].removed=false}else{e[j].removed=true}}e[j].idx=j;e[j].mySiblings=e;e[j].myInput=c;e[j].onmouseover=function(){var h=0;for(i=0;i<this.mySiblings.length;i++){if(this.mySiblings[i].className.indexOf("booked")>-1){if(i>this.idx){$(this.mySiblings[i]).removeClassName("highLight");$(this.mySiblings[i]).addClassName("lowLight")}else{if(this.mySiblings[i].removable&&!this.mySiblings[i].removed&&(i>=this.idx)){$(this.mySiblings[i]).removeClassName("highLight");$(this.mySiblings[i]).addClassName("lowLight")}else{$(this.mySiblings[i]).removeClassName("lowLight");$(this.mySiblings[i]).addClassName("highLight")}}h=i}else{if(i<=this.idx){this.mySiblings[i].className="highLight"}if(i>this.idx){if((i<this.idx+2)||(i<h+2)){this.mySiblings[i].className="gray"}else{this.mySiblings[i].className="hidden"}}}}if(this.removable&&!this.removed){this.myInput.value=0}else{this.myInput.value=this.idx+1}this.parentNode.lastOver=this.idx};e[j].onmouseout=function(k){var k=k||window.event;if(k.stopPropagation){k.stopPropagation()}else{k.cancelBubble=true}var h;for(i=0;i<this.mySiblings.length;i++){if(this.mySiblings[i].className.indexOf("booked")>-1){this.mySiblings[i].className="booked";h=i}else{if(i<h+1){this.mySiblings[i].className="gray"}else{if(i<this.parentNode.lastOver+1){this.mySiblings[i].className="gray"}else{this.mySiblings[i].className="hidden"}}}}this.myInput.value=this.myInput.defaultValue};e[j].onclick=function(){for(i=0;i<this.mySiblings.length;i++){if(this.className.indexOf("booked")>-1){if(i<this.idx){this.mySiblings[i].className="booked"}else{if(i<this.idx+2){this.mySiblings[i].className="gray"}else{this.mySiblings[i].className="hidden"}}}else{if(i<=this.idx){this.mySiblings[i].className="booked"}else{if(i<this.idx+2){this.mySiblings[i].className="gray"}else{this.mySiblings[i].className="hidden"}}}}if(this.removable){if(this.removed){this.myInput.value=1;this.className="booked"}else{this.myInput.value=0;this.className="gray"}this.removed=!this.removed}else{this.myInput.value=this.idx+1;this.className="booked"}this.myInput.defaultValue=this.myInput.value;return false}}}}function UpdatePassengerCount(e,l,b,k){$(l).value=e;if($(l).value!=$(l).defaultValue){var c=document.getElementById("Passengers");var g=c.getElementsByTagName("P");for(i=0;i<g.length;i++){var h=g[b].getElementsByTagName("A");g[b].ageGrp=h;for(i=0;i<h.length;i++){if(i<e){h[i].className="booked"}else{if(!k){if(i<e+1){h[i].className="gray"}else{h[i].className="hidden"}}else{h[i].className="hidden"}}}}$(l).defaultValue=$(l).value}}function init(){valignButtonsInTeaser.set();if(document.getElementById("transparentLayer")){transparentLayer.open()}if(document.getElementById("popupLayer")||document.getElementById("formWerbenNewsletter24")){popupLayerShadowForIE6.set();popupLayer.open()}if(document.getElementById("ibeHome")){ibeHomeShadowForIE6.set()}}var windowOpen={open:function(e,c,g,b){f=window.open(e,c,"width="+g+",height="+b+",scrollbars=yes,status=yes,toolbar=no,location=no,directories=no,resizable=yes,menubar=yes");setTimeout("f.focus()",200)}};var transparentLayer={pageWidth:false,pageheight:false,init:function(){scrollWidth=document.getElementsByTagName("body")[0].offsetWidth;scrollHeight=document.getElementsByTagName("body")[0].offsetHeight;documentWidth=document.getElementsByTagName("body")[0].scrollLeft;documentHeight=document.getElementsByTagName("body")[0].scrollTop;if(window.innerWidth){windowWidth=window.innerWidth;windowHeight=window.innerHeight}else{windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight}if((documentWidth-scrollWidth)>windowWidth){this.pageWidth=documentWidth-scrollWidth}else{this.pageWidth=windowWidth}if((documentHeight-scrollHeight)>windowHeight){this.pageHeight=documentHeight-scrollHeight}else{this.pageHeight=windowHeight}},open:function(){if(document.getElementById("transparentLayer")){this.init();document.getElementById("transparentLayer").style.width="100%";document.getElementById("transparentLayer").style.height=this.pageHeight+"px";document.getElementById("transparentLayer").style.zIndex="19999";document.getElementById("transparentLayer").style.visibility="visible"}},close:function(){if(document.getElementById("transparentLayer")){document.getElementById("transparentLayer").style.visibility="hidden"}},debug:function(){alert(this.pageWidth+" x "+this.pageHeight)}};var popupLayer={close:function(){if(document.getElementById("popupLayer")){document.getElementById("popupLayer").style.visibility="hidden"}else{if(document.getElementById("formWerbenNewsletter24")){document.getElementById("formWerbenNewsletter24").style.visibility="hidden"}}transparentLayer.close()},open:function(){if(document.getElementById("popupLayer")){document.getElementById("popupLayer").style.zIndex="20000";document.getElementById("popupLayer").style.visibility="visible"}else{if(document.getElementById("formWerbenNewsletter24")){document.getElementById("formWerbenNewsletter24").style.zIndex="20000";document.getElementById("formWerbenNewsletter24").style.visibility="visible"}}}};var popupLayerShadowForIE6={set:function(){if(document.all&&!window.opera){preffix="";if(document.getElementById("formWerbenNewsletter24")){preffix="werben_"}var b={top:{obj:document.getElementById("PopupLayerTop"),src:"images/structure/background/bg_"+preffix+"popupLayer_top.png"},content:{obj:document.getElementById("PopupLayerVertical"),src:"images/structure/background/bg_"+preffix+"popupLayer_vertical.png"},bottom:{obj:document.getElementById("PopupLayerBottom"),src:"images/structure/background/bg_"+preffix+"popupLayer_bottom.png"}};b.top["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.top["src"]+', sizingMethod="image")';b.top["obj"].style.backgroundColor="transparent";b.content["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.content["src"]+', sizingMethod="scale")';b.content["obj"].style.backgroundColor="transparent";b.bottom["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.bottom["src"]+', sizingMethod="image")';b.bottom["obj"].style.backgroundColor="transparent"}}};var ibeHomeShadowForIE6={set:function(){if(!document.getElementById("ibeHome")){return false}if(document.all&&!window.opera){var b={top:{obj:document.getElementById("shadowTop"),src:"/es/Images/bg_shadow_1_4_top.png"},content:{obj:document.getElementById("shadowContent"),src:"/es/Images/bg_shadow_1_4_content.png"},bottom:{obj:document.getElementById("shadowBottom"),src:"/es/Images/bg_shadow_1_4_bottom.gif"}};b.top["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.top["src"]+', sizingMethod="image")';b.top["obj"].style.backgroundColor="transparent";b.content["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.content["src"]+', sizingMethod="scale")';b.content["obj"].style.backgroundColor="transparent";b.bottom["obj"].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+b.bottom["src"]+', sizingMethod="image")';b.bottom["obj"].style.backgroundColor="transparent"}}};var valignButtonsInTeaser={check:function(e){var c=e.getElementsByTagName("div");for(var b=0;b<c.length;b++){if(c[b].className.indexOf("link")>-1){return true}}return false},set:function(){myDivs=document.getElementsByTagName("div");myAlignGroups=new Array();for(var c=0;c<myDivs.length;c++){if(myDivs[c].className.indexOf("alignButton")>-1){if(this.check(myDivs[c])){x=myDivs[c].offsetHeight;var b=myDivs[c].getElementsByTagName("DIV");for(j=0;j<b.length;j++){b[j].parentNode.style.height=x+25+"px"}}}}}};var motion=false;var decrease=0.9;function slideInit(b,k,h,e,c){var g=b.parentNode.nextSibling;while(g.nodeType!=1){g=g.nextSibling}if(!motion){window.slideObj=g;slideObj.toggle=b;if(slideObj.className.indexOf("noCollapse")>-1){if(!slideObj.style.height){slideObj.minHt=slideObj.offsetHeight-2;slideObj.style.height=slideObj.minHt+"px"}}else{slideObj.minHt=0;if(!slideObj.style.height){slideObj.style.height="0px"}}if(k){slideObj.sideBorder=false}else{slideObj.sideBorder=true}if(h){b.style.visibility="hidden"}else{b.style.visibility=""}if(b.getElementsByTagName("IMG").length==1){slideObj.toggleImage=b.getElementsByTagName("IMG")[0];slideObj.imageOpen=new Image();slideObj.imageOpen.src=e;slideObj.imageClose=new Image();slideObj.imageClose.src=c}if(!slideObj.direc){slideObj.direc=1}slideObj.speed=parseInt(slideObj.getElementsByTagName("DIV")[0].offsetHeight/4);slide()}return false}function slide(){window.clearTimeout(motion);slideObj.speed*=decrease;ht=parseInt(slideObj.style.height);if(slideObj.direc>0){if(slideObj.sideBorder){slideObj.style.borderStyle="solid"}if(ht<(slideObj.getElementsByTagName("DIV")[0].offsetHeight)){slideObj.style.height=ht+Math.ceil(slideObj.speed)+"px";if(slideObj.sideBorder){slideObj.style.borderStyle="solid"}}else{slideObj.style.height=slideObj.getElementsByTagName("DIV")[0].offsetHeight+"px";slideObj.toggle.className="open";if(slideObj.toggleImage&&slideObj.imageClose){slideObj.toggleImage.src=slideObj.imageClose.src}slideObj.direc*=-1;motion=false;return}}else{if(ht>slideObj.minHt){var b=ht-Math.ceil(slideObj.speed);if(b<slideObj.minHt){b=slideObj.minHt}slideObj.style.height=b+"px"}else{slideObj.style.height=slideObj.minHt+"px";if(!slideObj.minHt){slideObj.style.borderStyle="none"}slideObj.toggle.className="closed";if(slideObj.toggleImage&&slideObj.imageOpen){slideObj.toggleImage.src=slideObj.imageOpen.src}slideObj.direc*=-1;motion=false;return}}motion=window.setTimeout("slide()",83)}function toggleSlideContainer(b,c){if(navigator.userAgent.toUpperCase().indexOf("MSIE")>-1){simpleToggleSlideContainer(b,c)}else{slideToggleSlideContainer(b,c)}return false}function simpleToggleSlideContainer(b,c){if($(b).visible()){$(b).hide();$(c).className="closed"}else{$(b).show();$(c).className="open"}return false}function slideToggleSlideContainer(b,c){Effect.toggle($(b),"blind");if($(b).visible()){$(c).className="closed"}else{$(c).className="open"}return false}function changeOption(c){for(var b=0;b<c.length;b++){if(c[b].selected){c[b].style.fontWeight="bold"}else{c[b].style.fontWeight="normal"}}}function newsletter_email(b,c){if(b.value==""){b.style.color="#c1c1c1";b.value=c}}function newsletter_email_clear(b,c){if(b.value==c){b.style.color="#000000";b.value=""}}function zaehlen(){var b=501;anz=document.pressekontakt_form.Pressekontakt_Anliegen.value.length+1;document.pressekontakt_form.anzeige.value=b-anz;uebrig=b-anz;if(anz>=b){alert("Maximum erreicht !!!")}return uebrig}var px=10;var timer;var merker;function scrollDiv(b){clearTimeout(timer);d=document.getElementById("ScrollArea");y=d.scrollTop;if(b==1){y-=px}if(b==2){y+=px}if(y<=d.scrollHeight-d.offsetHeight+px&&y>=0-px){d.scrollTop=y;timer=setTimeout("scrollDiv("+b+")",50)}if(y<0||y>d.scrollHeight-d.offsetHeight){clearTimeout(timer)}}function zaehlenFAQ(){var b=501;anz=document.faq.faq_ihre_anfrage.value.length+1;document.faq.anzeige.value=b-anz;uebrig=b-anz;if(anz>=b){alert("Maximum erreicht !!!")}return uebrig}function switchLanguage(b){var c=b.options[b.options.selectedIndex].value;if(c!=""){window.location.href=c}}function gw_maxLengthTextArea(c,e,b){if((e.keyCode>=37&&e.keyCode<=40)||e.keyCode==8||e.keyCode==13||e.keyCode==35||e.keyCode==36||e.keyCode==46){return true}if(c.value.length+1>b){return false}else{return true}}function gw_updateCounter(e,c,b){c.update(b-e.value.length)}function popupSized(g,c,e,b){positionx=(screen.width/2)-(e/2);positiony=(screen.height/2)-(b/2);window.open(g,c,"width="+e+",height="+b+",resizable=yes,status=no,scrollbars=yes,toolbar=no,menubar=no,left="+positionx+",top="+positiony+",screenX="+positionx+",screenY="+positiony)}function slideInitUnternehmen(b,c){merker=b;if(!motion){window.slideObj=document.getElementById(c);slideObj.toggle=b;if(!slideObj.direc){slideObj.direc=1}slideObj.speed=parseInt(slideObj.getElementsByTagName("DIV")[0].offsetHeight/4);slideUnternehmen()}return false}function slideUnternehmen(){window.clearTimeout(motion);slideObj.speed*=decrease;ht=parseInt(slideObj.style.height);if(slideObj.direc>0){if(ht<(slideObj.getElementsByTagName("DIV")[0].offsetHeight)){slideObj.style.height=ht+Math.ceil(slideObj.speed)+"px"}else{slideObj.style.height=slideObj.getElementsByTagName("DIV")[0].offsetHeight+"px";slideObj.toggle.className="open";merker.style.visibility="hidden";slideObj.direc*=-1;motion=false;return}}else{if(ht>0){var b=ht-Math.ceil(slideObj.speed);if(b<0){b=0}slideObj.style.height=b+"px"}else{slideObj.style.height="0px";slideObj.toggle.className="";merker.style.visibility="visible";slideObj.direc*=-1;motion=false;return}}motion=window.setTimeout("slideUnternehmen()",40)}function mouseX(b){if(b.pageX){return b.pageX}else{if(b.clientX){return b.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft)}else{return null}}}function mouseY(b){if(b.pageY){return b.pageY}else{if(b.clientY){return b.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}else{return null}}}function displayImage(k,l){var c=document.getElementById("Container");try{var h=c.getElementsByTagName("IMG")[0];c.removeChild(h)}catch(g){}var b=document.createElement("IMG");b.src=l;c.appendChild(b);c.style.top=mouseY(k)+"px";c.style.left=mouseX(k)+"px";c.style.display="block"}function emptyContainer(){var b=document.getElementById("Container");var c=b.getElementsByTagName("IMG")[0];b.removeChild(c);b.style.display="none"}function openContentPopup(url,winName,w,h){var parameter="width="+w+",height="+h+",left="+eval((screen.width-w)/2)+",top=50,scrollbars=yes,resizable=yes,location=no,menubar=no,toolbar=no";a=window.open(url,winName,parameter);a.focus();return false}var servicesChoicesBaggageDecided=false;var servicesChoicesInsuranceDecided=false;function servicesChoicesCheck(b){if(window.ScBaggageModule!=undefined&&servicesChoicesBaggageDecided==false){if(ScBaggageModule.outwardBagCount==0&&ScBaggageModule.returnBagCount==0){servicesChoicesPopup(servicesChoicesData.baggageHeaderImage,servicesChoicesData.baggageBodyText,servicesChoicesData.baggageAcceptLabel,servicesChoicesData.baggageChangeButtonImage,function(c){$("ServicesChoicesPopup").hide();servicesChoicesBaggageDecided=true;c.stop();if(window.ScTravelInsuranceModule==null||(window.ScTravelInsuranceModule!=null&&ScTravelInsuranceModule.fee>0)){$("__EVENTTARGET").value=b;$("SkySales").submit()}else{performNext()}},function(c){window.location.href="#Baggage";$("ServicesChoicesPopup").hide();if(!$("BaggageSlideContainer").visible()){toggleSlideContainer("BaggageSlideContainer",$("BaggageSlider"))}servicesChoicesBaggageDecided=false;c.stop()});return false}}if(window.ScTravelInsuranceModule!=undefined&&servicesChoicesInsuranceDecided==false){if(ScTravelInsuranceModule.fee==null||ScTravelInsuranceModule.fee==0){servicesChoicesPopup(servicesChoicesData.elviaHeaderImage,servicesChoicesData.elviaBodyText,servicesChoicesData.elviaAcceptLabel,servicesChoicesData.elviaChangeButtonImage,function(c){$("ServicesChoicesPopup").hide();servicesChoicesInsuranceDecided=true;c.stop();$("__EVENTTARGET").value=b;$("SkySales").submit()},function(c){window.location.href="#Insurance";$("ServicesChoicesPopup").hide();servicesChoicesInsuranceDecided=false;c.stop()});return false}}return true}function servicesChoicesPopup(g,m,n,c,e,h){$("ServicesChoicesText").update(m);var k=$("ServicesChoicesHeading").childElements()[0];var l=$("ServicesChoicesAccept").childElements()[0];var b=$("ServicesChoicesChange").childElements()[0];k.src=g.src;k.alt=g.alt;b.src=c.src;b.alt=c.alt;l.update(n);if(e!=null){l.stopObserving();l.observe("click",e.bindAsEventListener(l))}if(h!=null){b.stopObserving();b.observe("click",h.bindAsEventListener(b))}$("ServicesChoicesPopup").show();l.focus()}function checkFormInput(c,e){var b=document.search.SearchQueryText.value;if(b==""){document.search.SearchQueryText.value=e}else{if(b==e){document.search.SearchQueryText.value=""}}}function ToggleCollapseState(c,g){try{var b=document.getElementById(g);if(b){if(b.style.display=="none"||b.className.indexOf("hidden")>-1){c.src="images/NewCSS/button-collapse.gif";if(collapseButtonHideTitle){c.title="Hide"}b.style.display="block";if(b.className.indexOf("hidden")>-1){b.className=b.className.substring(0,b.className.indexOf("hidden")-1)}}else{c.src="images/NewCSS/button-expand.gif";if(collapseButtonShowTitle){c.title=collapseButtonShowTitle}b.style.display="none"}}else{alert("Unable to find target body")}}catch(h){alert(h.message)}}var defaultXOffset=0;var defaultYOffset=0;var hintDiv="cssHint";function showHint(b){showHint(b,null,null,null)}function showHint(c,b,e){showHint(c,b,e,null)}function showHintWithReference(c,b){showHint(c,null,null,b)}function showHint(h,g,k,e){var c=0;var l=0;if(!e){c=getX(h);l=getY(h);if(g==null){c+=h.offsetWidth+5}}else{c=getX(e);l=getY(e);if(g==null){c+=e.offsetWidth+5}}var b="";if(h.getAttribute("hint")!=null){b+=h.getAttribute("hint")}if(h.getAttribute("serverHint")!=null){if(h.getAttribute("hintPriority")!=null){if(h.hintPriority=="server"){b=h.getAttribute("serverHint")+b}else{b+=h.getAttribute("serverHint")}}else{b+=h.getAttribute("serverHint")}}getObject(hintDiv).innerHTML=b;getStyle(hintDiv).visibility="visible";g=(g!=null)?g:defaultXOffset;k=(k!=null)?k:defaultYOffset;getStyle(hintDiv).left=g+c+"px";getStyle(hintDiv).top=k+l+"px"}function hideHint(b){getStyle(hintDiv).visibility="hidden"}function getX(b){var c=0;if(b.x){c+=b.x}else{if(b.offsetParent){while(b.offsetParent){c+=b.offsetLeft;b=b.offsetParent}}}return c}function getY(c){var b=0;var e=0;if(c.y){e+=c.y}else{if(c){while(c){e+=c.offsetTop;c=c.offsetParent}}}return e}function getObject(b){if(document.getElementById){return document.getElementById(b)}if(document.all){return document.all[b]}if(document.layers){if(document.layers[b]){return document.layers[b]}else{return document.layers[b].layers[b]}}}function getStyle(b){if(document.getElementById){return document.getElementById(b).style}if(document.all){return document.all[b].style}if(document.layers){if(document.layers[b]){return document.layers[b]}else{return this.style=document.layers[b].layers[b]}}}var errorsHeader="Please correct the following.\n\n";function Validate(h,g,b,k){this.form=h;this.namespace=g;this.errors="";this.setfocus=null;this.errorsHeader=b;if(k){this.regexElementIdFilter=k}this.requiredAttribute="required";this.requiredEmptyAttribute="requiredEmpty";this.validationTypeAttribute="validationtype";this.regexAttribute="regex";this.minLengthAttribute="minlength";this.numericMinLengthAttribute="numericminlength";this.maxLengthAttribute="maxlength";this.numericMaxLengthAttribute="numericmaxlength";this.minValueAttribute="minvalue";this.maxValueAttribute="maxvalue";this.equalsAttribute="equals";this.defaultErrorAttribute="error";this.requiredErrorAttribute="requirederror";this.validationTypeErrorAttribute="validationtypeerror";this.regexErrorAttribute="regexerror";this.minLengthErrorAttribute="minlengtherror";this.maxLengthErrorAttribute="maxlengtherror";this.minValueErrorAttribute="minvalueerror";this.maxValueErrorAttribute="maxvalueerror";this.equalsErrorAttribute="equalserror";this.defaultError="{name} is invalid.";this.defaultRequiredError="{name} is required.";this.defaultValidationTypeError="{name} is invalid.";this.defaultRegexError="{name} is invalid.";this.defaultMinLengthError="{name} is too short in length.";this.defaultMaxLengthError="{name} is too long in length.";this.defaultMinValueError="{name} must be greater than {minValue}.";this.defaultMaxValueError="{name} must be less than {maxValue}.";this.defaultEqualsError="{name} is not equal to {equals}";this.defaultNotEqualsError="{name} cannot equal {equals}";this.run=run;this.validateSingleElement=validateSingleElement;this.outputErrors=outputErrors;this.checkFocus=checkFocus;this.setError=setError;this.cleanAttributeForErrorDisplay=cleanAttributeForErrorDisplay;this.validateRequired=validateRequired;this.validateType=validateType;this.validateRegex=validateRegex;this.validateMinLength=validateMinLength;this.validateMaxLength=validateMaxLength;this.validateMinValue=validateMinValue;this.validateMaxValue=validateMaxValue;this.validateEquals=validateEquals;this.isExemptFromValidation=isExemptFromValidation;this.setValidateTypeError=setValidateTypeError;this.validateAmount=validateAmount;this.validateDate=validateDate;this.validateMod10=validateMod10;this.validateNumeric=validateNumeric;this.stringPattern="^.+$";this.upperCaseStringPattern="^[A-Z]([A-Z)|s)*$";this.numericPattern="^\\d+$";this.numericStripper=/\D/g;this.alphaNumericPattern="^\\w+$";var c="(\\.|,)";this.amountPattern="^(\\d+("+c+"\\d+)*)$";this.dateYearPattern="^\\d{4}$";this.dateMonthPattern="^\\d{2}$";this.dateDayPattern="^\\d{2}$";var e="[^:,;#$%&()+=/]+";this.emailPattern="^"+e+"(\\."+e+")?@"+e+"(\\."+e+")+$"}function checkKeyPressed(c,e){c=(c)?c:(window.event)?event:null;if(c){var b=(c.charCode)?c.charCode:((c.keyCode)?c.keyCode:((c.which)?c.which:0));if(b==13){e.click()}}}function run(){for(var b=0;b<this.form.length;b++){var c=this.form.elements[b];if(!this.isExemptFromValidation(c)){this.validateSingleElement(c)}}return this.outputErrors()}function isExemptFromValidation(b){if(b.id.indexOf(this.namespace)!=0){return true}if((this.regexElementIdFilter)&&(!b.id.match(this.regexElementIdFilter))){return true}return false}function outputErrors(){if(this.errors){alert(this.errorsHeader+this.errors);if(this.setfocus){this.setfocus.focus()}return false}return true}function validateSingleElement(b){this.validateRequired(b);if(0<b.value.length){this.validateType(b);this.validateRegex(b);this.validateMinLength(b);this.validateMaxLength(b);this.validateMinValue(b);this.validateMaxValue(b);this.validateEquals(b)}}function checkFocus(b){if(!this.setfocus){this.setfocus=b}}function validateRequired(b){if((b.getAttribute(this.requiredAttribute)=="true")&&((b.value.length<1)||(b.value==b.getAttribute(this.requiredEmptyAttribute)))){this.setError(b,this.requiredErrorAttribute,this.defaultRequiredError)}}function validateType(g){var b=g.getAttribute(this.validationTypeAttribute);var c=g.value;if(b){if((b=="Address")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}else{if((b=="AlphaNumeric")&&(!c.match(this.alphaNumericPattern))){this.setValidateTypeError(g)}else{if((b=="Amount")&&(!this.validateAmount(c))){this.setValidateTypeError(g)}else{if((b=="Country")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}else{if((b=="Email")&&(!c.match(this.emailPattern))){this.setValidateTypeError(g)}else{if((b=="Mod10")&&(!this.validateMod10(c))){this.setValidateTypeError(g)}else{if((b=="Name")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}else{if((b=="Numeric")&&(!this.validateNumeric(c))){this.setValidateTypeError(g)}else{if((b.indexOf("Date")==0)&&(!this.validateDate(g,b,c))){this.setValidateTypeError(g)}else{if((b=="State")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}else{if((b=="String")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}else{if((b=="UpperCaseString")&&(!c.match(this.upperCaseStringPattern))){this.setValidateTypeError(g)}else{if((b=="Zip")&&(!c.match(this.stringPattern))){this.setValidateTypeError(g)}}}}}}}}}}}}}}}function validateRegex(c){var b=c.getAttribute(this.regexAttribute);if((b)&&(!c.value.match(b))){this.setError(c,this.regexErrorAttribute,this.defaultRegexError)}}function validateMinLength(g){var b=g.getAttribute(this.minLengthAttribute);var c=g.getAttribute(this.numericMinLengthAttribute);if((0<b)&&(g.value.length<b)){this.setError(g,this.minLengthErrorAttribute,this.defaultMinLengthError)}else{if((0<c)&&(0<g.value.length)&&(g.value.replace(this.numericStripper,"").length<c)){this.setError(g,this.minLengthErrorAttribute,this.defaultMinLengthError)}}}function validateMaxLength(g){var b=g.getAttribute(this.maxLengthAttribute);var c=g.getAttribute(this.numericMaxLengthAttribute);if((0<b)&&(b<g.value.length)){this.setError(g,this.maxLengthErrorAttribute,this.defaultMaxLengthError)}else{if((0<c)&&(0<g.value.length)&&(c<g.value.replace(this.numericStripper,"").length)){this.setError(g,this.maxLengthErrorAttribute,this.defaultMaxLengthError)}}}function validateMinValue(c){var b=c.getAttribute(this.minValueAttribute);if((b!=null)&&(0<b.length)){if((5<b.length)&&(b.substring(0,5)=="&gt;=")){if(c.value<parseFloat(b.substring(5,b.length))){this.setError(c,this.minValueErrorAttribute,this.defaultMinValueError)}}else{if((4<b.length)&&(b.substring(0,4)=="&gt;")){if(c.value<=parseFloat(b.substring(4,b.length))){this.setError(c,this.minValueErrorAttribute,this.defaultMinValueError)}}else{if(c.value<parseFloat(b)){this.setError(c,this.minValueErrorAttribute,this.defaultMinValueError)}}}}}function validateMaxValue(c){var b=c.getAttribute(this.maxValueAttribute);if((b!=null)&&(0<b.length)){if((5<b.length)&&(b.substring(0,5)=="&lt;=")){if(c.value>parseFloat(b.substring(5,b.length))){this.setError(c,this.maxValueErrorAttribute,this.defaultMaxValueError)}}else{if((4<b.length)&&(b.substring(0,4)=="&lt;")){if(c.value>=parseFloat(b.substring(4,b.length))){this.setError(c,this.maxValueErrorAttribute,this.defaultMaxValueError)}}else{if(parseFloat(c.value)>b){this.setError(c,this.maxValueErrorAttribute,this.defaultMaxValueError)}}}}}function validateEquals(c){var b=c.getAttribute(this.equalsAttribute);if((b!=null)&&(0<b.length)){if((2<b.length)&&(b.substring(0,2)=="!=")){if(c.value==b.substring(2,b.length)){this.setError(c,this.equalsErrorAttribute,this.defaultEqualsError)}}else{if((2<b.length)&&(b.substring(0,2)=="==")){if(c.value!=b.substring(2,b.length)){this.setError(c,this.equalsErrorAttribute,this.defaultEqualsError)}}else{if(b.charAt(0)=="="){if(c.value!=b.substring(1,b.length)){this.setError(c,this.equalsErrorAttribute,this.defaultEqualsError)}}else{if(c.value!=b){this.setError(c,this.equalsErrorAttribute,this.defaultEqualsError)}}}}}}function setValidateTypeError(b){this.setError(b,this.validationTypeErrorAttribute,this.defaultValidationTypeError)}function setError(l,k,m){var c=l.getAttribute(k);if(!c){if(l.getAttribute(this.defaultErrorAttribute)){c=l.getAttribute(this.defaultErrorAttribute)}else{if(m){c=m}else{c=this.defaultError}}}var h=c.match(/{\s*(\w+)\s*}/g);if(h){for(var g=0;g<h.length;g++){var b=h[g].replace(/{\s*(\w+)\s*}/,"$1");c=c.replace(/{\s*\w+\s*}/,this.cleanAttributeForErrorDisplay(l,b))}}this.errors+=c+"\n";this.checkFocus(l)}function cleanAttributeForErrorDisplay(g,b){var c=g.getAttribute(b.toLowerCase());if(c==null){return b}if(b.match(/^(minvalue|maxvalue)$/i)){return c.replace(/[^\d.,]/g,"")}return c}function validateAmount(b){if((!b.match(this.amountPattern))||(b==0)){return false}return true}function validateDate(h,c,g){var b=new Date();if((c=="DateYear")&&((g<b.getYear())||(!g.match(this.dateYearPattern)))){return false}else{if((c=="DateMonth")&&(!g.match(this.dateMonthPattern))){return false}else{if((c=="DateDay")&&(!g.match(this.DateDayPattern))){return false}}}return true}function validateMod10(h){var g=/\D/;var c=h.replace(/ /g,"");if(!g.test(c)){var e;var b=0;while(c.length<16){c="0"+c}for(digitCounter=c.length-1;0<=digitCounter;digitCounter-=2){b+=parseInt(c.charAt(digitCounter));e=String((c.charAt(digitCounter-1)*2));for(var k=0;k<e.length;k++){b+=parseInt(e.charAt(k))}}return(b%10==0)}return false}function validateNumeric(b){b=b.replace(/\s/g,"");if(!b.match(this.numericPattern)){return false}return true}function validate(e,b,c){if(e!="ControlGroupContactView_MemberInputView"&&e!="CONTROLGROUPREGISTERVIEW_MemberInputRegisterView"&&e!="ControlGroupUpdateProfileView1_MemberInputUpdateProfileView"&&e!="ControlGroupRegisterViewBoomerang_MemberInputBoomerangRegisterView"){if(document.getElementById&&document.createTextNode){var g=new Validate(document.SkySales,e+"_",errorsHeader,c);if(b){g.validateSingleElement(document.getElementById(e+"_"+b));return g.outputErrors()}return g.run()}}return true}function VerifyMemberInput(c){var b=document.getElementById(c+"_PasswordFieldAgentPassword");if(b){if(b.value.length==0){alert(b.getAttribute("regexError"));b.focus();return false}}return true}var submitterClicked=false;function preventDoubleClick(){if(!submitterClicked){submitterClicked=true;return true}return false}var events=new Array();function register(eventName,functionName){if(eval(events[eventName])==null){events[eventName]=new Array()}events[eventName][events[eventName].length]=functionName}function raise(eventName,eventArgs){var undefined;if(events[eventName]!=undefined){for(var ix=0;ix<events[eventName].length;ix++){if(eval(events[eventName][ix]+"(eventArgs)")==false){return false}}}return true}function WindowLoadEventArgs(){}function WindowInitialize(){var b=window.onload;window.onload=function(){raise("WindowLoad",new WindowLoadEventArgs());if(b){b()}}}function debug(){var c=debug.arguments.length;if(c>0){var b=""+debug.arguments[0]+" [";for(var e=1;e<c;e++){b+=""+debug.arguments[e];if(c!=(e+1)){b+=", "}}alert(b+"]")}}function displayPopUpConverter(){var b="CurrencyConverter.aspx";if(!window.converterWindow||converterWindow.closed){converterWindow=window.open(b,"converter","width=360,height=190,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0")}else{converterWindow.open(b,"converter","width=360,height=190,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0");converterWindow.focus()}}Number.prototype.formatMoney=function(m,k,g){var l=this,m=isNaN(m=Math.abs(m))?2:m,k=k==undefined?",":k,g=g==undefined?".":g,h=l<0?"-":"",e=parseInt(l=Math.abs(+l||0).toFixed(m))+"",b=(b=e.length)>3?b%3:0;return h+(b?e.substr(0,b)+g:"")+e.substr(b).replace(/(\d{3})(?=\d)/g,"$1"+g)+(m?k+Math.abs(l-e).toFixed(m).slice(2):"")};var _departureStation="";var _isArrivalStation="";function FlightSearchAutocomplete(g,h,e,c,b){this.departureStationField=g;this.arrivalStationField=h;this.departureStationFormField=e;this.arrivalStationFormField=c;this.disableCologneBonnConnect=b;this.formFields=new Object();this.formFields[this.departureStationField]=this.departureStationFormField;this.formFields[this.arrivalStationField]=this.arrivalStationFormField;this.activeField=null;this.departureAutoComplete=null;this.arrivalAutoComplete=null;this.stationDataSource=null;this.initializeAutoCompleteFields=function(){this.stationDataSource=new YAHOO.util.FunctionDataSource(this.stationList);this.stationDataSource.responseSchema={fields:["code","name","active"]};this.stationDataSource.scope=this;this.departureAutoComplete=this.createAutoComplete(this.departureStationField);this.arrivalAutoComplete=this.createAutoComplete(this.arrivalStationField);var k=$(this.departureStationField);Event.observe(k,"click",this.selectAll.bind(k));Event.observe(k,"focus",this.selectAll.bind(k));var l=$(this.arrivalStationField);Event.observe(l,"click",this.selectAll.bind(l));Event.observe(l,"focus",this.selectAll.bind(l))};this.selectAll=function(){this.select()};this.stationList=function(r){stationListResult=Array();var o=decodeURIComponent(r);var m=SortedStations;var s=0;var p=false;for(var n=0;n<m.length;n++){var k=Stations[m[n]].name;var l=Stations[m[n]].code;var t=true;if(_isArrivalStation==true&&_departureStation!=""){t=false;if(RouteIndex[_departureStation+l]==true){t=true;if(l=="CGN"){p=true}}}else{if(Stations[m[n]].mkts==0){t=false}}var q=false;if(o.toLowerCase()==l.toLowerCase()||k.toLowerCase().indexOf(o.toLowerCase())==0){q=true}if(q==true&&t==true){stationListResult[s]=Array();stationListResult[s][0]=l;stationListResult[s][1]=k;stationListResult[s][2]=t;s++}}if((this.disableCologneBonnConnect===undefined||this.disableCologneBonnConnect==false)&&typeof CologneBonnConnectLabel!="undefined"){if(p){stationListResult[s]=Array();stationListResult[s][0]="CBC";stationListResult[s][1]=CologneBonnConnectLabel;stationListResult[s][2]=true}}return stationListResult};this.createAutoComplete=function(p){var m=new YAHOO.widget.AutoComplete(p,(p+"Container"),this.stationDataSource);m.formatResult=this.formatResult;m.resultTypeList=false;m.forceSelection=false;m.minQueryLength=0;m.animVert=false;m.maxResultsDisplayed=this.getStationsCount();m.itemSelectEvent.subscribe(this.selectStation,this);m.textboxFocusEvent.subscribe(this.setActiveField,this);m.containerExpandEvent.subscribe(startRenderStationIcon);m.containerCollapseEvent.subscribe(stopRenderStationIcon);var k=false;if(p==this.arrivalStationField){k=true}if($(p+"Toggle")){var n=$(p+"Toggle");var o=new YAHOO.widget.Button({container:n});var l=function(q){if(m.isContainerOpen()){m.collapseContainer()}else{if(k){_isArrivalStation=true}else{_isArrivalStation=false}m.getInputEl().focus();setTimeout(function(){m.sendQuery("")},0)}};o.on("click",l)}return m};this.getStationsCount=function(){return SortedStations.length};this.selectStation=function(o,n,k){var l=n[2];var m=n[0].getInputEl();m.value=l.name;$(k.formFields[m.id]).value=l.code;if(l.code!="CBC"&&RouteIndex[$(k.departureStationFormField).value+$(k.arrivalStationFormField).value]!==true){if(_isArrivalStation){if($(k.departureStationFormField).value!=""){$(k.departureStationField).value="";$(k.departureStationFormField).value=""}}else{if($(k.arrivalStationFormField).value!=""){$(k.arrivalStationField).value="";$(k.arrivalStationFormField).value=""}}}if(!_isArrivalStation){_departureStation=l.code}};this.setActiveField=function(m,l,k){k.activeField=l[0].getInputEl().id;if(k.activeField==k.arrivalStationField){_isArrivalStation=true}else{_isArrivalStation=false}};this.tabStationField=function(l){if(l.keyCode==9){var k=this.arrivalAutoComplete.getInputEl().id;setTimeout("$('"+k+"').focus()",10)}};this.formatResult=function(l,r,k){var o="active-station";if(!l.active){o="inactive-station"}var n=false;var t="";var p="";if(_isArrivalStation==false){var s=GetAirlinesByAirport(l.code);if(s.length==1){t=s[0];n=true;p="o_"}}else{n=IsOtherAirlineRoute(_departureStation,l.code);t=GetAirlineCodeByRoute(_departureStation,l.code);p="d_"}var m="<div class='station "+o+"'><div class='name'>"+l.name+"</div><div class='code'>"+l.code+"</div></div>";if(n==true&&t=="DE"){var q=p+"oal_"+t+"_"+l.code;m="<div id='"+q+"' class='station "+o+"' ><div class='name' style='width:100px;overflow:hidden;'>"+l.name+"</div><div class='code'>"+l.code+"</div></div>";sta_changeItemArray.push(q)}return m};this.initializeAutoCompleteFields()}var sta_changeItemNum=0;var sta_changeInterval;var sta_changeItemArray=new Array();function startRenderStationIcon(c,b){sta_changeItemNum=0;sta_changeItemArray=sta_changeItemArray.reverse();clearInterval(sta_changeInterval);if(sta_changeItemArray.length>0){sta_changeInterval=setInterval("renderStationIconAsync()",25)}}function stopRenderStationIcon(c,b){clearInterval(sta_changeInterval);sta_changeItemArray=new Array();sta_changeItemNum=0}function renderStationIconAsync(){if(document.getElementById(sta_changeItemArray[sta_changeItemNum])){var b=document.getElementById(sta_changeItemArray[sta_changeItemNum]);b.style.backgroundImage="url(/skysales/Images/GermanwingsNew/logos/airline-icons/DE.gif)";b.style.paddingLeft="18px";b.style.backgroundPosition="left";b.style.backgroundRepeat="no-repeat"}sta_changeItemNum++;if(sta_changeItemNum>=sta_changeItemArray.length){clearInterval(sta_changeInterval)}}var FlightSearchMessages={OtherAirline:function(g,k,b,e,l,h){var m=false;var c=GetAirlineCodeByRoute(g,k);if(typeof CologneBonnConnectLabel!="undefined"&&k=="CBC"){FlightSearchMessages.CologneBonnConnect(CologneBonnConnectLabel,CologneBonnConnectPrompt,b,e,l.CBC,function(){this.hide()});m=true}else{if(c=="2A"){FlightSearchMessages.RFMessage(c,g,k,b,e,l["2A"],function(){this.hide()},h);m=true}else{if(c=="2AA"){FlightSearchMessages.RFMessage(c,g,k,b,e,l["2AA"],function(){this.hide()},h);m=true}else{if(c=="XG"){FlightSearchMessages.OALMessage(c,g,k,"Clickair",b,e,l.XG,function(){this.hide()});m=true}else{if(c=="WW"){FlightSearchMessages.OALMessage(c,g,k,"<img src='/skysales/Images/GermanwingsNew/logos/bmibaby.gif' alt='bmibaby' />",b,e,l.WW,function(){this.hide()});m=true}else{if(c=="VY"){FlightSearchMessages.OALMessage(c,g,k,"<img src='/skysales/Images/GermanwingsNew/logos/vueling.gif' alt='Vueling' />",b,e,l.VY,function(){this.hide()});m=true}else{if(c=="DE"){FlightSearchMessages.OALMessage(c,g,k,"<img src='/skysales/Images/GermanwingsNew/logos/condor.gif' alt='Condor' />",b,e,l.DE,function(){this.hide()});m=true}}}}}}}return m},RFMessage:function(q,o,l,h,b,n,g,c){var p=OperatorInfo[q];var k=GetViaStationByRoute(o,l);p=p.replace(/{ORIGIN}/g,Stations[o].name);p=p.replace(/{DESTINATION}/g,Stations[l].name);p=p.replace(/\n/g,"<br/>");if(k!=""){p=p.replace(/{VIA}/g,Stations[k].name)}var m="<div style='padding:10px;'><img src='"+c+"' /><br/><br/><span>"+p+"</span></div>";var e=new YAHOO.widget.SimpleDialog("rfMessageBox",{width:"380px",fixedcenter:true,visible:false,draggable:true,close:true,modal:true,constraintoviewport:false,text:m,icon:"none",buttons:[{text:h,handler:n,isDefault:true},{text:b,handler:g,isDefault:false}]});e.setHeader("Germanwings.com");e.render(document.body);e.show()},CologneBonnConnect:function(g,c,b,e,l,h){var m="<div style='padding:10px;'><h2 style='color:#77003D;'>Cologne Bonn Connect</h2><br/><span>"+c.replace(/\n/g,"<br/>")+"</span></div>";var k=new YAHOO.widget.SimpleDialog("cbcMessageBox",{width:"380px",fixedcenter:true,visible:false,draggable:true,close:true,modal:true,constraintoviewport:false,text:m,icon:"none",buttons:[{text:b,handler:l,isDefault:true},{text:e,handler:h,isDefault:false}]});k.setHeader("Germanwings.com");k.render(document.body);k.show()},OALMessage:function(p,m,h,n,g,b,l,e){var o=OperatorInfo[p];o=o.replace(/{ORIGIN}/g,Stations[m].name);o=o.replace(/{DESTINATION}/g,Stations[h].name);o=o.replace(/\n/g,"<br/>");var k="<div style='padding:10px;'><h2 style='color:#77003D;'>"+n+"</h2><br/><span>"+o+"</span></div>";var c=new YAHOO.widget.SimpleDialog("oalMessageBox",{width:"380px",fixedcenter:true,visible:false,draggable:true,close:true,modal:true,constraintoviewport:false,text:k,icon:"none",buttons:[{text:g,handler:l,isDefault:true},{text:b,handler:e,isDefault:false}]});c.setHeader("Germanwings.com");c.render(document.body);c.show()},TodayMessage:function(g,e){var b=g;b=b.replace(/\n/g,"<br/>");var h="<div style='padding:10px;'><span>"+b+"</span></div>";var c=new YAHOO.widget.SimpleDialog("todayMessageBox",{width:"380px",fixedcenter:true,visible:false,draggable:false,close:true,modal:true,constraintoviewport:false,text:h,icon:"none",buttons:[{text:"OK",handler:e,isDefault:true}]});c.setHeader("Germanwings.com");c.render(document.body);c.show()}};function flightSearch(k,p,C,e,b,A,l,h,t,B,n,z,w,u,D,v,r,s,m,o,q,c){this.departureStationField=e;this.departureStationFormField=A;this.arrivalStationField=b;this.arrivalStationFormField=l;this.oneWayField=k;this.roundTripField=p;this.returnDateLabel=C;this.flightPlanExpiration=z;this.searchButton=B;this.searchForm=n;this.linkButtonName=s;this.adultPassengerField=w;this.childPassengerField=u;this.infantPassengerField=D;this.okButtonLabel=o.OKBUTTONLABEL;this.cancelButtonLabel=o.CANCELBUTTONLABEL;this.searchErrors=m;this.searchSettings=o;this.isRebooking=q;this.changeStatus=c;if(this.okButtonLabel==""){this.okButtonLabel="OK"}if(this.cancelButtonLabel==""){this.cancelButtonLabel="Cancel"}var g=this;if(!g.isRebooking){Event.observe(this.oneWayField,"click",function(){g.switchFlightType(1,g)});Event.observe(this.roundTripField,"click",function(){g.switchFlightType(2,g)})}$("datePickerOutward").onblur=function(){g.updateCalByField("datePickerOutward")};$("datePickerReturn").onblur=function(){g.updateCalByField("datePickerReturn")};$(this.searchButton).onclick=function(){var E=false;if(g.validate()){g.updatePassengerSystemFields();g.updateDateSystemFields();E=true}if(E){if(!g.isRebooking){var H={"2A":function(J){this.hide();J.executeSearch(GetViaStationByRoute($(J.autoComplete.formFields.departureStation).value,$(J.autoComplete.formFields.arrivalStation).value),$(J.autoComplete.formFields.arrivalStation).value)}.curry(g),"2AA":function(J){this.hide();J.executeSearch($(J.autoComplete.formFields.departureStation).value,GetViaStationByRoute($(J.autoComplete.formFields.departureStation).value,$(J.autoComplete.formFields.arrivalStation).value))}.curry(g),XG:function(J){this.hide();J.OALMethod("XG")}.curry(g),WW:function(J){this.hide();J.OALMethod("WW")}.curry(g),VY:function(J){this.hide();J.OALMethod("VY")}.curry(g),DE:function(J){this.hide();J.OALMethod("DE")}.curry(g),CBC:function(K){this.hide();var J=2;if(CurrentCompactCulture.toLowerCase()=="de-de"){J=1}window.open(CologneBonnConnectURL+"?pid=1&from="+$(K.autoComplete.formFields.departureStation).value+"&lang="+J,"CBCWindow")}.curry(g)};if(!FlightSearchMessages.OtherAirline($(A).value,$(l).value,g.okButtonLabel,g.cancelButtonLabel,H,"Images/GermanwingsNew/logos/rail_and_fly.gif")){var I=Date.UTC(g.outwardDate.getFullYear(),(g.outwardDate.getMonth()+1),g.outwardDate.getDate());var G=new Date();var F=Date.UTC(G.getFullYear(),(G.getMonth()+1),G.getDate());if(I==F&&typeof(todaysDateMessage)!="undefined"&&todaysDateMessage!=""){if(todaysDateMessage!=""){FlightSearchMessages.TodayMessage(todaysDateMessage,function(){this.hide();g.executeSearch($(g.autoComplete.formFields.departureStation).value,$(g.autoComplete.formFields.arrivalStation).value)})}}else{$("__EVENTTARGET").value=g.linkButtonName;$(g.searchForm).submit()}}}else{var I=Date.UTC(g.outwardDate.getFullYear(),(g.outwardDate.getMonth()+1),g.outwardDate.getDate());var G=new Date();var F=Date.UTC(G.getFullYear(),(G.getMonth()+1),G.getDate());if(I==F&&typeof(todaysDateMessage)!="undefined"&&todaysDateMessage!=""){if(todaysDateMessage!=""){FlightSearchMessages.TodayMessage(todaysDateMessage,function(){this.hide();g.executeSearch($(g.departureStationFormFields).value,$(g.arrivalStationFormFields).value)})}}else{$("__EVENTTARGET").value=g.linkButtonName;$(g.searchForm).submit()}}}return E};this.outwardCalendarContainer=h;this.returnCalendarContainer=t;if(!this.isRebooking){this.autoComplete=new FlightSearchAutocomplete(this.departureStationField,this.arrivalStationField,A,l)}this.initializeCalendars();if(!this.isRebooking){this.updateSettingsFromQueryString()}this.applySettings();if(this.changeStatus!=null&&this.changsStatus!=""){if(this.changeStatus=="ReturnFlight"){this.returnCalendar.cfg.setProperty("mindate",this.outwardCalendar.getSelectedDates()[0]);this.returnCalendar.render()}else{if(this.changeStatus=="OutboundFlight"){this.outwardCalendar.cfg.setProperty("maxdate",this.returnCalendar.getSelectedDates()[0]);this.outwardCalendar.render()}}}}flightSearch.prototype.oneWayField;flightSearch.prototype.roundTripField;flightSearch.prototype.departureStationField;flightSearch.prototype.departureStationFormField;flightSearch.prototype.arrivalStationField;flightSearch.prototype.arrivalStationFormField;flightSearch.prototype.outwardCalendarContainer;flightSearch.prototype.returnCalendarContainer;flightSearch.prototype.returnDateLabel;flightSearch.prototype.flightPlanExpiration;flightSearch.prototype.searchButton;flightSearch.prototype.adultPassengerField;flightSearch.prototype.childPassengerField;flightSearch.prototype.infantPassengerField;flightSearch.prototype.passengerSystemFields;flightSearch.prototype.dateSystemFields;flightSearch.prototype.isRebooking;flightSearch.prototype.changeStatus;flightSearch.prototype.okButtonLabel;flightSearch.prototype.cancelButtonLabel;flightSearch.prototype.linkButtonName;var _departureStation="";var _isArrivalStation="";flightSearch.prototype.outwardCalendar;flightSearch.prototype.returnCalendar;flightSearch.prototype.outwardDate;flightSearch.prototype.returnDate;flightSearch.prototype.searchSettings;flightSearch.prototype.searchErrors;flightSearch.prototype.updateCalByField=function(l){var n=$(l).value;var g=new Date();try{var b=n.split(".");var k=b[0];if(k.length==2&&k.substring(0,1)=="0"){k=k.replace("0","")}var h=b[1];if(h.length==2&&h.substring(0,1)=="0"){h=h.replace("0","")}var c=b[2];if(c.length==2&&c.substring(0,1)=="0"){c=c.replace("0","")}g.setFullYear(parseInt(c));g.setMonth(parseInt(h)-1);g.setDate(parseInt(k));if(l=="datePickerOutward"){this.outwardCalendar.cfg.setProperty("pagedate",g);this.outwardCalendar.select(g);this.outwardCalendar.render()}else{this.returnCalendar.cfg.setProperty("pagedate",g);this.returnCalendar.select(g);this.returnCalendar.render()}}catch(m){}$(l).style.visibility="hidden"};flightSearch.prototype.applySettings=function(){if(typeof(this.searchSettings.OUTWARDDATE)!="undefined"){var b=this.searchSettings.OUTWARDDATE.split("-");var c=new Date();c.setFullYear(b[0]);c.setMonth(parseInt(b[1],10)-1);c.setDate(b[2]);var k=String((c.getMonth()+1)+"/"+c.getFullYear());this.outwardCalendar.cfg.setProperty("pagedate",k);this.outwardCalendar.select(c)}if(typeof(this.searchSettings.RETURNDATE)!="undefined"){if(this.searchSettings.FLIGHTTYPE!="undefined"&&this.searchSettings.FLIGHTTYPE=="RoundTrip"){var g=this.searchSettings.RETURNDATE.split("-");var h=new Date();h.setFullYear(g[0]);h.setMonth(parseInt(g[1],10)-1);h.setDate(g[2]);var e=String((h.getMonth()+1)+"/"+h.getFullYear());this.returnCalendar.cfg.setProperty("pagedate",e);this.returnCalendar.select(h)}}if(!this.isRebooking){if(typeof(this.searchSettings.ADT_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.ADT_PAXCOUNT,this.adultPassengerField,0,false)}if(typeof(this.searchSettings.CHD_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.CHD_PAXCOUNT,this.childPassengerField,1,false)}if(typeof(this.searchSettings.INF_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.INF_PAXCOUNT,this.infantPassengerField,2,false)}}else{if(typeof(this.searchSettings.ADT_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.ADT_PAXCOUNT,this.adultPassengerField,0,true)}if(typeof(this.searchSettings.CHD_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.CHD_PAXCOUNT,this.childPassengerField,1,true)}if(typeof(this.searchSettings.INF_PAXCOUNT)!="undefined"){UpdatePassengerCount(this.searchSettings.INF_PAXCOUNT,this.infantPassengerField,2,true)}}if(typeof(this.searchSettings.ORIGIN)!="undefined"&&this.searchSettings.ORIGIN!="NULL"){$(this.departureStationField).value=Stations[this.searchSettings.ORIGIN].name;if(!this.isRebooking){$(this.autoComplete.formFields[this.departureStationField]).value=this.searchSettings.ORIGIN}else{$(this.departureStationFormField).value=this.searchSettings.ORIGIN}}if(typeof(this.searchSettings.DESTINATION)!="undefined"&&this.searchSettings.DESTINATION!="NULL"){$(this.arrivalStationField).value=Stations[this.searchSettings.DESTINATION].name;if(!this.isRebooking){$(this.autoComplete.formFields[this.arrivalStationField]).value=this.searchSettings.DESTINATION}else{$(this.arrivalStationFormField).value=this.searchSettings.DESTINATION}}if(typeof(this.searchSettings.FLIGHTTYPE)!="undefined"){if(this.searchSettings.FLIGHTTYPE=="OneWay"){this.switchFlightType(1,this)}else{this.switchFlightType(2,this)}}};flightSearch.prototype.updateSettingsFromQueryString=function(){if(!this.searchSettings){this.searchSettings=new Object()}var c=this.getQuerySetting("Origin1").toUpperCase();if(c!="NULL"){this.searchSettings.ORIGIN=c}var k=this.getQuerySetting("Destination1").toUpperCase();if(k!="NULL"){this.searchSettings.DESTINATION=k}var h=this.getQuerySetting("Day1");var b=this.getQuerySetting("MonthYear1");if(h!="null"&&b!="null"){this.searchSettings.OUTWARDDATE=b+"-"+h}var g=this.getQuerySetting("Day2");var e=this.getQuerySetting("MonthYear2");if(g!="null"&&e!="null"){this.searchSettings.RETURNDATE=e+"-"+g}var l=this.getQuerySetting("RadioButtonMarketStructure");if(l=="oneway"&&l!="null"){this.searchSettings.FLIGHTTYPE="OneWay"}};flightSearch.prototype.getQuerySetting=function(b){var h=window.location.search.substring(1).toLowerCase();var g=new Array();g=h.split("&");for(var e=0;e<g.length;e++){if(g[e].indexOf(b.toLowerCase())>=0){var c=new Array();c=g[e].split("=");return c[1]}}return"null"};flightSearch.prototype.initializeCalendars=function(){this.outwardCalendar=this.createCalendar("outward",this.outwardCalendarContainer);this.returnCalendar=this.createCalendar("return",this.returnCalendarContainer)};flightSearch.prototype.createCalendar=function(e,c){var g=new YAHOO.widget.Calendar(e,c);g.cfg.setProperty("start_weekday",1);g.cfg.setProperty("mindate",new Date());g.cfg.setProperty("maxdate",this.flightPlanExpiration);var b=new Array();b[0]=this;b[1]=g;if(this.changeStatus!=null&&this.changsStatus!=""){if((this.changeStatus=="OutboundFlight"&&e=="return")||(this.changeStatus=="ReturnFlight"&&e=="outward")||(this.searchSettings.FLIGHTTYPE!="undefined"&&this.searchSettings.FLIGHTTYPE=="OneWay"&&e=="return")){$(c).style.visibility="hidden";$(c+"Header").style.visibility="hidden"}}g.selectEvent.subscribe(this.setDate,b,true);if(typeof(localizeCalendar)!="undefined"){g=localizeCalendar(g)}g.render();return g};flightSearch.prototype.setDate=function(m,l,c){var h=new Date(l[0][0][0],(l[0][0][1]-1),l[0][0][2]);var b=c[0].outwardCalendar.cfg.getProperty("pagedate");var p=c[0].returnCalendar.cfg.getProperty("pagedate");var k=c[0].outwardCalendar.getSelectedDates()[0];var g=c[0].returnCalendar.getSelectedDates()[0];if(c[0].outwardCalendar.id==c[1].id){if(k>g){c[0].returnCalendar.deselectAll();$("datePickerReturn").value=""}if(b.getTime()>p.getTime()){c[0].returnCalendar.cfg.setProperty("pagedate",b)}c[0].outwardDate=h;var o=""+h.getDate();if(o.length<2){o="0"+o}var n=""+(h.getMonth()+1);if(n.length<2){n="0"+n}var e=""+(h.getFullYear());$("datePickerOutward").value=o+"."+n+"."+e}if(c[0].returnCalendar.id==c[1].id){c[0].returnDate=h;if(g<k){c[0].outwardCalendar.deselectAll();$("datePickerOutward").value=""}if(b.getTime()>p.getTime()){c[0].outwardCalendar.cfg.setProperty("pagedate",p)}var o=""+h.getDate();if(o.length<2){o="0"+o}var n=""+(h.getMonth()+1);if(n.length<2){n="0"+n}var e=""+(h.getFullYear());$("datePickerReturn").value=o+"."+n+"."+e;if($(c[0].oneWayField).checked==true){c[0].switchFlightType(2,c[0])}}if(c[0].outwardCalendar.getSelectedDates().length>0&&c[0].returnCalendar.getSelectedDates().length>0){c[0].outwardCalendar.renderEvent.subscribe(function(){c[0].renderDaysOut(c[0].outwardCalendar,c[0].outwardCalendar.getSelectedDates()[0],c[0].returnCalendar.getSelectedDates()[0])});c[0].returnCalendar.renderEvent.subscribe(function(){c[0].renderDaysOut(c[0].returnCalendar,c[0].outwardCalendar.getSelectedDates()[0],c[0].returnCalendar.getSelectedDates()[0])})}c[0].outwardCalendar.render();c[0].returnCalendar.render()};flightSearch.prototype.renderDaysOut=function(e,g,h){for(var l=0;l<e.cells.length;l++){var b=e.cells[l];var k=e.getDateByCellId(b.id);if(k.getTime()>=g.getTime()&&k.getTime()<=h.getTime()){YAHOO.util.Dom.addClass(b,"dayOut")}else{YAHOO.util.Dom.removeClass(b,"dayOut")}}};flightSearch.prototype.switchFlightType=function(b,c){switch(b){case 1:$(c.oneWayField).checked=true;c.returnCalendar.deselectAll();c.outwardCalendar.cfg.setProperty("maxdate",c.flightPlanExpiration);c.outwardCalendar.render();c.returnCalendar.render();if(!c.isRedmondBrowser()){new Effect.Opacity(c.returnDateLabel,{from:1,to:0.2,duration:0.5})}break;case 2:$(c.roundTripField).checked=true;if(!c.isRedmondBrowser()){new Effect.Opacity(c.returnDateLabel,{from:0.2,to:1,duration:0.5})}break}};flightSearch.prototype.isRedmondBrowser=function(){var b=false;window.status=navigator.appName;if(navigator.appName=="Microsoft Internet Explorer"){b=true}return b};flightSearch.prototype.executeSearch=function(c,b){$("__EVENTTARGET").value=this.linkButtonName;$(this.autoComplete.formFields.departureStation).value=c;$(this.autoComplete.formFields.arrivalStation).value=b;$(this.searchForm).submit()};flightSearch.prototype.updatePassengerSystemFields=function(){$(passengerSystemFields.ADT).value=$(this.adultPassengerField).value;$(passengerSystemFields.CHD).value=$(this.childPassengerField).value;$(passengerSystemFields.INFANT).value=$(this.infantPassengerField).value};flightSearch.prototype.updateDateSystemFields=function(){$(dateSystemFields.OUTWARD_DAY).value=this.outwardDate.getDate();$(dateSystemFields.OUTWARD_MONTH).value=this.outwardDate.getFullYear()+"-"+(this.outwardDate.getMonth()+1);if($(this.oneWayField).checked==false){$(dateSystemFields.RETURN_DAY).value=this.returnDate.getDate();$(dateSystemFields.RETURN_MONTH).value=this.returnDate.getFullYear()+"-"+(this.returnDate.getMonth()+1)}};flightSearch.prototype.displayError=function(b){if($("SearchError")){$("SearchError").innerHTML=b;$("SearchError").className="errorContainerActive"}};flightSearch.prototype.hideError=function(){if($("SearchError")){$("SearchError").className="errorContainer"}};flightSearch.prototype.validate=function(){var e=true;var c=$(this.departureStationFormField).value;if(!this.isRebooking){c=$(this.autoComplete.formFields[this.departureStationField]).value}var b=$(this.arrivalStationFormField).value;if(!this.isRebooking){b=$(this.autoComplete.formFields[this.arrivalStationField]).value}if(c.length!=3){this.displayError(this.searchErrors.DEPARTURESTATION_MISSING);e=false}if(b.length!=3&&e==true){this.displayError(this.searchErrors.ARRIVALSTATION_MISSING);e=false}if(this.outwardCalendar.getSelectedDates().length==0&&e==true){this.displayError(this.searchErrors.OUTWARDDATE_MISSING);e=false}if($(this.roundTripField).checked==true){if(this.returnCalendar.getSelectedDates().length==0&&e==true){this.displayError(this.searchErrors.RETURNDATE_MISSING);e=false}}if($(this.adultPassengerField).value==0&&e==true){this.displayError(this.searchErrors.ADULTS_MISSING);e=false}if($(this.infantPassengerField).value>$(this.adultPassengerField).value&&e==true){this.displayError(this.searchErrors.INFANTS_EXCEED);e=false}return e};flightSearch.prototype.OALMethod=function(o){var m=$(this.autoComplete.formFields.departureStation).value;var l=$(this.autoComplete.formFields.arrivalStation).value;var h=this.outwardDate.getDate()+"."+(this.outwardDate.getMonth()+1)+"."+this.outwardDate.getFullYear();var b=this.returnDate.getDate()+"."+(this.returnDate.getMonth()+1)+"."+this.returnDate.getFullYear();var k=$(this.adultPassengerField).value;var g=$(this.childPassengerField).value;var n=$(this.infantPassengerField).value;var c="RoundTrip";if($(this.roundTripField).checked==true){c="RoundTrip"}else{c="OneWay"}var e=this.searchSettings.CULTURECODE;if(o=="WW"){SearchWWFlights(m,l,h,b,"",k,g,n,"",c,e)}else{if(o=="VY"){SearchVYFlights(m,l,h,b,"",k,g,n,"",c,e)}else{if(o=="DE"){SearchDEFlights(m,l,h,b,"",k,g,n,"",c,e)}}}};function Aircraft(e,c){this.cabinRows=new Array();for(var b=0;b<e;b++){this.cabinRows[b]=new Array()}this.mapElementId=c}Aircraft.prototype.cabinRows;Aircraft.prototype.mapElementId;Aircraft.prototype.addSeat=function(e,b,c){this.cabinRows[b][c]=e};Aircraft.prototype.getSeatBySeatLabel=function(h){var g=null;for(var e=0;e<this.cabinRows.length;e++){for(var k=0;k<this.cabinRows[e].length;k++){var b=this.cabinRows[e][k].getSeatLabel();if(b==h){g=this.cabinRows[e][k]}}}return g};var SeatStatus={OPEN:0,OCCUPIED:1,MISSING:2};function CabinSeat(l,k,c,g,h,b,e){this.row=l;this.column=k;this.status=c;this.isExit=g;this.extraLegRoom=h;this.reservationFee=b;this.iconElementId=e}CabinSeat.prototype.row;CabinSeat.prototype.column;CabinSeat.prototype.isExit;CabinSeat.prototype.status;CabinSeat.prototype.extraLegRoom;CabinSeat.prototype.reservationFee;CabinSeat.prototype.iconElementId;CabinSeat.prototype.getSeatLabel=function(){return String(this.row)+String(this.column)};function Passenger(b,r,n,o,e,g,h,l,p,c,k,m,s,q){this.passengerNumber=b;this.typeCode=r;this.holdsInfant=n;this.assignedSeat=o;this.buttonElementId=e;this.rowElementId=g;this.inputElementId=h;this.displayElementId=l;this.priceElementId=p;this.cultureFeeChar=c;this.cultureFeeCurrency=k;this.seatInclusiveTranslation=m;this.rowInputElementId=s;this.columnInputElementId=q;this.fallBackFee="--"}Passenger.prototype.passengerNumber;Passenger.prototype.typeCode;Passenger.prototype.holdsInfant;Passenger.prototype.assignedSeat;Passenger.prototype.buttonElementId;Passenger.prototype.inputElementId;Passenger.prototype.displayElementId;Passenger.prototype.cultureFeeChar;Passenger.prototype.cultureFeeCurrency;Passenger.prototype.seatInclusiveTranslation;Passenger.prototype.priceElementId;Passenger.prototype.rowInputElementId;Passenger.prototype.columnInputElementId;Passenger.prototype.fallBackFee;Passenger.prototype.setSeat=function(c){if(this.assignedSeat!=c){if(this.assignedSeat!=null){this.assignedSeat.status=SeatStatus.OPEN}this.assignedSeat=c;$(this.inputElementId).value=c.getSeatLabel();$(this.displayElementId).innerHTML=c.getSeatLabel();var b="";if(c.reservationFee!=0){b=c.reservationFee.toString().replace(".",this.cultureFeeChar);b+=" "+this.cultureFeeCurrency}else{this.fallBackFee=this.seatInclusiveTranslation;b=this.seatInclusiveTranslation}$(this.priceElementId).innerHTML=b;$(this.rowInputElementId).value=c.row;$(this.columnInputElementId).value=c.column;c.status=SeatStatus.OCCUPIED}else{c.status=SeatStatus.OPEN;this.resetSeat()}};Passenger.prototype.resetSeat=function(){this.assignedSeat.status=SeatStatus.OPEN;this.assignedSeat=null;$(this.inputElementId).value="";$(this.rowInputElementId).value="";$(this.columnInputElementId).value="";$(this.displayElementId).innerHTML="--";$(this.priceElementId).innerHTML=this.fallBackFee};var FlightType={OUTWARD:0,RETURN:1};function Flight(b,c,e){this.aircraft=b;this.flightType=c;this.flightHeadElementId=e;this.passengerList=new Array()}Flight.prototype.aircraft;Flight.prototype.passengerList;Flight.prototype.flightType;Flight.prototype.flightHeadElementId;function SeatReservation(g,n,o,b,c,e,h,m,r,k,s,l,q,p){this.infantExitSeatErrorContainer=n;this.openSeatIcon=o;this.openXLSeatIcon=b;this.occupiedSeatIcon=c;this.missingSeatIcon=e;this.selectedSeatIcon=h;this.pendingSeatBox=m;this.pendingSeatConfirmButton=r;this.pendingSeatAbortButton=k;this.pendingSeatExitButton=s;this.pendingSeatAcceptCheckBox=l;this.activationCheckBox=q;this.waiveFeeCheckBox=g;this.initialPostSaleSeats=p;this.flightList=new Array()}SeatReservation.prototype.shoppingCart;SeatReservation.prototype.flightList;SeatReservation.prototype.activePassenger;SeatReservation.prototype.activeFlight;SeatReservation.prototype.infantExitSeatErrorContainer;SeatReservation.prototype.openSeatIcon;SeatReservation.prototype.openXLSeatIcon;SeatReservation.prototype.occupiedSeatIcon;SeatReservation.prototype.missingSeatIcon;SeatReservation.prototype.selectedSeatIcon;SeatReservation.prototype.pendingSeatBox;SeatReservation.prototype.pendingSeatConfirmButton;SeatReservation.prototype.pendingSeatAbortButton;SeatReservation.prototype.pendingSeatExitButton;SeatReservation.prototype.pendingSeatAcceptCheckBox;SeatReservation.prototype.activationCheckBox;SeatReservation.prototype.initialPostSaleSeats;SeatReservation.prototype.waiveFeeCheckBox;SeatReservation.prototype.pendingPassenger;SeatReservation.prototype.pendingSeat;SeatReservation.prototype.bindElements=function(){SeatReservationObject=this;for(var h=0;h<this.flightList.length;h++){var g=this.flightList[h].passengerList;for(var k=0;k<g.length;k++){Event.observe($(g[k].buttonElementId),"click",SeatReservationObject.passengerClick.bind(this))}var b=this.flightList[h].aircraft.cabinRows;for(var e=0;e<b.length;e++){for(var c=0;c<b[e].length;c++){Event.observe($(b[e][c].iconElementId),"click",SeatReservationObject.seatClick.bind(this))}}}Event.observe($(this.pendingSeatConfirmButton),"click",SeatReservationObject.pendingSeatConfirmClick.bind(this));Event.observe($(this.pendingSeatAbortButton),"click",SeatReservationObject.pendingSeatAbortClick.bind(this));Event.observe($(this.pendingSeatExitButton),"click",SeatReservationObject.pendingSeatAbortClick.bind(this))};SeatReservation.prototype.waiveFeeClick=function(e){var b=this.activeFlight;var c=this.activePassenger;for(var g=0;g<this.flightList.length;g++){for(var h=0;h<this.flightList[g].passengerList.length;h++){this.activeFlight=g;this.activePassenger=h;this.notifyShoppingCart()}}this.activeFlight=b;this.activePassenger=c};SeatReservation.prototype.passengerClick=function(c){var b=c.element().id;for(var g=0;g<this.flightList.length;g++){var e=this.flightList[g].passengerList;for(var h=0;h<e.length;h++){if(e[h].buttonElementId==b){this.setPassenger(h,g);this.showFlight(g)}}}};SeatReservation.prototype.seatClick=function(h){var l=h.element().id;for(var k=0;k<this.flightList.length;k++){var c=this.flightList[k].aircraft.cabinRows;for(var g=0;g<c.length;g++){for(var e=0;e<c[g].length;e++){if(c[g][e].iconElementId==l){var b=this.flightList[k].passengerList[this.activePassenger];this.assignSeat(b,c[g][e])}}}}};SeatReservation.prototype.assignSeat=function(l,k){if(k.status==SeatStatus.OPEN){$(this.infantExitSeatErrorContainer).className="errorContainer";if(k.isExit){if(l.holdsInfant||l.typeCode=="CHD"){$(this.infantExitSeatErrorContainer).className="errorContainerActive"}else{this.assignPendingSeat(l,k);this.render()}}else{l.setSeat(k);this.notifyShoppingCart();this.render()}}else{if(k==l.assignedSeat){var m=this.activeFlight;var b=this.activePassenger;var h=this.initialPostSaleSeats;var e=false;for(var c=0;c<h.length;c++){var g=h[c].split("|");if((g[0]==m)&&(g[1]==b)){e=true}}if(!e){l.resetSeat();this.notifyShoppingCart();this.render()}}}};SeatReservation.prototype.assignPendingSeat=function(c,b){this.pendingPassenger=c;this.pendingSeat=b;$(this.pendingSeatAcceptCheckBox).checked=false;$(this.pendingSeatBox).show()};SeatReservation.prototype.pendingSeatConfirmClick=function(b){if($(this.pendingSeatAcceptCheckBox).checked){this.pendingPassenger.setSeat(this.pendingSeat);$(this.pendingSeatBox).fade({duration:0.5,from:1,to:0});this.render();this.notifyShoppingCart()}};SeatReservation.prototype.pendingSeatAbortClick=function(b){this.pendingPassenger=null;this.pendingSeat=null;$(this.pendingSeatBox).fade({duration:0.5,from:1,to:0})};SeatReservation.prototype.showFlight=function(g){$(this.infantExitSeatErrorContainer).className="errorContainer";for(var c=0;c<this.flightList.length;c++){var b=this.flightList[c].aircraft.mapElementId;$(b).hide();$(this.flightList[c].flightHeadElementId).hide()}this.activeFlight=g;$(this.flightList[g].flightHeadElementId).show();var e=this.flightList[g].aircraft.mapElementId;$(e).show()};SeatReservation.prototype.hideFlight=function(){$(this.infantExitSeatErrorContainer).className="errorContainer";for(var c=0;c<this.flightList.length;c++){var b=this.flightList[c].aircraft.mapElementId;$(b).hide();$(this.flightList[c].flightHeadElementId).hide()}};SeatReservation.prototype.setPassenger=function(b,h){$(this.infantExitSeatErrorContainer).className="errorContainer";for(var e=0;e<this.flightList.length;e++){var c=this.flightList[e].passengerList;for(var g=0;g<c.length;g++){$(c[g].rowElementId).className=""}}$(this.flightList[h].passengerList[b].rowElementId).className="checked";$(this.flightList[h].passengerList[b].buttonElementId).checked=true;this.activePassenger=b;this.activeFlight=h;this.render()};SeatReservation.prototype.removePassenger=function(){$(this.infantExitSeatErrorContainer).className="errorContainer";for(var c=0;c<this.flightList.length;c++){var b=this.flightList[c].passengerList;for(var e=0;e<b.length;e++){$(b[e].rowElementId).className="";$(b[e].buttonElementId).checked=false}}};SeatReservation.prototype.render=function(){for(var k=0;k<this.flightList.length;k++){var g=this.flightList[k].aircraft.cabinRows;for(var c=0;c<g.length;c++){for(var m=0;m<g[c].length;m++){var h=g[c][m];switch(h.status){case SeatStatus.OCCUPIED:$(h.iconElementId).src=this.occupiedSeatIcon;break;case SeatStatus.MISSING:$(h.iconElementId).src=this.missingSeatIcon;break;case SeatStatus.OPEN:if(h.extraLegRoom){$(h.iconElementId).src=this.openXLSeatIcon}else{$(h.iconElementId).src=this.openSeatIcon}break}}}}var l=this.flightList[this.activeFlight].passengerList[this.activePassenger].assignedSeat;if(l){$(l.iconElementId).src=this.selectedSeatIcon}var n=false;for(var k=0;k<this.flightList.length;k++){var b=this.flightList[k].passengerList;for(var e=0;e<b.length;e++){if(b[e].assignedSeat){n=true}}}};SeatReservation.prototype.notifyShoppingCart=function(){if(this.shoppingCart){var k=this.flightList[this.activeFlight].passengerList[this.activePassenger];var h=null;if(k.assignedSeat){h=k.assignedSeat.reservationFee}var c="outward";if(this.flightList[this.activeFlight].flightType==FlightType.RETURN){c="return"}var b=0;var l=0;var e=FlightType.OUTWARD;for(var g=0;g<this.flightList.length;g++){if(this.flightList[g].flightType!=e){b=0;e=this.flightList[g].flightType}if(g==this.activeFlight){l=b}b++}this.shoppingCart.setSeatFee(c,l,k.passengerNumber,h);this.shoppingCart.update();if(ShoppingCartController){ShoppingCartController.updateTotal()}}};var _charSubstitutionMaps=[{regex:/[/&]/g,replacement:"+"},{regex:/[Ã€ÃÃ‚ÃƒÃ„Ã…Ã†Ä€Ä‚Ä„ÇºÇ»Ç¼Î†Ã„]/g,replacement:"A"},{regex:/[Ã¢Ã£Ã¤Ã¥Ã¦ÄÄƒÄ…Ã¤]/g,replacement:"a"},{regex:/[Ã‡]/g,replacement:"C"},{regex:/[Ã§]/g,replacement:"c"},{regex:/[ÄŽÄ]/g,replacement:"D"},{regex:/[ÃˆÃ‰ÃŠÃ‹Ä’Ä”Ä–Ä˜Äš]/g,replacement:"E"},{regex:/[Ä“Ä•Ä—Ä™Ä›Ã¨Ã©ÃªÃ«]/g,replacement:"e"},{regex:/[ÄœÄžÄ Ä¢]/g,replacement:"G"},{regex:/[ÄŸÄ¡Ä£Ä]/g,replacement:"g"},{regex:/[Ä¤Ä¦]/g,replacement:"H"},{regex:/[Ä¨ÄªÄ¬Ä®Ä°Ç]/g,replacement:"I"},{regex:/[Ä©Ä«ÄÄ¯Ä±Ç]/g,replacement:"i"},{regex:/[Ä´]/g,replacement:"J"},{regex:/[Äµ]/g,replacement:"j"},{regex:/[Ä¶]/g,replacement:"K"},{regex:/[Ä·Ä¸]/g,replacement:"k"},{regex:/[Ä¹Ä»Ä½Ä¿Å]/g,replacement:"L"},{regex:/[ÄºÄ¼Ä¾Å€Å‚]/g,replacement:"l"},{regex:/[ÅƒÅ…Å‡]/g,replacement:"N"},{regex:/[Å„Å†ÅˆÅ‰Å‹]/g,replacement:"n"},{regex:/[ÅŒÅŽÅÇ‘Ã–]/g,replacement:"O"},{regex:/[ÅÅÅ‘Ç’Ã¶]/g,replacement:"o"},{regex:/[Ç“Ç•Ç—Ç™Ç›ÃœÅ²]/g,replacement:"U"},{regex:/[Ç”Ç–Ç˜ÇšÇœÃ¼Å³]/g,replacement:"u"},{regex:/[Å”Å–Å˜]/g,replacement:"R"},{regex:/[Å•Å—Å™]/g,replacement:"r"},{regex:/[ÅšÅœÅžÅ ]/g,replacement:"S"},{regex:/[Å›ÅÅŸÅ¡]/g,replacement:"s"},{regex:/[ÃŸ]/g,replacement:"ss"},{regex:/[Å¢Å¤Å¦]/g,replacement:"T"},{regex:/[Å£Å¥Å§]/g,replacement:"t"},{regex:/[Å´]/g,replacement:"W"},{regex:/[Åµ]/g,replacement:"w"},{regex:/[Å¶Å¸]/g,replacement:"Y"},{regex:/[Å·]/g,replacement:"y"},{regex:/[Å¹Å»Å½]/g,replacement:"Z"},{regex:/[ÅºÅ¼Å¾]/g,replacement:"z"}];var initReplacementsForFormFields=function(e){if(typeof e=="string"){e=$(e.strip())}var c=Form.getInputs(e,"text");for(var b=0;b<c.length;b++){if(c[b].hasClassName("replaceable")){c[b].observe("blur",function(h){var g=replaceText($F(h.target));g=g.replace(/ {2,}/g," ");h.target.value=g.strip()})}}};var replaceText=function(b){b=b!=null&typeof b!="string"?""+b:b;if(b!=null){b=b.strip();for(var c=0;c<_charSubstitutionMaps.length;c++){var e=_charSubstitutionMaps[c];b=b.replace(e.regex,e.replacement)}}return b==null?"":b};var Validator=Class.create();Validator.prototype={initialize:function(){this.globalErrorContainerHiddenClass="globalErrorContainerHidden";this.globalErrorContainerActiveClass="globalErrorContainerActive";this.rules=[];this.failedValidationFieldIds=[]},initValues:function(e,b,c){this.form=e;this.globalErrorContainerId=b;this.globalErrorMessage=c;this.registerEventHandlers()},registerEventHandlers:function(){var theRegisterFieldsFunction=function(anInputField){if(anInputField.hasClassName("defaultValue")){anInputField.initialFieldValue=$F(anInputField)}function clickHandle(event,inInputField){with(inInputField){removeClassName("defaultValue");if(inInputField.hasClassName("error")){if(typeof(initialFieldValue)!="undefined"&&value==initialFieldValue){value=""}addClassName("errorEditing");removeClassName("error")}}}function blurHandle(event,inInputField){with(inInputField){isDefaultValueSet=typeof(initialFieldValue)=="undefined"?null:(value==initialFieldValue||value=="");if(inInputField.hasClassName("errorEditing")){if(isDefaultValueSet!=null&&isDefaultValueSet){value=initialFieldValue}removeClassName("errorEditing");addClassName("error")}if(isDefaultValueSet!=null&&isDefaultValueSet){addClassName("defaultValue")}else{if(isDefaultValueSet!=null&&!isDefaultValueSet){removeClassName("defaultValue")}}}}$(anInputField).observe("focus",clickHandle.bindAsEventListener(this,$(anInputField)));$(anInputField).observe("blur",blurHandle.bindAsEventListener(this,$(anInputField)))};Form.getInputs($(this.form),"text").each(theRegisterFieldsFunction);Form.getInputs($(this.form),"password").each(theRegisterFieldsFunction)},registerRule:function(b){this.rules.push(b);b.options.counter=this.rules.size()},validate:function(){var b=true;this.reset();this.rules.each(function(e){if(e.doValidate(this.failedValidationFieldIds)){var c=e.validate();b=b&&c;if(!c){e.visualizeError();if(!e.options.proceedOnError){this.failedValidationFieldIds=this.failedValidationFieldIds.concat(e.options.fieldIds)}}}},this);if(!b){this.visualizeGlobalError()}return b},reset:function(){this.failedValidationFieldIds=[];this.devisualizeGlobalError();this.rules.each(function(b){b.devisualizeError()})},visualizeGlobalError:function(){if(this.globalErrorContainerId!=null){$(this.globalErrorContainerId).insert({bottom:"<p>"+this.globalErrorMessage+"</p>"});$(this.globalErrorContainerId).removeClassName(this.globalErrorContainerHiddenClass);$(this.globalErrorContainerId).addClassName(this.globalErrorContainerActiveClass)}},devisualizeGlobalError:function(){$(this.globalErrorContainerId).childElements().each(function(b){b.remove()});$(this.globalErrorContainerId).removeClassName(this.globalErrorContainerActiveClass);$(this.globalErrorContainerId).addClassName(this.globalErrorContainerHiddenClass)}};var AbstractRule=Class.create();AbstractRule.prototype={initialize:function(b,c,e){this.options=Object.extend({proceedOnError:false,fieldIds:[],highlightLabel:true},e||{});this.errorMessage=b;this.errorContainerId=c;this.errorContainerHiddenClass="errorContainer";this.errorContainerActiveClass="errorContainerActive";this.errorContainerEditingClass="errorContainerEditing";this.fieldAndLabelErrorClass="error";this.fieldAndLabelErrorEditingClass="errorEditing"},isDefaultValueSet:function(){if(this.options.fieldIds!=null&&this.options.fieldIds.size()>0&&$(this.getFirstFieldId()).initialFieldValue!=null){return $F(this.getFirstFieldId()).strip()!=$(this.getFirstFieldId()).initialFieldValue}return null},isAllDefaultValuesSet:function(){if(this.options.fieldIds!=null&&this.options.fieldIds.size()>0){var b=true;for(var c=0;c<this.options.fieldIds.length&&b;c++){b=b&&$F(this.options.fieldIds[c]).strip()==$(this.options.fieldIds[c]).initialFieldValue}return b}return null},isAllFieldsWithValue:function(){if(this.options.fieldIds!=null&&this.options.fieldIds.size()>0){var b=true;for(var c=0;c<this.options.fieldIds.length&&b;c++){b=b&&$F(this.options.fieldIds[c]).strip()!=""}return b}return null},doValidate:function(c){var b=true;if(this.options.fieldIds.size()>0&&c!=null){this.options.fieldIds.each(function(e){if(c.indexOf(e)>-1){b=false}},this)}return b},highlightFields:function(){this.options.fieldIds.each(function(c){if($(c)!=null){$(c).addClassName(this.fieldAndLabelErrorClass);var b=$$("label[for="+c+"]")==null?null:($$("label[for="+c+"]").first()==null?null:$$("label[for="+c+"]").first());if(b!=null&&this.options.highlightLabel==true){b.addClassName(this.fieldAndLabelErrorClass)}}},this)},unhighlightFields:function(){this.options.fieldIds.each(function(c){if($(c)!=null){$(c).removeClassName(this.fieldAndLabelErrorClass);$(c).removeClassName(this.fieldAndLabelErrorEditingClass);var b=$$("label[for="+c+"]")==null?null:($$("label[for="+c+"]").first()==null?null:$$("label[for="+c+"]").first());if(b!=null){b.removeClassName(this.fieldAndLabelErrorClass)}}},this)},validate:function(){return true},visualizeError:function(){if(this.errorContainerId!=null){$(this.errorContainerId).insert({bottom:"<p>"+this.errorMessage+"</p>"});$(this.errorContainerId).removeClassName(this.errorContainerEditingClass);$(this.errorContainerId).removeClassName(this.errorContainerHiddenClass);$(this.errorContainerId).addClassName(this.errorContainerActiveClass)}this.highlightFields()},devisualizeError:function(){if(this.errorContainerId!=null){$(this.errorContainerId).childElements().each(function(b){if(b!=null){b.remove()}});$(this.errorContainerId).removeClassName(this.errorContainerEditingClass);$(this.errorContainerId).removeClassName(this.errorContainerActiveClass);$(this.errorContainerId).addClassName(this.errorContainerHiddenClass)}this.unhighlightFields()},getFirstFieldId:function(){return this.options.fieldIds.size()>0?this.options.fieldIds[0]:null}};var AbstractSingleFieldRule=Class.create(AbstractRule,{initialize:function($super,e,b,c,g){$super(b,c,g);this.options.fieldIds.unshift(e)}});var RequiredRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=this.isDefaultValueSet();return(b==null||!b)&&!($(this.getFirstFieldId())==null||$(this.getFirstFieldId()).value=="")}});var MultiRequiredRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,h){$super(e[0],b,c,h);for(var g=1;g<e.length;g++){this.options.fieldIds.push(e[g])}},validate:function(){var e=this.isAllDefaultValuesSet();var c=e==null?true:!e;for(var b=0;c&&b<this.options.fieldIds.length;b++){c&=!($(this.options.fieldIds[b])==null||$(this.options.fieldIds[b]).value=="")}return c}});var IsDigitRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||!/[^\d]/.test(b)}});var IsAlphaRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||/^[a-zA-Z]+$/.test(b)}});var IsAlphaNumRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||!/\W/.test(b)}});var RegexRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,g,b,c,e,h){$super(g,b,c,h);this.options.regex=e},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||this.options.regex.test(b)}});var IsDateRule=Class.create(AbstractRule,{initialize:function($super,e,g,k,b,c,h){$super(b,c,h);this.options.fieldIds.unshift(k);this.options.fieldIds.unshift(g);this.options.fieldIds.unshift(e)},validate:function(){var e=$F(this.options.fieldIds[0]).strip();if(e.length==1){e="0"+e}var c=$F(this.options.fieldIds[1]).strip();if(c.length==1){c="0"+c}var l=$F(this.options.fieldIds[2]).strip();if((e.length==0&&c.length==0&&l.length==0)||this.isAllDefaultValuesSet()){return true}var k=c+"/"+e+"/"+l;var g=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!g.test(k)){return false}var h=new Date(k);var b=(parseInt(e,10)==h.getDate())&&(parseInt(c,10)==(1+h.getMonth()))&&(parseInt(l,10)==h.getFullYear());return b}});var IsEmailRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(b)}});var IsEqualToRule=Class.create(AbstractRule,{initialize:function($super,g,c,b,e,h){$super(b,e,h);this.options.fieldIds.unshift(c);this.options.fieldIds.unshift(g)},validate:function(){return $F(this.options.fieldIds[0])==$F(this.options.fieldIds[1])}});var IsCheckboxCheckedRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){theCheckbox=$(this.getFirstFieldId());return theCheckbox!=null&&(theCheckbox.checked=="checked"||theCheckbox.checked==true||theCheckbox.checked=="true")}});_dateHelper={convertToLexicalByFieldIds:function(b,e,g){var c=parseInt(!$F(b).startsWith("0")?$F(b):$F(b).substr(1));c+=parseInt(!$F(e).startsWith("0")?$F(e):$F(e).substr(1))*100;c+=parseInt($F(g))*10000;return c},convertToLexicalByDate:function(c){var b=c.getDate();b+=(c.getMonth()+1)*100;b+=c.getFullYear()*10000;return b}};var DateMinYearDifferenceRule=Class.create(AbstractRule,{initialize:function($super,e,h,l,b,c,g,k){if(k!=null&&k.referenceDate==null){k.referenceDate=new Date()}$super(b,c,k);this.options.fieldIds.unshift(l);this.options.fieldIds.unshift(h);this.options.fieldIds.unshift(e);this.options.minYears=g},validate:function(){var c=true;if(!this.isAllDefaultValuesSet()&&this.isAllFieldsWithValue()){var b=_dateHelper.convertToLexicalByFieldIds(this.options.fieldIds[0],this.options.fieldIds[1],this.options.fieldIds[2]);var g=_dateHelper.convertToLexicalByDate(this.options.referenceDate);var e=g-b;c=e>=this.options.minYears*10000}return c}});var DateMaxYearDifferenceRule=Class.create(AbstractRule,{initialize:function($super,g,h,l,c,e,b,k){if(k!=null&&k.referenceDate==null){k.referenceDate=new Date()}$super(c,e,k);this.options.fieldIds.unshift(l);this.options.fieldIds.unshift(h);this.options.fieldIds.unshift(g);this.options.maxYears=b},validate:function(){var c=true;if(!this.isAllDefaultValuesSet()){var b=_dateHelper.convertToLexicalByFieldIds(this.options.fieldIds[0],this.options.fieldIds[1],this.options.fieldIds[2]);var g=_dateHelper.convertToLexicalByDate(this.options.referenceDate);var e=g-b;c=e<this.options.maxYears*10000}return c}});var IsPhoneNumberRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=$F(this.getFirstFieldId()).strip();return b.length==0||!/[^\d\s]/.test(b)}});var IsPhoneNumberRuleNewsflash=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){var b=true;var c=$F(this.getFirstFieldId()).strip();c=c.replace(/\D/g,"");if($("ControlGroupContactView_MobileNewsQuestionView_CheckBoxWantMobileNews")!=null&&$("ControlGroupContactView_MobileNewsQuestionView_CheckBoxWantMobileNews").checked==true&&c!=null&&(c==""||!/(1[5-7]\d)(\d{7,})/.test(c))){b=false}return b}});var UniqueValueRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,h,b,e,c,k){$super(h,b,e,k);for(var g=0;c!=null&&g<c.length;g++){this.options.fieldIds=this.options.fieldIds.concat(c[g])}},validate:function(){var c=$F(this.getFirstFieldId()).strip();for(var b=1;b<this.options.fieldIds.length;b++){if(c==$F(this.options.fieldIds[b])){return false}}return true},highlightFields:function($super){if($(this.getFirstFieldId())!=null){$(this.getFirstFieldId()).addClassName(this.fieldAndLabelErrorClass);var b=$$("label[for="+this.getFirstFieldId()+"]")==null?null:($$("label[for="+this.getFirstFieldId()+"]").first()==null?null:$$("label[for="+this.getFirstFieldId()+"]").first());if(b!=null){b.addClassName(this.fieldAndLabelErrorClass)}}}});var FailOnCheckboxSelectionRule=Class.create(AbstractSingleFieldRule,{initialize:function($super,e,b,c,g){$super(e,b,c,g)},validate:function(){return $F(this.getFirstFieldId())==null}});function PaymentClient(e,b,c,h,k){this.paymentMethods=e;this.paymentErrors=b;this.paymentsExist=c;this.buttonNextImage=h;this.buttonBookingImage=k;this.isValidVoucherCode=false;this.isValidCreditCardNumber=false;this.isValidDirectDebitingAccount=false;this.isValidDirectDebitingAccountHolder=false;this.isValidCvcCode=false;this.isValidExpiryDate=false;if(this.paymentsExist){$("PaymentOverview").show()}this.linkPaymentUI();var g=$("PaymentDue");var l=0;if(g){l=g.innerHTML;l=l.replace(",",".");l=parseFloat(l);if(l==0){$("PaymentNotFree").hide();$("FreeBookingControlBox").show();$("FreeBookingInfoBox").show()}}}PaymentClient.prototype.paymentMethods;PaymentClient.prototype.systemVoucherCode;PaymentClient.prototype.paymentErrors;PaymentClient.prototype.paymentsExist;PaymentClient.prototype.buttonBookingImage;PaymentClient.prototype.buttonNextImage;PaymentClient.prototype.isValidVoucherCode;PaymentClient.prototype.isValidCreditCardNumber;PaymentClient.prototype.isValidCvcCode;PaymentClient.prototype.isValidExpiryDate;PaymentClient.prototype.isValidDirectDebitingAccount;PaymentClient.prototype.linkPaymentUI=function(){var e=this;var g="VI";var h="";for(var k=0;k<this.paymentMethods.length;k++){g=this.paymentMethods[k]["CODE"];h=$("setType"+g);if(h){Event.observe(h,"click",e.setPaymentType.bind(this))}}if($("resetPaymentMethod")){Event.observe($("resetPaymentMethod"),"click",e.resetPaymentType.bind(this))}Event.observe($("cardType"),"change",e.setCreditCardType.bind(this));this.initializeExpiryFields();Event.observe($("accountNumber"),"blur",e.checkCardNumber.bind(this));Event.observe($("cvcCode"),"blur",e.checkCvcCode.bind(this));Event.observe($("BIC"),"blur",e.validateBankAccount.bind(this));Event.observe($("IBAN"),"blur",e.validateBankAccount.bind(this));Event.observe($("AccountHolder"),"blur",e.validateBankAccountHolder.bind(this));for(var c=0;c<4;c++){Event.observe($("voucherCodeBlock"+String(c+1)),"blur",e.validateVoucher.bind(this))}Event.observe($("mandatoryBookingButton"),"click",e.transact.bind(this));Event.observe($("mandatoryBookingButtonFree"),"click",e.transactPaymentFree.bind(this))};PaymentClient.prototype.applyCardDiscount=function(){this.setPaymentType();$("cardType").disabled=true;$("resetPaymentMethod").hide();var b=$("PaymentDue");var c=0;if(b){c=b.innerHTML;c=c.replace(",",".");c=parseFloat(c);if(c==0){$("PaymentInput").hide();$("PaymentMethod").show()}}};PaymentClient.prototype.setCreditCardType=function(){this.hideAllPaymentErrors();var n=$("cardType").value;$("PaymentMethodCode").value=n;$("CVCNotice").hide();$("CVCLabel").hide();$("cvcCode").hide();$("CVCArrow").hide();$("CVVNotice").hide();$("CVVLabel").hide();var c=$("PaymentTotal");var o=$("PaymentDue");if(c&&o&&this.ccDiscountAmount){var h=this.ccDiscountAmount+ShoppingCartController._extractTotal(c);c.update(ShoppingCart.formatPrice(h));o.update(ShoppingCart.formatPrice(h));this.ccDiscountAmount=null}$("accountNumber").value="";$("accountNumber").className="accountNumber";switch(n){case"AX":$("CVVNotice").show();$("CVVLabel").show();$("CVCArrow").show();$("cvcCode").show();$("cvcCode").value="";$("cvcCode").writeAttribute("maxlength",4);break;case"TP":this.isValidCvcCode=true;break;default:$("CVCNotice").show();$("CVCLabel").show();$("CVCArrow").show();$("cvcCode").show();$("cvcCode").value="";$("cvcCode").writeAttribute("maxlength",3);break}cCodeImages=document.getElementsByClassName("CCodeImage");for(var r=0;r<cCodeImages.length;r++){$(cCodeImages[r].id).hide()}if($(n+"CCodeImage")){$(n+"CCodeImage").show()}else{if(n!="TP"){$("CCodeImage").show()}}var m=0;for(var e=0;e<this.paymentMethods.length;e++){if(this.paymentMethods[e]["CODE"]==n){m=this.paymentMethods[e]["FEE"]}}if(ScPaymentModule){var l=ShoppingCartPaymentData.creditCardFees.clone();l.push(m);ScPaymentModule.setTransactionFees(l);ScPaymentModule.update();ShoppingCartController.updateTotal()}if(ShoppingCartController){if(n=="GW"){if(this.paymentTotal&&this.paymentDue){$("PaymentTotal").update(this.paymentTotal);$("PaymentDue").update(this.paymentDue);this.paymentTotal=null;this.paymentDue=null;this.previousCreditCardFee=0}var c=$("PaymentTotal");var o=$("PaymentDue");if(c&&o){if(this.paymentTotal&&this.paymentDue){c.update(this.paymentTotal);o.update(this.paymentDue)}}if((n=="GW"&&isNewBooking)||cardDiscountIsActive){if(ScBaggageModule){ScBaggageModule.setCCDiscount(true);ScBaggageModule.update()}if(ScSeatingModule){ScSeatingModule.setCCDiscount(true);ScSeatingModule.update()}this.ccDiscountAmount=ScBaggageModule.xlBagFee*(ScBaggageModule.outwardXLBagCount+ScBaggageModule.returnXLBagCount);for(var g=0;g<ScSeatingModule.outwardSeatFees.length;g++){for(var q=0;q<ScSeatingModule.outwardSeatFees[g].length;q++){if(ScSeatingModule.outwardSeatFees[g][q]!=null){this.ccDiscountAmount+=ScSeatingModule.outwardSeatFees[g][q]}}}for(var g=0;g<ScSeatingModule.returnSeatFees.length;g++){for(var q=0;q<ScSeatingModule.returnSeatFees[g].length;q++){if(ScSeatingModule.returnSeatFees[g][q]!=null){this.ccDiscountAmount+=ScSeatingModule.returnSeatFees[g][q]}}}if(!isNewBooking){this.ccDiscountAmount=0}var b=ShoppingCartController._extractTotal(c)-this.ccDiscountAmount;var k=ShoppingCartController._extractTotal(o)-this.ccDiscountAmount;c.update(ShoppingCart.formatPrice(b));o.update(ShoppingCart.formatPrice(k))}else{if(ScBaggageModule){ScBaggageModule.setCCDiscount(false);ScBaggageModule.update()}if(ScSeatingModule){ScSeatingModule.setCCDiscount(false);ScSeatingModule.update()}}ShoppingCartController.updateTotal()}else{if(this.previousCreditCardFee!=m){if(ScBaggageModule){ScBaggageModule.setCCDiscount(false);ScBaggageModule.update()}if(ScSeatingModule){ScSeatingModule.setCCDiscount(false);ScSeatingModule.update()}ShoppingCartController.updateTotal();var c=$("PaymentTotal");var o=$("PaymentDue");if(c&&o){if(this.paymentTotal&&this.paymentDue){c.update(this.paymentTotal);o.update(this.paymentDue)}this.paymentTotal=c.firstChild.nodeValue;this.paymentDue=o.firstChild.nodeValue;this.previousCreditCardFee=m;var b=ShoppingCartController._extractTotal(c)+m;var k=ShoppingCartController._extractTotal(o)+m;c.update(ShoppingCart.formatPrice(b));o.update(ShoppingCart.formatPrice(k))}}}}};PaymentClient.prototype.checkCardNumber=function(b){var e=true;var c=$("accountNumber").value;switch($("cardType").value){case"AX":e=checkCreditCard(c,"AmEx");break;case"GW":e=checkCreditCard(c,"MasterCard");break;case"MC":e=checkCreditCard(c,"MasterCard");break;case"VI":e=checkCreditCard(c,"Visa");break;case"DI":e=checkCreditCard(c,"DinersClub");break;case"TP":e=c.length>0?true:false;break}if(!e){this.isValidCreditCardNumber=false}else{this.isValidCreditCardNumber=true}};PaymentClient.prototype.checkCvcCode=function(c){var b=$("cardType").value;var e=$("cvcCode").value;if(b=="TP"){this.isValidCvcCode=true}else{if(b=="AX"){if(e.length!=4){this.isValidCvcCode=false}else{this.isValidCvcCode=true}}else{if(e.length!=3){this.isValidCvcCode=false}else{this.isValidCvcCode=true}}}};PaymentClient.prototype.checkCardExpiry=function(b){var e=new Date();var h=new Date();var g=parseInt($("goodThruMonth").value);var c=$("goodThruYear").value;e.setMonth((g)-1);e.setFullYear(c);e.setDate(this.getDaysInMonth(g,c));if(e.getTime()<h.getTime()){this.isValidExpiryDate=false;$("cardExpiryError").innerHTML=this.paymentErrors.CARD_EXPIRED;$("cardExpiryError").className="errorContainerActive";$("ExpiryLabel").className="error";$("goodThruMonth").className="error";$("goodThruYear").className="error"}else{this.isValidExpiryDate=true;$("cardExpiryError").innerHTML="";$("cardExpiryError").className="errorContainer";$("ExpiryLabel").className="";$("goodThruMonth").className="";$("goodThruYear").className=""}};PaymentClient.prototype.getDaysInMonth=function(e,c){var b=[31,28,31,30,31,30,31,31,30,31,30,31];if(e!=2){return b[e-1]}if(c%4!=0){return b[1]}if(c%100==0&&c%400!=0){return b[1]}return b[1]+1};PaymentClient.prototype.displayCvcCodeError=function(b){$("globalErrorContainer").innerHTML=GlobalPaymentError;$("globalErrorContainer").className="globalErrorContainerActive";$("cvcCode").className="error";$("CVCLabel").className="error";$("CVVLabel").className="error";$("cvcError").innerHTML=b;$("cvcError").className="errorContainerActive"};PaymentClient.prototype.hideCvcCodeError=function(){$("globalErrorContainer").innerHTML="";$("globalErrorContainer").className="globalErrorContainerHidden";$("cvcCode").className="";$("CVCLabel").className="";$("CVVLabel").className="";$("cvcError").innerHTML="";$("cvcError").className="errorContainer"};PaymentClient.prototype.displayPaymentError=function(c,b,e){$("globalErrorContainer").innerHTML=GlobalPaymentError;$("globalErrorContainer").className="globalErrorContainerActive";$(c).className=e+" error";$(c+"Label").className="error";$(c+"Error").innerHTML=b;$(c+"Error").className="errorContainerActive"};PaymentClient.prototype.hidePaymentError=function(b,c){$("globalErrorContainer").innerHTML="";$("globalErrorContainer").className="globalErrorContainerHidden";$(b).className=c;$(b+"Label").className="";$(b+"Error").innerHTML="";$(b+"Error").className="errorContainer"};PaymentClient.prototype.displayVoucherPaymentError=function(b){$("globalErrorContainer").innerHTML=GlobalPaymentError;$("globalErrorContainer").className="globalErrorContainerActive";$("voucherCodeBlock1").className="error";$("voucherCodeBlock2").className="error";$("voucherCodeBlock3").className="error";$("voucherCodeBlock4").className="error";$("voucherLabel").className="error";$("voucherError").innerHTML=b;$("voucherError").className="errorContainerActive"};PaymentClient.prototype.hideVoucherPaymentError=function(){$("globalErrorContainer").innerHTML="";$("globalErrorContainer").className="globalErrorContainerHidden";$("voucherCodeBlock1").className="";$("voucherCodeBlock2").className="";$("voucherCodeBlock3").className="";$("voucherCodeBlock4").className="";$("voucherLabel").className="";$("voucherError").innerHTML="";$("voucherError").className="errorContainer"};PaymentClient.prototype.hideAllPaymentErrors=function(){$("globalErrorContainer").className="globalErrorContainerHidden";$("globalErrorContainer").innerHTML="";$("cardHolderError").className="errorContainer";$("cardHolderError").innerHTML="";$("cardHolderLabel").className="";$("cardHolder").className="";$("accountNumberError").className="errorContainer";$("accountNumberError").innerHTML="";$("accountNumberLabel").className="";$("accountNumber").className="";$("cardExpiryError").className="errorContainer";$("cardExpiryError").innerHTML="";$("ExpiryLabel").className="";$("goodThruMonth").className="";$("goodThruYear").className="";$("cvcError").className="errorContainer";$("cvcError").innerHTML="";$("CVCLabel").className="";$("CVVLabel").className="";$("cvcCode").className="";$("BICError").className="errorContainer";$("BICError").innerHTML="";$("BIC").className="";$("BICLabel").className="";$("IBANError").className="errorContainer";$("IBANError").innerHTML="";$("IBAN").className="";$("IBANLabel").className="";$("AccountHolderError").className="errorContainer";$("AccountHolderError").innerHTML="";$("AccountHolder").className="";$("AccountHolderLabel").className="";$("ELVConditionsAcceptanceError").className="errorContainer";$("ELVConditionsAcceptanceError").innerHTML="";$("ELVConditionsAcceptance").className="";$("ELVConditionsAcceptanceLabel").className="";$("voucherError").className="errorContainer";$("voucherError").innerHTML="";$("voucherLabel").className="";$("voucherCodeBlock1").className="";$("voucherCodeBlock2").className="";$("voucherCodeBlock3").className="";$("voucherCodeBlock4").className=""};PaymentClient.prototype.isMandatoryBooking=function(){$("MandatoryBookingInfo").show();$("mandatoryBookingButton").src=this.buttonBookingImage};PaymentClient.prototype.isBalanceReduction=function(){$("MandatoryBookingInfo").hide();$("mandatoryBookingButton").src=this.buttonNextImage};PaymentClient.prototype.validateVoucher=function(e){var l=false;var k=new Array();var h=true;for(var c=0;c<4;c++){k[c]=$("voucherCodeBlock"+String(c+1)).value;if(k[c].length==0){h=false}}if(h){var g="html/DecryptVoucher.aspx?Code="+k.join("-")+"&Currency="+$("PaymentCurrencyCode").value;var m=this;new Ajax.Request(g,{method:"get",onSuccess:function(t){var r=t.responseXML;var p=r.getElementsByTagName("vcode").item(0);var s=p.firstChild.data;if(s=="ERR"){m.resetVoucherCode();m.displayVoucherPaymentError(m.paymentErrors.VOUCHER_INVALID)}else{var o=r.getElementsByTagName("status").item(0);var q=r.getElementsByTagName("available").item(0);var n=q.firstChild.data;var b=o.firstChild.data;switch(b){case"Available":m.setVoucherCode(s,n);m.hideVoucherPaymentError();break;case"Expired":m.resetVoucherCode();m.displayVoucherPaymentError(m.paymentErrors.VOUCHER_EXPIRED);break;case"PaidExpired":m.resetVoucherCode();m.displayVoucherPaymentError(m.paymentErrors.PAIDVOUCHER_EXPIRED);break;case"Void":m.resetVoucherCode();m.displayVoucherPaymentError(m.paymentErrors.VOUCHER_VOIDED);break;case"Redeemed":m.resetVoucherCode();m.displayVoucherPaymentError(m.paymentErrors.VOUCHER_REDEEMED);break}}}})}};PaymentClient.prototype.validateBankAccount=function(c){var g=/[^0-9]/g;$("BIC").value=$("BIC").value.replace(g,"");$("IBAN").value=$("IBAN").value.replace(g,"");var e=$("BIC").value;var b=$("IBAN").value;if(e.length>0&&b.length>0){var h="html/BankAccountCheck/BankAccountCheck.aspx?accountnumber="+b+"&bankcode="+e;var k=this;new Ajax.Request(h,{method:"get",onSuccess:function(l){if(l.responseText=="0"||l.responseText=="2"||l.responseText=="5"){k.hidePaymentError("BIC","");k.hidePaymentError("IBAN","");k.isValidDirectDebitingAccount=true}else{k.displayPaymentError("BIC",k.paymentErrors.BANKCODE_INVALID,"");k.displayPaymentError("IBAN",k.paymentErrors.BANKACCOUNT_INVALID,"");k.isValidDirectDebitingAccount=false}}})}};PaymentClient.prototype.validateBankAccountHolder=function(b){if($("AccountHolder").value.length>0){this.isValidDirectDebitingAccountHolder=true;this.hidePaymentError("AccountHolder","")}else{this.isValidDirectDebitingAccountHolder=false;this.displayPaymentError("AccountHolder",this.paymentErrors.ACCOUNTHOLDER_MISSING,"")}};PaymentClient.prototype.initializeExpiryFields=function(){var l=new Date();var o=parseInt(l.getFullYear());for(var c=1;c<13;c++){var h=String(c);if(h.length==1){h="0"+String(h)}var b=new Option(h,c);$("goodThruMonth").options[(c-1)]=b}$("goodThruMonth").value=(l.getMonth()+1);var g=parseInt(o+12);var k=0;for(var n=o;n<g;n++){var e=new Option(n,n);$("goodThruYear").options[k]=e;k++}$("goodThruYear").value=l.getFullYear()};PaymentClient.prototype.setPaymentType=function(c){var g="GW";if(c){var g=c.element().id.substring(c.element().id.length-2);c.stop()}var e=g;$("PaymentMethod").hide();if(g=="GW"){e="VI"}if(e=="VI"){$("cardType").value=g;this.setCreditCardType()}if(e=="VO"){this.resetVoucherCode()}$(e+"_PaymentInput").show();$("PaymentInput").show();$("PaymentMethodCode").value=g;$("PaymentOverview").show();var b=0;for(var k=0;k<this.paymentMethods.length;k++){if(this.paymentMethods[k]["CODE"]==g){b=this.paymentMethods[k]["FEE"]}}if(ScPaymentModule){if(g=="EV"||g=="AB"||g=="VO"){var h=ShoppingCartPaymentData.creditCardFees.clone();h.push(b);ScPaymentModule.setTransactionFees(h);ScPaymentModule.update();ShoppingCartController.updateTotal()}}this.isMandatoryBooking();if(e=="VI"){$("cardType").focus();$("cardType").select()}if(e=="EV"){$("BIC").focus();$("BIC").select()}if(e=="AB"){$("BIC").focus();$("BIC").select()}if(e=="VO"){$("voucherCodeBlock1").focus();$("voucherCodeBlock1").select()}};PaymentClient.prototype.resetPaymentType=function(b){if(!this.paymentsExist){$("PaymentOverview").hide()}$("PaymentInput").hide();$("VI_PaymentInput").hide();$("VO_PaymentInput").hide();if($("EV_PaymentInput")!=null){$("EV_PaymentInput").hide()}if($("AB_PaymentInput")!=null){$("AB_PaymentInput").hide()}$("PaymentMethod").show();this.hideAllPaymentErrors();if(b){b.stop()}if(ScBaggageModule){ScBaggageModule.setCCDiscount(false);ScBaggageModule.update()}if(ScSeatingModule){ScSeatingModule.setCCDiscount(false);ScSeatingModule.update()}if(ScPaymentModule){ScPaymentModule.transactionFees.pop();ScPaymentModule.update();ShoppingCartController.updateTotal()}var c=$("PaymentTotal");var g=$("PaymentDue");if(this.paymentTotal&&this.paymentDue){c.update(this.paymentTotal);g.update(this.paymentDue);this.paymentTotal=null;this.paymentDue=null;this.previousCreditCardFee=0}if(c&&g&&this.ccDiscountAmount){var e=this.ccDiscountAmount+ShoppingCartController._extractTotal(c);c.update(ShoppingCart.formatPrice(e));g.update(ShoppingCart.formatPrice(e));this.ccDiscountAmount=null}$("globalErrorContainer").className="globalErrorContainerHidden"};PaymentClient.prototype.transact=function(b){if(b){b.stop()}switch($("PaymentMethodCode").value){case"EV":if(this.ensuredDirectDebit()){this.transactDirectDebit("EV")}break;case"AB":if(this.ensuredDirectDebit()){this.transactDirectDebit("AB")}break;case"VO":if(this.ensuredVoucher()){this.transactVoucher()}break;default:if(this.ensuredCreditCard()){this.transactCreditCard()}break}};PaymentClient.prototype.transactPaymentFree=function(b){if(b){b.stop()}if(isNewBooking){$("SkySales").action="Wait.aspx"}else{$("SkySales").action="AddWait.aspx"}$("SkySales").submit()};PaymentClient.prototype.setVoucherCode=function(k,g){this.systemVoucherCode=k;var e=this.parseAmountFloat($("balanceDueAmount").value);if(e==""){e=$("PaymentDue").innerHTML;$("balanceDueAmount").value=e}var c=parseFloat(g);var h=c;if(c>parseFloat(e)){h=e}if(e>c){this.isBalanceReduction()}var b=$("paymentHtmlId").value;$(b+"_TextBoxVoucherAccount_VO_ACCTNO").value=k;$(b+"_TextBoxVoucherAccount_VO_AMOUNT").value=this.getDecimalDelimitedValue(h);$("voucherAmount").show();$("voucherAmountValue").innerHTML=this.getDecimalDelimitedValue(g);$("voucherAmountCurrency").innerHTML=$("PaymentCurrencySymbol").value;this.isValidVoucherCode=true};PaymentClient.prototype.resetVoucherCode=function(){this.systemVoucherCode="";var e=$("paymentHtmlId").value;$(e+"_TextBoxVoucherAccount_VO_ACCTNO").value="";$(e+"_TextBoxVoucherAccount_VO_AMOUNT").value="";for(var c=0;c<4;c++){$("voucherCodeBlock"+String(c+1)).value=""}$("voucherAmount").hide();$("voucherAmountValue").value="";this.isValidVoucherCode=false};PaymentClient.prototype.ensuredCreditCard=function(){var b=true;$("cardHolder").value=this.removeSpecialCharacters($F("cardHolder"));if($("cardHolder").value.length<1){this.displayPaymentError("cardHolder",this.paymentErrors.CARDHOLDER_REQUIRED,"");b=false}else{this.hidePaymentError("cardHolder","cardHolder")}this.checkCardNumber();if(!this.isValidCreditCardNumber){this.displayPaymentError("accountNumber",this.paymentErrors.CARDNUMBER_INVALID,"");b=false}else{this.hidePaymentError("accountNumber","accountNumber")}this.checkCardExpiry();if(!this.isValidExpiryDate){b=false}this.checkCvcCode();if(!this.isValidCvcCode){this.displayCvcCodeError(this.paymentErrors.CVC_INVALID);b=false}else{this.hideCvcCodeError()}return b};PaymentClient.prototype.ensuredVoucher=function(){if(!this.isValidVoucherCode){this.displayVoucherPaymentError(this.paymentErrors.VOUCHER_INVALID)}return this.isValidVoucherCode};PaymentClient.prototype.ensuredDirectDebit=function(){var b=false;$("AccountHolder").value=this.removeSpecialCharacters($F("AccountHolder"));if($("ELVConditionsAcceptance").checked==true){if(this.isValidDirectDebitingAccount==true&&this.isValidDirectDebitingAccountHolder==true){b=true}}else{this.displayPaymentError("ELVConditionsAcceptance",$("ELVConditionsAcceptanceError").innerHTML,"");b=false}return b};PaymentClient.prototype.getDecimalDelimitedValue=function(e){var c=this.getDecimalDelimiter();var b=String(e);if(c==","){b=b.replace(".",",")}return b};PaymentClient.prototype.getDecimalDelimiter=function(){var b=String($("balanceDueAmount").value);return b.substr((b.length-3),1)};PaymentClient.prototype.parseAmountFloat=function(e){var c=this.getDecimalDelimiter();var b=e;if(c==","){b=b.replace(".","").replace(",",".")}if(c=="."){b=b.replace(",","")}return b};PaymentClient.prototype.transactCreditCard=function(){var b=$("paymentHtmlId").value;$(b+"_DropDownListPaymentMethodCode").value="ExternalAccount:"+$("PaymentMethodCode").value;$(b+"_TextBoxACCTNO").value=$("accountNumber").value;$(b+"TextBoxCC__AccountHolderName").value=$("cardHolder").value;$(b+"_DropDownListEXPDAT_Month").value=$("goodThruMonth").value;$(b+"_DropDownListEXPDAT_Year").value=$("goodThruYear").value;$(b+"_TextBoxCC__VerificationCode").value=$("cvcCode").value;var c=$("PaymentTotal");if(c&&isNewBooking&&$("PaymentMethodCode").value=="GW"){var e=ShoppingCart.formatPrice(ShoppingCartController._extractTotal(c));$(b+"_TextBoxAMT").value=e;$("balanceDueAmount").value=e}$("SkySales").submit()};PaymentClient.prototype.transactDirectDebit=function(c){var b=$("paymentHtmlId").value;$(b+"_DropDownListPaymentMethodCode").value="ExternalAccount:"+c;$(b+"_TextBoxACCTNO").value=$("IBAN").value;$(b+"_TextBoxDD__BankAccountHolderName").value=$("AccountHolder").value;$(b+"_TextBoxDD__BankCode").value=$("BIC").value;$("SkySales").submit()};PaymentClient.prototype.transactVoucher=function(){var b=$("paymentHtmlId").value;$(b+"_DropDownListPaymentMethodCode").value="Voucher:VO";$("__EVENTARGUMENT").value="Voucher";$("SkySales").submit()};PaymentClient.prototype.removeSpecialCharacters=function(e){e=e.replace(/\u00d6/g,"Oe");e=e.replace(/\u00f6/g,"oe");e=e.replace(/\u00c4/g,"Ae");e=e.replace(/\u00e4/g,"ae");e=e.replace(/\u00dc/g,"Ue");e=e.replace(/\u00fc/g,"ue");e=e.replace(/\u00df/g,"ss");e=e.replace(/&/g," u ");e=e.replace(/-/g," ");for(var b=0;b<_charSubstitutionMaps.length;b++){var c=_charSubstitutionMaps[b];e=e.replace(c.regex,c.replacement)}e=e.replace(/[^a-z0-9\s]/gi,"");e=e.replace(/\s{2,}/g," ");e=e.replace(/^\s+|\s+$/g,"");return e};var BestPopup=function(c,b){this.popupContainer=$(c);this.version=b;this.chooseBestCallback=null;this.keepTariffCallback=null;this._updateElements=function(e,g){if(e!=null){e.each(function(h){h.update(g)})}};this._initTracking=function(){if(typeof(s_gi)=="function"){var e=s_gi("germanwingscomprod");e.linkTrackVars="eVar34,events";e.eVar34="Version "+this.version;return e}else{return null}};this._initPopup=function(){if(this.popupContainer!=null){this.popupContainer.getElementsBySelector("#bestPopupClose a")[0].observe("click",this.backEvent.bindAsEventListener(this));this.popupContainer.getElementsBySelector("#bestPopupChoice a")[0].observe("click",this.continueEvent.bindAsEventListener(this));this.popupContainer.getElementsBySelector("#bestPopupChoice img")[0].observe("click",this.switchAndContinueEvent.bindAsEventListener(this))}};this._execKeepTariffCallback=function(){if(typeof(this.keepTariffCallback)=="function"){this.keepTariffCallback()}};this._execChooseBestCallback=function(){if(typeof(this.chooseBestCallback)=="function"){this.chooseBestCallback()}};this.setSavingText=function(e){if(this.popupContainer!=null){this._updateElements(this.popupContainer.getElementsBySelector("span.saving"),e)}};this.setSurchargeText=function(e){if(this.popupContainer!=null){this._updateElements(this.popupContainer.getElementsBySelector("span.surcharge"),e)}};this.setCallbacks=function(e,g){this.chooseBestCallback=e;this.keepTariffCallback=g};this.execute=function(){if(this.version==4){this._execKeepTariffCallback()}else{if(this.popupContainer!=null){var e=this._initTracking();if(e!=null){e.linkTrackEvents="event36";e.events="event36";e.tl(this,"o","Best popup viewed")}window.scrollTo(0,0);this.popupContainer.show()}else{this._execKeepTariffCallback()}}};this.hide=function(){this.popupContainer.hide()};this.continueEvent=function(e){var g=this._initTracking();if(g!=null){g.linkTrackEvents="event35";g.events="event35";g.tl(this,"o","Best popup failed")}this.hide();e.stop();this._execKeepTariffCallback()};this.switchAndContinueEvent=function(e){var g=this._initTracking();if(g!=null){g.linkTrackEvents="event34";g.events="event34";g.tl(this,"o","Best popup succeeded")}this.hide();e.stop();this._execChooseBestCallback()};this.backEvent=function(e){this.hide();e.stop()};this._initPopup()};