(function(){this.MooTools={version:"1.4.4",build:"adb02e676407521b516ffa10d2dc6b54237a80f9"};var o=this.typeOf=function(t){if(t==null){return"null"}if(t.$family!=null){return t.$family()}if(t.nodeName){if(t.nodeType==1){return"element"}if(t.nodeType==3){return(/\S/).test(t.nodeValue)?"textnode":"whitespace"}}else{if(typeof t.length=="number"){if(t.callee){return"arguments"}if("item" in t){return"collection"}}}return typeof t};var j=this.instanceOf=function(v,t){if(v==null){return false}var u=v.$constructor||v.constructor;while(u){if(u===t){return true}u=u.parent}if(!v.hasOwnProperty){return false}return v instanceof t};var f=this.Function;var q=true;for(var k in {toString:1}){q=null}if(q){q=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"]}f.prototype.overloadSetter=function(u){var t=this;return function(w,v){if(w==null){return this}if(u||typeof w!="string"){for(var x in w){t.call(this,x,w[x])}if(q){for(var y=q.length;y--;){x=q[y];
if(w.hasOwnProperty(x)){t.call(this,x,w[x])}}}}else{t.call(this,w,v)}return this}};f.prototype.overloadGetter=function(u){var t=this;return function(w){var x,v;if(u||typeof w!="string"){x=w}else{if(arguments.length>1){x=arguments}}if(x){v={};for(var y=0;y<x.length;y++){v[x[y]]=t.call(this,x[y])}}else{v=t.call(this,w)}return v}};f.prototype.extend=function(t,u){this[t]=u}.overloadSetter();f.prototype.implement=function(t,u){this.prototype[t]=u}.overloadSetter();var n=Array.prototype.slice;f.from=function(t){return(o(t)=="function")?t:function(){return t}};Array.from=function(t){if(t==null){return[]}return(a.isEnumerable(t)&&typeof t!="string")?(o(t)=="array")?t:n.call(t):[t]};Number.from=function(u){var t=parseFloat(u);return isFinite(t)?t:null};String.from=function(t){return t+""};f.implement({hide:function(){this.$hidden=true;return this},protect:function(){this.$protected=true;return this}});var a=this.Type=function(w,v){if(w){var u=w.toLowerCase();var t=function(x){return(o(x)==u)};a["is"+w]=t;
if(v!=null){v.prototype.$family=(function(){return u}).hide()}}if(v==null){return null}v.extend(this);v.$constructor=a;v.prototype.$constructor=v;return v};var e=Object.prototype.toString;a.isEnumerable=function(t){return(t!=null&&typeof t.length=="number"&&e.call(t)!="[object Function]")};var r={};var s=function(t){var u=o(t.prototype);return r[u]||(r[u]=[])};var b=function(u,y){if(y&&y.$hidden){return}var t=s(this);for(var v=0;v<t.length;v++){var x=t[v];if(o(x)=="type"){b.call(x,u,y)}else{x.call(this,u,y)}}var w=this.prototype[u];if(w==null||!w.$protected){this.prototype[u]=y}if(this[u]==null&&o(y)=="function"){m.call(this,u,function(z){return y.apply(z,n.call(arguments,1))})}};var m=function(t,v){if(v&&v.$hidden){return}var u=this[t];if(u==null||!u.$protected){this[t]=v}};a.implement({implement:b.overloadSetter(),extend:m.overloadSetter(),alias:function(t,u){b.call(this,t,this.prototype[u])}.overloadSetter(),mirror:function(t){s(this).push(t);return this}});new a("Type",a);var d=function(t,y,w){var v=(y!=Object),C=y.prototype;
if(v){y=new a(t,y)}for(var z=0,x=w.length;z<x;z++){var D=w[z],B=y[D],A=C[D];if(B){B.protect()}if(v&&A){y.implement(D,A.protect())}}if(v){var u=C.propertyIsEnumerable(w[0]);y.forEachMethod=function(H){if(!u){for(var G=0,E=w.length;G<E;G++){H.call(C,C[w[G]],w[G])}}for(var F in C){H.call(C,C[F],F)}}}return d};d("String",String,["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","quote","replace","search","slice","split","substr","substring","trim","toLowerCase","toUpperCase"])("Array",Array,["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"])("Number",Number,["toExponential","toFixed","toLocaleString","toPrecision"])("Function",f,["apply","call","bind"])("RegExp",RegExp,["exec","test"])("Object",Object,["create","defineProperty","defineProperties","keys","getPrototypeOf","getOwnPropertyDescriptor","getOwnPropertyNames","preventExtensions","isExtensible","seal","isSealed","freeze","isFrozen"])("Date",Date,["now"]);
Object.extend=m.overloadSetter();Date.extend("now",function(){return +(new Date)});new a("Boolean",Boolean);Number.prototype.$family=function(){return isFinite(this)?"number":"null"}.hide();Number.extend("random",function(u,t){return Math.floor(Math.random()*(t-u+1)+u)});var g=Object.prototype.hasOwnProperty;Object.extend("forEach",function(t,v,w){for(var u in t){if(g.call(t,u)){v.call(w,t[u],u,t)}}});Object.each=Object.forEach;Array.implement({forEach:function(v,w){for(var u=0,t=this.length;u<t;u++){if(u in this){v.call(w,this[u],u,this)}}},each:function(t,u){Array.forEach(this,t,u);return this}});var l=function(t){switch(o(t)){case"array":return t.clone();case"object":return Object.clone(t);default:return t}};Array.implement("clone",function(){var t=this.length,u=new Array(t);while(t--){u[t]=l(this[t])}return u});var h=function(u,t,v){switch(o(v)){case"object":if(o(u[t])=="object"){Object.merge(u[t],v)}else{u[t]=Object.clone(v)}break;case"array":u[t]=v.clone();break;default:u[t]=v}return u
};Object.extend({merge:function(A,w,u){if(o(w)=="string"){return h(A,w,u)}for(var z=1,t=arguments.length;z<t;z++){var x=arguments[z];for(var y in x){h(A,y,x[y])}}return A},clone:function(t){var v={};for(var u in t){v[u]=l(t[u])}return v},append:function(x){for(var w=1,u=arguments.length;w<u;w++){var t=arguments[w]||{};for(var v in t){x[v]=t[v]}}return x}});["Object","WhiteSpace","TextNode","Collection","Arguments"].each(function(t){new a(t)});var c=Date.now();String.extend("uniqueID",function(){return(c++).toString(36)})})();Array.implement({every:function(c,d){for(var b=0,a=this.length>>>0;b<a;b++){if((b in this)&&!c.call(d,this[b],b,this)){return false}}return true},filter:function(d,f){var c=[];for(var e,b=0,a=this.length>>>0;b<a;b++){if(b in this){e=this[b];if(d.call(f,e,b,this)){c.push(e)}}}return c},indexOf:function(c,d){var b=this.length>>>0;for(var a=(d<0)?Math.max(0,b+d):d||0;a<b;a++){if(this[a]===c){return a}}return -1},map:function(c,e){var d=this.length>>>0,b=Array(d);for(var a=0;
a<d;a++){if(a in this){b[a]=c.call(e,this[a],a,this)}}return b},some:function(c,d){for(var b=0,a=this.length>>>0;b<a;b++){if((b in this)&&c.call(d,this[b],b,this)){return true}}return false},clean:function(){return this.filter(function(a){return a!=null})},invoke:function(a){var b=Array.slice(arguments,1);return this.map(function(c){return c[a].apply(c,b)})},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a]}return d},link:function(c){var a={};for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break}}}return a},contains:function(a,b){return this.indexOf(a,b)!=-1},append:function(a){this.push.apply(this,a);return this},getLast:function(){return(this.length)?this[this.length-1]:null},getRandom:function(){return(this.length)?this[Number.random(0,this.length-1)]:null},include:function(a){if(!this.contains(a)){this.push(a)}return this},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b])
}return this},erase:function(b){for(var a=this.length;a--;){if(this[a]===b){this.splice(a,1)}}return this},empty:function(){this.length=0;return this},flatten:function(){var d=[];for(var b=0,a=this.length;b<a;b++){var c=typeOf(this[b]);if(c=="null"){continue}d=d.concat((c=="array"||c=="collection"||c=="arguments"||instanceOf(this[b],Array))?Array.flatten(this[b]):this[b])}return d},pick:function(){for(var b=0,a=this.length;b<a;b++){if(this[b]!=null){return this[b]}}return null},hexToRgb:function(b){if(this.length!=3){return null}var a=this.map(function(c){if(c.length==1){c+=c}return c.toInt(16)});return(b)?a:"rgb("+a+")"},rgbToHex:function(d){if(this.length<3){return null}if(this.length==4&&this[3]==0&&!d){return"transparent"}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16);b.push((c.length==1)?"0"+c:c)}return(d)?b:"#"+b.join("")}});String.implement({test:function(a,b){return((typeOf(a)=="regexp")?a:new RegExp(""+a,b)).test(this)},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:String(this).indexOf(a)>-1
},trim:function(){return String(this).replace(/^\s+|\s+$/g,"")},clean:function(){return String(this).replace(/\s+/g," ").trim()},camelCase:function(){return String(this).replace(/-\D/g,function(a){return a.charAt(1).toUpperCase()})},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase())})},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase()})},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")},toInt:function(a){return parseInt(this,a||10)},toFloat:function(){return parseFloat(this)},hexToRgb:function(b){var a=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):null},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1)}return(a[c]!=null)?a[c]:""})}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this))
},round:function(a){a=Math.pow(10,a||0).toFixed(a<0?-a:0);return Math.round(this*a)/a},times:function(b,c){for(var a=0;a<this;a++){b.call(c,a,this)}},toFloat:function(){return parseFloat(this)},toInt:function(a){return parseInt(this,a||10)}});Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments)))}}});Number.implement(a)})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);Function.extend({attempt:function(){for(var b=0,a=arguments.length;b<a;b++){try{return arguments[b]()}catch(c){}}return null}});Function.implement({attempt:function(a,c){try{return this.apply(c,Array.from(a))}catch(b){}return null},bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;g=new d}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);
return g==e?f:g};return c},pass:function(b,c){var a=this;if(b!=null){b=Array.from(b)}return function(){return a.apply(c,b||arguments)}},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b)},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c)}});(function(){var a=Object.prototype.hasOwnProperty;Object.extend({subset:function(d,g){var f={};for(var e=0,b=g.length;e<b;e++){var c=g[e];if(c in d){f[c]=d[c]}}return f},map:function(b,e,f){var d={};for(var c in b){if(a.call(b,c)){d[c]=e.call(f,b[c],c,b)}}return d},filter:function(b,e,g){var d={};for(var c in b){var f=b[c];if(a.call(b,c)&&e.call(g,f,c,b)){d[c]=f}}return d},every:function(b,d,e){for(var c in b){if(a.call(b,c)&&!d.call(e,b[c],c)){return false}}return true},some:function(b,d,e){for(var c in b){if(a.call(b,c)&&d.call(e,b[c],c)){return true}}return false},keys:function(b){var d=[];for(var c in b){if(a.call(b,c)){d.push(c)}}return d},values:function(c){var b=[];for(var d in c){if(a.call(c,d)){b.push(c[d])
}}return b},getLength:function(b){return Object.keys(b).length},keyOf:function(b,d){for(var c in b){if(a.call(b,c)&&b[c]===d){return c}}return null},contains:function(b,c){return Object.keyOf(b,c)!=null},toQueryString:function(b,c){var d=[];Object.each(b,function(h,g){if(c){g=c+"["+g+"]"}var f;switch(typeOf(h)){case"object":f=Object.toQueryString(h,g);break;case"array":var e={};h.each(function(k,j){e[j]=k});f=Object.toQueryString(e,g);break;default:f=g+"="+encodeURIComponent(h)}if(h!=null){d.push(f)}});return d.join("&")}})})();(function(){var k=this.document;var g=k.window=this;var a=navigator.userAgent.toLowerCase(),b=navigator.platform.toLowerCase(),h=a.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0],d=h[1]=="ie"&&k.documentMode;var o=this.Browser={extend:Function.prototype.extend,name:(h[1]=="version")?h[3]:h[1],version:d||parseFloat((h[1]=="opera"&&h[4])?h[4]:h[2]),Platform:{name:a.match(/ip(?:ad|od|hone)/)?"ios":(a.match(/(?:webos|android)/)||b.match(/mac|win|linux/)||["other"])[0]},Features:{xpath:!!(k.evaluate),air:!!(g.runtime),query:!!(k.querySelector),json:!!(g.JSON)},Plugins:{}};
o[o.name]=true;o[o.name+parseInt(o.version,10)]=true;o.Platform[o.Platform.name]=true;o.Request=(function(){var r=function(){return new XMLHttpRequest()};var q=function(){return new ActiveXObject("MSXML2.XMLHTTP")};var e=function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Function.attempt(function(){r();return r},function(){q();return q},function(){e();return e})})();o.Features.xhr=!!(o.Request);var j=(Function.attempt(function(){return navigator.plugins["Shockwave Flash"].description},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")})||"0 r0").match(/\d+/g);o.Plugins.Flash={version:Number(j[0]||"0."+j[1])||0,build:Number(j[2])||0};o.exec=function(q){if(!q){return q}if(g.execScript){g.execScript(q)}else{var e=k.createElement("script");e.setAttribute("type","text/javascript");e.text=q;k.head.appendChild(e);k.head.removeChild(e)}return q};String.implement("stripScripts",function(q){var e="";var r=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(s,t){e+=t+"\n";
return""});if(q===true){o.exec(e)}else{if(typeOf(q)=="function"){q(e,r)}}return r});o.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event});this.Window=this.$constructor=new Type("Window",function(){});this.$family=Function.from("window").hide();Window.mirror(function(e,q){g[e]=q});this.Document=k.$constructor=new Type("Document",function(){});k.$family=Function.from("document").hide();Document.mirror(function(e,q){k[e]=q});k.html=k.documentElement;if(!k.head){k.head=k.getElementsByTagName("head")[0]}if(k.execCommand){try{k.execCommand("BackgroundImageCache",false,true)}catch(f){}}if(this.attachEvent&&!this.addEventListener){var c=function(){this.detachEvent("onunload",c);k.head=k.html=k.window=null};this.attachEvent("onunload",c)}var m=Array.from;try{m(k.html.childNodes)}catch(f){Array.from=function(q){if(typeof q!="string"&&Type.isEnumerable(q)&&typeOf(q)!="array"){var e=q.length,r=new Array(e);while(e--){r[e]=q[e]}return r}return m(q)};var l=Array.prototype,n=l.slice;
["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var q=l[e];Array[e]=function(r){return q.apply(Array.from(r),n.call(arguments,1))}})}})();(function(){var b={};var a=this.DOMEvent=new Type("DOMEvent",function(c,g){if(!g){g=window}c=c||g.event;if(c.$extended){return c}this.event=c;this.$extended=true;this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey;var j=this.type=c.type;var h=c.target||c.srcElement;while(h&&h.nodeType==3){h=h.parentNode}this.target=document.id(h);if(j.indexOf("key")==0){var d=this.code=(c.which||c.keyCode);this.key=b[d];if(j=="keydown"){if(d>111&&d<124){this.key="f"+(d-111)}else{if(d>95&&d<106){this.key=d-96}}}if(this.key==null){this.key=String.fromCharCode(d).toLowerCase()}}else{if(j=="click"||j=="dblclick"||j=="contextmenu"||j=="DOMMouseScroll"||j.indexOf("mouse")==0){var k=g.document;k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body;this.page={x:(c.pageX!=null)?c.pageX:c.clientX+k.scrollLeft,y:(c.pageY!=null)?c.pageY:c.clientY+k.scrollTop};
this.client={x:(c.pageX!=null)?c.pageX-g.pageXOffset:c.clientX,y:(c.pageY!=null)?c.pageY-g.pageYOffset:c.clientY};if(j=="DOMMouseScroll"||j=="mousewheel"){this.wheel=(c.wheelDelta)?c.wheelDelta/120:-(c.detail||0)/3}this.rightClick=(c.which==3||c.button==2);if(j=="mouseover"||j=="mouseout"){var l=c.relatedTarget||c[(j=="mouseover"?"from":"to")+"Element"];while(l&&l.nodeType==3){l=l.parentNode}this.relatedTarget=document.id(l)}}else{if(j.indexOf("touch")==0||j.indexOf("gesture")==0){this.rotation=c.rotation;this.scale=c.scale;this.targetTouches=c.targetTouches;this.changedTouches=c.changedTouches;var f=this.touches=c.touches;if(f&&f[0]){var e=f[0];this.page={x:e.pageX,y:e.pageY};this.client={x:e.clientX,y:e.clientY}}}}}if(!this.client){this.client={}}if(!this.page){this.page={}}});a.implement({stop:function(){return this.preventDefault().stopPropagation()},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation()}else{this.event.cancelBubble=true}return this},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault()
}else{this.event.returnValue=false}return this}});a.defineKey=function(d,c){b[d]=c;return this};a.defineKeys=a.defineKey.overloadSetter(true);a.defineKeys({"38":"up","40":"down","37":"left","39":"right","27":"esc","32":"space","8":"backspace","9":"tab","46":"delete","13":"enter"})})();(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h}}var g=function(){e(this);if(g.$prototyping){return this}this.$caller=null;var j=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null;return j}.extend(this).implement(h);g.$constructor=a;g.prototype.$constructor=g;g.prototype.parent=c;return g});var c=function(){if(!this.$caller){throw new Error('The method "parent" cannot be called.')}var g=this.$caller.$name,h=this.$caller.$owner.parent,j=(h)?h.prototype[g]:null;if(!j){throw new Error('The method "'+g+'" has no parent.')}return j.apply(this,arguments)};var e=function(g){for(var h in g){var k=g[h];switch(typeOf(k)){case"object":var j=function(){};
j.prototype=k;g[h]=e(new j);break;case"array":g[h]=k.clone();break}}return g};var b=function(g,h,k){if(k.$origin){k=k.$origin}var j=function(){if(k.$protected&&this.$caller==null){throw new Error('The method "'+h+'" cannot be called.')}var m=this.caller,n=this.$caller;this.caller=n;this.$caller=j;var l=k.apply(this,arguments);this.$caller=n;this.caller=m;return l}.extend({$owner:g,$origin:k,$name:h});return j};var f=function(h,j,g){if(a.Mutators.hasOwnProperty(h)){j=a.Mutators[h].call(this,j);if(j==null){return this}}if(typeOf(j)=="function"){if(j.$hidden){return this}this.prototype[h]=(g)?j:b(this,h,j)}else{Object.merge(this.prototype,h,j)}return this};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping;return h};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g)},Implements:function(g){Array.from(g).each(function(k){var h=new k;for(var j in h){f.call(this,j,h[j],true)}},this)}}})();(function(){this.Chain=new Class({$chain:[],chain:function(){this.$chain.append(Array.flatten(arguments));
return this},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false},clearChain:function(){this.$chain.empty();return this}});var a=function(b){return b.replace(/^on([A-Z])/,function(c,d){return d.toLowerCase()})};this.Events=new Class({$events:{},addEvent:function(d,c,b){d=a(d);this.$events[d]=(this.$events[d]||[]).include(c);if(b){c.internal=true}return this},addEvents:function(b){for(var c in b){this.addEvent(c,b[c])}return this},fireEvent:function(e,c,b){e=a(e);var d=this.$events[e];if(!d){return this}c=Array.from(c);d.each(function(f){if(b){f.delay(b,this,c)}else{f.apply(this,c)}},this);return this},removeEvent:function(e,d){e=a(e);var c=this.$events[e];if(c&&!d.internal){var b=c.indexOf(d);if(b!=-1){delete c[b]}}return this},removeEvents:function(d){var e;if(typeOf(d)=="object"){for(e in d){this.removeEvent(e,d[e])}return this}if(d){d=a(d)}for(e in this.$events){if(d&&d!=e){continue}var c=this.$events[e];for(var b=c.length;b--;){if(b in c){this.removeEvent(e,c[b])
}}}return this}});this.Options=new Class({setOptions:function(){var b=this.options=Object.merge.apply(null,[{},this.options].append(arguments));if(this.addEvent){for(var c in b){if(typeOf(b[c])!="function"||!(/^on[A-Z]/).test(c)){continue}this.addEvent(c,b[c]);delete b[c]}}return this}})})();(function(){var l,o,m,g,a={},c={},n=/\\/g;var e=function(s,r){if(s==null){return null}if(s.Slick===true){return s}s=(""+s).replace(/^\s+|\s+$/g,"");g=!!r;var q=(g)?c:a;if(q[s]){return q[s]}l={Slick:true,expressions:[],raw:s,reverse:function(){return e(this.raw,true)}};o=-1;while(s!=(s=s.replace(k,b))){}l.length=l.expressions.length;return q[l.raw]=(g)?h(l):l};var j=function(q){if(q==="!"){return" "}else{if(q===" "){return"!"}else{if((/^!/).test(q)){return q.replace(/^!/,"")}else{return"!"+q}}}};var h=function(w){var t=w.expressions;for(var r=0;r<t.length;r++){var v=t[r];var s={parts:[],tag:"*",combinator:j(v[0].combinator)};for(var q=0;q<v.length;q++){var u=v[q];if(!u.reverseCombinator){u.reverseCombinator=" "
}u.combinator=u.reverseCombinator;delete u.reverseCombinator}v.reverse().push(s)}return w};var f=function(q){return q.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(r){return"\\"+r})};var k=new RegExp("^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(/<combinator>/,"["+f(">+~`!@$%^&={}\\;</")+"]").replace(/<unicode>/g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(/<unicode1>/g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])"));function b(z,u,F,B,t,E,s,D,C,A,w,H,I,x,r,y){if(u||o===-1){l.expressions[++o]=[];m=-1;if(u){return""}}if(F||B||m===-1){F=F||" ";var v=l.expressions[o];if(g&&v[m]){v[m].reverseCombinator=j(F)}v[++m]={combinator:F,tag:"*"}}var q=l.expressions[o][m];if(t){q.tag=t.replace(n,"")}else{if(E){q.id=E.replace(n,"")}else{if(s){s=s.replace(n,"");if(!q.classList){q.classList=[]
}if(!q.classes){q.classes=[]}q.classList.push(s);q.classes.push({value:s,regexp:new RegExp("(^|\\s)"+f(s)+"(\\s|$)")})}else{if(I){y=y||r;y=y?y.replace(n,""):null;if(!q.pseudos){q.pseudos=[]}q.pseudos.push({key:I.replace(n,""),value:y,type:H.length==1?"class":"element"})}else{if(D){D=D.replace(n,"");w=(w||"").replace(n,"");var G,J;switch(C){case"^=":J=new RegExp("^"+f(w));break;case"$=":J=new RegExp(f(w)+"$");break;case"~=":J=new RegExp("(^|\\s)"+f(w)+"(\\s|$)");break;case"|=":J=new RegExp("^"+f(w)+"(-|$)");break;case"=":G=function(K){return w==K};break;case"*=":G=function(K){return K&&K.indexOf(w)>-1};break;case"!=":G=function(K){return w!=K};break;default:G=function(K){return !!K}}if(w==""&&(/^[*$^]=$/).test(C)){G=function(){return false}}if(!G){G=function(K){return K&&J.test(K)}}if(!q.attributes){q.attributes=[]}q.attributes.push({key:D,operator:C,value:w,test:G})}}}}}return""}var d=(this.Slick||{});d.parse=function(q){return e(q)};d.escapeRegExp=f;if(!this.Slick){this.Slick=d}}).apply((typeof exports!="undefined")?exports:this);
(function(){var l={},n={},d=Object.prototype.toString;l.isNativeCode=function(c){return(/\{\s*\[native code\]\s*\}/).test(""+c)};l.isXML=function(c){return(!!c.xmlVersion)||(!!c.xml)||(d.call(c)=="[object XMLDocument]")||(c.nodeType==9&&c.documentElement.nodeName!="HTML")};l.setDocument=function(y){var r=y.nodeType;if(r==9){}else{if(r){y=y.ownerDocument}else{if(y.navigator){y=y.document}else{return}}}if(this.document===y){return}this.document=y;var C=y.documentElement,q=this.getUIDXML(C),u=n[q],t;if(u){for(t in u){this[t]=u[t]}return}u=n[q]={};u.root=C;u.isXMLDocument=this.isXML(y);u.brokenStarGEBTN=u.starSelectsClosedQSA=u.idGetsName=u.brokenMixedCaseQSA=u.brokenGEBCN=u.brokenCheckedQSA=u.brokenEmptyAttributeQSA=u.isHTMLDocument=u.nativeMatchesSelector=false;var s,w,A,B,v;var z,x="slick_uniqueid";var c=y.createElement("div");var o=y.body||y.getElementsByTagName("body")[0]||C;o.appendChild(c);try{c.innerHTML='<a id="'+x+'"></a>';u.isHTMLDocument=!!y.getElementById(x)}catch(E){}if(u.isHTMLDocument){c.style.display="none";
c.appendChild(y.createComment(""));w=(c.getElementsByTagName("*").length>1);try{c.innerHTML="foo</foo>";z=c.getElementsByTagName("*");s=(z&&!!z.length&&z[0].nodeName.charAt(0)=="/")}catch(E){}u.brokenStarGEBTN=w||s;try{c.innerHTML='<a name="'+x+'"></a><b id="'+x+'"></b>';u.idGetsName=y.getElementById(x)===c.firstChild}catch(E){}if(c.getElementsByClassName){try{c.innerHTML='<a class="f"></a><a class="b"></a>';c.getElementsByClassName("b").length;c.firstChild.className="b";B=(c.getElementsByClassName("b").length!=2)}catch(E){}try{c.innerHTML='<a class="a"></a><a class="f b a"></a>';A=(c.getElementsByClassName("a").length!=2)}catch(E){}u.brokenGEBCN=B||A}if(c.querySelectorAll){try{c.innerHTML="foo</foo>";z=c.querySelectorAll("*");u.starSelectsClosedQSA=(z&&!!z.length&&z[0].nodeName.charAt(0)=="/")}catch(E){}try{c.innerHTML='<a class="MiX"></a>';u.brokenMixedCaseQSA=!c.querySelectorAll(".MiX").length}catch(E){}try{c.innerHTML='<select><option selected="selected">a</option></select>';u.brokenCheckedQSA=(c.querySelectorAll(":checked").length==0)
}catch(E){}try{c.innerHTML='<a class=""></a>';u.brokenEmptyAttributeQSA=(c.querySelectorAll('[class*=""]').length!=0)}catch(E){}}try{c.innerHTML='<form action="s"><input id="action"/></form>';v=(c.firstChild.getAttribute("action")!="s")}catch(E){}u.nativeMatchesSelector=C.matchesSelector||C.mozMatchesSelector||C.webkitMatchesSelector;if(u.nativeMatchesSelector){try{u.nativeMatchesSelector.call(C,":slick");u.nativeMatchesSelector=null}catch(E){}}}try{C.slick_expando=1;delete C.slick_expando;u.getUID=this.getUIDHTML}catch(E){u.getUID=this.getUIDXML}o.removeChild(c);c=z=o=null;u.getAttribute=(u.isHTMLDocument&&v)?function(I,G){var J=this.attributeGetters[G];if(J){return J.call(I)}var H=I.getAttributeNode(G);return(H)?H.nodeValue:null}:function(H,G){var I=this.attributeGetters[G];return(I)?I.call(H):H.getAttribute(G)};u.hasAttribute=(C&&this.isNativeCode(C.hasAttribute))?function(H,G){return H.hasAttribute(G)}:function(H,G){H=H.getAttributeNode(G);return !!(H&&(H.specified||H.nodeValue))};var F=C&&this.isNativeCode(C.contains),D=y&&this.isNativeCode(y.contains);
u.contains=(F&&D)?function(G,H){return G.contains(H)}:(F&&!D)?function(G,H){return G===H||((G===y)?y.documentElement:G).contains(H)}:(C&&C.compareDocumentPosition)?function(G,H){return G===H||!!(G.compareDocumentPosition(H)&16)}:function(G,H){if(H){do{if(H===G){return true}}while((H=H.parentNode))}return false};u.documentSorter=(C.compareDocumentPosition)?function(H,G){if(!H.compareDocumentPosition||!G.compareDocumentPosition){return 0}return H.compareDocumentPosition(G)&4?-1:H===G?0:1}:("sourceIndex" in C)?function(H,G){if(!H.sourceIndex||!G.sourceIndex){return 0}return H.sourceIndex-G.sourceIndex}:(y.createRange)?function(J,H){if(!J.ownerDocument||!H.ownerDocument){return 0}var I=J.ownerDocument.createRange(),G=H.ownerDocument.createRange();I.setStart(J,0);I.setEnd(J,0);G.setStart(H,0);G.setEnd(H,0);return I.compareBoundaryPoints(Range.START_TO_END,G)}:null;C=null;for(t in u){this[t]=u[t]}};var f=/^([#.]?)((?:[\w-]+|\*))$/,h=/\[.+[*$^]=(?:""|'')?\]/,g={};l.search=function(V,A,I,t){var q=this.found=(t)?null:(I||[]);
if(!V){return q}else{if(V.navigator){V=V.document}else{if(!V.nodeType){return q}}}var G,P,W=this.uniques={},J=!!(I&&I.length),z=(V.nodeType==9);if(this.document!==(z?V:V.ownerDocument)){this.setDocument(V)}if(J){for(P=q.length;P--;){W[this.getUID(q[P])]=true}}if(typeof A=="string"){var s=A.match(f);simpleSelectors:if(s){var v=s[1],w=s[2],B,F;if(!v){if(w=="*"&&this.brokenStarGEBTN){break simpleSelectors}F=V.getElementsByTagName(w);if(t){return F[0]||null}for(P=0;B=F[P++];){if(!(J&&W[this.getUID(B)])){q.push(B)}}}else{if(v=="#"){if(!this.isHTMLDocument||!z){break simpleSelectors}B=V.getElementById(w);if(!B){return q}if(this.idGetsName&&B.getAttributeNode("id").nodeValue!=w){break simpleSelectors}if(t){return B||null}if(!(J&&W[this.getUID(B)])){q.push(B)}}else{if(v=="."){if(!this.isHTMLDocument||((!V.getElementsByClassName||this.brokenGEBCN)&&V.querySelectorAll)){break simpleSelectors}if(V.getElementsByClassName&&!this.brokenGEBCN){F=V.getElementsByClassName(w);if(t){return F[0]||null}for(P=0;
B=F[P++];){if(!(J&&W[this.getUID(B)])){q.push(B)}}}else{var U=new RegExp("(^|\\s)"+e.escapeRegExp(w)+"(\\s|$)");F=V.getElementsByTagName("*");for(P=0;B=F[P++];){className=B.className;if(!(className&&U.test(className))){continue}if(t){return B}if(!(J&&W[this.getUID(B)])){q.push(B)}}}}}}if(J){this.sort(q)}return(t)?null:q}querySelector:if(V.querySelectorAll){if(!this.isHTMLDocument||g[A]||this.brokenMixedCaseQSA||(this.brokenCheckedQSA&&A.indexOf(":checked")>-1)||(this.brokenEmptyAttributeQSA&&h.test(A))||(!z&&A.indexOf(",")>-1)||e.disableQSA){break querySelector}var T=A,y=V;if(!z){var D=y.getAttribute("id"),u="slickid__";y.setAttribute("id",u);T="#"+u+" "+T;V=y.parentNode}try{if(t){return V.querySelector(T)||null}else{F=V.querySelectorAll(T)}}catch(R){g[A]=1;break querySelector}finally{if(!z){if(D){y.setAttribute("id",D)}else{y.removeAttribute("id")}V=y}}if(this.starSelectsClosedQSA){for(P=0;B=F[P++];){if(B.nodeName>"@"&&!(J&&W[this.getUID(B)])){q.push(B)}}}else{for(P=0;B=F[P++];){if(!(J&&W[this.getUID(B)])){q.push(B)
}}}if(J){this.sort(q)}return q}G=this.Slick.parse(A);if(!G.length){return q}}else{if(A==null){return q}else{if(A.Slick){G=A}else{if(this.contains(V.documentElement||V,A)){(q)?q.push(A):q=A;return q}else{return q}}}}this.posNTH={};this.posNTHLast={};this.posNTHType={};this.posNTHTypeLast={};this.push=(!J&&(t||(G.length==1&&G.expressions[0].length==1)))?this.pushArray:this.pushUID;if(q==null){q=[]}var N,M,L;var C,K,E,c,r,H,X;var O,Q,o,x,S=G.expressions;search:for(P=0;(Q=S[P]);P++){for(N=0;(o=Q[N]);N++){C="combinator:"+o.combinator;if(!this[C]){continue search}K=(this.isXMLDocument)?o.tag:o.tag.toUpperCase();E=o.id;c=o.classList;r=o.classes;H=o.attributes;X=o.pseudos;x=(N===(Q.length-1));this.bitUniques={};if(x){this.uniques=W;this.found=q}else{this.uniques={};this.found=[]}if(N===0){this[C](V,K,E,r,H,X,c);if(t&&x&&q.length){break search}}else{if(t&&x){for(M=0,L=O.length;M<L;M++){this[C](O[M],K,E,r,H,X,c);if(q.length){break search}}}else{for(M=0,L=O.length;M<L;M++){this[C](O[M],K,E,r,H,X,c)
}}}O=this.found}}if(J||(G.expressions.length>1)){this.sort(q)}return(t)?(q[0]||null):q};l.uidx=1;l.uidk="slick-uniqueid";l.getUIDXML=function(o){var c=o.getAttribute(this.uidk);if(!c){c=this.uidx++;o.setAttribute(this.uidk,c)}return c};l.getUIDHTML=function(c){return c.uniqueNumber||(c.uniqueNumber=this.uidx++)};l.sort=function(c){if(!this.documentSorter){return c}c.sort(this.documentSorter);return c};l.cacheNTH={};l.matchNTH=/^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;l.parseNTHArgument=function(s){var q=s.match(this.matchNTH);if(!q){return false}var r=q[2]||false;var o=q[1]||1;if(o=="-"){o=-1}var c=+q[3]||0;q=(r=="n")?{a:o,b:c}:(r=="odd")?{a:2,b:1}:(r=="even")?{a:2,b:0}:{a:0,b:o};return(this.cacheNTH[s]=q)};l.createNTHPseudo=function(r,o,c,q){return function(u,s){var w=this.getUID(u);if(!this[c][w]){var C=u.parentNode;if(!C){return false}var t=C[r],v=1;if(q){var B=u.nodeName;do{if(t.nodeName!=B){continue}this[c][this.getUID(t)]=v++}while((t=t[o]))}else{do{if(t.nodeType!=1){continue}this[c][this.getUID(t)]=v++
}while((t=t[o]))}}s=s||"n";var x=this.cacheNTH[s]||this.parseNTHArgument(s);if(!x){return false}var A=x.a,z=x.b,y=this[c][w];if(A==0){return z==y}if(A>0){if(y<z){return false}}else{if(z<y){return false}}return((y-z)%A)==0}};l.pushArray=function(r,c,t,q,o,s){if(this.matchSelector(r,c,t,q,o,s)){this.found.push(r)}};l.pushUID=function(s,c,u,r,o,t){var q=this.getUID(s);if(!this.uniques[q]&&this.matchSelector(s,c,u,r,o,t)){this.uniques[q]=true;this.found.push(s)}};l.matchNode=function(o,q){if(this.isHTMLDocument&&this.nativeMatchesSelector){try{return this.nativeMatchesSelector.call(o,q.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g,'[$1="$2"]'))}catch(w){}}var v=this.Slick.parse(q);if(!v){return true}var t=v.expressions,u=0,s;for(s=0;(currentExpression=t[s]);s++){if(currentExpression.length==1){var r=currentExpression[0];if(this.matchSelector(o,(this.isXMLDocument)?r.tag:r.tag.toUpperCase(),r.id,r.classes,r.attributes,r.pseudos)){return true}u++}}if(u==v.length){return false}var c=this.search(this.document,v),x;
for(s=0;x=c[s++];){if(x===o){return true}}return false};l.matchPseudo=function(s,c,r){var o="pseudo:"+c;if(this[o]){return this[o](s,r)}var q=this.getAttribute(s,c);return(r)?r==q:!!q};l.matchSelector=function(q,x,c,r,s,u){if(x){var v=(this.isXMLDocument)?q.nodeName:q.nodeName.toUpperCase();if(x=="*"){if(v<"@"){return false}}else{if(v!=x){return false}}}if(c&&q.getAttribute("id")!=c){return false}var t,o,w;if(r){for(t=r.length;t--;){w=this.getAttribute(q,"class");if(!(w&&r[t].regexp.test(w))){return false}}}if(s){for(t=s.length;t--;){o=s[t];if(o.operator?!o.test(this.getAttribute(q,o.key)):!this.hasAttribute(q,o.key)){return false}}}if(u){for(t=u.length;t--;){o=u[t];if(!this.matchPseudo(q,o.key,o.value)){return false}}}return true};var k={" ":function(s,y,o,t,u,w,r){var v,x,q;if(this.isHTMLDocument){getById:if(o){x=this.document.getElementById(o);if((!x&&s.all)||(this.idGetsName&&x&&x.getAttributeNode("id").nodeValue!=o)){q=s.all[o];if(!q){return}if(!q[0]){q=[q]}for(v=0;x=q[v++];){var c=x.getAttributeNode("id");
if(c&&c.nodeValue==o){this.push(x,y,null,t,u,w);break}}return}if(!x){if(this.contains(this.root,s)){return}else{break getById}}else{if(this.document!==s&&!this.contains(s,x)){return}}this.push(x,y,null,t,u,w);return}getByClass:if(t&&s.getElementsByClassName&&!this.brokenGEBCN){q=s.getElementsByClassName(r.join(" "));if(!(q&&q.length)){break getByClass}for(v=0;x=q[v++];){this.push(x,y,o,null,u,w)}return}}getByTag:{q=s.getElementsByTagName(y);if(!(q&&q.length)){break getByTag}if(!this.brokenStarGEBTN){y=null}for(v=0;x=q[v++];){this.push(x,y,o,t,u,w)}}},">":function(r,c,t,q,o,s){if((r=r.firstChild)){do{if(r.nodeType==1){this.push(r,c,t,q,o,s)}}while((r=r.nextSibling))}},"+":function(r,c,t,q,o,s){while((r=r.nextSibling)){if(r.nodeType==1){this.push(r,c,t,q,o,s);break}}},"^":function(r,c,t,q,o,s){r=r.firstChild;if(r){if(r.nodeType==1){this.push(r,c,t,q,o,s)}else{this["combinator:+"](r,c,t,q,o,s)}}},"~":function(s,c,u,r,o,t){while((s=s.nextSibling)){if(s.nodeType!=1){continue}var q=this.getUID(s);
if(this.bitUniques[q]){break}this.bitUniques[q]=true;this.push(s,c,u,r,o,t)}},"++":function(r,c,t,q,o,s){this["combinator:+"](r,c,t,q,o,s);this["combinator:!+"](r,c,t,q,o,s)},"~~":function(r,c,t,q,o,s){this["combinator:~"](r,c,t,q,o,s);this["combinator:!~"](r,c,t,q,o,s)},"!":function(r,c,t,q,o,s){while((r=r.parentNode)){if(r!==this.document){this.push(r,c,t,q,o,s)}}},"!>":function(r,c,t,q,o,s){r=r.parentNode;if(r!==this.document){this.push(r,c,t,q,o,s)}},"!+":function(r,c,t,q,o,s){while((r=r.previousSibling)){if(r.nodeType==1){this.push(r,c,t,q,o,s);break}}},"!^":function(r,c,t,q,o,s){r=r.lastChild;if(r){if(r.nodeType==1){this.push(r,c,t,q,o,s)}else{this["combinator:!+"](r,c,t,q,o,s)}}},"!~":function(s,c,u,r,o,t){while((s=s.previousSibling)){if(s.nodeType!=1){continue}var q=this.getUID(s);if(this.bitUniques[q]){break}this.bitUniques[q]=true;this.push(s,c,u,r,o,t)}}};for(var j in k){l["combinator:"+j]=k[j]}var m={empty:function(c){var o=c.firstChild;return !(o&&o.nodeType==1)&&!(c.innerText||c.textContent||"").length
},not:function(c,o){return !this.matchNode(c,o)},contains:function(c,o){return(c.innerText||c.textContent||"").indexOf(o)>-1},"first-child":function(c){while((c=c.previousSibling)){if(c.nodeType==1){return false}}return true},"last-child":function(c){while((c=c.nextSibling)){if(c.nodeType==1){return false}}return true},"only-child":function(q){var o=q;while((o=o.previousSibling)){if(o.nodeType==1){return false}}var c=q;while((c=c.nextSibling)){if(c.nodeType==1){return false}}return true},"nth-child":l.createNTHPseudo("firstChild","nextSibling","posNTH"),"nth-last-child":l.createNTHPseudo("lastChild","previousSibling","posNTHLast"),"nth-of-type":l.createNTHPseudo("firstChild","nextSibling","posNTHType",true),"nth-last-of-type":l.createNTHPseudo("lastChild","previousSibling","posNTHTypeLast",true),index:function(o,c){return this["pseudo:nth-child"](o,""+(c+1))},even:function(c){return this["pseudo:nth-child"](c,"2n")},odd:function(c){return this["pseudo:nth-child"](c,"2n+1")},"first-of-type":function(c){var o=c.nodeName;
while((c=c.previousSibling)){if(c.nodeName==o){return false}}return true},"last-of-type":function(c){var o=c.nodeName;while((c=c.nextSibling)){if(c.nodeName==o){return false}}return true},"only-of-type":function(q){var o=q,r=q.nodeName;while((o=o.previousSibling)){if(o.nodeName==r){return false}}var c=q;while((c=c.nextSibling)){if(c.nodeName==r){return false}}return true},enabled:function(c){return !c.disabled},disabled:function(c){return c.disabled},checked:function(c){return c.checked||c.selected},focus:function(c){return this.isHTMLDocument&&this.document.activeElement===c&&(c.href||c.type||this.hasAttribute(c,"tabindex"))},root:function(c){return(c===this.root)},selected:function(c){return c.selected}};for(var b in m){l["pseudo:"+b]=m[b]}var a=l.attributeGetters={"for":function(){return("htmlFor" in this)?this.htmlFor:this.getAttribute("for")},href:function(){return("href" in this)?this.getAttribute("href",2):this.getAttribute("href")},style:function(){return(this.style)?this.style.cssText:this.getAttribute("style")
},tabindex:function(){var c=this.getAttributeNode("tabindex");return(c&&c.specified)?c.nodeValue:null},type:function(){return this.getAttribute("type")},maxlength:function(){var c=this.getAttributeNode("maxLength");return(c&&c.specified)?c.nodeValue:null}};a.MAXLENGTH=a.maxLength=a.maxlength;var e=l.Slick=(this.Slick||{});e.version="1.1.7";e.search=function(o,q,c){return l.search(o,q,c)};e.find=function(c,o){return l.search(c,o,null,true)};e.contains=function(c,o){l.setDocument(c);return l.contains(c,o)};e.getAttribute=function(o,c){l.setDocument(o);return l.getAttribute(o,c)};e.hasAttribute=function(o,c){l.setDocument(o);return l.hasAttribute(o,c)};e.match=function(o,c){if(!(o&&c)){return false}if(!c||c===o){return true}l.setDocument(o);return l.matchNode(o,c)};e.defineAttributeGetter=function(c,o){l.attributeGetters[c]=o;return this};e.lookupAttributeGetter=function(c){return l.attributeGetters[c]};e.definePseudo=function(c,o){l["pseudo:"+c]=function(r,q){return o.call(r,q)};return this
};e.lookupPseudo=function(c){var o=l["pseudo:"+c];if(o){return function(q){return o.call(this,q)}}return null};e.override=function(o,c){l.override(o,c);return this};e.isXML=l.isXML;e.uidOf=function(c){return l.getUIDHTML(c)};if(!this.Slick){this.Slick=e}}).apply((typeof exports!="undefined")?exports:this);var Element=function(b,g){var h=Element.Constructors[b];if(h){return h(g)}if(typeof b!="string"){return document.id(b).set(g)}if(!g){g={}}if(!(/^[\w-]+$/).test(b)){var e=Slick.parse(b).expressions[0][0];b=(e.tag=="*")?"div":e.tag;if(e.id&&g.id==null){g.id=e.id}var d=e.attributes;if(d){for(var a,f=0,c=d.length;f<c;f++){a=d[f];if(g[a.key]!=null){continue}if(a.value!=null&&a.operator=="="){g[a.key]=a.value}else{if(!a.value&&!a.operator){g[a.key]=true}}}}if(e.classList&&g["class"]==null){g["class"]=e.classList.join(" ")}}return document.newElement(b,g)};if(Browser.Element){Element.prototype=Browser.Element.prototype;Element.prototype._fireEvent=(function(a){return function(b,c){return a.call(this,b,c)
}})(Element.prototype.fireEvent)}new Type("Element",Element).mirror(function(a){if(Array.prototype[a]){return}var b={};b[a]=function(){var h=[],e=arguments,j=true;for(var g=0,d=this.length;g<d;g++){var f=this[g],c=h[g]=f[a].apply(f,e);j=(j&&typeOf(c)=="element")}return(j)?new Elements(h):h};Elements.implement(b)});if(!Browser.Element){Element.parent=Object;Element.Prototype={"$constructor":Element,"$family":Function.from("element").hide()};Element.mirror(function(a,b){Element.Prototype[a]=b})}Element.Constructors={};var IFrame=new Type("IFrame",function(){var e=Array.link(arguments,{properties:Type.isObject,iframe:function(f){return(f!=null)}});var c=e.properties||{},b;if(e.iframe){b=document.id(e.iframe)}var d=c.onload||function(){};delete c.onload;c.id=c.name=[c.id,c.name,b?(b.id||b.name):"IFrame_"+String.uniqueID()].pick();b=new Element(b||"iframe",c);var a=function(){d.call(b.contentWindow)};if(window.frames[c.id]){a()}else{b.addListener("load",a)}return b});var Elements=this.Elements=function(a){if(a&&a.length){var e={},d;
for(var c=0;d=a[c++];){var b=Slick.uidOf(d);if(!e[b]){e[b]=true;this.push(d)}}}};Elements.prototype={length:0};Elements.parent=Array;new Type("Elements",Elements).implement({filter:function(a,b){if(!a){return this}return new Elements(Array.filter(this,(typeOf(a)=="string")?function(c){return c.match(a)}:a,b))}.protect(),push:function(){var d=this.length;for(var b=0,a=arguments.length;b<a;b++){var c=document.id(arguments[b]);if(c){this[d++]=c}}return(this.length=d)}.protect(),unshift:function(){var b=[];for(var c=0,a=arguments.length;c<a;c++){var d=document.id(arguments[c]);if(d){b.push(d)}}return Array.prototype.unshift.apply(this,b)}.protect(),concat:function(){var b=new Elements(this);for(var c=0,a=arguments.length;c<a;c++){var d=arguments[c];if(Type.isEnumerable(d)){b.append(d)}else{b.push(d)}}return b}.protect(),append:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b])}return this}.protect(),empty:function(){while(this.length){delete this[--this.length]}return this}.protect()});
(function(){var f=Array.prototype.splice,a={"0":0,"1":1,length:2};f.call(a,1,1);if(a[1]==1){Elements.implement("splice",function(){var g=this.length;var e=f.apply(this,arguments);while(g>=this.length){delete this[g--]}return e}.protect())}Array.forEachMethod(function(g,e){Elements.implement(e,g)});Array.mirror(Elements);var d;try{d=(document.createElement("<input name=x>").name=="x")}catch(b){}var c=function(e){return(""+e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")};Document.implement({newElement:function(e,g){if(g&&g.checked!=null){g.defaultChecked=g.checked}if(d&&g){e="<"+e;if(g.name){e+=' name="'+c(g.name)+'"'}if(g.type){e+=' type="'+c(g.type)+'"'}e+=">";delete g.name;delete g.type}return this.id(this.createElement(e)).set(g)}})})();(function(){Slick.uidOf(window);Slick.uidOf(document);Document.implement({newTextNode:function(e){return this.createTextNode(e)},getDocument:function(){return this},getWindow:function(){return this.window},id:(function(){var e={string:function(G,F,l){G=Slick.find(l,"#"+G.replace(/(\W)/g,"\\$1"));
return(G)?e.element(G,F):null},element:function(F,G){Slick.uidOf(F);if(!G&&!F.$family&&!(/^(?:object|embed)$/i).test(F.tagName)){var l=F.fireEvent;F._fireEvent=function(H,I){return l(H,I)};Object.append(F,Element.Prototype)}return F},object:function(F,G,l){if(F.toElement){return e.element(F.toElement(l),G)}return null}};e.textnode=e.whitespace=e.window=e.document=function(l){return l};return function(F,H,G){if(F&&F.$family&&F.uniqueNumber){return F}var l=typeOf(F);return(e[l])?e[l](F,H,G||document):null}})()});if(window.$==null){Window.implement("$",function(e,l){return document.id(e,l,this.document)})}Window.implement({getDocument:function(){return this.document},getWindow:function(){return this}});[Document,Element].invoke("implement",{getElements:function(e){return Slick.search(this,e,new Elements)},getElement:function(e){return document.id(Slick.find(this,e))}});var n={contains:function(e){return Slick.contains(this,e)}};if(!document.contains){Document.implement(n)}if(!document.createElement("div").contains){Element.implement(n)
}var t=function(G,F){if(!G){return F}G=Object.clone(Slick.parse(G));var l=G.expressions;for(var e=l.length;e--;){l[e][0].combinator=F}return G};Object.forEach({getNext:"~",getPrevious:"!~",getParent:"!"},function(e,l){Element.implement(l,function(F){return this.getElement(t(F,e))})});Object.forEach({getAllNext:"~",getAllPrevious:"!~",getSiblings:"~~",getChildren:">",getParents:"!"},function(e,l){Element.implement(l,function(F){return this.getElements(t(F,e))})});Element.implement({getFirst:function(e){return document.id(Slick.search(this,t(e,">"))[0])},getLast:function(e){return document.id(Slick.search(this,t(e,">")).getLast())},getWindow:function(){return this.ownerDocument.window},getDocument:function(){return this.ownerDocument},getElementById:function(e){return document.id(Slick.find(this,"#"+(""+e).replace(/(\W)/g,"\\$1")))},match:function(e){return !e||Slick.match(this,e)}});if(window.$$==null){Window.implement("$$",function(e){if(arguments.length==1){if(typeof e=="string"){return Slick.search(this.document,e,new Elements)
}else{if(Type.isEnumerable(e)){return new Elements(e)}}}return new Elements(arguments)})}var y={before:function(l,e){var F=e.parentNode;if(F){F.insertBefore(l,e)}},after:function(l,e){var F=e.parentNode;if(F){F.insertBefore(l,e.nextSibling)}},bottom:function(l,e){e.appendChild(l)},top:function(l,e){e.insertBefore(l,e.firstChild)}};y.inside=y.bottom;var k={},d={};var m={};Array.forEach(["type","value","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","rowSpan","tabIndex","useMap"],function(e){m[e.toLowerCase()]=e});m.html="innerHTML";m.text=(document.createElement("div").textContent==null)?"innerText":"textContent";Object.forEach(m,function(l,e){d[e]=function(F,G){F[l]=G};k[e]=function(F){return F[l]}});var z=["compact","nowrap","ismap","declare","noshade","checked","disabled","readOnly","multiple","selected","noresize","defer","defaultChecked","autofocus","controls","autoplay","loop"];var h={};Array.forEach(z,function(e){var l=e.toLowerCase();h[l]=e;d[l]=function(F,G){F[e]=!!G
};k[l]=function(F){return !!F[e]}});Object.append(d,{"class":function(e,l){("className" in e)?e.className=(l||""):e.setAttribute("class",l)},"for":function(e,l){("htmlFor" in e)?e.htmlFor=l:e.setAttribute("for",l)},style:function(e,l){(e.style)?e.style.cssText=l:e.setAttribute("style",l)},value:function(e,l){e.value=(l!=null)?l:""}});k["class"]=function(e){return("className" in e)?e.className||null:e.getAttribute("class")};var f=document.createElement("button");try{f.type="button"}catch(B){}if(f.type!="button"){d.type=function(e,l){e.setAttribute("type",l)}}f=null;var r=document.createElement("input");r.value="t";r.type="submit";if(r.value!="t"){d.type=function(l,e){var F=l.value;l.type=e;l.value=F}}r=null;var s=(function(e){e.random="attribute";return(e.getAttribute("random")=="attribute")})(document.createElement("div"));Element.implement({setProperty:function(l,F){var G=d[l.toLowerCase()];if(G){G(this,F)}else{if(s){var e=this.retrieve("$attributeWhiteList",{})}if(F==null){this.removeAttribute(l);
if(s){delete e[l]}}else{this.setAttribute(l,F);if(s){e[l]=true}}}return this},setProperties:function(e){for(var l in e){this.setProperty(l,e[l])}return this},getProperty:function(H){var F=k[H.toLowerCase()];if(F){return F(this)}if(s){var l=this.getAttributeNode(H),G=this.retrieve("$attributeWhiteList",{});if(!l){return null}if(l.expando&&!G[H]){var I=this.outerHTML;if(I.substr(0,I.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(H)<0){return null}G[H]=true}}var e=Slick.getAttribute(this,H);return(!e&&!Slick.hasAttribute(this,H))?null:e},getProperties:function(){var e=Array.from(arguments);return e.map(this.getProperty,this).associate(e)},removeProperty:function(e){return this.setProperty(e,null)},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this},set:function(F,l){var e=Element.Properties[F];(e&&e.set)?e.set.call(this,l):this.setProperty(F,l)}.overloadSetter(),get:function(l){var e=Element.Properties[l];return(e&&e.get)?e.get.apply(this):this.getProperty(l)
}.overloadGetter(),erase:function(l){var e=Element.Properties[l];(e&&e.erase)?e.erase.apply(this):this.removeProperty(l);return this},hasClass:function(e){return this.className.clean().contains(e," ")},addClass:function(e){if(!this.hasClass(e)){this.className=(this.className+" "+e).clean()}return this},removeClass:function(e){this.className=this.className.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)"),"$1");return this},toggleClass:function(e,l){if(l==null){l=!this.hasClass(e)}return(l)?this.addClass(e):this.removeClass(e)},adopt:function(){var G=this,e,I=Array.flatten(arguments),H=I.length;if(H>1){G=e=document.createDocumentFragment()}for(var F=0;F<H;F++){var l=document.id(I[F],true);if(l){G.appendChild(l)}}if(e){this.appendChild(e)}return this},appendText:function(l,e){return this.grab(this.getDocument().newTextNode(l),e)},grab:function(l,e){y[e||"bottom"](document.id(l,true),this);return this},inject:function(l,e){y[e||"bottom"](this,document.id(l,true));return this},replaces:function(e){e=document.id(e,true);
e.parentNode.replaceChild(this,e);return this},wraps:function(l,e){l=document.id(l,true);return this.replaces(l).grab(l,e)},getSelected:function(){this.selectedIndex;return new Elements(Array.from(this.options).filter(function(e){return e.selected}))},toQueryString:function(){var e=[];this.getElements("input, select, textarea").each(function(F){var l=F.type;if(!F.name||F.disabled||l=="submit"||l=="reset"||l=="file"||l=="image"){return}var G=(F.get("tag")=="select")?F.getSelected().map(function(H){return document.id(H).get("value")}):((l=="radio"||l=="checkbox")&&!F.checked)?null:F.get("value");Array.from(G).each(function(H){if(typeof H!="undefined"){e.push(encodeURIComponent(F.name)+"="+encodeURIComponent(H))}})});return e.join("&")}});var j={},C={};var D=function(e){return(C[e]||(C[e]={}))};var x=function(l){var e=l.uniqueNumber;if(l.removeEvents){l.removeEvents()}if(l.clearAttributes){l.clearAttributes()}if(e!=null){delete j[e];delete C[e]}return l};var E={input:"checked",option:"selected",textarea:"value"};
Element.implement({destroy:function(){var e=x(this).getElementsByTagName("*");Array.each(e,x);Element.dispose(this);return null},empty:function(){Array.from(this.childNodes).each(Element.dispose);return this},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this},clone:function(I,G){I=I!==false;var N=this.cloneNode(I),F=[N],H=[this],L;if(I){F.append(Array.from(N.getElementsByTagName("*")));H.append(Array.from(this.getElementsByTagName("*")))}for(L=F.length;L--;){var J=F[L],M=H[L];if(!G){J.removeAttribute("id")}if(J.clearAttributes){J.clearAttributes();J.mergeAttributes(M);J.removeAttribute("uniqueNumber");if(J.options){var Q=J.options,e=M.options;for(var K=Q.length;K--;){Q[K].selected=e[K].selected}}}var l=E[M.tagName.toLowerCase()];if(l&&M[l]){J[l]=M[l]}}if(Browser.ie){var O=N.getElementsByTagName("object"),P=this.getElementsByTagName("object");for(L=O.length;L--;){O[L].outerHTML=P[L].outerHTML}}return document.id(N)}});[Element,Window,Document].invoke("implement",{addListener:function(G,F){if(G=="unload"){var e=F,l=this;
F=function(){l.removeListener("unload",F);e()}}else{j[Slick.uidOf(this)]=this}if(this.addEventListener){this.addEventListener(G,F,!!arguments[2])}else{this.attachEvent("on"+G,F)}return this},removeListener:function(l,e){if(this.removeEventListener){this.removeEventListener(l,e,!!arguments[2])}else{this.detachEvent("on"+l,e)}return this},retrieve:function(l,e){var G=D(Slick.uidOf(this)),F=G[l];if(e!=null&&F==null){F=G[l]=e}return F!=null?F:null},store:function(l,e){var F=D(Slick.uidOf(this));F[l]=e;return this},eliminate:function(e){var l=D(Slick.uidOf(this));delete l[e];return this}});if(window.attachEvent&&!window.addEventListener){window.addListener("unload",function(){Object.each(j,x);if(window.CollectGarbage){CollectGarbage()}})}Element.Properties={};Element.Properties.style={set:function(e){this.style.cssText=e},get:function(){return this.style.cssText},erase:function(){this.style.cssText=""}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase()}};Element.Properties.html={set:function(e){if(e==null){e=""
}else{if(typeOf(e)=="array"){e=e.join("")}}this.innerHTML=e},erase:function(){this.innerHTML=""}};var v=document.createElement("div");v.innerHTML="<nav></nav>";var a=(v.childNodes.length==1);if(!a){var u="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),b=document.createDocumentFragment(),w=u.length;while(w--){b.createElement(u[w])}}v=null;var g=Function.attempt(function(){var e=document.createElement("table");e.innerHTML="<tr><td></td></tr>";return true});var c=document.createElement("tr"),q="<td></td>";c.innerHTML=q;var A=(c.innerHTML==q);c=null;if(!g||!A||!a){Element.Properties.html.set=(function(l){var e={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};e.thead=e.tfoot=e.tbody;return function(F){var G=e[this.get("tag")];if(!G&&!a){G=[0,"",""]}if(!G){return l.call(this,F)
}var J=G[0],I=document.createElement("div"),H=I;if(!a){b.appendChild(I)}I.innerHTML=[G[1],F,G[2]].flatten().join("");while(J--){H=H.firstChild}this.empty().adopt(H.childNodes);if(!a){b.removeChild(I)}I=null}})(Element.Properties.html.set)}var o=document.createElement("form");o.innerHTML="<select><option>s</option></select>";if(o.firstChild.value!="s"){Element.Properties.value={set:function(I){var l=this.get("tag");if(l!="select"){return this.setProperty("value",I)}var F=this.getElements("option");for(var G=0;G<F.length;G++){var H=F[G],e=H.getAttributeNode("value"),J=(e&&e.specified)?H.value:H.get("text");if(J==I){return H.selected=true}}},get:function(){var F=this,l=F.get("tag");if(l!="select"&&l!="option"){return this.getProperty("value")}if(l=="select"&&!(F=F.getSelected()[0])){return""}var e=F.getAttributeNode("value");return(e&&e.specified)?F.value:F.get("text")}}}o=null;if(document.createElement("div").getAttributeNode("id")){Element.Properties.id={set:function(e){this.id=this.getAttributeNode("id").value=e
},get:function(){return this.id||null},erase:function(){this.id=this.getAttributeNode("id").value=""}}}})();(function(){var j=document.html;var d=document.createElement("div");d.style.color="red";d.style.color=null;var c=d.style.color=="red";d=null;Element.Properties.styles={set:function(l){this.setStyles(l)}};var h=(j.style.opacity!=null),e=(j.style.filter!=null),k=/alpha\(opacity=([\d.]+)\)/i;var a=function(m,l){m.store("$opacity",l);m.style.visibility=l>0||l==null?"visible":"hidden"};var f=(h?function(m,l){m.style.opacity=l}:(e?function(m,l){var o=m.style;if(!m.currentStyle||!m.currentStyle.hasLayout){o.zoom=1}if(l==null){l=""}else{l="alpha(opacity="+(l*100).limit(0,100).round()+")"}var n=o.filter||m.getComputedStyle("filter")||"";o.filter=k.test(n)?n.replace(k,l):n+l;if(!o.filter){o.removeAttribute("filter")}}:a));var g=(h?function(m){var l=m.style.opacity||m.getComputedStyle("opacity");return(l=="")?1:l.toFloat()}:(e?function(m){var n=(m.style.filter||m.getComputedStyle("filter")),l;
if(n){l=n.match(k)}return(l==null||n==null)?1:(l[1]/100)}:function(m){var l=m.retrieve("$opacity");if(l==null){l=(m.style.visibility=="hidden"?0:1)}return l}));var b=(j.style.cssFloat==null)?"styleFloat":"cssFloat";Element.implement({getComputedStyle:function(n){if(this.currentStyle){return this.currentStyle[n.camelCase()]}var m=Element.getDocument(this).defaultView,l=m?m.getComputedStyle(this,null):null;return(l)?l.getPropertyValue((n==b)?"float":n.hyphenate()):null},setStyle:function(m,l){if(m=="opacity"){if(l!=null){l=parseFloat(l)}f(this,l);return this}m=(m=="float"?b:m).camelCase();if(typeOf(l)!="string"){var n=(Element.Styles[m]||"@").split(" ");l=Array.from(l).map(function(q,o){if(!n[o]){return""}return(typeOf(q)=="number")?n[o].replace("@",Math.round(q)):q}).join(" ")}else{if(l==String(Number(l))){l=Math.round(l)}}this.style[m]=l;if((l==""||l==null)&&c&&this.style.removeAttribute){this.style.removeAttribute(m)}return this},getStyle:function(t){if(t=="opacity"){return g(this)}t=(t=="float"?b:t).camelCase();
var l=this.style[t];if(!l||t=="zIndex"){l=[];for(var r in Element.ShortStyles){if(t!=r){continue}for(var q in Element.ShortStyles[r]){l.push(this.getStyle(q))}return l.join(" ")}l=this.getComputedStyle(t)}if(l){l=String(l);var n=l.match(/rgba?\([\d\s,]+\)/);if(n){l=l.replace(n[0],n[0].rgbToHex())}}if(Browser.opera||(Browser.ie&&isNaN(parseFloat(l)))){if((/^(height|width)$/).test(t)){var m=(t=="width")?["left","right"]:["top","bottom"],o=0;m.each(function(s){o+=this.getStyle("border-"+s+"-width").toInt()+this.getStyle("padding-"+s).toInt()},this);return this["offset"+t.capitalize()]-o+"px"}if(Browser.opera&&String(l).indexOf("px")!=-1){return l}if((/^border(.+)Width|margin|padding/).test(t)){return"0px"}}return l},setStyles:function(m){for(var l in m){this.setStyle(l,m[l])}return this},getStyles:function(){var l={};Array.flatten(arguments).each(function(m){l[m]=this.getStyle(m)},this);return l}});Element.Styles={left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"};
Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(s){var r=Element.ShortStyles;var m=Element.Styles;["margin","padding"].each(function(t){var u=t+s;r[t][u]=m[u]="@px"});var q="border"+s;r.border[q]=m[q]="@px @ rgb(@, @, @)";var o=q+"Width",l=q+"Style",n=q+"Color";r[q]={};r.borderWidth[o]=r[q][o]=m[o]="@px";r.borderStyle[l]=r[q][l]=m[l]="@";r.borderColor[n]=r[q][n]=m[n]="rgb(@, @, @)"})})();(function(){Element.Properties.events={set:function(b){this.addEvents(b)}};[Element,Window,Document].invoke("implement",{addEvent:function(f,h){var j=this.retrieve("events",{});if(!j[f]){j[f]={keys:[],values:[]}}if(j[f].keys.contains(h)){return this}j[f].keys.push(h);var g=f,b=Element.Events[f],d=h,k=this;if(b){if(b.onAdd){b.onAdd.call(this,h,f)}if(b.condition){d=function(l){if(b.condition.call(this,l,f)){return h.call(this,l)}return true}}if(b.base){g=Function.from(b.base).call(this,f)}}var e=function(){return h.call(k)
};var c=Element.NativeEvents[g];if(c){if(c==2){e=function(l){l=new DOMEvent(l,k.getWindow());if(d.call(k,l)===false){l.stop()}}}this.addListener(g,e,arguments[2])}j[f].values.push(e);return this},removeEvent:function(e,d){var c=this.retrieve("events");if(!c||!c[e]){return this}var h=c[e];var b=h.keys.indexOf(d);if(b==-1){return this}var g=h.values[b];delete h.keys[b];delete h.values[b];var f=Element.Events[e];if(f){if(f.onRemove){f.onRemove.call(this,d,e)}if(f.base){e=Function.from(f.base).call(this,e)}}return(Element.NativeEvents[e])?this.removeListener(e,g,arguments[2]):this},addEvents:function(b){for(var c in b){this.addEvent(c,b[c])}return this},removeEvents:function(b){var d;if(typeOf(b)=="object"){for(d in b){this.removeEvent(d,b[d])}return this}var c=this.retrieve("events");if(!c){return this}if(!b){for(d in c){this.removeEvents(d)}this.eliminate("events")}else{if(c[b]){c[b].keys.each(function(e){this.removeEvent(b,e)},this);delete c[b]}}return this},fireEvent:function(e,c,b){var d=this.retrieve("events");
if(!d||!d[e]){return this}c=Array.from(c);d[e].keys.each(function(f){if(b){f.delay(b,this,c)}else{f.apply(this,c)}},this);return this},cloneEvents:function(e,d){e=document.id(e);var c=e.retrieve("events");if(!c){return this}if(!d){for(var b in c){this.cloneEvents(e,b)}}else{if(c[d]){c[d].keys.each(function(f){this.addEvent(d,f)},this)}}return this}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,orientationchange:2,touchstart:2,touchmove:2,touchend:2,touchcancel:2,gesturestart:2,gesturechange:2,gestureend:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,paste:2,input:2,load:2,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};Element.Events={mousewheel:{base:(Browser.firefox)?"DOMMouseScroll":"mousewheel"}};if("onmouseenter" in document.documentElement){Element.NativeEvents.mouseenter=Element.NativeEvents.mouseleave=2
}else{var a=function(b){var c=b.relatedTarget;if(c==null){return true}if(!c){return false}return(c!=this&&c.prefix!="xul"&&typeOf(this)!="document"&&!this.contains(c))};Element.Events.mouseenter={base:"mouseover",condition:a};Element.Events.mouseleave={base:"mouseout",condition:a}}if(!window.addEventListener){Element.NativeEvents.propertychange=2;Element.Events.change={base:function(){var b=this.type;return(this.get("tag")=="input"&&(b=="radio"||b=="checkbox"))?"propertychange":"change"},condition:function(b){return this.type!="radio"||(b.event.propertyName=="checked"&&this.checked)}}}})();(function(){var c=!!window.addEventListener;Element.NativeEvents.focusin=Element.NativeEvents.focusout=2;var l=function(m,n,o,q,r){while(r&&r!=m){if(n(r,q)){return o.call(r,q,r)}r=document.id(r.parentNode)}};var a={mouseenter:{base:"mouseover"},mouseleave:{base:"mouseout"},focus:{base:"focus"+(c?"":"in"),capture:true},blur:{base:c?"blur":"focusout",capture:true}};var b="$delegation:";var j=function(m){return{base:"focusin",remove:function(n,q){var r=n.retrieve(b+m+"listeners",{})[q];
if(r&&r.forms){for(var o=r.forms.length;o--;){r.forms[o].removeEvent(m,r.fns[o])}}},listen:function(z,t,x,o,v,u){var q=(v.get("tag")=="form")?v:o.target.getParent("form");if(!q){return}var w=z.retrieve(b+m+"listeners",{}),r=w[u]||{forms:[],fns:[]},n=r.forms,y=r.fns;if(n.indexOf(q)!=-1){return}n.push(q);var s=function(A){l(z,t,x,A,v)};q.addEvent(m,s);y.push(s);w[u]=r;z.store(b+m+"listeners",w)}}};var d=function(m){return{base:"focusin",listen:function(n,o,r,s,t){var q={blur:function(){this.removeEvents(q)}};q[m]=function(u){l(n,o,r,u,t)};s.target.addEvents(q)}}};if(!c){Object.append(a,{submit:j("submit"),reset:j("reset"),change:d("change"),select:d("select")})}var h=Element.prototype,f=h.addEvent,k=h.removeEvent;var e=function(m,n){return function(t,s,o){if(t.indexOf(":relay")==-1){return m.call(this,t,s,o)}var q=Slick.parse(t).expressions[0][0];if(q.pseudos[0].key!="relay"){return m.call(this,t,s,o)}var r=q.tag;q.pseudos.slice(1).each(function(u){r+=":"+u.key+(u.value?"("+u.value+")":"")
});m.call(this,t,s);return n.call(this,r,q.pseudos[0].value,s)}};var g={addEvent:function(x,s,z){var v=this.retrieve("$delegates",{}),t=v[x];if(t){for(var A in t){if(t[A].fn==z&&t[A].match==s){return this}}}var r=x,w=s,q=z,o=a[x]||{};x=o.base||r;s=function(D){return Slick.match(D,w)};var y=Element.Events[r];if(y&&y.condition){var m=s,n=y.condition;s=function(E,D){return m(E,D)&&n.call(E,D,x)}}var B=this,u=String.uniqueID();var C=o.listen?function(D,E){if(!E&&D&&D.target){E=D.target}if(E){o.listen(B,s,z,D,E,u)}}:function(D,E){if(!E&&D&&D.target){E=D.target}if(E){l(B,s,z,D,E)}};if(!t){t={}}t[u]={match:w,fn:q,delegator:C};v[r]=t;return f.call(this,x,C,o.capture)},removeEvent:function(u,o,v,w){var t=this.retrieve("$delegates",{}),r=t[u];if(!r){return this}if(w){var n=u,y=r[w].delegator,m=a[u]||{};u=m.base||n;if(m.remove){m.remove(this,w)}delete r[w];t[n]=r;return k.call(this,u,y)}var q,x;if(v){for(q in r){x=r[q];if(x.match==o&&x.fn==v){return g.removeEvent.call(this,u,o,v,q)}}}else{for(q in r){x=r[q];
if(x.match==o){g.removeEvent.call(this,u,o,x.fn,q)}}}return this}};[Element,Window,Document].invoke("implement",{addEvent:e(f,g.addEvent),removeEvent:e(k,g.removeEvent)})})();(function(){var h=document.createElement("div"),e=document.createElement("div");h.style.height="0";h.appendChild(e);var d=(e.offsetParent===h);h=e=null;var m=function(n){return l(n,"position")!="static"||a(n)};var j=function(n){return m(n)||(/^(?:table|td|th)$/i).test(n.tagName)};Element.implement({scrollTo:function(n,o){if(a(this)){this.getWindow().scrollTo(n,o)}else{this.scrollLeft=n;this.scrollTop=o}return this},getSize:function(){if(a(this)){return this.getWindow().getSize()}return{x:this.offsetWidth,y:this.offsetHeight}},getScrollSize:function(){if(a(this)){return this.getWindow().getScrollSize()}return{x:this.scrollWidth,y:this.scrollHeight}},getScroll:function(){if(a(this)){return this.getWindow().getScroll()}return{x:this.scrollLeft,y:this.scrollTop}},getScrolls:function(){var o=this.parentNode,n={x:0,y:0};
while(o&&!a(o)){n.x+=o.scrollLeft;n.y+=o.scrollTop;o=o.parentNode}return n},getOffsetParent:d?function(){var n=this;if(a(n)||l(n,"position")=="fixed"){return null}var o=(l(n,"position")=="static")?j:m;while((n=n.parentNode)){if(o(n)){return n}}return null}:function(){var n=this;if(a(n)||l(n,"position")=="fixed"){return null}try{return n.offsetParent}catch(o){}return null},getOffsets:function(){if(this.getBoundingClientRect&&!Browser.Platform.ios){var t=this.getBoundingClientRect(),q=document.id(this.getDocument().documentElement),s=q.getScroll(),v=this.getScrolls(),u=(l(this,"position")=="fixed");return{x:t.left.toInt()+v.x+((u)?0:s.x)-q.clientLeft,y:t.top.toInt()+v.y+((u)?0:s.y)-q.clientTop}}var o=this,n={x:0,y:0};if(a(this)){return n}while(o&&!a(o)){n.x+=o.offsetLeft;n.y+=o.offsetTop;if(Browser.firefox){if(!c(o)){n.x+=b(o);n.y+=g(o)}var r=o.parentNode;if(r&&l(r,"overflow")!="visible"){n.x+=b(r);n.y+=g(r)}}else{if(o!=this&&Browser.safari){n.x+=b(o);n.y+=g(o)}}o=o.offsetParent}if(Browser.firefox&&!c(this)){n.x-=b(this);
n.y-=g(this)}return n},getPosition:function(r){var s=this.getOffsets(),o=this.getScrolls();var n={x:s.x-o.x,y:s.y-o.y};if(r&&(r=document.id(r))){var q=r.getPosition();return{x:n.x-q.x-b(r),y:n.y-q.y-g(r)}}return n},getCoordinates:function(q){if(a(this)){return this.getWindow().getCoordinates()}var n=this.getPosition(q),o=this.getSize();var r={left:n.x,top:n.y,width:o.x,height:o.y};r.right=r.left+r.width;r.bottom=r.top+r.height;return r},computePosition:function(n){return{left:n.x-k(this,"margin-left"),top:n.y-k(this,"margin-top")}},setPosition:function(n){return this.setStyles(this.computePosition(n))}});[Document,Window].invoke("implement",{getSize:function(){var n=f(this);return{x:n.clientWidth,y:n.clientHeight}},getScroll:function(){var o=this.getWindow(),n=f(this);return{x:o.pageXOffset||n.scrollLeft,y:o.pageYOffset||n.scrollTop}},getScrollSize:function(){var q=f(this),o=this.getSize(),n=this.getDocument().body;return{x:Math.max(q.scrollWidth,n.scrollWidth,o.x),y:Math.max(q.scrollHeight,n.scrollHeight,o.y)}
},getPosition:function(){return{x:0,y:0}},getCoordinates:function(){var n=this.getSize();return{top:0,left:0,bottom:n.y,right:n.x,height:n.y,width:n.x}}});var l=Element.getComputedStyle;function k(n,o){return l(n,o).toInt()||0}function c(n){return l(n,"-moz-box-sizing")=="border-box"}function g(n){return k(n,"border-top-width")}function b(n){return k(n,"border-left-width")}function a(n){return(/^(?:body|html)$/i).test(n.tagName)}function f(n){var o=n.getDocument();return(!o.compatMode||o.compatMode=="CSS1Compat")?o.html:o.body}})();Element.alias({position:"setPosition"});[Window,Document,Element].invoke("implement",{getHeight:function(){return this.getSize().y},getWidth:function(){return this.getSize().x},getScrollTop:function(){return this.getScroll().y},getScrollLeft:function(){return this.getScroll().x},getScrollHeight:function(){return this.getScrollSize().y},getScrollWidth:function(){return this.getScrollSize().x},getTop:function(){return this.getPosition().y},getLeft:function(){return this.getPosition().x
}});(function(){var f=this.Fx=new Class({Implements:[Chain,Events,Options],options:{fps:60,unit:false,duration:500,frames:null,frameSkip:true,link:"ignore"},initialize:function(g){this.subject=this.subject||this;this.setOptions(g)},getTransition:function(){return function(g){return -(Math.cos(Math.PI*g)-1)/2}},step:function(g){if(this.options.frameSkip){var h=(this.time!=null)?(g-this.time):0,j=h/this.frameInterval;this.time=g;this.frame+=j}else{this.frame++}if(this.frame<this.frames){var k=this.transition(this.frame/this.frames);this.set(this.compute(this.from,this.to,k))}else{this.frame=this.frames;this.set(this.compute(this.from,this.to,1));this.stop()}},set:function(g){return g},compute:function(j,h,g){return f.compute(j,h,g)},check:function(){if(!this.isRunning()){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.pass(arguments,this));return false}return false},start:function(l,k){if(!this.check(l,k)){return this}this.from=l;
this.to=k;this.frame=(this.options.frameSkip)?0:-1;this.time=null;this.transition=this.getTransition();var j=this.options.frames,h=this.options.fps,g=this.options.duration;this.duration=f.Durations[g]||g.toInt();this.frameInterval=1000/h;this.frames=j||Math.round(this.duration/this.frameInterval);this.fireEvent("start",this.subject);b.call(this,h);return this},stop:function(){if(this.isRunning()){this.time=null;d.call(this,this.options.fps);if(this.frames==this.frame){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject)}}else{this.fireEvent("stop",this.subject)}}return this},cancel:function(){if(this.isRunning()){this.time=null;d.call(this,this.options.fps);this.frame=this.frames;this.fireEvent("cancel",this.subject).clearChain()}return this},pause:function(){if(this.isRunning()){this.time=null;d.call(this,this.options.fps)}return this},resume:function(){if((this.frame<this.frames)&&!this.isRunning()){b.call(this,this.options.fps)}return this
},isRunning:function(){var g=e[this.options.fps];return g&&g.contains(this)}});f.compute=function(j,h,g){return(h-j)*g+j};f.Durations={"short":250,normal:500,"long":1000};var e={},c={};var a=function(){var h=Date.now();for(var j=this.length;j--;){var g=this[j];if(g){g.step(h)}}};var b=function(h){var g=e[h]||(e[h]=[]);g.push(this);if(!c[h]){c[h]=a.periodical(Math.round(1000/h),g)}};var d=function(h){var g=e[h];if(g){g.erase(this);if(!g.length&&c[h]){delete e[h];c[h]=clearInterval(c[h])}}}})();Fx.CSS=new Class({Extends:Fx,prepare:function(c,d,b){b=Array.from(b);if(b[1]==null){b[1]=b[0];b[0]=c.getStyle(d);if(this.options.unit!="px"){c.setStyle(d,b[1]+this.options.unit);b[0]=(b[1]||1)/parseFloat(c.getComputedStyle(d))*(parseFloat(b[0])||0);c.setStyle(d,b[0]+this.options.unit)}}var a=b.map(this.parse);return{from:a[0],to:a[1]}},parse:function(a){a=Function.from(a)();a=(typeof a=="string")?a.split(" "):Array.from(a);return a.map(function(c){c=String(c);var b=false;Object.each(Fx.CSS.Parsers,function(f,e){if(b){return
}var d=f.parse(c);if(d||d===0){b={value:d,parser:f}}});b=b||{value:c,parser:Fx.CSS.Parsers.String};return b})},compute:function(d,c,b){var a=[];(Math.min(d.length,c.length)).times(function(e){a.push({value:d[e].parser.compute(d[e].value,c[e].value,b),parser:d[e].parser})});a.$family=Function.from("fx:css:value");return a},serve:function(c,b){if(typeOf(c)!="fx:css:value"){c=this.parse(c)}var a=[];c.each(function(d){a=a.concat(d.parser.serve(d.value,b))});return a},render:function(a,d,c,b){a.setStyle(d,this.serve(c,b))},search:function(a){if(Fx.CSS.Cache[a]){return Fx.CSS.Cache[a]}var c={},b=new RegExp("^"+a.escapeRegExp()+"$");Array.each(document.styleSheets,function(f,e){var d=f.href;if(d&&d.contains("://")&&!d.contains(document.domain)){return}var g=f.rules||f.cssRules;Array.each(g,function(k,h){if(!k.style){return}var j=(k.selectorText)?k.selectorText.replace(/^\w+/,function(l){return l.toLowerCase()}):null;if(!j||!b.test(j)){return}Object.each(Element.Styles,function(m,l){if(!k.style[l]||Element.ShortStyles[l]){return
}m=String(k.style[l]);c[l]=((/^rgb/).test(m))?m.rgbToHex():m})})});return Fx.CSS.Cache[a]=c}});Fx.CSS.Cache={};Fx.CSS.Parsers={Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true)}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a))})},serve:function(a){return a.map(Number)}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b}},String:{parse:Function.from(false),compute:function(b,a){return a},serve:function(a){return a}}};Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a)},set:function(b,a){if(arguments.length==1){a=b;b=this.property||this.options.property}this.render(this.element,b,a,this.options.unit);return this},start:function(c,e,d){if(!this.check(c,e,d)){return this}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);
return this.parent(a.from,a.to)}});Element.Properties.tween={set:function(a){this.get("tween").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("tween");if(!a){a=new Fx.Tween(this,{link:"cancel"});this.store("tween",a)}return a}};Element.implement({tween:function(a,c,b){this.get("tween").start(a,c,b);return this},fade:function(d){var e=this.get("tween"),g,c=["opacity"].append(arguments),a;if(c[1]==null){c[1]="toggle"}switch(c[1]){case"in":g="start";c[1]=1;break;case"out":g="start";c[1]=0;break;case"show":g="set";c[1]=1;break;case"hide":g="set";c[1]=0;break;case"toggle":var b=this.retrieve("fade:flag",this.getStyle("opacity")==1);g="start";c[1]=b?0:1;this.store("fade:flag",!b);a=true;break;default:g="start"}if(!a){this.eliminate("fade:flag")}e[g].apply(e,c);var f=c[c.length-1];if(g=="set"||f!=0){this.setStyle("visibility",f==0?"hidden":"visible")}else{e.chain(function(){this.element.setStyle("visibility","hidden");this.callChain()})}return this},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color"));
a=(a=="transparent")?"#fff":a}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));b.callChain()}.bind(this));return this}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a)},set:function(a){if(typeof a=="string"){a=this.search(a)}for(var b in a){this.render(this.element,b,a[b],this.options.unit)}return this},compute:function(e,d,c){var a={};for(var b in e){a[b]=this.parent(e[b],d[b],c)}return a},start:function(b){if(!this.check(b)){return this}if(typeof b=="string"){b=this.search(b)}var e={},d={};for(var c in b){var a=this.prepare(this.element,c,b[c]);e[c]=a.from;d[c]=a.to}return this.parent(e,d)}});Element.Properties.morph={set:function(a){this.get("morph").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("morph");if(!a){a=new Fx.Morph(this,{link:"cancel"});this.store("morph",a)}return a}};Element.implement({morph:function(a){this.get("morph").start(a);
return this}});Fx.implement({getTransition:function(){var a=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof a=="string"){var b=a.split(":");a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")]}}return a}});Fx.Transition=function(c,b){b=Array.from(b);var a=function(d){return c(d,b)};return Object.append(a,{easeIn:a,easeOut:function(d){return 1-c(1-d,b)},easeInOut:function(d){return(d<=0.5?c(2*d,b):(2-c(2*(1-d),b)))/2}})};Fx.Transitions={linear:function(a){return a}};Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b])}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a&&a[0]||6)},Expo:function(a){return Math.pow(2,8*(a-1))},Circ:function(a){return 1-Math.sin(Math.acos(a))},Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Back:function(b,a){a=a&&a[0]||1.618;return Math.pow(b,2)*((a+1)*b-a)},Bounce:function(f){var e;for(var d=0,c=1;1;d+=c,c/=2){if(f>=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);
break}}return e},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a&&a[0]||1)/3)}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,a+2)})});(function(){var d=function(){},a=("onprogress" in new Browser.Request);var c=this.Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,timeout:0,noCache:false},initialize:function(e){this.xhr=new Browser.Request();this.setOptions(e);this.headers=this.options.headers},onStateChange:function(){var e=this.xhr;if(e.readyState!=4||!this.running){return}this.running=false;this.status=0;Function.attempt(function(){var f=e.status;this.status=(f==1223)?204:f}.bind(this));e.onreadystatechange=d;
if(a){e.onprogress=e.onloadstart=d}clearTimeout(this.timer);this.response={text:this.xhr.responseText||"",xml:this.xhr.responseXML};if(this.options.isSuccess.call(this,this.status)){this.success(this.response.text,this.response.xml)}else{this.failure()}},isSuccess:function(){var e=this.status;return(e>=200&&e<300)},isRunning:function(){return !!this.running},processScripts:function(e){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return Browser.exec(e)}return e.stripScripts(this.options.evalScripts)},success:function(f,e){this.onSuccess(this.processScripts(f),e)},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain()},failure:function(){this.onFailure()},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr)},loadstart:function(e){this.fireEvent("loadstart",[e,this.xhr])},progress:function(e){this.fireEvent("progress",[e,this.xhr])},timeout:function(){this.fireEvent("timeout",this.xhr)
},setHeader:function(e,f){this.headers[e]=f;return this},getHeader:function(e){return Function.attempt(function(){return this.xhr.getResponseHeader(e)}.bind(this))},check:function(){if(!this.running){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.pass(arguments,this));return false}return false},send:function(q){if(!this.check(q)){return this}this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.running=true;var m=typeOf(q);if(m=="string"||m=="element"){q={data:q}}var h=this.options;q=Object.append({data:h.data,url:h.url,method:h.method},q);var k=q.data,f=String(q.url),e=q.method.toLowerCase();switch(typeOf(k)){case"element":k=document.id(k).toQueryString();break;case"object":case"hash":k=Object.toQueryString(k)}if(this.options.format){var n="format="+this.options.format;k=(k)?n+"&"+k:n}if(this.options.emulation&&!["get","post"].contains(e)){var l="_method="+e;k=(k)?l+"&"+k:l;e="post"}if(this.options.urlEncoded&&["post","put"].contains(e)){var g=(this.options.encoding)?"; charset="+this.options.encoding:"";
this.headers["Content-type"]="application/x-www-form-urlencoded"+g}if(!f){f=document.location.pathname}var j=f.lastIndexOf("/");if(j>-1&&(j=f.indexOf("#"))>-1){f=f.substr(0,j)}if(this.options.noCache){f+=(f.contains("?")?"&":"?")+String.uniqueID()}if(k&&e=="get"){f+=(f.contains("?")?"&":"?")+k;k=null}var o=this.xhr;if(a){o.onloadstart=this.loadstart.bind(this);o.onprogress=this.progress.bind(this)}o.open(e.toUpperCase(),f,this.options.async,this.options.user,this.options.password);if(this.options.user&&"withCredentials" in o){o.withCredentials=true}o.onreadystatechange=this.onStateChange.bind(this);Object.each(this.headers,function(s,r){try{o.setRequestHeader(r,s)}catch(t){this.fireEvent("exception",[r,s])}},this);this.fireEvent("request");o.send(k);if(!this.options.async){this.onStateChange()}else{if(this.options.timeout){this.timer=this.timeout.delay(this.options.timeout,this)}}return this},cancel:function(){if(!this.running){return this}this.running=false;var e=this.xhr;e.abort();clearTimeout(this.timer);
e.onreadystatechange=d;if(a){e.onprogress=e.onloadstart=d}this.xhr=new Browser.Request();this.fireEvent("cancel");return this}});var b={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(e){b[e]=function(g){var f={method:e};if(g!=null){f.data=g}return this.send(f)}});c.implement(b);Element.Properties.send={set:function(e){var f=this.get("send").cancel();f.setOptions(e);return this},get:function(){var e=this.retrieve("send");if(!e){e=new c({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")});this.store("send",e)}return e}};Element.implement({send:function(e){var f=this.get("send");f.send({data:this,url:e||f.options.url});return this}})})();Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false,headers:{Accept:"text/html, application/xml, text/xml, */*"}},success:function(f){var e=this.options,c=this.response;c.html=f.stripScripts(function(h){c.javascript=h});var d=c.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
if(d){c.html=d[1]}var b=new Element("div").set("html",c.html);c.tree=b.childNodes;c.elements=b.getElements(e.filter||"*");if(e.filter){c.tree=c.elements}if(e.update){var g=document.id(e.update).empty();if(e.filter){g.adopt(c.elements)}else{g.set("html",c.html)}}else{if(e.append){var a=document.id(e.append);if(e.filter){c.elements.reverse().inject(a)}else{a.adopt(b.getChildren())}}}if(e.evalScripts){Browser.exec(c.javascript)}this.onSuccess(c.tree,c.elements,c.html,c.javascript)}});Element.Properties.load={set:function(a){var b=this.get("load").cancel();b.setOptions(a);return this},get:function(){var a=this.retrieve("load");if(!a){a=new Request.HTML({data:this,link:"cancel",update:this,method:"get"});this.store("load",a)}return a}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Type.isObject,url:Type.isString}));return this}});if(typeof JSON=="undefined"){this.JSON={}}(function(){var special={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
var escape=function(chr){return special[chr]||"\\u"+("0000"+chr.charCodeAt(0).toString(16)).slice(-4)};JSON.validate=function(string){string=string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(string)};JSON.encode=JSON.stringify?function(obj){return JSON.stringify(obj)}:function(obj){if(obj&&obj.toJSON){obj=obj.toJSON()}switch(typeOf(obj)){case"string":return'"'+obj.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":return"["+obj.map(JSON.encode).clean()+"]";case"object":case"hash":var string=[];Object.each(obj,function(value,key){var json=JSON.encode(value);if(json){string.push(JSON.encode(key)+":"+json)}});return"{"+string+"}";case"number":case"boolean":return""+obj;case"null":return"null"}return null};JSON.decode=function(string,secure){if(!string||typeOf(string)!="string"){return null}if(secure||JSON.secure){if(JSON.parse){return JSON.parse(string)
}if(!JSON.validate(string)){throw new Error("JSON could not decode the input; security is enabled and the value is not secure.")}}return eval("("+string+")")}})();Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);Object.append(this.headers,{Accept:"application/json","X-Request":"JSON"})},success:function(c){var b;try{b=this.response.json=JSON.decode(c,this.options.secure)}catch(a){this.fireEvent("error",[c,a]);return}if(b==null){this.onFailure()}else{this.onSuccess(b,c)}}});var Cookie=new Class({Implements:Options,options:{path:"/",domain:false,duration:false,secure:false,document:document,encode:true},initialize:function(b,a){this.key=b;this.setOptions(a)},write:function(b){if(this.options.encode){b=encodeURIComponent(b)}if(this.options.domain){b+="; domain="+this.options.domain}if(this.options.path){b+="; path="+this.options.path}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString()
}if(this.options.secure){b+="; secure"}this.options.document.cookie=this.key+"="+b;return this},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");return(a)?decodeURIComponent(a[1]):null},dispose:function(){new Cookie(this.key,Object.merge({},this.options,{duration:-1})).write("");return this}});Cookie.write=function(b,c,a){return new Cookie(b,a).write(c)};Cookie.read=function(a){return new Cookie(a).read()};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose()};(function(j,l){var m,f,e=[],c,b,d=l.createElement("div");var g=function(){clearTimeout(b);if(m){return}Browser.loaded=m=true;l.removeListener("DOMContentLoaded",g).removeListener("readystatechange",a);l.fireEvent("domready");j.fireEvent("domready")};var a=function(){for(var n=e.length;n--;){if(e[n]()){g();return true}}return false};var k=function(){clearTimeout(b);if(!a()){b=setTimeout(k,10)}};l.addListener("DOMContentLoaded",g);var h=function(){try{d.doScroll();return true
}catch(n){}return false};if(d.doScroll&&!h()){e.push(h);c=true}if(l.readyState){e.push(function(){var n=l.readyState;return(n=="loaded"||n=="complete")})}if("onreadystatechange" in l){l.addListener("readystatechange",a)}else{c=true}if(c){k()}Element.Events.domready={onAdd:function(n){if(m){n.call(this)}}};Element.Events.load={base:"load",onAdd:function(n){if(f&&this==j){n.call(this)}},condition:function(){if(this==j){g();delete Element.Events.load}return true}};j.addEvent("load",function(){f=true})})(window,document);MooTools.More={version:"1.4.0.1",build:"a4244edf2aa97ac8a196fc96082dd35af1abab87"};Class.Mutators.Binds=function(a){if(!this.prototype.initialize){this.implement("initialize",function(){})}return Array.from(a).concat(this.prototype.Binds||[])};Class.Mutators.initialize=function(a){return function(){Array.from(this.Binds).each(function(b){var c=this[b];if(c){this[b]=c.bind(this)}},this);return a.apply(this,arguments)}};(function(a){Array.implement({min:function(){return Math.min.apply(null,this)
},max:function(){return Math.max.apply(null,this)},average:function(){return this.length?this.sum()/this.length:0},sum:function(){var b=0,c=this.length;if(c){while(c--){b+=this[c]}}return b},unique:function(){return[].combine(this)},shuffle:function(){for(var c=this.length;c&&--c;){var b=this[c],d=Math.floor(Math.random()*(c+1));this[c]=this[d];this[d]=b}return this},reduce:function(d,e){for(var c=0,b=this.length;c<b;c++){if(c in this){e=e===a?this[c]:d.call(null,e,this[c],c,this)}}return e},reduceRight:function(c,d){var b=this.length;while(b--){if(b in this){d=d===a?this[b]:c.call(null,d,this[b],b,this)}}return d}})})();(function(){var b=function(c){return c!=null};var a=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(e,f){if(typeof f=="string"){f=f.split(".")}for(var d=0,c=f.length;d<c;d++){if(a.call(e,f[d])){e=e[f[d]]}else{return null}}return e},cleanValues:function(c,e){e=e||b;for(var d in c){if(!e(c[d])){delete c[d]}}return c},erase:function(c,d){if(a.call(c,d)){delete c[d]
}return c},run:function(d){var c=Array.slice(arguments,1);for(var e in d){if(d[e].apply){d[e].apply(d,c)}}return d}})})();(function(){var c={a:/[àáâãäåăą]/g,A:/[ÀÁÂÃÄÅĂĄ]/g,c:/[ćčç]/g,C:/[ĆČÇ]/g,d:/[ďđ]/g,D:/[ĎÐ]/g,e:/[èéêëěę]/g,E:/[ÈÉÊËĚĘ]/g,g:/[ğ]/g,G:/[Ğ]/g,i:/[ìíîï]/g,I:/[ÌÍÎÏ]/g,l:/[ĺľł]/g,L:/[ĹĽŁ]/g,n:/[ñňń]/g,N:/[ÑŇŃ]/g,o:/[òóôõöøő]/g,O:/[ÒÓÔÕÖØ]/g,r:/[řŕ]/g,R:/[ŘŔ]/g,s:/[ššş]/g,S:/[ŠŞŚ]/g,t:/[ťţ]/g,T:/[ŤŢ]/g,ue:/[ü]/g,UE:/[Ü]/g,u:/[ùúûůµ]/g,U:/[ÙÚÛŮ]/g,y:/[ÿý]/g,Y:/[ŸÝ]/g,z:/[žźż]/g,Z:/[ŽŹŻ]/g,th:/[þ]/g,TH:/[Þ]/g,dh:/[ð]/g,DH:/[Ð]/g,ss:/[ß]/g,oe:/[œ]/g,OE:/[Œ]/g,ae:/[æ]/g,AE:/[Æ]/g},b={" ":/[\xa0\u2002\u2003\u2009]/g,"*":/[\xb7]/g,"'":/[\u2018\u2019]/g,'"':/[\u201c\u201d]/g,"...":/[\u2026]/g,"-":/[\u2013]/g,"&raquo;":/[\uFFFD]/g};var a=function(f,h){var e=f,g;for(g in h){e=e.replace(h[g],g)}return e};var d=function(e,g){e=e||"";var h=g?"<"+e+"(?!\\w)[^>]*>([\\s\\S]*?)</"+e+"(?!\\w)>":"</?"+e+"([^>]+)?>",f=new RegExp(h,"gi");return f};String.implement({standardize:function(){return a(this,c)
},repeat:function(e){return new Array(e+1).join(this)},pad:function(e,h,g){if(this.length>=e){return this}var f=(h==null?" ":""+h).repeat(e-this.length).substr(0,e-this.length);if(!g||g=="right"){return this+f}if(g=="left"){return f+this}return f.substr(0,(f.length/2).floor())+this+f.substr(0,(f.length/2).ceil())},getTags:function(e,f){return this.match(d(e,f))||[]},stripTags:function(e,f){return this.replace(d(e,f),"")},tidy:function(){return a(this,b)},truncate:function(e,f,j){var h=this;if(f==null&&arguments.length==1){f="…"}if(h.length>e){h=h.substring(0,e);if(j){var g=h.lastIndexOf(j);if(g!=-1){h=h.substr(0,g)}}if(f){h+=f}}return h}})})();String.implement({parseQueryString:function(d,a){if(d==null){d=true}if(a==null){a=true}var c=this.split(/[&;]/),b={};if(!c.length){return b}c.each(function(j){var e=j.indexOf("=")+1,g=e?j.substr(e):"",f=e?j.substr(0,e-1).match(/([^\]\[]+|(\B)(?=\]))/g):[j],h=b;if(!f){return}if(a){g=decodeURIComponent(g)}f.each(function(l,k){if(d){l=decodeURIComponent(l)
}var m=h[l];if(k<f.length-1){h=h[l]=m||{}}else{if(typeOf(m)=="array"){m.push(g)}else{h[l]=m!=null?[m,g]:g}}})});return b},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);return a?a.call(null,c,d):(d||d===0)}).join("&")}});(function(){var b=function(){return this.get("value")};var a=this.URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(d,c){this.setOptions(c);var e=this.options.base||a.base;if(!d){d=e}if(d&&d.parsed){this.parsed=Object.clone(d.parsed)}else{this.set("value",d.href||d.toString(),e?new a(e):false)}},parse:function(e,d){var c=e.match(this.regex);if(!c){return false}c.shift();return this.merge(c.associate(this.parts),d)
},merge:function(d,c){if((!d||!d.scheme)&&(!c||!c.scheme)){return false}if(c){this.parts.every(function(e){if(d[e]){return false}d[e]=c[e]||"";return true})}d.port=d.port||this.schemes[d.scheme.toLowerCase()];d.directory=d.directory?this.parseDirectory(d.directory,c?c.directory:""):"/";return d},parseDirectory:function(d,e){d=(d.substr(0,1)=="/"?"":(e||"/"))+d;if(!d.test(a.regs.directoryDot)){return d}var c=[];d.replace(a.regs.endSlash,"").split("/").each(function(f){if(f==".."&&c.length>0){c.pop()}else{if(f!="."){c.push(f)}}});return c.join("/")+"/"},combine:function(c){return c.value||c.scheme+"://"+(c.user?c.user+(c.password?":"+c.password:"")+"@":"")+(c.host||"")+(c.port&&c.port!=this.schemes[c.scheme]?":"+c.port:"")+(c.directory||"/")+(c.file||"")+(c.query?"?"+c.query:"")+(c.fragment?"#"+c.fragment:"")},set:function(d,f,e){if(d=="value"){var c=f.match(a.regs.scheme);if(c){c=c[1]}if(c&&this.schemes[c.toLowerCase()]==null){this.parsed={scheme:c,value:f}}else{this.parsed=this.parse(f,(e||this).parsed)||(c?{scheme:c,value:f}:{value:f})
}}else{if(d=="data"){this.setData(f)}else{this.parsed[d]=f}}return this},get:function(c,d){switch(c){case"value":return this.combine(this.parsed,d?d.parsed:false);case"data":return this.getData()}return this.parsed[c]||""},go:function(){document.location.href=this.toString()},toURI:function(){return this},getData:function(e,d){var c=this.get(d||"query");if(!(c||c===0)){return e?null:{}}var f=c.parseQueryString();return e?f[e]:f},setData:function(c,f,d){if(typeof c=="string"){var e=this.getData();e[arguments[0]]=arguments[1];c=e}else{if(f){c=Object.merge(this.getData(),c)}}return this.set(d||"query",Object.toQueryString(c))},clearData:function(c){return this.set(c||"query","")},toString:b,valueOf:b});a.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};a.base=new a(Array.from(document.getElements("base[href]",true)).getLast(),{base:document.location});String.implement({toURI:function(c){return new a(this,c)}})})();(function(){if(this.Hash){return}var a=this.Hash=new Type("Hash",function(b){if(typeOf(b)=="hash"){b=Object.clone(b.getClean())
}for(var c in b){this[c]=b[c]}return this});this.$H=function(b){return new a(b)};a.implement({forEach:function(b,c){Object.forEach(this,b,c)},getClean:function(){var c={};for(var b in this){if(this.hasOwnProperty(b)){c[b]=this[b]}}return c},getLength:function(){var c=0;for(var b in this){if(this.hasOwnProperty(b)){c++}}return c}});a.alias("each","forEach");a.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){return Object.keyOf(this,b)},hasValue:function(b){return Object.contains(this,b)},extend:function(b){a.each(b||{},function(d,c){a.set(this,c,d)},this);return this},combine:function(b){a.each(b||{},function(d,c){a.include(this,c,d)},this);return this},erase:function(b){if(this.hasOwnProperty(b)){delete this[b]}return this},get:function(b){return(this.hasOwnProperty(b))?this[b]:null},set:function(b,c){if(!this[b]||this.hasOwnProperty(b)){this[b]=c}return this},empty:function(){a.each(this,function(c,b){delete this[b]},this);return this},include:function(b,c){if(this[b]==undefined){this[b]=c
}return this},map:function(b,c){return new a(Object.map(this,b,c))},filter:function(b,c){return new a(Object.filter(this,b,c))},every:function(b,c){return Object.every(this,b,c)},some:function(b,c){return Object.some(this,b,c)},getKeys:function(){return Object.keys(this)},getValues:function(){return Object.values(this)},toQueryString:function(b){return Object.toQueryString(this,b)}});a.alias({indexOf:"keyOf",contains:"hasValue"})})();Hash.implement({getFromPath:function(a){return Object.getFromPath(this,a)},cleanValues:function(a){return new Hash(Object.cleanValues(this,a))},run:function(){Object.run(arguments)}});Element.implement({tidy:function(){this.set("value",this.get("value").tidy())},getTextInRange:function(b,a){return this.get("value").substring(b,a)},getSelectedText:function(){if(this.setSelectionRange){return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd())}return document.selection.createRange().text},getSelectedRange:function(){if(this.selectionStart!=null){return{start:this.selectionStart,end:this.selectionEnd}
}var e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length}else{var b=this.get("value");var d=b.length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);if(c.text.length){d-=b.match(/[\n\r]*$/)[0].length}e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length}return e},getSelectionStart:function(){return this.getSelectedRange().start},getSelectionEnd:function(){return this.getSelectedRange().end},setCaretPosition:function(a){if(a=="end"){a=this.get("value").length}this.selectRange(a,a);return this},getCaretPosition:function(){return this.getSelectedRange().start},selectRange:function(e,a){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,a)}else{var c=this.get("value");var d=c.substr(e,a-e).replace(/\r/g,"").length;e=c.substr(0,e).replace(/\r/g,"").length;var b=this.createTextRange();
b.collapse(true);b.moveEnd("character",e+d);b.moveStart("character",e);b.select()}return this},insertAtCursor:function(b,a){var d=this.getSelectedRange();var c=this.get("value");this.set("value",c.substring(0,d.start)+b+c.substring(d.end,c.length));if(a!==false){this.selectRange(d.start,d.start+b.length)}else{this.setCaretPosition(d.start+b.length)}return this},insertAroundCursor:function(b,a){b=Object.append({before:"",defaultMiddle:"",after:""},b);var c=this.getSelectedText()||b.defaultMiddle;var g=this.getSelectedRange();var f=this.get("value");if(g.start==g.end){this.set("value",f.substring(0,g.start)+b.before+c+b.after+f.substring(g.end,f.length));this.selectRange(g.start+b.before.length,g.end+b.before.length+c.length)}else{var d=f.substring(g.start,g.end);this.set("value",f.substring(0,g.start)+b.before+d+b.after+f.substring(g.end,f.length));var e=g.start+b.before.length;if(a!==false){this.selectRange(e,e+d.length)}else{this.setCaretPosition(e+f.length)}}return this}});Elements.from=function(e,d){if(d||d==null){e=e.stripScripts()
}var b,c=e.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i);if(c){b=new Element("table");var a=c[1].toLowerCase();if(["td","th","tr"].contains(a)){b=new Element("tbody").inject(b);if(a!="tr"){b=new Element("tr").inject(b)}}}return(b||new Element("div")).set("html",e).getChildren()};(function(){var b=function(e,d){var f=[];Object.each(d,function(g){Object.each(g,function(h){e.each(function(j){f.push(j+"-"+h+(j=="border"?"-width":""))})})});return f};var c=function(f,e){var d=0;Object.each(e,function(h,g){if(g.test(f)){d=d+h.toInt()}});return d};var a=function(d){return !!(!d||d.offsetHeight||d.offsetWidth)};Element.implement({measure:function(h){if(a(this)){return h.call(this)}var g=this.getParent(),e=[];while(!a(g)&&g!=document.body){e.push(g.expose());g=g.getParent()}var f=this.expose(),d=h.call(this);f();e.each(function(j){j()});return d},expose:function(){if(this.getStyle("display")!="none"){return function(){}}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});
return function(){this.style.cssText=d}.bind(this)},getDimensions:function(d){d=Object.merge({computeSize:false},d);var j={x:0,y:0};var h=function(k,e){return(e.computeSize)?k.getComputedSize(e):k.getSize()};var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){j=this.measure(function(){return h(this,d)})}else{if(f){try{j=h(this,d)}catch(g){}}}return Object.append(j,(j.x||j.x===0)?{width:j.x,height:j.y}:{x:j.width,y:j.height})},getComputedSize:function(d){d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f;if(d.mode=="vertical"){delete e.width;delete d.planes.width}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt()},this);Object.each(d.planes,function(j,h){var l=h.capitalize(),k=this.getStyle(h);if(k=="auto"&&!f){f=this.getDimensions()}k=g[h]=(k=="auto")?f[h]:k.toInt();e["total"+l]=k;j.each(function(n){var m=c(n,g);
e["computed"+n.capitalize()]=m;e["total"+l]+=m})},this);return Object.append(e,g)}})})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c);a.setPositionOption(c);a.setEdgeOption(c);a.setOffsetOption(d,c);a.setDimensionsOption(d,c);return c},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position)},setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"}},setOffsetOption:function(f,d){var c={x:0,y:0},g=f.measure(function(){return document.id(this.getOffsetParent())}),e=g.getScroll();if(!g||g==f.getDocument().body){return}c=g.measure(function(){var j=this.getPosition();if(this.getStyle("position")=="fixed"){var h=window.getScroll();j.x+=h.x;j.y+=h.y}return j});d.offset={parentPositioned:g!=document.id(d.relativeTo),x:d.offset.x-c.x+e.x,y:d.offset.y-c.y+e.y}
},setDimensionsOption:function(d,c){c.dimensions=d.getDimensions({computeSize:true,styles:["padding","border","margin"]})},getPosition:function(e,d){var c={};d=a.getOptions(e,d);var f=document.id(d.relativeTo)||document.body;a.setPositionCoordinates(d,c,f);if(d.edge){a.toEdge(c,d)}var g=d.offset;c.left=((c.x>=0||g.parentPositioned||d.allowNegative)?c.x:0).toInt();c.top=((c.y>=0||g.parentPositioned||d.allowNegative)?c.y:0).toInt();a.toMinMax(c,d);if(d.relFixedPosition||f.getStyle("position")=="fixed"){a.toRelFixedPosition(f,c)}if(d.ignoreScroll){a.toIgnoreScroll(f,c)}if(d.ignoreMargins){a.toIgnoreMargins(c,d)}c.left=Math.ceil(c.left);c.top=Math.ceil(c.top);delete c.x;delete c.y;return c},setPositionCoordinates:function(l,g,d){var f=l.offset.y,h=l.offset.x,e=(d==document.body)?window.getScroll():d.getPosition(),k=e.y,c=e.x,j=window.getSize();switch(l.position.x){case"left":g.x=c+h;break;case"right":g.x=c+h+d.offsetWidth;break;default:g.x=c+((d==document.body?j.x:d.offsetWidth)/2)+h;break}switch(l.position.y){case"top":g.y=k+f;
break;case"bottom":g.y=k+f+d.offsetHeight;break;default:g.y=k+((d==document.body?j.y:d.offsetHeight)/2)+f;break}},toMinMax:function(c,d){var f={left:"x",top:"y"},e;["minimum","maximum"].each(function(g){["left","top"].each(function(h){e=d[g]?d[g][f[h]]:null;if(e!=null&&((g=="minimum")?c[h]<e:c[h]>e)){c[h]=e}})})},toRelFixedPosition:function(e,c){var d=window.getScroll();c.top+=d.y;c.left+=d.x},toIgnoreScroll:function(e,d){var c=e.getScroll();d.top-=c.y;d.left-=c.x},toIgnoreMargins:function(c,d){c.left+=d.edge.x=="right"?d.dimensions["margin-right"]:(d.edge.x!="center"?-d.dimensions["margin-left"]:-d.dimensions["margin-left"]+((d.dimensions["margin-right"]+d.dimensions["margin-left"])/2));c.top+=d.edge.y=="bottom"?d.dimensions["margin-bottom"]:(d.edge.y!="center"?-d.dimensions["margin-top"]:-d.dimensions["margin-top"]+((d.dimensions["margin-bottom"]+d.dimensions["margin-top"])/2))},toEdge:function(c,d){var e={},g=d.dimensions,f=d.edge;switch(f.x){case"left":e.x=0;break;case"right":e.x=-g.x-g.computedRight-g.computedLeft;
break;default:e.x=-(Math.round(g.totalWidth/2));break}switch(f.y){case"top":e.y=0;break;case"bottom":e.y=-g.y-g.computedTop-g.computedBottom;break;default:e.y=-(Math.round(g.totalHeight/2));break}c.x+=e.x;c.y+=e.y},getCoordinateFromValue:function(c){if(typeOf(c)!="string"){return c}c=c.toLowerCase();return{x:c.test("left")?"left":(c.test("right")?"right":"center"),y:c.test(/upper|top/)?"top":(c.test("bottom")?"bottom":"center")}}};Element.implement({position:function(d){if(d&&(d.x!=null||d.y!=null)){return(b?b.apply(this,arguments):this)}var c=this.setStyle("position","absolute").calculatePosition(d);return(d&&d.returnPos)?c:this.setStyles(c)},calculatePosition:function(c){return a.getPosition(this,c)}})})(Element.prototype.position);Element.implement({isDisplayed:function(){return this.getStyle("display")!="none"},isVisible:function(){var a=this.offsetWidth,b=this.offsetHeight;return(a==0&&b==0)?false:(a>0&&b>0)?true:this.style.display!="none"},toggle:function(){return this[this.isDisplayed()?"hide":"show"]()
},hide:function(){var b;try{b=this.getStyle("display")}catch(a){}if(b=="none"){return this}return this.store("element:_originalDisplay",b||"").setStyle("display","none")},show:function(a){if(!a&&this.isDisplayed()){return this}a=a||this.retrieve("element:_originalDisplay")||"block";return this.setStyle("display",(a=="none")?"block":a)},swapClass:function(a,b){return this.removeClass(a).addClass(b)}});Document.implement({clearSelection:function(){if(window.getSelection){var a=window.getSelection();if(a&&a.removeAllRanges){a.removeAllRanges()}}else{if(document.selection&&document.selection.empty){try{document.selection.empty()}catch(b){}}}}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);this.parent(a)},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j)}}return c},set:function(b){for(var c in b){if(!this.elements[c]){continue}var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit)
}}return this},start:function(c){if(!this.check(c)){return this}var h={},j={};for(var d in c){if(!this.elements[d]){continue}var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to}}return this.parent(h,j)}});Fx.Accordion=new Class({Extends:Fx.Elements,options:{fixedHeight:false,fixedWidth:false,display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,resetHeight:true},initialize:function(){var g=function(h){return h!=null};var f=Array.link(arguments,{container:Type.isElement,options:Type.isObject,togglers:g,elements:g});this.parent(f.elements,f.options);var b=this.options,e=this.togglers=$$(f.togglers);this.previous=-1;this.internalChain=new Chain();if(b.alwaysHide){this.options.link="chain"}if(b.show||this.options.show===0){b.display=false;this.previous=b.show}if(b.start){b.display=false;b.show=false}var d=this.effects={};if(b.opacity){d.opacity="fullOpacity"}if(b.width){d.width=b.fixedWidth?"fullWidth":"offsetWidth"
}if(b.height){d.height=b.fixedHeight?"fullHeight":"scrollHeight"}for(var c=0,a=e.length;c<a;c++){this.addSection(e[c],this.elements[c])}this.elements.each(function(j,h){if(b.show===h){this.fireEvent("active",[e[h],j])}else{for(var k in d){j.setStyle(k,0)}}},this);if(b.display||b.display===0||b.initialDisplayFx===false){this.display(b.display,b.initialDisplayFx)}if(b.fixedHeight!==false){b.resetHeight=false}this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain))},addSection:function(g,d){g=document.id(g);d=document.id(d);this.togglers.include(g);this.elements.include(d);var f=this.togglers,c=this.options,h=f.contains(g),a=f.indexOf(g),b=this.display.pass(a,this);g.store("accordion:display",b).addEvent(c.trigger,b);if(c.height){d.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})}if(c.width){d.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})}d.fullOpacity=1;if(c.fixedWidth){d.fullWidth=c.fixedWidth
}if(c.fixedHeight){d.fullHeight=c.fixedHeight}d.setStyle("overflow","hidden");if(!h){for(var e in this.effects){d.setStyle(e,0)}}return this},removeSection:function(f,b){var e=this.togglers,a=e.indexOf(f),c=this.elements[a];var d=function(){e.erase(f);this.elements.erase(c);this.detach(f)}.bind(this);if(this.now==a||b!=null){this.display(b!=null?b:(a-1>=0?a-1:0)).chain(d)}else{d()}return this},detach:function(b){var a=function(c){c.removeEvent(this.options.trigger,c.retrieve("accordion:display"))}.bind(this);if(!b){this.togglers.each(a)}else{a(b)}return this},display:function(b,c){if(!this.check(b,c)){return this}var h={},g=this.elements,a=this.options,f=this.effects;if(c==null){c=true}if(typeOf(b)=="element"){b=g.indexOf(b)}if(b==this.previous&&!a.alwaysHide){return this}if(a.resetHeight){var e=g[this.previous];if(e&&!this.selfHidden){for(var d in f){e.setStyle(d,e[f[d]])}}}if((this.timer&&a.link=="chain")||(b===this.previous&&!a.alwaysHide)){return this}this.previous=b;this.selfHidden=false;
g.each(function(l,k){h[k]={};var j;if(k!=b){j=true}else{if(a.alwaysHide&&((l.offsetHeight>0&&a.height)||l.offsetWidth>0&&a.width)){j=true;this.selfHidden=true}}this.fireEvent(j?"background":"active",[this.togglers[k],l]);for(var m in f){h[k][m]=j?0:l[f[m]]}if(!c&&!j&&a.resetHeight){h[k].height="auto"}},this);this.internalChain.clearChain();this.internalChain.chain(function(){if(a.resetHeight&&!this.selfHidden){var j=g[b];if(j){j.setStyle("height","auto")}}}.bind(this));return c?this.start(h):this.set(h).internalChain.callChain()}});Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(a){var b=this.element,c=b.getStyles("top","left");if(c.top=="auto"||c.left=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()))}return this.parent(b.position(Object.merge({},this.options,a,{returnPos:true})))}});Element.Properties.move={set:function(a){this.get("move").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("move");
if(!a){a=new Fx.Move(this,{link:"cancel"});this.store("move",a)}return a}};Element.implement({move:function(a){this.get("move").start(a);return this}});(function(){var a=function(d){var b=d.options.hideInputs;if(window.OverText){var c=[null];OverText.each(function(e){c.include("."+e.options.labelClass)});if(c){b+=c.join(", ")}}return(b)?d.element.getElements(b):null};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.ie6,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row"},opacity:1,hideInputs:Browser.ie?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});if(this.options.transitionOpacity){d.opacity=this.options.opacity
}var c={};Object.each(d,function(f,e){c[e]=[f,0]});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"});var b=a(this);if(b){b.setStyle("visibility","hidden")}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(b){b.setStyle("visibility","visible")}}this.fireEvent("hide",this.element);this.callChain()}.bind(this));this.start(c)}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element)}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this))}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve()}}}return this},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false;this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var d;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode})
}.bind(this));if(this.options.heightOverride!=null){d.height=this.options.heightOverride.toInt()}if(this.options.widthOverride!=null){d.width=this.options.widthOverride.toInt()}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=this.options.opacity}var c={height:0,display:Function.from(this.options.display).call(this)};Object.each(d,function(f,e){c[e]=0});c.overflow="hidden";this.element.setStyles(c);var b=a(this);if(b){b.setStyle("visibility","hidden")}this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false}if(b){b.setStyle("visibility","visible")}this.callChain();this.fireEvent("show",this.element)}.bind(this));this.start(d)}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element)}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this))}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();
this.reveal()}}}return this},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal()}else{this.dissolve()}return this},cancel:function(){this.parent.apply(this,arguments);if(this.cssText!=null){this.element.style.cssText=this.cssText}this.hiding=false;this.showing=false;return this}});Element.Properties.reveal={set:function(b){this.get("reveal").cancel().setOptions(b);return this},get:function(){var b=this.retrieve("reveal");if(!b){b=new Fx.Reveal(this);this.store("reveal",b)}return b}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(b){this.get("reveal").setOptions(b).reveal();return this},dissolve:function(b){this.get("reveal").setOptions(b).dissolve();return this},nix:function(b){var c=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(b).dissolve().chain(function(){this[c.destroy?"destroy":"dispose"]()}.bind(this));return this},wink:function(){var c=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});
var b=this.get("reveal").setOptions(c.options);b.reveal().chain(function(){(function(){b.dissolve()}).delay(c.duration||2000)})}})})();(function(){Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(c,b){this.element=this.subject=document.id(c);this.parent(b);if(typeOf(this.element)!="element"){this.element=document.id(this.element.getDocument().body)}if(this.options.wheelStops){var d=this.element,e=this.cancel.pass(false,this);this.addEvent("start",function(){d.addEvent("mousewheel",e)},true);this.addEvent("complete",function(){d.removeEvent("mousewheel",e)},true)}},set:function(){var b=Array.flatten(arguments);if(Browser.firefox){b=[Math.round(b[0]),Math.round(b[1])]}this.element.scrollTo(b[0],b[1]);return this},compute:function(d,c,b){return[0,1].map(function(e){return Fx.compute(d[e],c[e],b)})},start:function(c,d){if(!this.check(c,d)){return this}var b=this.element.getScroll();return this.parent([b.x,b.y],[c,d])},calculateScroll:function(g,f){var d=this.element,b=d.getScrollSize(),h=d.getScroll(),k=d.getSize(),c=this.options.offset,j={x:g,y:f};
for(var e in j){if(!j[e]&&j[e]!==0){j[e]=h[e]}if(typeOf(j[e])!="number"){j[e]=b[e]-k[e]}j[e]+=c[e]}return[j.x,j.y]},toTop:function(){return this.start.apply(this,this.calculateScroll(false,0))},toLeft:function(){return this.start.apply(this,this.calculateScroll(0,false))},toRight:function(){return this.start.apply(this,this.calculateScroll("right",false))},toBottom:function(){return this.start.apply(this,this.calculateScroll(false,"bottom"))},toElement:function(d,e){e=e?Array.from(e):["x","y"];var c=a(this.element)?{x:0,y:0}:this.element.getScroll();var b=Object.map(document.id(d).getPosition(this.element),function(g,f){return e.contains(f)?g+c[f]:false});return this.start.apply(this,this.calculateScroll(b.x,b.y))},toElementEdge:function(d,g,e){g=g?Array.from(g):["x","y"];d=document.id(d);var j={},f=d.getPosition(this.element),k=d.getSize(),h=this.element.getScroll(),b=this.element.getSize(),c={x:f.x+k.x,y:f.y+k.y};["x","y"].each(function(l){if(g.contains(l)){if(c[l]>h[l]+b[l]){j[l]=c[l]-b[l]
}if(f[l]<h[l]){j[l]=f[l]}}if(j[l]==null){j[l]=h[l]}if(e&&e[l]){j[l]=j[l]+e[l]}},this);if(j.x!=h.x||j.y!=h.y){this.start(j.x,j.y)}return this},toElementCenter:function(e,f,h){f=f?Array.from(f):["x","y"];e=document.id(e);var j={},c=e.getPosition(this.element),d=e.getSize(),b=this.element.getScroll(),g=this.element.getSize();["x","y"].each(function(k){if(f.contains(k)){j[k]=c[k]-(g[k]-d[k])/2}if(j[k]==null){j[k]=b[k]}if(h&&h[k]){j[k]=j[k]+h[k]}},this);if(j.x!=b.x||j.y!=b.y){this.start(j.x,j.y)}return this}});function a(b){return(/^(?:body|html)$/i).test(b.tagName)}})();Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:false,hideOverflow:true,resetHeight:false},initialize:function(b,a){b=this.element=this.subject=document.id(b);this.parent(a);a=this.options;var d=b.retrieve("wrapper"),c=b.getStyles("margin","position","overflow");if(a.hideOverflow){c=Object.append(c,{overflow:"hidden"})}if(a.wrapper){d=document.id(a.wrapper).setStyles(c)}if(!d){d=new Element("div",{styles:c}).wraps(b)
}b.store("wrapper",d).setStyle("margin",0);if(b.getStyle("overflow")=="visible"){b.setStyle("overflow","hidden")}this.now=[];this.open=true;this.wrapper=d;this.addEvent("complete",function(){this.open=(d["offset"+this.layout.capitalize()]!=0);if(this.open&&this.options.resetHeight){d.setStyle("height","")}},true)},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);return this},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a)})},start:function(b,e){if(!this.check(b,e)){return this}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt(),c=this.wrapper.getStyle(this.layout).toInt(),a=[[d,c],[0,this.offset]],g=[[d,c],[-this.offset,0]],f;switch(b){case"in":f=a;break;case"out":f=g;break;
case"toggle":f=(c==0)?a:g}return this.parent(f[0],f[1])},slideIn:function(a){return this.start("in",a)},slideOut:function(a){return this.start("out",a)},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(a){this[a||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(a){return this.start("toggle",a)}});Element.Properties.slide={set:function(a){this.get("slide").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("slide");if(!a){a=new Fx.Slide(this,{link:"cancel"});this.store("slide",a)}return a}};Element.implement({slide:function(d,e){d=d||"toggle";var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);this.store("slide:flag",!c);a=true;break;default:b.start(d,e)}if(!a){this.eliminate("slide:flag")}return this}});Fx.SmoothScroll=new Class({Extends:Fx.Scroll,options:{axes:["x","y"]},initialize:function(c,d){d=d||document;
this.doc=d.getDocument();this.parent(this.doc,c);var e=d.getWindow(),a=e.location.href.match(/^[^#]*/)[0]+"#",b=$$(this.options.links||this.doc.links);b.each(function(g){if(g.href.indexOf(a)!=0){return}var f=g.href.substr(a.length);if(f){this.useLink(g,f)}},this);this.addEvent("complete",function(){e.location.hash=this.anchor;this.element.scrollTo(this.to[0],this.to[1])},true)},useLink:function(b,a){b.addEvent("click",function(d){var c=document.id(a)||this.doc.getElement("a[name="+a+"]");if(!c){return}d.preventDefault();this.toElement(c,this.options.axes).chain(function(){this.fireEvent("scrolledTo",[b,c])}.bind(this));this.anchor=a}.bind(this));return this}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null}});this.element=document.id(b.element);
this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.ie)?"selectstart":"mousedown";if(Browser.ie&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false);Drag.ondragstartFixed=true}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)};this.attach()},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this},start:function(a){var j=this.options;if(a.rightClick){return}if(j.preventDefault){a.preventDefault()}if(j.stopPropagation){a.stopPropagation()}this.mouse.start=a.page;this.fireEvent("beforeStart",this.element);
var c=j.limit;this.limit={x:[],y:[]};var e,g;for(e in j.modifiers){if(!j.modifiers[e]){continue}var b=this.element.getStyle(j.modifiers[e]);if(b&&!b.match(/px$/)){if(!g){g=this.element.getCoordinates(this.element.getOffsetParent())}b=g[j.modifiers[e]]}if(j.style){this.value.now[e]=(b||0).toInt()}else{this.value.now[e]=this.element[j.modifiers[e]]}if(j.invert){this.value.now[e]*=-1}this.mouse.pos[e]=a.page[e]-this.value.now[e];if(c&&c[e]){var d=2;while(d--){var f=c[e][d];if(f||f===0){this.limit[e][d]=(typeof f=="function")?f():f}}}}if(typeOf(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}}var h={mousemove:this.bound.check,mouseup:this.bound.cancel};h[this.selection]=this.bound.eventStop;this.document.addEvents(h)},check:function(a){if(this.options.preventDefault){a.preventDefault()}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});
this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element)}},drag:function(b){var a=this.options;if(a.preventDefault){b.preventDefault()}this.mouse.now=b.page;for(var c in a.modifiers){if(!a.modifiers[c]){continue}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(a.invert){this.value.now[c]*=-1}if(a.limit&&this.limit[c]){if((this.limit[c][1]||this.limit[c][1]===0)&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1]}else{if((this.limit[c][0]||this.limit[c][0]===0)&&(this.value.now[c]<this.limit[c][0])){this.value.now[c]=this.limit[c][0]}}}if(a.grid[c]){this.value.now[c]-=((this.value.now[c]-(this.limit[c][0]||0))%a.grid[c])}if(a.style){this.element.setStyle(a.modifiers[c],this.value.now[c]+a.unit)}else{this.element[a.modifiers[c]]=this.value.now[c]}}this.fireEvent("drag",[this.element,b])},cancel:function(a){this.document.removeEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});if(a){this.document.removeEvent(this.selection,this.bound.eventStop);
this.fireEvent("cancel",this.element)}},stop:function(b){var a={mousemove:this.bound.drag,mouseup:this.bound.stop};a[this.selection]=this.bound.eventStop;this.document.removeEvents(a);if(b){this.fireEvent("complete",[this.element,b])}}});Element.implement({makeResizable:function(a){var b=new Drag(this,Object.merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b)}.bind(this))}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&typeOf(this.container)!="element"){this.container=document.id(this.container.getDocument().body)}if(this.options.style){if(this.options.modifiers.x=="left"&&this.options.modifiers.y=="top"){var c=b.getOffsetParent(),d=b.getStyles("left","top");
if(c&&(d.left=="auto"||d.top=="auto")){b.setPosition(b.getPosition(c))}}if(b.getStyle("position")=="static"){b.setStyle("position","absolute")}}this.addEvent("start",this.checkDroppables,true);this.overed=null},start:function(a){if(this.container){this.options.limit=this.calculateLimit()}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates()})}this.parent(a)},calculateLimit:function(){var k=this.element,e=this.container,d=document.id(k.getOffsetParent())||document.body,h=e.getCoordinates(d),c={},b={},l={},g={},n={};["top","right","bottom","left"].each(function(s){c[s]=k.getStyle("margin-"+s).toInt();b[s]=k.getStyle("border-"+s).toInt();l[s]=e.getStyle("margin-"+s).toInt();g[s]=e.getStyle("border-"+s).toInt();n[s]=d.getStyle("padding-"+s).toInt()},this);var f=k.offsetWidth+c.left+c.right,r=k.offsetHeight+c.top+c.bottom,j=0,m=0,q=h.right-g.right-f,a=h.bottom-g.bottom-r;if(this.options.includeMargins){j+=c.left;m+=c.top}else{q+=c.right;a+=c.bottom
}if(k.getStyle("position")=="relative"){var o=k.getCoordinates(d);o.left-=k.getStyle("left").toInt();o.top-=k.getStyle("top").toInt();j-=o.left;m-=o.top;if(e.getStyle("position")!="relative"){j+=g.left;m+=g.top}q+=c.left-o.left;a+=c.top-o.top;if(e!=d){j+=l.left+n.left;m+=((Browser.ie6||Browser.ie7)?0:l.top)+n.top}}else{j-=c.left;m-=c.top;if(e!=d){j+=h.left+g.left;m+=h.top+g.top}}return{x:[j,q],y:[m,a]}},getDroppableCoordinates:function(c){var b=c.getCoordinates();if(c.getStyle("position")=="fixed"){var a=window.getScroll();b.left+=a.x;b.right+=a.x;b.top+=a.y;b.bottom+=a.y}return b},checkDroppables:function(){var a=this.droppables.filter(function(d,c){d=this.positions?this.positions[c]:this.getDroppableCoordinates(d);var b=this.mouse.now;return(b.x>d.left&&b.x<d.right&&b.y<d.bottom&&b.y>d.top)},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed])}if(a){this.fireEvent("enter",[this.element,a])}this.overed=a}},drag:function(a){this.parent(a);
if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables()}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a)}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);this.store("dragger",b);return b}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(b,a){this.parent(b,a);this.load()},save:function(){var a=JSON.encode(this.hash);if(!a||a.length>4096){return false}if(a=="{}"){this.dispose()}else{this.write(a)}return true},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this}});Hash.each(Hash.prototype,function(b,a){if(typeof b=="function"){Hash.Cookie.implement(a,function(){var c=b.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return c})}});var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(c,a,b){this.element=$(c)||$$(c);this.addEvent("onFired",a);
this.setOptions(b);this.bound=this.changed.bind(this);this.resume()},changed:function(){var a=this.element.get("value");if($equals(this.value,a)){return}this.clear();this.value=a;this.timeout=this.onFired.delay(this.options.delay,this)},setValue:function(a){this.value=a;this.element.set("value",a);return this.clear()},onFired:function(){this.fireEvent("onFired",[this.value,this.element])},clear:function(){clearTimeout(this.timeout||null);return this},pause:function(){if(this.timer){clearInterval(this.timer)}else{this.element.removeEvent("keyup",this.bound)}return this.clear()},resume:function(){this.value=this.element.get("value");if(this.options.periodical){this.timer=this.changed.periodical(this.options.periodical,this)}else{this.element.addEvent("keyup",this.bound)}return this}});var $equals=function(b,a){return(b==a||JSON.encode(b)==JSON.encode(a))};var Overlay=new Class({Implements:[Options,Events],options:{id:"overlay",color:"#000",duration:500,opacity:0.5,zIndex:5000},initialize:function(a,b){this.setOptions(b);
this.container=document.id(a);if(Browser.ie&&Browser.version<=6){this.ie6=true}this.overlay=new Element("div",{id:this.options.id,styles:{position:(this.ie6)?"absolute":"fixed",background:this.options.color,left:0,top:0,opacity:0,"z-index":this.options.zIndex},events:{click:function(){this.fireEvent("click")}.bind(this)}}).inject(this.container);this.tween=new Fx.Tween(this.overlay,{duration:this.options.duration,link:"cancel",property:"opacity",onStart:function(){this.overlay.setStyles({width:"100%",height:this.container.getScrollSize().y})}.bind(this),onComplete:function(){this.fireEvent(this.overlay.get("opacity")==this.options.opacity?"show":"hide")}.bind(this)});window.addEvents({resize:function(){if(!Browser.ie6){this.resize()}}.bind(this),scroll:function(){if(!Browser.ie6){this.scroll()}}.bind(this)})},open:function(){this.fireEvent("open");this.tween.start(this.options.opacity);return this},close:function(){this.fireEvent("close");this.tween.start(0);return this},resize:function(){this.fireEvent("resize");
this.overlay.setStyle("height",this.container.getScrollSize().y);return this},scroll:function(){this.fireEvent("scroll");if(this.ie6){this.overlay.setStyle("left",window.getScroll().x)}return this}});var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:"inherit",maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:"autocompleter-choices",zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:", ",separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(b,a){this.element=$(b);this.setOptions(a);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),Object.merge({delay:this.options.delay},this.options.observerOptions));this.queryValue=null;
if(this.options.filter){this.filter=this.options.filter.bind(this)}var c=this.options.selectMode;this.typeAhead=(c=="type-ahead");this.selectMode=(c===true)?"selection":c;this.cached=[]},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices}else{this.choices=new Element("ul",{"class":this.options.className,styles:{zIndex:this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,"after");this.relative=this.element.getOffsetParent()}this.fix=new OverlayFix(this.choices)}if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator}this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,Object.merge({property:"opacity",link:"cancel",duration:200},this.options.fxOptions)).addEvent("onStart",Chain.prototype.clearChain).set(0);this.element.setProperty("autocomplete","off").addEvent((Browser.ie||Browser.chrome||Browser.safari)?"keydown":"keypress",this.onCommand.bind(this)).addEvent("click",this.onCommand.bind(this,false)).addEvent("focus",(function(){this.toggleFocus.delay(100,this,true)
}).bind(this)).addEvent("blur",(function(){this.toggleFocus.delay(100,this,false)}).bind(this))},destroy:function(){if(this.fix){this.fix.destroy()}this.choices=this.selected=this.choices.destroy()},toggleFocus:function(a){this.focussed=a;if(!a){this.hideChoices(true)}this.fireEvent((a)?"onFocus":"onBlur",[this.element])},onCommand:function(b){if(!b&&this.focussed){return this.prefetch()}if(b&&b.key&&!b.shift){switch(b.key){case"enter":if(this.element.value!=this.opted){return true}if(this.selected&&this.visible){this.choiceSelect(this.selected);return !!(this.options.autoSubmit)}break;case"up":case"down":if(!this.prefetch()&&this.queryValue!==null){var a=(b.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((a)?"getPrevious":"getNext"):((a)?"getLast":"getFirst")](this.options.choicesMatch),true)}return false;case"esc":case"tab":this.hideChoices(true);break}}return true},setSelection:function(f){var g=this.selected.inputValue,h=g;var a=this.queryValue.length,c=g.length;
if(g.substr(0,a).toLowerCase()!=this.queryValue.toLowerCase()){a=0}if(this.options.multiple){var e=this.options.separatorSplit;h=this.element.value;a+=this.queryIndex;c+=this.queryIndex;var b=h.substr(this.queryIndex).split(e,1)[0];h=h.substr(0,this.queryIndex)+g+h.substr(this.queryIndex+b.length);if(f){var d=h.split(this.options.separatorSplit).filter(function(k){return this.test(k)},/[^\s,]+/);if(!this.options.allowDupes){d=[].combine(d)}var j=this.options.separator;h=d.join(j)+j;c=h.length}}this.observer.setValue(h);this.opted=h;if(f||this.selectMode=="pick"){a=c}this.element.selectRange(a,c);this.fireEvent("onSelection",[this.element,this.selected,h,g])},showChoices:function(){var c=this.options.choicesMatch,b=this.choices.getFirst(c);this.selected=this.selectedValue=null;if(this.fix){var e=this.element.getCoordinates(this.relative),a=this.options.width||"auto";this.choices.setStyles({left:e.left,top:e.bottom,width:(a===true||a=="inherit")?e.width:a})}if(!b){return}if(!this.visible){this.visible=true;
this.choices.setStyle("display","");if(this.fx){this.fx.start(1)}this.fireEvent("onShow",[this.element,this.choices])}if(this.options.selectFirst||this.typeAhead||b.inputValue==this.queryValue){this.choiceOver(b,this.typeAhead)}var d=this.choices.getChildren(c),f=this.options.maxChoices;var j={overflowY:"hidden",height:""};this.overflown=false;if(d.length>f){var k=d[f-1];j.overflowY="scroll";j.height=k.getCoordinates(this.choices).bottom;this.overflown=true}this.choices.setStyles(j);this.fix.show();if(this.options.visibleChoices){var h=document.getScroll(),l=document.getSize(),g=this.choices.getCoordinates();if(g.right>h.x+l.x){h.x=g.right-l.x}if(g.bottom>h.y+l.y){h.y=g.bottom-l.y}window.scrollTo(Math.min(h.x,g.left),Math.min(h.y,g.top))}},hideChoices:function(a){if(a){var c=this.element.value;if(this.options.forceSelect){c=this.opted}if(this.options.autoTrim){c=c.split(this.options.separatorSplit).filter(function(d){return d}).join(this.options.separator)}this.observer.setValue(c)}if(!this.visible){return
}this.visible=false;if(this.selected){this.selected.removeClass("autocompleter-selected")}this.observer.clear();var b=function(){this.choices.setStyle("display","none");this.fix.hide()}.bind(this);if(this.fx){this.fx.start(0).chain(b)}else{b()}this.fireEvent("onHide",[this.element,this.choices])},prefetch:function(){var f=this.element.value,e=f;if(this.options.multiple){var c=this.options.separatorSplit;var a=f.split(c);var b=this.element.getSelectedRange().start;var g=f.substr(0,b).split(c);var d=g.length-1;b-=g[d].length;e=a[d]}if(e.length<this.options.minLength){this.hideChoices()}else{if(e===this.queryValue||(this.visible&&e==this.selectedValue)){if(this.visible){return false}this.showChoices()}else{this.queryValue=e;this.queryIndex=b;if(!this.fetchCached()){this.query()}}}return true},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue){return false}this.update(this.filter(this.cached));
return true},update:function(b){this.choices.empty();this.cached=b;var a=b&&typeOf(b);if(a=="null"||(a=="array"&&!b.length)||(a=="hash"&&!b.getLength())){(this.options.emptyChoices||this.hideChoices).call(this)}else{if(this.options.maxChoices<b.length&&!this.options.overflow){b.length=this.options.maxChoices}b.each(this.options.injectChoice||function(d){var c=new Element("li",{html:this.markQueryValue(d)});c.inputValue=d;this.addChoiceEvents(c).inject(this.choices)},this);this.showChoices()}},choiceOver:function(c,d){if(!c||c==this.selected){return}if(this.selected){this.selected.removeClass("autocompleter-selected")}this.selected=c.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,d]);if(!this.selectMode){this.opted=this.element.value}if(!d){return}this.selectedValue=this.selected.inputValue;if(this.overflown){var f=this.selected.getCoordinates(this.choices),e=this.options.overflowMargin,g=this.choices.scrollTop,a=this.choices.offsetHeight,b=g+a;if(f.top-e<g&&g){this.choices.scrollTop=Math.max(f.top-e,0)
}else{if(f.bottom+e>b){this.choices.scrollTop=Math.min(f.bottom-a+e,b)}}}if(this.selectMode){this.setSelection()}},choiceSelect:function(a){if(a){this.choiceOver(a)}this.setSelection(true);this.queryValue=false;this.hideChoices()},filter:function(a){return(a||this.tokens).filter(function(b){return this.test(b)},new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i"))},markQueryValue:function(a){return(!this.options.markQuery||!this.queryValue)?a:a.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",(this.options.filterCase)?"":"i"),'<span class="autocompleter-queried">$1</span>')},addChoiceEvents:function(a){return a.addEvents({mouseover:this.choiceOver.bind(this,a),click:this.choiceSelect.bind(this,a)})}});var OverlayFix=new Class({initialize:function(a){if(Browser.ie){this.element=$(a);this.relative=this.element.getOffsetParent();this.fix=new Element("iframe",{frameborder:"0",scrolling:"no",src:"javascript:false;",styles:{position:"absolute",border:"none",display:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}}).inject(this.element,"after")
}},show:function(){if(this.fix){var a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles(Object.append(a,{display:"",zIndex:(this.element.getStyle("zIndex")||1)-1}))}return this},hide:function(){if(this.fix){this.fix.setStyle("display","none")}return this},destroy:function(){if(this.fix){this.fix=this.fix.destroy()}}});Element.implement({getSelectedRange:function(){if(!Browser.ie){return{start:this.selectionStart,end:this.selectionEnd}}var e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length}else{var b=this.value;var d=b.length-b.match(/[\n\r]*$/)[0].length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length}return e},selectRange:function(d,a){if(Browser.ie){var c=this.value.substr(d,a-d).replace(/\r/g,"").length;
d=this.value.substr(0,d).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);b.moveEnd("character",d+c);b.moveStart("character",d);b.select()}else{this.focus();this.setSelectionRange(d,a)}return this}});Autocompleter.Base=Autocompleter;Autocompleter.Local=new Class({Extends:Autocompleter,options:{minLength:0,delay:200},initialize:function(b,c,a){this.parent(b,a);this.tokens=c},query:function(){this.update(this.filter())}});Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:"value"},query:function(){var c=Object.clone(this.options.postData)||{};c[this.options.postVar]=this.queryValue;var b=$(this.options.indicator);if(b){b.setStyle("display","")}var a=this.options.indicatorClass;if(a){this.element.addClass(a)}this.fireEvent("onRequest",[this.element,this.request,c,this.queryValue]);this.request.send({data:c})},queryResponse:function(){var b=$(this.options.indicator);if(b){b.setStyle("display","none")}var a=this.options.indicatorClass;
if(a){this.element.removeClass(a)}return this.fireEvent("onComplete",[this.element,this.request])}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.JSON(Object.merge({url:b,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(a){this.parent();this.update(a)}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.HTML(Object.merge({url:b,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(a,b){this.parent();if(!b||!b.length){this.hideChoices()}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(c){var d=c.innerHTML;c.inputValue=d;this.addChoiceEvents(c.set("html",this.markQueryValue(d)))},this);this.showChoices()}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};
window.$w=function(a){return Array.from(String(a).split(" "))};Function.implement({curry:function(){if(!arguments.length){return this}var a=this;var b=Array.prototype.slice.call(Array.from(arguments),0);return function(){return a.apply(this,b.concat(Array.from(arguments)))}},wrap:function(b){var a=this;return function(){return b.apply(this,[a.bind(this)].concat(Array.from(arguments)))}}});Object.append(Object,{toHTML:function(a){return a&&a.toHTML?a.toHTML():(a==null?"":String(a))}});Array.implement({find:function(d,c){var a;var b=d;if(c){b=b.bind(c)}this.some(function(f,e,g){if(b(f,e,g)){a=f;return true}return false});return a},inject:function(b,a){this.each(function(d,c,e){b=a(b,d,c,e)});return b},invoke:function(a){this.each(function(b){if(b&&b[a]){b[a]()}});return this}});(function(){var a=Element.prototype;if(Browser.ie&&Browser.version<9){a=Element.Prototype}Element.addClass=Element.addClass.wrap(function(d,c,b){if(typeOf(b)!="array"){b=$w(b)}if(typeOf(b)=="array"){b.each(function(e){d(e)
})}else{d(b)}return c});a.addClass=a.addClass.wrap(function(c,b){if(typeOf(b)!="array"){b=$w(b)}if(typeOf(b)=="array"){b.each(function(d){c(d)})}else{c(b)}return this});Element.removeClass=Element.removeClass.wrap(function(d,c,b){if(typeOf(b)!="array"){b=$w(b)}if(typeOf(b)=="array"){b.each(function(e){d(e)})}else{d(b)}return c});a.removeClass=a.removeClass.wrap(function(c,b){if(typeOf(b)!="array"){b=$w(b)}if(typeOf(b)=="array"){b.each(function(d){c(d)})}else{c(b)}return this})})();Element.implement({disableSelection:function(){return this.setStyles({MozUserSelect:"none",KhtmlUserSelect:"none"}).setProperty("unselectable","on")},down:function(a){return this.getElement(a)},getSelectionEnd:function(){if(this.createTextRange){var a=document.selection.createRange().duplicate();a.moveStart("character",-this.value.length);return a.text.length}return this.selectionEnd},getSelectionStart:function(){if(this.createTextRange){var a=document.selection.createRange().duplicate();a.moveEnd("character",this.value.length);
if(a.text==""){return this.value.length}return this.value.lastIndexOf(a.text)}return this.selectionStart},insert:function(b){var d=$(this);var c={before:function(k,l){k.parentNode.insertBefore(l,k)},top:function(k,l){k.insertBefore(l,k.firstChild)},bottom:function(k,l){k.appendChild(l)},after:function(k,l){k.parentNode.insertBefore(l,k.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]}};var g=function(m,l){var n=new Element("div"),k=c.tags[m];if(k){n.innerHTML=k[0]+l+k[1];k[2].times(function(){n=n.firstChild})}else{n.innerHTML=l}return Array.from(n.childNodes)};if(typeof b=="string"||typeof b=="number"||(b.nodeName&&b.nodeType==1)||(b&&(b.toElement||b.toHTML))){b={bottom:b}}var f,j,a,h;for(var e in b){f=b[e];e=e.toLowerCase();j=c[e];if(f&&f.toElement){f=f.toElement()}if(f.nodeName&&f.nodeType==1){j(d,f);
continue}f=Object.toHTML(f);a=((e=="before"||e=="after")?d.parentNode:d).tagName.toUpperCase();h=g(a,f);if(e=="top"||e=="after"){h.reverse()}h.each(function(k){j(d,k)})}return d},next:function(a){return this.getNext(a)},prev:function(a){return this.getPrevious(a)},select:function(b){var c=this;var a=[];Array.from(arguments).each(function(d){var e=c.getElements(d);if(typeOf(e)=="elements"){a=a.concat(Array.from(e))}});return a},setSize:function(b,a){if(b&&b.$family&&b.$family.name=="array"){a=b[1];b=b[0]}else{if(typeof b=="object"){if(typeof b.x=="number"){a=b.y;b=b.x}else{a=b.height;b=b.width}}}return this.setStyles({width:b,height:a})},serializeForm:function(a){return Form.serialize(this,a)},up:function(a){return this.getParent(a)}});var Form=(function(){function h(m){switch(m.type.toLowerCase()){case"checkbox":case"radio":return g(m);default:return e(m)}}function g(m){return m.checked?m.value:null}function e(m){return m.value}function j(m){return(m.type==="select-one"?k:b)(m)}function k(n){var m=n.selectedIndex;
return m>=0?f(n.options[m]):null}function b(q){var m,r=q.length;if(!r){return null}for(var o=0,m=[];o<r;o++){var n=q.options[o];if(n.selected){m.push(f(n))}}return m}function a(m,n){return !!m.getAttribute(n)}function f(m){return a(m,"value")?m.value:m.text}var l={input:h,inputSelector:g,textarea:e,select:j,selectOne:k,selectMany:b,optionValue:f,button:e};function c(m){m=$(m);var n=m.tagName.toLowerCase();return l[n](m)}function d(q){var r=$(q).getElementsByTagName("*"),o,m=[];for(var n=0;o=r[n];n++){m.push(o)}return m.inject([],function(s,t){if(l[t.tagName.toLowerCase()]){s.push($(t))}return s})}return{serialize:function(n,v){var m=d(n);if(typeof v!="object"){v={}}var u,t,s=false,r=v.submit,o,q;q={};o=function(w,x,y){if(x in w){if(typeOf(w[x])=="array"){w[x]=[w[x]]}w[x].push(y)}else{w[x]=y}return w};return m.inject(q,function(w,x){if(!x.disabled&&x.name){u=x.name;t=c(x);if(t!=null&&x.type!="file"&&(x.type!="submit"||(!s&&r!==false&&(!r||u==r)&&(s=true)))){w=o(w,u,t)}}return w})}}})();Hash.implement({find:function(d,c){var a;
var b=d;if(c){b=b.bind(c)}this.some(function(f,e,g){if(b(f,e,g)){a=f;return true}return false});return a},inject:function(b,a){this.each(function(d,c,e){b=a(b,d,c,e)});return b},invoke:function(a){this.each(function(b){if(b[a]){b[a]()}});return this},ksort:function(c){var b=this;var a=$H({});this.getKeys().sort(c).each(function(d){a[d]=b[d]});return a},merge:function(a){return $H(Object.merge({},this.toObject(),a||{}))},sort:function(a){return this.toArray().sort(a)},toArray:function(){var a=[];this.each(function(b){a.push(b)});return a},toObject:function(){var a={};this.each(function(c,b){a[b]=c});return a}});Number.implement({isNaN:function(){return isNaN(this)},sgn:function(){if(this<0){return -1}else{if(this>0){return 1}}return 0}});String.implement({fromQueryString:function(b){var c=this;var a={};if(c.indexOf("?")!=-1){c=c.substr(c.indexOf("?")+1)}a=$H(Array.from(c.split("&")).inject({},function(d,e){e=e.split("=");if(e.length==2){d[e[0]]=e[1]}return d}));if(a&&a.toObject&&b){a=a.toObject()
}return a},leftPad:function(b,c){var a=new String(this);if(!c){c=" "}while(a.length<b){a=c+a}return a.toString()},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},substituteWithoutReplacingUndefinedKeys:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1)}return(a[c]!=undefined)?a[c]:"{"+c+"}"})},unescapeHtml:function(){var b=new Element("div");b.innerHTML=this.stripTags();if(!b.childNodes[0]){return""}if(b.childNodes.length>1){var a="";Array.from(b.childNodes).each(function(c){return a+c.nodeValue});return a}else{return b.childNodes[0].nodeValue}}});Element.NativeEvents=Object.append(Element.NativeEvents,{touchstart:2,touchend:2,touchmove:2,touchcancel:2,gesturechange:2,gestureend:2});if(Browser.ie){Element.implement({insertAtCursor:function(b,a){var d=this.getSelectedRange();if(d.start==0&&d.end==0){this.focus();sel=document.selection.createRange();sel.text=b;this.focus();return this}var c=this.get("value");this.set("value",c.substring(0,d.start)+b+c.substring(d.end,c.length));
if(Array.pick(a,true)){this.selectRange(d.start,d.start+b.length)}else{this.setCaretPosition(d.start+b.length)}return this},insertAroundCursor:function(b,a){b=Object.append({before:"",defaultMiddle:"",after:""},b);var c=this.getSelectedText()||b.defaultMiddle;var g=this.getSelectedRange();if(g.start==0&&g.end==0){this.focus();sel=document.selection.createRange();sel.text=b.before+b.after;this.focus();return this}var f=this.get("value");if(g.start==g.end){this.set("value",f.substring(0,g.start)+b.before+c+b.after+f.substring(g.end,f.length));this.selectRange(g.start+b.before.length,g.end+b.before.length+c.length)}else{var d=f.substring(g.start,g.end);this.set("value",f.substring(0,g.start)+b.before+d+b.after+f.substring(g.end,f.length));var e=g.start+b.before.length;if(Array.pick(a,true)){this.selectRange(e,e+d.length)}else{this.setCaretPosition(e+f.length)}}return this}})}(function(){var e="1.2.4";var r=false;var k=[];var v=function(A){var B=A.split(".");return parseInt(B[0])*100000+parseInt(B[1])*1000+parseInt(B[2])
};if(typeof MooTools=="undefined"||v(MooTools.version)<v(e)){throw ("jScroll requires the MooTools JavaScript framework >= "+e);return}var n=/jScroll\.js(\?.*)?$/;var c=null;var t=$$("head script[src]").find(function(A){if(c==null){c=A}return A.src.match(n)});if(t){t=t.src.replace(n,"")}else{t=c.src.replace(n,"")}var a=function(A){if(!r){window.addEvent("domready",function(){r=true;A()})}else{A.bind(window)()}};var w=function(A){if(A<0){A=0}else{if(A>100){A=100}}return A};var f=function(C){if($(document.body).getStyle("direction").toLowerCase()=="rtl"){C=C.replace(/left/g,"#left#");C=C.replace(/ltr/g,"#ltr#");C=C.replace(/right/g,"left");C=C.replace(/rtl/g,"ltr");C=C.replace(/#left#/g,"right");C=C.replace(/#ltr#/g,"rtl")}var A=function(){var D=/^[\s\n\r]+|[\s\n\r]+$/g;return function(E){return E.replace(D,"")}}();var B=function(D,H){if(D.indexOf(",")!=-1){D.split(",").each(function(I){B(A(I),H)});return}var G=$("jScroll.css");if(!G){var G=document.createElement("style");G.setAttribute("type","text/css");
G.setAttribute("media","screen");G.setAttribute("id","jScroll.css");Element.insert(document.getElementsByTagName("head")[0],{top:G})}if(typeof H!="string"){var E="";Object.each(H,function(J,I){E+I.hyphenate()+":"+J,I});H=E}if(!Browser.ie||(Browser.ie&&Browser.version>=9)){G.appendChild(document.createTextNode(D+" {"+H+"}\n"))}if(Browser.ie&&Browser.version<9&&document.styleSheets&&document.styleSheets.length>0){var F=document.styleSheets[0];if(typeof(F.addRule)=="object"){F.addRule(D,H)}}};C.replace(/[\n\r]/gi,"").split("}").each(function(D){D=D.split("{");if(D.length<2||A(D[0])==0||A(D[1])==0){return}B(A(D[0]),A(D[1]))})};var d=function(A){A.container=$(A.container);if(!A.container||!A.container.nodeName||A.container.nodeType!=1){throw ("Missing scroll container for jScroll!")}if(A.container.tagName!="DIV"){throw ("invalid scroll container for jScroll! Can only be a div")}A.container._jScroll=A;b(A.container);if(y(A,"onRenderBefore")===false){return}if(A.rendered){return}A.rendered=true;
A.container.setStyles({overflow:"hidden"});var C=A.container.getChildren();C.each(function(D){D.dispose()});A.container.innerHTML="";Element.insert(A.container,{bottom:'<div class="jScroll"><div class="jScroll-content"></div><div class="jScroll-scroll '+A.options.clsScroll+'"><div class="jScroll-scroll-up"><div class="'+A.options.clsUp+'"></div></div><div class="jScroll-scroll-between '+A.options.clsBetween+'"></div><div class="jScroll-scroll-slider '+A.options.clsSlider+'"><div class="'+A.options.clsSlider+' top"></div><div class="'+A.options.clsSlider+' center"></div><div class="'+A.options.clsSlider+' bottom"></div></div><div class="jScroll-scroll-between '+A.options.clsBetween+'"></div><div class="jScroll-scroll-down"><div class="'+A.options.clsDown+'"></div></div></div></div>'});A.element=A.container.down(".jScroll");A.elementContent=A.container.down(".jScroll-content");A.elementScroll=A.container.down(".jScroll-scroll");A.elementUp=A.container.down(".jScroll-scroll-up");A.elementUpBetween=A.container.down(".jScroll-scroll-between",0);
A.elementSlider=A.container.down(".jScroll-scroll-slider");A.elementSliderTop=A.elementSlider.down(".top");A.elementSliderCenter=A.elementSlider.down(".center");A.elementSliderBottom=A.elementSlider.down(".bottom");A.elementDownBetween=A.container.down(".jScroll-scroll-between",1);A.elementDown=A.container.down(".jScroll-scroll-down");C.each(function(D){Element.insert(A.elementContent,{bottom:D})});var B=0;A.elementScroll.addEvent("mousedown",function(D){A._sliderScroll=true;D.stop();l(function(){if(x(A.elementSlider)<=B&&B<=x(A.elementSlider)+A.elementSlider.getSize().y){return}var E=B-x(A.elementSlider);if(E<0){A.elementUpBetween.addClass(A.options.clsBetweenClicked);A.elementDownBetween.removeClass(A.options.clsBetweenClicked)}else{A.elementUpBetween.removeClass(A.options.clsBetweenClicked);A.elementDownBetween.addClass(A.options.clsBetweenClicked)}A.scroll((E<0?-1:1)*A.stepLarge)},A)});A.elementUp.addEvent("mousedown",function(D){A._sliderScroll=true;D.stop();l(A.up.pass([A.stepSmall,A],A),A)
});A.elementDown.addEvent("mousedown",function(D){A._sliderScroll=true;D.stop();l(A.down.pass([A.stepSmall],A),A)});A.elementSlider.addEvent("mousedown",function(D){D.stop();A._sliderMove=true;A._sliderY=D.page.y-parseFloat(A.elementSlider.getStyle("top"))+A.elementUp.getSize().y});document.addEvent("mousemove",function(E){B=E.page.y;if(!A._sliderMove){return}E.stop();var D=(E.page.y-A._sliderY)*100/A.sliderHeight;if(y(A,"onScrollSlideBefore",D)===false){return}A.update(D);y(A,"onScrollSlideAfter")});document.addEvent("mouseup",function(D){if(A._sliderMove||A._sliderScroll){D.stop();A._sliderMove=false;A._sliderScroll=false;z(A);A.elementUpBetween.removeClass(A.options.clsBetweenClicked);A.elementDownBetween.removeClass(A.options.clsBetweenClicked);A.elementDownBetween.removeClass(A.options.clsBetweenClicked)}});A.element.addEvent("mousewheel",function(D){D.stop();A.scroll(-D.wheel*(D.alt?A.stepSmall:A.stepLarge))});A.refresh();y(A,"onRenderAfter")};var y=function(B,A,D){if(typeof B.options[A]!="function"){return true
}if(typeof D!="undefined"){D=w(D);if(B.current==D){return false}var F=B.options[A].pass([B,B.current,D])}else{var F=B.options[A].pass([B])}try{return F()}catch(C){if(Browser.firefox){var E=C.name+" in "+C.fileName+" #"+C.lineNumber+" : "+C.message}else{if(Browser.ie){var E=C.name+" "+C.number+" : "+C.message}else{if(Browser.chrome||Browser.safari){var E=C.name+" in "+C.sourceURL+" #"+C.line+" : "+C.message}else{var E=JSON.encode(C)}}}Travian.$d(E+" -> function: "+String(B.options[A]));return}};var l=function(B,A){z(A);B.bind(A)();A._pe=B.periodical(50,A)};var z=function(A){if(A._pe){clearInterval(A._pe)}};var b=function(A){k.push(A);return k};window.jScroll=new Class({current:0,container:null,element:null,elementContent:null,elementDown:null,elementScroll:null,elementSlider:null,elementUp:null,enabled:false,options:null,rendered:false,stepLarge:10,stepSmall:1,applyContent:function(A){this.elementContent.innerHTML="";Element.insert(this.elementContent,A);this.refresh();this.update();return this
},down:function(A){if(typeof A=="undefined"){A=this.options.scrollSmall}if(y(this,"onScrollDownBefore",this.current+A)===false){return this}this.scroll(A);y(this,"onScrollDownAfter");return this},initialize:function(A){if(typeof A.container=="undefined"){throw ("Missing container in options for jScroll!")}this.container=A.container;this.options=A;this.options.clsBetween=this.options.clsBetween||"jScroll-element-between";this.options.clsBetweenClicked=this.options.clsBetweenClicked||"clicked";this.options.clsDown=this.options.clsDown||"jScroll-element-down";this.options.clsScroll=this.options.clsScroll||"jScroll-element-scroll";this.options.clsSlider=this.options.clsSlider||"jScroll-element-slider";this.options.clsUp=this.options.clsUp||"jScroll-element-up";this.options.lines=this.options.lines||10;this.options.alignRight=typeof this.options.alignRight!="undefined"?this.options.alignRight:"auto";if(!r){a(d.pass([this]))}else{d(this)}},insertContent:function(A){Element.insert(this.elementContent,A);
this.refresh();this.update();return this},refresh:function(){var F=true;var D=null;var C=null;if(!this.rendered){return this}if(this.container.isDisplayed()===false){F=false;this.container.setStyles({display:"block"})}D=this.elementContent.getSize().y;C=parseInt(this.container.getStyle("max-height"));if(C>0){this.container.setStyles({height:D<=C?D:C})}this.elementContent.setStyles({height:"auto"});D=this.elementContent.getSize().y;if(D<=this.element.getSize().y){this.enabled=false;this.container.setStyles({overflow:""});this.elementScroll.hide();this.elementContent.setStyles({marginTop:0,right:""});if(F===false){this.container.setStyles({display:""})}return this}this.enabled=true;this.elementScroll.show();this.container.setStyles({overflow:"hidden"});if($(document.body).getStyle("direction").toLowerCase()=="ltr"){this.elementContent.setStyles({marginTop:0,right:this.options.alignRight=="auto"?this.elementScroll.getSize().x+"px":this.options.alignRight})}else{this.elementContent.setStyles({marginTop:0,left:this.options.alignRight=="auto"?this.elementScroll.getSize().x+"px":this.options.alignRight})
}this.sliderTop=this.elementUp.getSize().y-o(this.elementUp,"tb");this.sliderHeight=this.elementScroll.getSize().y-this.elementUp.getSize().y-o(this.elementUp,"tb")-this.elementDown.getSize().y-o(this.elementDown,"tb");var B=this.element.getSize().y;var E=this.elementContent.getSize().y;this.contentHeight=E-B;this.stepSmall=B*100/(this.options.lines*E);this.stepLarge=this.stepSmall*this.options.lines;var A=(this.sliderHeight*B/E);if(A<this.elementSliderTop.getSize().y+this.elementSliderBottom.getSize().y){A=this.elementSliderTop.getSize().y+this.elementSliderBottom.getSize().y}this.elementSlider.setStyles({height:A,top:this.sliderTop});this.elementSliderCenter.setStyles({height:(A-this.elementSliderTop.getSize().y-this.elementSliderBottom.getSize().y)});this.elementContent.setStyles({height:"100%"});this.elementUpBetween.setStyles({top:this.sliderTop,height:0});this.elementDownBetween.setStyles({top:(this.sliderTop+this.sliderHeight*this.current/100+this.elementSlider.getSize().y),bottom:this.elementDown.getSize().y});
this.sliderHeight-=A;if(F===false){this.container.setStyles({display:""})}return this},scroll:function(A){if(typeof A=="undefined"||A==0||(A<0&&this.current<=0)||(A>0&&this.current>=100)){return this}if(y(this,"onScrollBefore",this.current+A)===false){return this}this.current+=A;this.update();y(this,"onScrollAfter");return this},scrollTo:function(J){var H=this;var D=null;var A=false;var E="view";var G=0;if(typeOf(J)=="element"){D=J}else{D=J.element;A=J.animate;E=J.position}D=$(D);if(!D||!D.getParents().find(function(K){return K==H.elementContent})){return this}var C=x(this.elementContent);var I=this.elementContent.getSize().y;var B=x(D);var F=D.getSize().y;switch(E){case"top":G=(B-C)*100/this.contentHeight;break;case"view":default:G=(B-C-this.sliderHeight/2)*100/this.contentHeight;break}if(y(this,"onScrollBefore",G)===false){return this}this.update(G,A);y(this,"onScrollAfter");return this},up:function(A){if(typeof A=="undefined"){A=this.options.scrollSmall}if(y(this,"onScrollUpBefore",this.current-A)===false){return this
}this.scroll(-1*A);y(this,"onScrollUpAfter");return this},update:function(B,A){A=typeof A=="undefined"?false:A;if(!this.rendered||!this.enabled){return this}if(typeof B!="undefined"){this.current=B}this.current=w(this.current);y(this,"onUpdateBefore");this.elementSlider.setStyles({top:(this.sliderTop+this.sliderHeight*this.current/100)});if(A){new Fx.Morph(this.elementContent).start({marginTop:(-1*this.contentHeight*this.current/100)})}else{this.elementContent.setStyles({marginTop:(-1*this.contentHeight*this.current/100)})}this.elementUpBetween.setStyles({height:(this.sliderTop+this.sliderHeight*this.current/100-this.elementUp.getSize().y)});this.elementDownBetween.setStyles({top:(this.sliderTop+this.sliderHeight*this.current/100+this.elementSlider.getSize().y)});y(this,"onUpdateAfter");return this}});jScroll.$=function(B){var A=$(B);if(!A&&typeof B=="string"){A=k.find(function(C){return C.id==B})}else{if(A&&typeof A._jScroll!="undefined"){A=A._jScroll}else{if(A&&typeof A._jScroll=="undefined"){A=null
}}}return(A?A:null)};var j=document.compatMode=="CSS1Compat";var q=function(E,G,F){var H=0,C,B;E=$(E);for(var D=0,A=G.length;D<A;D++){C=E.getStyle(F[G.charAt(D)]);if(C){B=parseInt(C,10);if(B){H+=(B>=0?B:-1*B)}}}return H};var g=function(B,A){B=$(B);return q(B,A,{l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"})};var s=function(B){var C=null;B=$(B);var A=0;B.getChildren().each(function(E,D){if(E.nodeType!=1){if(D==0){C=E}return}E=$(E);if(C){A+=E.offsetTop-B.offsetTop;C=null}return A+E.getSize().y+h(E,"tb")});return A};var o=function(B,C,A){B=$(B);return A&&Browser.ie&&!j?0:(u(B,C)+g(B,C))};var h=function(B,A){B=$(B);if(!A){return{top:parseInt(B.getStyle("margin-top"),10)||0,left:parseInt(B.getStyle("margin-left"),10)||0,bottom:parseInt(B.getStyle("margin-bottom"),10)||0,right:parseInt(B.getStyle("margin-right"),10)||0}}else{return q(B,A,{l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"})}};var u=function(B,A){B=$(B);return q(B,A,{l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"})
};var m=function(C){C=$(C);var E=C,D=document;if(E==D||E==D.body){var A,B;if(Browser.ie&&j){A=D.documentElement.scrollLeft||(D.body.scrollLeft||0);B=D.documentElement.scrollTop||(D.body.scrollTop||0)}else{A=window.pageXOffset||(D.body.scrollLeft||0);B=window.pageYOffset||(D.body.scrollTop||0)}return{left:A,top:B}}else{return{left:E.scrollLeft,top:E.scrollTop}}};var x=function(A){A=$(A);var V,R,G,D,S=(document.body||document.documentElement);if(A==S){return 0}if(A.getBoundingClientRect){G=A.getBoundingClientRect();D=m($(document.body));return G.top+D.top}var C=0,Q=0;V=A;var W=A.getStyle("position")=="absolute";while(V){$(V);C+=V.offsetLeft;Q+=V.offsetTop;if(!W&&V.getStyle("position")=="absolute"){W=true}if(Browser.firefox){R=V;var B=parseInt(R.getStyle("borderTopWidth"),10)||0;var U=parseInt(R.getStyle("borderLeftWidth"),10)||0;C+=U;Q+=B;if(V!=A&&R.getStyle("overflow")!="visible"){C+=U;Q+=B}}V=V.offsetParent}if((Browser.chrome||Browser.safari)&&W){C-=S.offsetLeft;Q-=S.offsetTop}if(Browser.firefox&&!W){var T=$(S);
C+=parseInt(T.getStyle("borderLeftWidth"),10)||0;Q+=parseInt(T.getStyle("borderTopWidth"),10)||0}V=A.parentNode;while(V&&V!=S){if(!Prototype.Browser.Opera||(V.tagName!="TR"&&$(V).getStyle("display")!="inline")){C-=V.scrollLeft;Q-=V.scrollTop}V=V.parentNode}return Q};a(function(){});window.addEvent("domready",function(){f(".jScroll {overflow: hidden; width: 100%; height: 100%;position:relative;}.jScroll .jScroll-content {position: absolute; top: 0px; left: 0px;}.jScroll .jScroll-scroll {cursor:pointer; position: absolute; height: 100%; right: 0px; top: 0px;}.jScroll .jScroll-scroll-up, .jScroll .jScroll-scroll-slider, .jScroll .jScroll-scroll-down, .jScroll .jScroll-scroll-between {position: absolute; width: 100%;}.jScroll .jScroll-scroll-slider {top: 10px; height: 50px;}.jScroll .jScroll-scroll-slider .top, .jScroll .jScroll-scroll-slider .center, .jScroll .jScroll-scroll-slider .bottom {width: 100%;}.jScroll .jScroll-scroll-between {}.jScroll .jScroll-scroll-down {bottom: 0px;}.jScroll .jScroll-element-scroll {width: 15px;}.jScroll .jScroll-element-down {background: transparent url("+t+"images/down.gif) no-repeat center bottom; height: 6px;}.jScroll .jScroll-element-down:hover {background-image: url("+t+"images/down-hover.gif);}.jScroll .jScroll-element-up {background: transparent url("+t+"images/up.gif) no-repeat center top; height: 6px;}.jScroll .jScroll-element-up:hover {background-image: url("+t+"images/up-hover.gif);}.jScroll .jScroll-element-between {margin-left: 4px; width: 7px; opacity: 0; background-color: #000000; filter: alpha(opacity=0);}.jScroll .jScroll-element-between:hover {opacity: 0.25; filter: alpha(opacity=25);}.jScroll .jScroll-element-between.clicked {opacity: 0.5; filter: alpha(opacity=50);}.jScroll .jScroll-element-slider .top {background: transparent url("+t+"images/slider-top.gif) no-repeat center top; height: 1px;}.jScroll .jScroll-element-slider:hover .top {background-image: url("+t+"images/slider-top-hover.gif);}.jScroll .jScroll-element-slider .center {background: transparent url("+t+"images/slider-center.gif) repeat-y center top;}.jScroll .jScroll-element-slider:hover .center {background-image: url("+t+"images/slider-center-hover.gif);}.jScroll .jScroll-element-slider .bottom {background: transparent url("+t+"images/slider-bottom.gif) no-repeat center bottom; height: 1px;}.jScroll .jScroll-element-slider:hover .bottom {background-image: url("+t+"images/slider-bottom-hover.gif);}")
})})();window.Travian={applicationId:"travian",emptyFunction:function(){},$d:function(b){if(window.console&&window.console.info){if(Browser.ie){console.info(JSON.encode(b))}else{console.info(b)}}else{if(!$("travian_console")){var a=new Element("div",{id:"travian_console",styles:{position:"absolute",left:0,height:150,width:"100%",bottom:0,zIndex:10000,overflow:"auto",overflowX:"hidden",overflowY:"auto",borderTop:"1px solid #A06060",backgroundColor:"#FFD0D0",fontSize:"10px",fontFamily:"tahoma,arial,helvetica,sans-serif"}});(new Element("div",{html:"Console",styles:{fontWeight:"bold",padding:1,marginBottom:2,borderBottom:"1px solid #858484"}})).inject(a,"bottom");a.inject(document.body,"bottom")}(new Element("span",{html:JSON.encode(b)+"<br />"})).inject($("travian_console"),"bottom")}},ajax:function(a){a=a||{};var b={onRequest:a.onRequest||Travian.emptyFunction,onComplete:a.onComplete||Travian.emptyFunction,onCancel:a.onCancel||Travian.emptyFunction,onSuccess:a.onSuccess||Travian.emptyFunction,onFailure:a.onFailure||Travian.emptyFunction,onException:a.onException||Travian.emptyFunction};
if(!a.url){a.url="ajax.php"}if(a.data&&a.data.cmd){a.url=a.url+(a.url.indexOf("?")==-1?"?":"&")+"cmd="+a.data.cmd}return new Request(Object.merge({},a,{method:"post",encoding:"utf-8",evalResponse:false,evalScripts:false,headers:{"X-Request":"JSON"},onRequest:function(){b.onRequest(this)},onComplete:function(){if(!this.response.json){this.response.json=JSON.decode(this.response.text)}b.onComplete(this.response.json.data)},onCancel:function(){b.onCancel(this)},onSuccess:function(){if(!this.response.json){this.response.json=JSON.decode(this.response.text)}if(this.response.json.javascript){Browser.exec(this.response.json.javascript)}if(this.response.json.error){if(this.response.json.errorMsg==null){this.response.json.errorMsg="Ajax Request error and no text. That is not so good."}if(b.onFailure(this.response.json.data,this.response.json.errorMsg)!==false){this.response.json.errorMsg.dialog()}return}else{if(this.response.json.reload){window.location.reload()}else{if(this.response.json.redirectTo){window.location.href=this.response.json.redirectTo
}}}b.onSuccess(this.response.json.data)},onFailure:function(){if(!this.response.json){this.response.json=JSON.decode(this.response.text)}if(this.response.json.error){if(this.response.json.errorMsg==null){this.response.json.errorMsg="Ajax Request error and no text. That is not so good."}if(b.onFailure(this.response.json.data,this.response.json.errorMsg)!==false){this.response.json.errorMsg.dialog()}return}b.onFailure(this.response.json.data)},onException:function(){b.onException(this)}})).send()},getDirection:function(){if(!this.direction){this.direction=$(document.body).getStyle("direction").toLowerCase()}return this.direction},insertScript:(function(){var a=[];var b=function(c){if(a.length==0){$$("script[src]").each(function(d){a.push({src:d.src,id:d.id,defer:d.defer,defaultURL:false})})}return a.find(function(d){return d.src==c.src})};return function(c){var e=this;if(!c){return}if(c&&c.$family&&c.$family.name=="array"){return c.each(function(f){e.insertScript(f)})}if(typeof c=="string"){c={src:c}
}c.onLoad=c.onLoad||this.emptyFunction;if(b(c)){c.onLoad(false);return true}a.push(c);var d=new Element("script",{id:(c.id?c.id:undefined),src:c.src,type:"text/javascript",defer:(c.defer?true:false)});if(Browser.ie){d.onreadystatechange=function(){if(d.readyState=="loaded"||d.readyState=="complete"||d.readyState==4){c.onLoad(true,d)}}}else{d.onload=c.onLoad.pass(true,d)}$(document.html).getElement("head").appendChild(d);return d}})(),popup:function(b,a){a=a||{};return window.open(b,a.id||"_blank",$H(a).getKeys().inject([],function(d,c){if(c!="id"){if(typeOf(a[c])=="boolean"){a[c]=a[c]?"yes":"no"}d.push(c+"="+a[c])}return d}).join(","),true)},toggleSwitch:function(b,a){b.toggleClass("hide");a.toggleClass("switchClosed");a.toggleClass("switchOpened");return this},toggleSwitchDescription:function(c,a,b){if(typeOf(c)=="element"){c=[c]}c.each(function(d){if(d.hasClass("switchClosed")){d.setTitle(a)}else{d.setTitle(b)}});return this}};Travian.Storage=(function(){var c=null;var d=function(l,k){var m=f(l);
k=g(k);if(m===null){}else{m.removeItem(k)}};var a=function(l,k){return{data:l,time:(new Date()).getTime(),cachingTime:k}};var j=function(l,k){var n=f(l);var m=null;k=g(k);if(n===null){return null}else{m=n.getItem(k)}if(m==null||typeof m=="undefined"){return null}return JSON.decode(m)};var f=function(l){var k=l?"localStorage":"sessionStorage";if(!window[k]){return null}return window[k]};var b=function(){if(c===null){c=new Element("input",{type:"hidden"}).setStyles({behavior:"url(#default#userData)"}).inject(document.body)}return c};var g=function(k){return"Travian."+k};var e=function(l,k,m){var o=f(l);var n=JSON.encode(m);k=g(k);if(o===null){return null}else{o.setItem(k,n)}};var h=function(m,l){var k=m.cachingTime;if(typeof l.cachingTime!="undefined"&&l.cachingTime!==null){k=l.cachingTime}return l.time!==false&&(new Date()).getTime()-l.time>k};return{cachingTime:365*24*60*60*1000,clear:function(k,l){d(l,k);return this},get:function(k,l){var m=j(l,k);if(m===null){return null}if(h(this,m)===true){return null
}return m.data},set:function(l,n,m,k){var o=a(this,n,k);e(m,l,o);return this}}})();Travian.Translation={keys:{},add:function(b,c){var a={};if(typeof b!="object"){a[b]=c}else{a=b}this.keys=Object.merge({},this.keys,a);return this},get:function(a){return this.keys[a]},translate:function(c,b){var a=null;if(typeof b=="object"){a=Object.append(Object.clone(this.keys),b)}else{a=this.keys}return c.substituteWithoutReplacingUndefinedKeys(a)}};String.implement({translate:function(a){return Travian.Translation.translate(this,a)}});Travian.Tips=(function(){var c=function(d){var e={title:"",text:""};var f=d.split("||");if(f.length==1){e.text=f[0]}else{if(f.length==2){e.title=f[0];e.text=f[1]}else{return false}}return e};var b=function(d){d.each(function(e){if(e.title!=""){var f=c(e.title);if(f===false){return}f.unescaped=true;e.setTip(f).removeAttribute("title");if(Browser.ie&&Browser.version<=7){e.setTip(f).removeAttribute("alt")}}})};var a=function(h){var f=window.getSize();var e=window.getScroll();
var g={x:h.element.offsetWidth,y:h.element.offsetHeight};var d=Object.clone(h.mousePosition);d.x=h.mousePosition.x+h.options.offset.x;d.y=h.mousePosition.y+h.options.offset.y;if((d.x+g.x-e.x)>f.x-h.options.windowPadding.x){d.x=h.mousePosition.x-h.options.offset.x-g.x}if((d.y+g.y-e.y)>f.y-h.options.windowPadding.y){d.y=h.mousePosition.y-h.options.offset.y-g.y}if(d.x<h.options.windowPadding.x){d.x=h.options.windowPadding.x}if(d.y<h.options.windowPadding.y){d.y=h.options.windowPadding.y}h.element.setPosition(d)};window.addEvent("domready",function(){Travian.Tip=new Travian.Tips();b($$('[title!=""]'))});Element.set=Element.set.wrap(function(e,g,f){if(typeof g=="string"&&g=="title"){this.setTitle(f);return this}var d=e(g,f);if(typeof g=="string"&&g=="html"){b(this.select('[title!=""]'))}return d});[Element.Prototype,Element.prototype].each(function(d){if(!d){return}d.set=d.set.wrap(function(f,h,g){if(typeof h=="string"&&h=="title"){this.setTitle(g);return this}var e=f(h,g);if(typeof h=="string"&&h=="html"){b(this.select('[title!=""]'))
}return e})});Element.implement({setTip:function(e){if(typeof e=="string"){var d=e;e=c(d);if(e===false){e=d}}Travian.Tip.set(this,e);return this},setTipUnescaped:function(e){if(typeof e=="string"){var d=e;e=c(d);if(e===false){e=d}}e.unescaped=true;Travian.Tip.set(this,e);return this},setTitle:function(d){return this.setTip(d)}});return new Class({Implements:[Options],displayState:"hide",element:null,elementCurrent:null,elementTitle:null,elementText:null,lastText:"",lastTitle:"",mousePosition:{x:0,y:0},options:{html:'<div class="tip"><div class="tip-container"><div class="tl"></div><div class="tr"></div><div class="tc"></div><div class="ml"></div><div class="mr"></div><div class="mc"></div><div class="bl"></div><div class="br"></div><div class="bc"></div><div class="tip-contents"><div class="title {title}"></div><div class="text {text}"></div></div></div></div>',hideDelay:250,maxWidthInPercent:0.33,offset:{x:16,y:16},showDelay:100,windowPadding:{x:10,y:10},zIndex:10000},timer:null,hide:function(){if(this.displayState!="hide"){this.displayState="hide";
clearTimeout(this.timer);this.element.get("tween").cancel();if(Browser.ie6){this.timer=(function(){this.setStyles({opacity:0,display:"none"})}).delay(this.options.hideDelay,this.element)}else{this.timer=this.element.fade.delay(this.options.hideDelay,this.element,"out")}}return this},initialize:function(d){this.setOptions(d);this.render()},render:function(){var d=this;this.element=(new Element("div",{styles:{position:"absolute",top:0,left:0,opacity:0,zIndex:this.options.zIndex}})).inject(document.body,"bottom").set("html",this.options.html.substitute({title:"elementTitle",text:"elementText"}));this.elementTitle=this.element.down(".elementTitle");this.elementText=this.element.down(".elementText");this.elementContainer=this.element.down(".tip-container");this.elementContents=this.element.down(".tip-contents");$(document.body).addEvents({mousemove:function(f){d.mousePosition.x=f.page.x;d.mousePosition.y=f.page.y;if(d.displayState!="show"){return}a(d)}});return this},set:function(d,e){var f=this;
d=$(d);d._extendedTipContent=e;if(!d._extendedTip){d._extendedTip=true;d.addEvents({mouseover:function(g){f.elementCurrent=d;f.show(d._extendedTipContent)},mouseout:function(g){f.elementCurrent=null;f.hide()}})}d.setTitle=function(g){d._extendedTipContent=g;if(f.elementCurrent==d){f.show(d._extendedTipContent)}};return this},show:function(d){if(typeof d=="string"){d={title:"",text:d,unescaped:false}}if(!d.text&&!d.title){this.hide();return this}this.updateContent(d);if(this.displayState!="show"){this.displayState="show";clearTimeout(this.timer);this.element.get("tween").cancel();if(Browser.ie6){this.timer=(function(e){this.setStyles({opacity:1,display:"block"})}).delay(this.options.showDelay,this.element)}else{this.timer=this.element.fade.delay(this.options.showDelay,this.element,"in")}}return this},updateContent:function(g){var f=Object.clone(g);var e=null;var h=null;var d=null;if(typeof f.title=="undefined"||!f.title){f.title=""}if(typeof f.text=="undefined"||!f.text){f.text=""}f.title=f.title.translate();
f.text=f.text.translate();if(this.lastText!=f.text||this.lastTitle!=f.title){if(typeof f.unescaped=="undefined"||f.unescaped!==true){f.title=f.title.unescapeHtml();f.text=f.text.unescapeHtml()}this.elementContainer.setStyles({width:"auto"});this.elementTitle.set("html",f.title);if(f.title){this.elementTitle.show()}else{this.elementTitle.hide()}this.elementText.set("html",f.text);if(f.text){this.elementText.show()}else{this.elementText.hide()}if(Browser.ie7&&Travian.getDirection()=="rtl"){this.elementContainer.setStyles({width:this.elementContents.getSize().x})}e=$(document.body).getSize().x;h=this.elementContents.getSize().x;if(Math.floor(e*this.options.maxWidthInPercent)<h){this.elementContainer.setStyles({width:Math.floor(e*this.options.maxWidthInPercent)})}d=this.elementContainer.getSize().x;if(Browser.ie6&&d==0){d=200}this.elementContainer.setStyles({width:d});a(this);this.lastText=f.text;this.lastTitle=f.title}return this}})})();Travian.Translation.add({"allgemein.ok":"ok","allgemein.cancel":"cancel"});
Travian.Dialog=new Class({Implements:[Options,Events],options:{cssClass:"",buttonOk:true,keepOpen:false,buttonTextOk:null,buttonCancel:true,buttonTextCancel:null,elementFocus:"dialogButtonOk",maxWidthInPercent:0.75,moveable:true,relativeTo:null,scroll:true,title:null,useEscKey:true,disposeOnClose:true,submitMethod:null,submitUrl:null,fx:{type:"tween",open:1,close:0,options:{property:"opacity",duration:400}}},toggleFormState:function(a){if(Browser.ie&&(this.options.submitMethod||this.options.submitUrl)){this.buttonOk.toggleClass("disabled",a).disabled=a}else{this.form.disabled=a}return this},disableForm:function(){return this.toggleFormState(true)},enableForm:function(){return this.toggleFormState(false)},initialize:function(a){this.setOptions(a);this.options.relativeTo=this.options.relativeTo||document.body;this.ie6=Browser.ie&&Browser.version<=6;this.options.relativeTo=$(this.options.relativeTo);if(this.options.buttonTextOk==null){this.options.buttonTextOk=Travian.Translation.get("allgemein.ok")
}if(this.options.buttonTextCancel==null){this.options.buttonTextCancel=Travian.Translation.get("allgemein.cancel")}this.render()},render:function(){var a=this;this.wrapper=new Element("div",{styles:{position:this.options.scroll&&!this.ie6&&document.body==this.options.relativeTo?"fixed":"absolute",zIndex:6000,opacity:0}}).inject(document.body).insert({top:'<div class="dialog '+this.options.cssClass+'"><div class="dialog-container"><div class="dialog-background-tl"></div><div class="dialog-background-tr"></div><div class="dialog-background-tc"></div><div class="dialog-background-ml"></div><div class="dialog-background-mr"></div><div class="dialog-background-mc"></div><div class="dialog-background-bl"></div><div class="dialog-background-br"></div><div class="dialog-background-bc"></div><div class="dialog-tl"></div><div class="dialog-tr"></div><div class="dialog-tc"></div><div class="dialog-ml"></div><div class="dialog-mr"></div><div class="dialog-mc"></div><div class="dialog-bl"></div><div class="dialog-br"></div><div class="dialog-bc"></div><div class="dialog-contents"><form action="?" method="get" accept-charset="UTF-8"><div class="iconButton delete small cancel"></div><div class="title"></div><div class="content"></div><div class="buttons"><button id="dialogButtonOk" class="ok" type="submit"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents"><div class="text"></div></div></div></button></div></form></div></div></div>'});
this.content=this.wrapper.down(".content");this.title=this.wrapper.down(".title");this.setTitle(this.options.title);this.elementContainer=this.wrapper.down(".dialog-container");this.elementContents=this.wrapper.down(".dialog-contents");this.form=this.wrapper.down("form").addEvent("submit",function(b){if(a.form.disabled){b.stop();return}a.disableForm();a.fireEvent("okay",[a,a.content]);if(a.options.keepOpen==false){a.close()}if(!a.options.submitMethod){b.stop()}});this.form.disabled=false;if(this.options.submitMethod){this.form.setAttribute("method",this.options.submitMethod);if(this.options.submitUrl){this.form.setAttribute("action",this.options.submitUrl)}}this.buttonOk=this.wrapper.down("button.ok");if(this.options.buttonOk==false){this.buttonOk.hide().up(".buttons").hide()}this.buttonOkText=this.wrapper.down("button.ok .text");if(this.buttonOkText){this.buttonOkText.set("html",this.options.buttonTextOk)}else{this.buttonOk.setTitle(this.options.buttonTextOk)}this.buttonCancel=this.wrapper.down(".cancel").addEvent("click",function(b){a.fireEvent("cancel",[a,a.content]);
a.close()});if(this.options.buttonCancel==false){this.buttonCancel.hide()}this.buttonCancelText=this.wrapper.down(".cancel .text");if(this.buttonCancelText){this.buttonCancelText.set("html",this.options.buttonTextCancel)}else{this.buttonCancel.setTitle(this.options.buttonTextCancel)}this.fireEvent("render",[this,this.content]);if(!this.fx){this.fx=this.options.fx.type=="morph"?new Fx.Morph(this.wrapper,this.options.fx.options):new Fx.Tween(this.wrapper,this.options.fx.options)}this.fx.addEvent("complete",function(){if(a.open&&$(a.options.elementFocus)){try{$(a.options.elementFocus).focus()}catch(b){}}a.fireEvent(a.open?"show":"hide",[a,a.content]);if(a.options.disposeOnClose&&!a.open){a.dispose()}});this.overlay=new Overlay(document.body,{onClick:function(){a.fireEvent("cancel",[a,a.content]);a.close()},opacity:0.3,duration:this.options.fx.options.duration})},setContent:function(d,b){var c=null;var a=null;this.content.empty();if(Browser.ie7&&Travian.getDirection()=="rtl"){this.elementContainer.setStyles({width:"auto"})
}this.content.insert({bottom:d});if(Browser.ie7&&Travian.getDirection()=="rtl"){this.elementContainer.setStyles({width:this.elementContents.getSize().x})}c=$(document.body).getSize().x;a=this.elementContents.getSize().x;if(Math.floor(c*this.options.maxWidthInPercent)<a){this.elementContainer.setStyles({width:Math.floor(c*this.options.maxWidthInPercent)})}if(b){this.options.elementFocus=b}if($(this.options.elementFocus)){(function(){try{$(this.options.elementFocus).focus()}catch(f){}}).delay(50)}this.update();return this},setTitle:function(a){this.options.title=a;this.title.set("html",this.options.title);if(!this.options.title){this.title.hide()}return this},update:function(){var b={x:0,y:0};var d=$(document.body).getSize();if(this.wrapper.getStyle("position")!="fixed"&&document.body==this.options.relativeTo){b=$(document.body).getScroll()}var c=this.wrapper.getDimensions({computeSize:true});var e=$(this.options.relativeTo).getSize();var f=$(this.options.relativeTo).getPosition();var a={left:b.x+f.x+e.x/2-c.width/2,top:b.y+f.y+e.y/2-c.height/2};
if(a.left<0){a.left=5}if(a.top<0){a.top=5}if(Travian.getDirection()=="rtl"&&(a.left+c.width)>d.x){a.left=d.x-c.width-5}this.wrapper.setStyles(a)},show:function(){var a=this;this.open=true;this.fireEvent("open",[this,this.content]);this.update();this.fx.start(this.options.fx.open);if(this.overlay){this.overlay.open()}if(this.options.useEscKey){document.id(document.body).addEvent("keydown",function(b){if(b.key=="esc"){a.close()}})}return this},close:function(){this.open=false;this.fireEvent("close",[this,this.content]);this.fx.start(this.options.fx.close);if(this.overlay){this.overlay.close();this.overlay.overlay.hide()}return this},dispose:function(){this.wrapper.destroy();if(this.overlay){this.overlay.overlay.destroy()}},toElement:function(){return this.wrapper}});Element.implement({dialog:function(a){new Travian.Dialog(a).setContent(this.get("html")).show();return this}});String.implement({dialog:function(a){this.dialog=new Travian.Dialog(a).setContent(this).show();return this}});Travian.Dialog.Ajax=new Class({Extends:Travian.Dialog,options:{data:{}},initialize:function(a){this.parent(a);
this.request()},request:function(){var a=this;Travian.ajax({data:this.options.data,onSuccess:function(b){a.setContent(b.html).setTitle(b.title).show()}});return this}});Hash.implement({dialog:function(a){new Travian.Dialog.Ajax(Object.merge({},this.toObject(),a||{}));return this}});Travian.AutoCompleter=new Class({Extends:Autocompleter.Request.JSON,initialize:function(c,b,a){var d=this;this.parent(c,b,Object.merge({minLength:2,maxChoices:10,width:"auto",postVar:"search",postData:{cmd:"autoComplete"},emptyChoices:function(){var e=new Element("li",{html:"{cropfinder.keine_ergebnisse}".translate()});e.inject(d.choices);d.showChoices()}},a||{}))}});Travian.Form=new Class({elements:{},onClick:function(a){return this},addElement:function(a,b){b.setName(a);this.elements[a]=b;return this},addInputElementByName:function(a,c){var b=Travian.Form.Element.Input.createElementByName(this,a,c);this.addElement(a,b);return this},onElementChanged:function(a){var b=a.isDirty();if(b==false){if($H(this.elements).find(function(c){return c.isDirty()
})){b=true}}this.onDirty(b);return this},onDirty:function(a){return this}});Travian.Form.Element=new Class({form:null,name:null,initialize:function(a){this.form=a},isDirty:function(){return false},onChange:function(){this.form.onElementChanged(this);return this},onClick:function(){this.form.onClick(this);return this},setForm:function(a){this.form=a;return this},setName:function(a){this.name=a;return this},getName:function(){return this.name}});Travian.Form.Element.Input=new Class({Extends:Travian.Form.Element,originalValue:null,currentValue:null,type:null,element:null,initialize:function(b,a){this.parent(b);this.element=a;this.originalValue=this.currentValue=this.getValue();this.initEvents()},getInput:function(){return this.element},initEvents:function(){var a=this;this.element.addEvent("change",function(){a.onChange()});return this},onChange:function(){this.currentValue=this.getValue();this.parent();return this},getValue:function(){return this.element.value},isDirty:function(){return this.originalValue!=this.currentValue
}});Travian.Form.Element.Input.createElementByName=function(d,a,c){var f=null;var b=null;var e=null;if(c===undefined){c=$(document)}f=$(c).getElements('[name="'+a+'"]');if(f.length==0){throw new Error('Element with name "'+a+'" not found.')}b=$(f[0]);switch(b.nodeName.toLowerCase()){case"input":e=b.get("type");if(e=="radio"||e=="checkbox"){b=f}break;default:e=b.nodeName.toLowerCase();break}e=e.capitalize();if(!Travian.Form.Element.Input[e]){throw new Error('Element type "'+e+'" not yet implemented!')}return new Travian.Form.Element.Input[e](d,b)};Travian.Form.Element.Input.Button=new Class({Extends:Travian.Form.Element.Input,initEvents:function(){var a=this;this.element.addEvent("click",function(){a.onClick()});return this},getValue:function(){return null}});Travian.Form.Element.Input.Checkbox=new Class({Extends:Travian.Form.Element.Input,valueBefore:null,initEvents:function(){var a=this;this.valueBefore=this.getValue();this.element.addEvent("click",function(){if(a.getValue()!=a.valueBefore){a.valueBefore=a.getValue();
a.onChange()}});return this},getValue:function(){var a=this.element.find(function(b){return b.checked});if(a){return a.value}return null}});Travian.Form.Element.Input.Radio=new Class({Extends:Travian.Form.Element.Input,valueBefore:null,initEvents:function(){var a=this;this.valueBefore=this.getValue();this.element.addEvent("click",function(){if(a.getValue()!=a.valueBefore){a.valueBefore=a.getValue();a.onChange()}});return this},getValue:function(){var a=this.element.find(function(b){return b.checked});if(a){return a.value}return null}});Travian.Form.Element.Input.Text=new Class({Extends:Travian.Form.Element.Input});Travian.Form.Element.Input.Textarea=new Class({Extends:Travian.Form.Element.Input});Travian.ajax=Travian.ajax.wrap(function(b,a){if(!a.url){a.url="ajax.php"}return b(a)});Travian.Game={currentPage:window.location.href.split("/").pop().split(".php",2).shift(),eventJamHtml:null,speed:1,version:4,worldId:null,ajaxUpdate:function(b,a){b=$(b);a=a||{};var c={onRequest:a.onRequest||Travian.emptyFunction,onComplete:a.onComplete||Travian.emptyFunction,onCancel:a.onCancel||Travian.emptyFunction,onSuccess:a.onSuccess||Travian.emptyFunction,onFailure:a.onFailure||Travian.emptyFunction,onException:a.onException||Travian.emptyFunction};
if(!a.url){a.url="admin.php"}if(a.parameters&&a.parameters.cmd){a.url=a.url+(a.url.indexOf("?")==-1?"?":"&")+"cmd="+a.parameters.cmd}return new Request(Object.merge({},a,{method:"get",encoding:"utf-8",evalResponse:false,evalScripts:false,onRequest:function(){c.onRequest(this)},onComplete:function(){c.onComplete(this.response.text)},onCancel:function(){c.onCancel(this)},onSuccess:function(){b.set("html",this.response.text);c.onSuccess(this.response.text)},onFailure:function(){c.onFailure(this.response.text)},onException:function(){c.onException(this)}})).send()},gotoPage:function(c,d,a,b){Travian.ajax({data:{cmd:d,data:{page:c,entries:b}},onSuccess:function(e){$(a).set("html",e.result)}});return this},iPopup:function(a,b){('<iframe class="popup" frameborder="0"  id="Frame" src="manual.php?typ='+b+"&amp;gid="+a+'" width="475" height="500" scrolling="no" border="0" allowTransparency="true"></iframe>').dialog({title:"{allgemein.anleitung}".translate(),buttonOk:false,cssClass:"white"});return false
},unitZoom:function(a){('<div class="zoomTop"></div><div class="zoomMiddle"><img src="img/x.gif" class="unitBig u'+a+'Big" /></div><div class="zoomBottom"></div>').dialog({buttonOk:false,cssClass:"unitZoom"});return false},showEditVillageDialog:function(e,b,d,c){var a=b+' <input type="text" id="villageNameInput" name="villageName" value="" maxlength="20" class="text" />';a.dialog({title:e,relativeTo:$("villageName"),buttonTextOk:d,onOkay:function(f,g){Travian.ajax({data:{cmd:"changeVillageName",name:$("villageNameInput").value,did:c},onSuccess:function(h){$("villageNameField").innerHTML=h.name}})},onOpen:function(f,g){g.down("#villageNameInput").value=$("villageNameField").get("text")}});return this}};window.addEvent("domready",function(){initTimer("l1","lbar1");initTimer("l2","lbar2");initTimer("l3","lbar3");initTimer("l4","lbar4");initCounter();$$("*.dynamic_img").addEvents({mouseenter:function(){this.addClass("over")},mouseleave:function(){this.removeClass("over");this.removeClass("clicked")
},mousedown:function(){this.removeClass("over");this.addClass("clicked")}})});Travian.Game.PageScroller=new Class({Implements:[Options],currentPage:1,pages:1,options:{classActive:"active",classEntry:"entry",elementList:null,elementBackground:null,elementPrev:null,elementNext:null,maxPerPage:8},initialize:function(a){var c=this;this.setOptions(a);var b=function(){c.elementList=$(c.options.elementList);c.elementPrev=$(c.options.elementPrev);c.elementNext=$(c.options.elementNext);c.elementBackground=$(c.options.elementBackground);c.resetBackground();c.elementEntries=c.elementList.select("."+c.options.classEntry);c.pages=Math.floor((c.elementEntries.length-1)/c.options.maxPerPage)+1;if(c.pages<=1){c.elementPrev.hide();c.elementNext.hide();c.elementBackground.addClass("none");return}if(c.elementEntries.length!=0){var d=c.elementEntries[0].getDimensions({computeSize:true});c.elementList.setStyles({height:d.totalHeight*c.options.maxPerPage})}c.elementEntries.find(function(f,e){if(f.hasClass(c.options.classActive)){c.currentPage=Math.floor(e/c.options.maxPerPage)+1;
return true}return false});c.showPage(c.currentPage);c.elementPrev.addEvent("click",function(f){f.stop();c.prev()});c.elementNext.addEvent("click",function(f){f.stop();c.next()})};if(!$(this.options.elementList)){$(document).addEvent("domready",b)}else{b()}},next:function(){return this.showPage(this.currentPage+1)},prev:function(){return this.showPage(this.currentPage-1)},resetBackground:function(){this.elementBackground.removeClass("none back forward both");return this},showPage:function(a){var b=this;if(this.pages<=1){return this}if(a>this.pages){a=this.pages}else{if(a<1){a=1}}this.currentPage=a;this.elementPrev[this.currentPage!=1?"show":"hide"]();this.elementNext[this.currentPage!=this.pages?"show":"hide"]();b.resetBackground();if(this.currentPage!=1&&this.currentPage!=this.pages){this.elementBackground.addClass("both")}else{if(this.currentPage!=1){this.elementBackground.addClass("back")}else{if(this.currentPage!=this.pages){this.elementBackground.addClass("forward")}else{this.elementBackground.addClass("none")
}}}this.elementEntries.each(function(d,c){var e=Math.floor(c/b.options.maxPerPage)+1;if(e==b.currentPage){d.show()}else{d.hide()}});return this}});Travian.Game.InputCoordinates=(function(){Element.inject=Element.inject.wrap(function(l,h,k,j){e(Travian.Game.InputCoordinates,h);return l(h,k,j)});Element.prototype.inject=Element.prototype.inject.wrap(function(k,j,h){e(Travian.Game.InputCoordinates,this);return k(j,h)});Element.insert=Element.insert.wrap(function(k,h,j){return e(Travian.Game.InputCoordinates,k(h,j))});Element.prototype.insert=Element.prototype.insert.wrap(function(j,h){return e(Travian.Game.InputCoordinates,j(h))});var e=function(j,h){var k={x:null,y:null};$(h).getElements(j.options.selector).each(function(l){if(l.hasClass(j.options.classNames.x)){k.x=l}if(l.hasClass(j.options.classNames.y)){k.y=l}if(k.x!=null&&k.y!=null){j.add(k);k.x=null;k.y=null}});return h};var d=function(j,h){var k=parseInt(h.value);if(k<j.options.range.min){h.value=j.options.range.min;k=j.options.range.min
}else{if(k>j.options.range.max){h.value=j.options.range.max;k=j.options.range.max}}return k};var c=function(l,m,k){var o=k.value;var n=l.options.splitChars.find(function(q){return o.indexOf(q)!=-1});if(!n){return false}var j=o.split(n);if(j.length<=1){return false}var h=[j.shift(),j.join("")].map(function(q){q=f(l,q);if(q<l.options.range.min){q=l.options.range.min}else{if(q>l.options.range.max){q=l.options.range.max}}return parseInt(q)});if(typeof h[0]!="number"||typeof h[1]!="number"||h[0].isNaN()||h[1].isNaN()){return false}m.x.value=h[0];m.y.value=h[1];return true};var f=function(h,j){return j.split("").filter(function(l,k){return(l=="-"||!parseInt(l).isNaN())}).filter(function(l,k){return !(k>=1&&l=="-")}).join("")};var a=function(l,h,j,k){if(c(h,j,k)){l.stop();return}k.value=f(h,k.value)};var b=function(l,h,k,j){if(h.options.passThroughChars[l.code]){return}if(l.control){return}if(h.options.validChars[l.code]=="-"&&k.value.indexOf("-")!=-1&&k.getSelectionStart()!=0){l.stop();return
}if(h.options.splitChars[l.code]){if(k.value.length!=0&&parseInt(k.value).isNaN()==false){if(Browser.opera){k.value=f(h,k.value)}(j||Travian.emptyFunction)()}l.stop();return}else{if(!h.options.validChars[l.code]){l.stop();return}}};var g=function(n,j,l,m,o,h){if(j.options.passThroughChars[n.code]){return}if(c(j,l,m)){if(Browser.opera){m.value=f(j,m.value)}(o||Travian.emptyFunction)();n.stop();return}if(n.control){return}n.stop();if((m.value.length>=1&&j.options.validChars[n.code]=="-")||(j.options.splitChars[n.code])||(!j.options.validChars[n.code])){return}var k=d(j,m);if(k.isNaN()){return}if((k.sgn()==-1&&j.options.range.min.toString().length==k.toString().length)||(k.sgn()>=0&&j.options.range.max.toString().length==k.toString().length)){if(Browser.opera){m.value=f(j,m.value)}(h||Travian.emptyFunction)();return}};return new (new Class({Implements:[Options],elements:[],options:{selector:"input[class~=coordinates]",classNames:{x:"x",y:"y"},range:{min:-400,max:400},splitChars:$H({226:"|",188:",",78:",",110:",",190:".",32:" "}),prefixChars:$H({109:"+",43:"+",109:"-",189:"-"}),validChars:$H({109:"-",189:"-",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9"}),passThroughChars:$H({8:String.fromCharCode(8),9:String.fromCharCode(9),13:String.fromCharCode(13),36:String.fromCharCode(36),35:String.fromCharCode(35),37:String.fromCharCode(37),39:String.fromCharCode(39),46:String.fromCharCode(46)})},add:function(h){var k=this;
h=Object.clone(h);if(!h.x||!h.y){return this}if(h.x._inputCoordinates&&h.y._inputCoordinates){return this}h.x._inputCoordinates=true;h.y._inputCoordinates=true;h.x.removeAttribute("maxlength");h.y.removeAttribute("maxlength");var j=null;h.x.addEvents({change:function(l){a(l,k,h,h.x)},keydown:function(l){b(l,k,h.x,function(){h.y.focus()});return},keyup:function(l){g(l,k,h,h.x,function(){h.y.focus()},function(){h.y.focus()})}});h.y.addEvents({change:function(l){a(l,k,h,h.y)},keydown:function(l){b(l,k,h.y)},keyup:function(l){g(l,k,h,h.y)}});return this},initialize:function(h){var j=this;this.setOptions(h);$(document).addEvent("domready",(function(){e(j,document.body)}))}}))})();Travian.Game.ColorPicker=new Class({Implements:[Options,Events],options:{colors:[],defaultColor:-1,className:"moocolorcheckbox",selectedClassName:"moocolorcheckbox_selected"},initialize:function(a,b){var c=this;this.setOptions(b);this.container=$(a);this.container.setStyle("overflow","hidden");this.container.addEvents({mouseenter:function(){c.fireEvent("mouseenter")
},mouseleave:function(){c.fireEvent("mouseleave")}});this.draw();if(this.options.defaultColor>=0){this.selectColor(this.options.colors[this.options.defaultColor])}return this},addColor:function(a){if(!a){return this}this.options.colors.include(a);this.draw();return this.draw()},removeColor:function(a){if(!a){return this}this.options.colors.erase(a);return this.draw()},selectColor:function(a){if(!a){return this}var b=this;this.container.getElements("div.moocolorcheckbox-container").each(function(c){if(c.down(".entry").getStyle("background-color").toUpperCase()==a.toUpperCase()){b.fireEvent("change",[a,c]);c.addClass(b.options.selectedClassName)}else{c.removeClass(b.options.selectedClassName)}});return this},getContainer:function(){return this.container},draw:function(){var a=this;this.container.empty();this.options.colors.each(function(b,c){var e=new Element("div",{"class":a.options.className+" moocolorcheckbox-container"});var d=new Element("div",{"class":"entry"});d.set("html","&nbsp;").setStyles({"background-color":b}).inject(e);
e.setStyles({"float":"left",cursor:"pointer"}).addEvents({click:function(){a.selectColor(b)},mouseenter:function(){a.fireEvent("mouseenter",[e])},mouseleave:function(){a.fireEvent("mouseleave",[e])}}).inject(a.container)});return this}});Travian.Game.ImagePicker=new Class({Implements:[Options,Events],options:{images:[],defaultImage:-1,className:"mooimagecheckbox",selectedClassName:"mooimagecheckbox_selected"},initialize:function(a,b){var c=this;this.setOptions(b);this.container=$(a);this.container.setStyle("overflow","hidden");this.container.addEvents({mouseenter:function(){c.fireEvent("mouseenter")},mouseleave:function(){c.fireEvent("mouseleave")}});this.draw();if(this.options.defaultImage>=0){this.selectImage(this.options.images[this.options.defaultImage])}return this},addImage:function(a){if(!a){return this}this.options.images.include(a);this.draw();return this.draw()},removeImage:function(a){if(!a){return this}this.options.images.erase(a);return this.draw()},selectImage:function(b){if(!b){return this
}var a=this;this.container.getElements("div").each(function(c){var d=c.down("img")._src;if(d.toUpperCase()==b.toUpperCase()){a.fireEvent("change",[b,c]);c.addClass(a.options.selectedClassName)}else{c.removeClass(a.options.selectedClassName)}});return this},getContainer:function(){return this.container},draw:function(){var a=this;this.container.empty();this.options.images.each(function(c,b){var d=new Element("div",{"class":a.options.className});d.set("html",'<img src="'+c+'" alt="" />').down("img")._src=c;d.setStyles({"float":"left",cursor:"pointer"}).addEvents({click:function(){a.selectImage(c)},mouseenter:function(){a.fireEvent("mouseenter",[d])},mouseleave:function(){a.fireEvent("mouseleave",[d])}}).inject(a.container)});return this}});Travian.Game.Menu=new Class({initialize:function(a){var c=$(a);var b=this;c.getElements("a").each(function(f){var d=f.getParent(".normal");if(!d){return}d.addEvents({mouseenter:function(h){var g=b.getMorphContainer(h);if(typeOf(g._fxMenu)!="null"&&g._fxMenu.cancel){g._fxMenu.cancel()
}g._fxMenu=(new Fx.Morph(g,{duration:200,transition:Fx.Transitions.Sine.easeOut})).start({height:"38px","margin-top":"0px"})},mouseleave:function(h){var g=b.getMorphContainer(h);if(typeOf(g._fxMenu)!="null"&&g._fxMenu.cancel){g._fxMenu.cancel()}g._fxMenu=(new Fx.Morph(g,{duration:200,transition:Fx.Transitions.Sine.easeOut})).start({height:"30px","margin-top":"8px"})}})})},getMorphContainer:function(b){var a=$(b.target);if(a.getParent(".container")){var a=a.getParent(".container")}return a}});Travian.Game.AddLine=new Class({Implements:[Options,Events],options:{insertAfterLastEntry:true,elements:{add:null,insert:null,table:null,template:null},entryCount:0,maxEntries:false,selectors:{add:".addLine.addElement",insert:".addLine.insertElement",template:".addLine.templateElement"}},getEntryCount:function(){return this.options.entryCount},initialize:function(a){var b=this;this.setOptions(a);if(!this.options.elements.table){throw"Table element for Travian.Game.AddLine is not definied"}this.options.elements.table=$(this.options.elements.table);
$w("template add insert").each(function(c){if(!b.options.elements[c]){b.options.elements[c]=b.options.elements.table.down(b.options.selectors[c])}if(!b.options.elements[c]){throw'Element "'+c+'" for Travian.Game.AddLine is not definied'}});this.options.elements.add.addClass("addLine removeElement");this.options.elements.template=$(this.options.elements.template).cloneNode(true);this.options.elements.add.removeClass("addLine removeElement");this.options.elements.add.addEvent("click",function(g){var f=null;var d=null;var c=null;g.stop();b.fireEvent("addBefore",[b]);b.fireEvent("cloneBefore",[b]);f=b.options.elements.template.cloneNode(true);b.fireEvent("cloneAfter",[b,f]);d=f.select("label","input","textarea","button","select");b.fireEvent("insertBefore",[b,f]);d.each(function(e){if(e.tagName.toLowerCase()=="input"){if(e.type.toLowerCase()=="checkbox"||e.type.toLowerCase()=="radio"){e.tagName.checked=false}else{if(e.type.toLowerCase()=="text"||e.type.toLowerCase()=="password"){e.tagName.value=""
}}}else{if(e.tagName.toLowerCase()=="select"){e.tagName.selectedIndex=-1}else{if(e.tagName.toLowerCase()=="textarea"){e.tagName.value=""}}}b.fireEvent("insertInputBefore",[b,f,e])});b.options.elements.insert.insert({after:f.setStyles({opacity:0})});c=f.down(".addLine.removeElement");if(c){c.insert({after:b.options.elements.add});c.dispose()}b.options.entryCount++;if(b.options.maxEntries!==false&&b.options.maxEntries==b.options.entryCount){b.options.elements.add.dispose();Travian.Tip.hide()}d.each(function(e){b.fireEvent("insertInputAfter",[b,f,e])});new Fx.Morph(f,{duration:400}).start({opacity:[0,1]});b.fireEvent("insertAfter",[b,f]);if(b.options.insertAfterLastEntry===true){b.options.elements.insert=f}b.fireEvent("addAfter",[b,f])})}});Travian.Game.AutoCompleter=new Class({Extends:Travian.AutoCompleter,initialize:function(b,a){this.parent(b,"ajax.php?cmd=autoComplete",a)}});Travian.Game.AutoCompleter.UserName=new Class({Extends:Travian.Game.AutoCompleter,initialize:function(a){this.parent(a,{postData:{type:"username"}})
}});Travian.Game.AutoCompleter.VillageName=new Class({Extends:Travian.Game.AutoCompleter,initialize:function(a){this.parent(a,{maxChoices:20,postData:{type:"villagename"}})}});Travian.Game.Messages={};Travian.Game.Messages.Write={receivertext:"",initialize:function(){$("ally").addEvent("click",function(){$("recipient").getElement("input").set("value","[ally]")});new Travian.Game.AutoCompleter.UserName("receiver");var a=false;$("receiver").up("form").addEvent("submit",function(b){b.stop();receivertext=$("receiver").get("value");Travian.ajax({data:{cmd:"checkRecipient",recipient:$("receiver").get("value")},onSuccess:function(){$("receiver").up("form").submit();a=true}})})},showAddressBook:function(a){var b=true;if(this.addressBookDialog){$(a).removeClass("hide");this.addressBookDialog.show()}else{this.addressBookDialog="".dialog({disposeOnClose:false,title:"{nachrichten.adressbuch}".translate(),buttonTextOk:"{allgemein.save}".translate(),submitMethod:"post",submitUrl:"nachrichten.php",onOpen:function(c,d){$$(".dialog").removeClass("hide");
if(!b){return}b=false;$(a).removeClass("hide");$(a).inject(d);d.getElements("td.pla a").addEvent("click",function(f){c.close();$("recipient").getElement("input").set("value",$(f.target).get("text"));f.stop()})},onClose:function(){$$(".dialog").addClass("hide")}}).dialog}return this}};Travian.Game.BBEditor=(function(){var a=function(d,e){var c=d;if(d.nodeName.toLowerCase()=="img"){d=c.up("button");if(!d){d=c.up("a")}}var b=d.className.split(" ").find(function(f){if(f.indexOf(e)==0){return true}return false});if(b){b=b.substr(0,b.length-1).split("{");if(b.length==2){b=b[1]}else{b=null}}return b};return new Class({preview:null,textArea:null,id:null,Binds:["fetchPreview","showToolbarWindow","insertTag","insertSingleTag","insertSmilieTag","hideToolbarWindow","showPreview","hidePreview"],initialize:function(b){this.id=b;this.textArea=$(b);this.toolbar=$(b+"_toolbar");this.preview=$(b+"_preview");this.preview.setStyle("display","none");this.preview.addClass("preview");$(b+"_previewButton").addEvent("click",this.fetchPreview);
$(b+"_resourceButton").addEvent("click",this.showToolbarWindow);$(b+"_smilieButton").addEvent("click",this.showToolbarWindow);$(b+"_troopButton").addEvent("click",this.showToolbarWindow);$(b).addEvent("click",this.hideToolbarWindow);this.addEvent($(b+"_toolbar"),this.insertTag);this.addEvent($(b+"_resources"),this.insertTag);this.addEvent($(b+"_smilies"),this.insertTag);this.addEvent($(b+"_troops"),this.insertTag)},addEvent:function(d,b){var c=d.getChildren();for(i=0;i<c.length;i++){if(a($(c[i]),"bbTag")){$(c[i]).addEvent("click",b)}}},insertTag:function(d){d.stop();this.hidePreview();if($(d.target).match("button")){var c=$(d.target)}else{var c=$(d.target.parentNode)}var b=a(c,"bbTag");switch(a(c,"bbType")){case"d":this.textArea.insertAroundCursor({before:"["+b+"]",after:"[/"+b+"]"});break;case"s":this.textArea.insertAtCursor(b,false);break;case"o":this.textArea.insertAtCursor("["+a(c,"bbTag")+"]",false);break}},showToolbarWindow:function(f){f.stop();var d=f.target;var c=$(this.id+"_"+a(d,"bbWin"));
var b=true;if(c.getStyle("display")=="block"){b=false}this.hideToolbarWindow();if(b){c.fade("hide").fade("in");c.setStyle("display","block")}},hideToolbarWindow:function(b){if(b){b.stop()}var c=$(this.id+"_toolbarWindows").getChildren();for(i=0;i<c.length;i++){$(c[i]).setStyle("display","none")}},fetchPreview:function(c){c.stop();if(this.textArea.getStyle("display")=="none"||this.textArea.value.length<1){this.hidePreview();return}var b=new Request.JSON({method:"post",url:"ajax.php",data:{cmd:"bb",nl2br:1,target:this.id,text:this.textArea.value},onSuccess:this.showPreview});b.post()},showPreview:function(b){if(b.error==true){alert(b.errorMsg);return}else{this.preview.innerHTML=b.text;this.preview.setStyle("display","block");this.textArea.setStyle("display","none")}},hidePreview:function(){this.preview.setStyle("display","none");this.textArea.setStyle("display","inline")}})})();Travian.Game.GoldToSilver=(function(){var a=function(d,c,e){return(e>=1&&c>=e)};var b=function(c,d,e){return(e>=1&&e>=c.options.rateSilverToGold&&d>=e)
};return new Class({Binds:["transfer","transferSilverToGold"],Implements:[Options],options:{elementInputGold:null,elementInputSilver:null,elementResultGold:null,elementResultSilver:null,gold:null,rateGoldToSilver:null,rateSilverToGold:null,silver:null,lastFocusedElement:null},initialize:function(c){this.setOptions(c);this.options.elementInputGold=$(this.options.elementInputGold);this.options.elementInputSilver=$(this.options.elementInputSilver);this.options.elementResultGold=$(this.options.elementResultGold);this.options.elementResultSilver=$(this.options.elementResultSilver);this.options.elementInputGold.addEvent("keyup",this.transfer);this.options.elementInputSilver.addEvent("keyup",this.transfer)},handleFocusChange:function(c){if(this.options.lastFocusedElement!=c){if(c!=this.options.elementInputGold){this.options.elementInputGold.value=""}else{this.options.elementInputSilver.value=""}this.options.lastFocusedElement=c}},transfer:function(h){this.handleFocusChange(h.target);var d=parseInt(this.options.elementInputGold.value);
var g=parseInt(this.options.elementInputSilver.value);var c=this.options.gold;var f=this.options.silver;if(typeOf(d)=="null"||a(this,c,d)==false){d=0}d=Math.floor(d*this.options.rateGoldToSilver)/this.options.rateGoldToSilver;f+=Math.floor(d*this.options.rateGoldToSilver);c-=d;if(typeOf(g)=="null"||b(this,f,g)==false){g=0}g=Math.floor(g/this.options.rateSilverToGold)*this.options.rateSilverToGold;c+=Math.floor(g/this.options.rateSilverToGold);f-=g;c-=this.options.gold;f-=this.options.silver;if(c>0){c="+"+c}if(f>0){f="+"+f}this.options.elementResultGold.set("html",c);this.options.elementResultSilver.set("html",f);return this}})})();Travian.Game.RaidList={data:null,addSlot:function(b){var c=$("list"+b);var a=c.down("input[name=sort]").value;var d=c.down("input[name=direction]").value;window.location.href="build.php?gid=16&tt=99&action=showSlot&lid="+b+"&sort="+a+"&direction="+d},editSlot:function(b,c){var d=$("list"+b);var a=d.down("input[name=sort]").value;var e=d.down("input[name=direction]").value;
window.location.href="build.php?gid=16&tt=99&action=showSlot&eid="+c+"&sort="+a+"&direction="+e},loadList:function(b,a,e){var d=this;var c=$("list"+b);c.down(".loading").toggleClass("hide");Travian.ajax({data:{cmd:"raidListSlots",lid:b,sort:a,direction:e},onComplete:function(){c.down(".loading").toggleClass("hide")},onSuccess:function(f){c.down(".listContent").set("html",f.html);d.data[b]=f.list;c.down("input[name=sort]").value=f.sort;c.down("input[name=direction]").value=f.direction}});return this},markAllSlotsOfAListForRaid:function(a,b){Object.each(this.data[a].slots,function(c){c.marked=b});$("list"+a).getElements(".markSlot").each(function(c){c.checked=b});this.updateTroopSummaryForAList(a);return this},markSlotForRaid:function(a,b,c,d){this.data[a].slots[b].marked=c;if(typeof d=="undefined"||d){this.updateTroopSummaryForAList(a)}return this},setData:function(a){this.data=a},sort:function(a,b){return this.loadList(a,b,this.data[a].directions[b]!="asc"?"asc":"desc")},toggleList:function(a){var b=$("list"+a);
if(typeof this.data[a]=="undefined"){this.loadList(a)}Travian.toggleSwitch(b.down(".listContent"),b.down(".openedClosedSwitch"));return this},updateTroopSummaryForAList:function(b){var c=this;var a=$H(this.data[b].slots).inject([0,0,0,0,0,0,0,0,0,0,0],function(e,f){if(f.marked){for(var d=1;d<=10;d++){e[d]+=f.troops[d]}}return e});$("list"+b).getElements(".troopSelectionValue").each(function(e,d){if(a[d+1]>0){e.set("html",'<span class="{alert}">{selected}/{available}'.substitute({selected:a[d+1],available:c.data[b].troops[d+1],alert:a[d+1]>c.data[b].troops[d+1]?"alert":""})).up(".troopSelectionUnit").show()}else{e.up(".troopSelectionUnit").hide()}});return this}};Travian.Game.Reports={editRights:function(b,a){Travian.ajax({data:{cmd:"reportRightsGet",reportId:a.datas.reportId},onSuccess:function(d){a.datas=Object.merge({},a.datas||{},d||{});var c='<div class="reports" id="editRights"><div><input type="checkbox" id="right1" class="check" /> {anonymOpponent}</div><div><input type="checkbox" id="right2" class="check" /> {anonymMyself}</div><div><input type="checkbox" id="right3" class="check" /> {hiddenOwnTroops}</div><div><input type="checkbox" id="right4" class="check" /> {hiddenOtherTroops}</div><div class="description">{description}<br /><textarea id="description"></textarea></div></div>';
c.substitute(a.text).dialog({relativeTo:b,buttonTextOk:a.text.buttonTextOk,buttonTextCancel:a.text.buttonTextCancel,title:a.text.title,onOpen:function(e,f){$("right1").checked=a.datas.right1;$("right2").checked=a.datas.right2;$("right3").checked=a.datas.right3;$("right4").checked=a.datas.right4;$("description").innerHTML=a.datas.description},onOkay:function(e,f){Travian.ajax({data:{cmd:"reportRightsSet",data:Object.merge({},a.datas,{right1:$("right1").checked,right2:$("right2").checked,right3:$("right3").checked,right4:$("right4").checked,description:$("description").value})}})}})}});return false}};Travian.Game.Hero={};Travian.Game.Hero.Editor=function(){var a=null;return new Class({Implements:[Options],options:{attributes:null,element:null,command:null,attributes:null,urlHeroImage:null,elementHeroImage:null},hideAll:function(){var b=this.options.element.getElements(".attributes .container .infoOpen").removeClass("infoOpen");b.down(".headline").removeClass("switchOpened").addClass("switchClosed");
this.options.element.getElements(".attributes .container .details").hide();if(Browser.ie6){b.setStyles({height:"auto"})}return this},initialize:function(b){var d=this;d.initializeAttributes(b);var c=this.options.element.down("#save");if(c!=null){c.addEvent("click",function(f){d.sendAction("save",function(){$(d.options.elementHeroImage).src=d.options.urlHeroImage.substitute({time:(new Date()).getTime()})});f.stop()})}var c=this.options.element.down("#random");if(c!=null){c.removeEvent("click",a);a=function(f){d.sendAction("random");f.stop()};c.addEvent("click",a)}this.bindGenderSwitch();this.options.attributes=this.options.attributes;this.storeAttributesInInput(this.options.attributes)},initializeAttributes:function(b){var c=this;this.setOptions(b);this.options.element=$(this.options.element);this.hideAll();this.options.element.getElements(".attributes .container .info").each(function(d){d.addEvent("click",function(e){c.showAttribute(d);e.preventDefault()})});this.options.element.getElements(".attributes .container .attribute").addEvent("click",function(f){var g=parseInt(f.target.id.split("attribute_button_")[1]);
var d=f.target.getParent(".info").id;c.options.attributes[d]=g;c.sendAction("show");f.stop()})},sendAction:function(b,d){var c=this;Travian.ajax({data:{cmd:this.options.command,action:b,attribs:this.options.attributes},onSuccess:function(e){$$(".hero_head .image").set("html",e.html);if(e.attributesHtml){$("attributesContainer").set("html",e.attributesHtml);c.initializeAttributes(c.options)}c.options.attributes=e.attributes;c.storeAttributesInInput(e.attributes);(d||Travian.emptyFunction)()}});return this},showAttribute:function(d){this.hideAll();if(d.hasClass("infoOpen")){return}d.addClass("infoOpen");var b=d.down(".headline").removeClass("switchClosed").addClass("switchOpened");var c=d.down(".details").show();if(Browser.ie6){c.setStyles({position:"absolute",left:0,top:b.getSize().y});d.setStyles({position:"relative",height:c.getSize().y+b.getSize().y})}return this},storeAttributesInInput:function(c){var b=this.options.element.down("input[name=attributes]");if(b!=null){b.set("value",escape(JSON.encode(c)))
}return this},switchGender:function(b){if($(this.options.element).hasClass("genderSwitch")){if(b=="male"){this.options.element.removeClass("female").addClass("male");$("heroEditorActivateMale").addClass("iconActive disabled");$("heroEditorActivateFemale").removeClass("iconActive disabled")}else{this.options.element.removeClass("male").addClass("female");$("heroEditorActivateFemale").addClass("iconActive disabled");$("heroEditorActivateMale").removeClass("iconActive disabled")}}this.options.attributes.gender=b;this.sendAction("gender")},bindGenderSwitch:function(){var b=this;$$("#heroEditorActivateMale, #heroEditorActivateFemale").addEvent("click",function(c){if(this.get("id")=="heroEditorActivateMale"&&b.options.element.hasClass("male")==false){b.switchGender("male")}else{if(this.get("id")=="heroEditorActivateFemale"&&b.options.element.hasClass("female")==false){b.switchGender("female")}}c.stop()})}})}();Travian.Game.Hero.Inventory=new Class({Implements:[Options],dragStatus:false,items:[],options:{a:null,c:null,gender:"male",heroState:{},isInVillage:true,isDead:false,data:[],heroBodyHash:false,images:"img/hero/items/item{typeId}.png",text:{moveDialogDescription:"Anzahl der zu verschiebenden Items: {inputField}",useDialogDescription:"Anzahl der zu anwendenden Items: {inputField}",moveDialogTitle:"Verschieben!",useDialogTitle:"Anwenden!",useOneDialogTitle:"Soll dieser Gegenstand wirklich benutzt werden?",buttonOk:"Ok",buttonCancel:"Cancel"}},startDrop:false,createAndAddItem:function(a){this.items.include(Object.merge({placeElement:undefined,html_id:"item_"+a.id},a||{}));
return this},createDivs:function(){var a=this;var b=$("placeHolder");this.items.each(function(g,d){g.isUseable=(g.slot=="bag"||a.options.isInVillage);if(a.options.isDead&&!g.isUsableIfDead){g.isUseable=false}var f="";if(!g.isUseable){if(a.options.isDead){f=a.options.text.notMoveableTextDead}else{f=a.options.text.notMoveableText}f+="<br />"}f+=g.attributes.join("<br />");var e=(new Element("div",{id:"item_"+g.id,"class":"item "+a.options.gender+"_item_"+g.typeId+" "+(g.isUseable?"":"disabled"),html:'<div class="amount">'+g.amount+"</div>",styles:{position:"relative"},events:{click:function(){if(g.isUseable){Travian.Tip.hide();a.moveToMatchingPlace(this)}},mouseover:function(){if(g.isUseable){if(a.startDrop!=true){a.mark(g.slot)}}},mouseout:function(){if(g.isUseable){if(a.startDrop!=true){a.unMark(g.slot)}}}}}));e.setTip({unescaped:true,title:"("+g.amount+") "+g.name,text:f});e.inject(b);e.item=g;var c=null;if(g.placeId==0){c=$(g.slot);e.addClass("onHero")}else{c=$("inventory_"+g.placeId)
}a.moveToDrop(e,c.addClass(g.isUseable?"":"disabled"),true)});this.makeDraggable();$(this.options.elementHeroBody).src=this.options.urlBodyImage.substitute({heroBodyHash:this.options.heroBodyHash});return this},dialog:function(a){var d=this;var e=a.text;var c=a.amount;var b=a.calculate;delete (a.text);delete (a.amount);delete (a.calculate);a.onOpen=(a.onOpen||Travian.emptyFunction).wrap(function(k,j,l){var h=l.down("#amount");if(h){h.value=c}if(b){var f=l.down(b.selectorDisplayUseValue||".displayUseValue");var m=l.down(b.selectorDisplayAfterUse||".displayAfterUse");if(!f){throw'missing elementByItem in item dialog. Selector does not match "'+(b.selectorDisplayUseValue||".displayUseValue")+'"'}if(!m){throw'missing elementByItem in item dialog. Selector does not match "'+(b.selectorDisplayAfterUse||".displayAfterUse")+'"'}var g=function(o){o=parseInt(o);if(o.isNaN()||o<0){o=0}var n=o*b.valuePerItem;f.set("html",n);m.set("html",b.currentValue+n)};g(h.value);h.addEvent("keyup",function(n){g(h.value)
})}return k(j,l)});a=Object.merge(a,{buttonTextOk:this.options.text.buttonOk,buttonTextCancel:this.options.text.buttonCancel});e.substitute({inputField:'<input class="text" id="amount" type="text" value="0" />'}).dialog(a);return this},executeMovement:function(d,b,a){var c=this;Travian.ajax({data:{cmd:"heroInventory",id:d,drid:b,amount:a,a:this.options.a,c:this.options.c},onSuccess:function(h){c.options.c=h.checkSum;c.options.heroState=Object.merge(c.options.heroState,h.heroState||{});if(h.heroBodyHash){c.options.heroBodyHash=h.heroBodyHash}c.items.each(function(l,k){$(l.html_id).dispose()});c.items=new Array();h.items.each(function(l,k){c.createAndAddItem(l)});$$(".inventory").each(function(k){k.dispose()});var j=h.inventorySize;if(h.heroData.freePoints>0){$$("div.hero_inventory .attribute .setPoint").show()}for(var f=1,e=null;f<=j;f++){e=new Element("div",{id:"inventory_"+f,"class":"inventory draggable"});e.inject($("itemsToSale").down(".market"),"before")}c.createDivs();var g=$("attributes");
$H(h.heroData).each(function(n,l){var m=g.down("."+l);if(m!=null){var o=m.down(".current");var q=m.down(".progress .bar");var s=m.down(".points");var k=m.getElements(".tooltip");if(m.hasClass("res")){var r=$("setResource").getElements(".resource label .current");r.each(function(u,t){u.set("html",n["resourceHero"+t])})}if(m.hasClass("tooltip")){k.push(m)}if(o&&o.down(".value")){o=o.down(".value")}if(typeof n.current!="undefined"&&o){o.set("html",n.current)}if(typeof n.percent!="undefined"&&q){q.setStyles({width:n.percent+"%"});if(typeof n.backgroundColor!="undefined"){q.setStyles({backgroundColor:n.backgroundColor})}}if(typeof n.points!="undefined"&&s){if(s.down("input")!==null){s.down("input").value=n.points}else{s.set("html",n.points)}}if(typeof n.tooltip!="undefined"&&k.length){k.setTipUnescaped(n.tooltip)}}});g.down(".experience").down(".points").set("html",h.heroData.experience.current);if(g.down(".health")){g.down(".health").down(".value").set("html",h.heroData.health.percent);g.down(".health").down(".bar").setStyles({width:h.heroData.health.percent+"%"})
}if(c.options.afterRequestCallback[h.itemTypeId]){c.options.afterRequestCallback[h.itemTypeId](c,c.options,a,h)}}});return this},findFirstFreeInventory:function(){var a=null;$$(".inventory").each(function(b){if(b.getChildren().length==0&&a==null){a=b}});return a},initialize:function(a){var b=this;this.setOptions(a);this.options.data.each(function(c){b.createAndAddItem(c)});this.createDivs()},isInventoryId:function(a){return a.substr(0,9)=="inventory"},makeDraggable:function(){var c=this;var a=$("drag_cont");var b=$$(".draggable");var d=$("text");$$(".item").each(function(e){if(e.item.isUseable==false){return}new Drag.Move(e,{droppables:b,container:a,handle:e,onDrop:function(f,g){Travian.Tip.hide();if(c.startDrop==true){if(f.item.slot!="bag"&&f.item.placeId==0){f.addClass("onHero")}if(!g){c.moveToDrop(f,f.item.placeElement,true)}else{if(g.id==f.item.slot||c.isInventoryId(g.id)){f.addClass("highlight");(function(){f.removeClass("highlight")}).delay(500);c.unMark(g);if(f.item.placeElement!=g){c.moveToDrop(f,g)
}else{c.moveToDrop(f,f.item.placeElement,true)}}else{c.moveToDrop(f,f.item.placeElement,true)}}c.startDrop=false;f.removeClass("whileDragging")}if($$("body")[0].hasClass("ie6")||$$("body")[0].hasClass("ie7")){f.getParents().each(function(h){if(h.id=="bodyOptions"||h.id=="hero_inventory"){h.setStyles({zIndex:0,position:"static"})}})}return true},onLeave:function(f,g){},onEnter:function(f,g){if(g.id==f.item.slot||g.id.substr(0,9)=="inventory"){c.mark(g)}},onStart:function(f){c.startDrop=true;c.dragStatus=true;f.addClass("whileDragging").removeClass("onHero");if($$("body")[0].hasClass("ie6")||$$("body")[0].hasClass("ie7")){f.getParents().each(function(g){if(g.id=="bodyOptions"||g.id=="hero_inventory"){g.setStyles({zIndex:1,position:"relative"})}})}}})});return this},mark:function(a){$(a).addClass("heroMarked");return this},moveItem:function(c,a,b){if(b){this.executeMovement(c.item.id,a.id,b)}else{Element.dispose(c).inject(a)}this.resetItemDrop(c);c.item.placeElement=a;return this},moveToDrop:function(j,d,e){var f=this;
var a=null;var c={title:"",text:"",executeAfterOkay:true,show:true,onOpen:Travian.emptyFunction,onOkay:Travian.emptyFunction,onCancel:Travian.emptyFunction,relativeTo:j,amount:j.item.amount};var g=false;var b={title:"",text:""};var h=function(){if(!c.executeAfterOkay){f.resetItemDrop(j);return}var k;if(e){k=false}else{if(j.item.amount==1){k=1}else{if(g==true){k=$("amount").value}else{k=j.item.amount}}}f.moveItem(j,d,k)};if(e!=true&&!this.isInventoryId(d.id)&&((j.item.instant&&j.item.amount==1)||j.item.amount>1)){if(this.options.useOneDialogTitleCallbacks[j.item.typeId]){c=Object.merge(c,this.options.useOneDialogTitleCallbacks[j.item.typeId](j.item,this.options,c)||{})}g=true;if(j.item.instant){if(j.item.amount==1){b.title=this.options.text.useDialogTitle;b.text=this.options.text.useOneDialogTitle}else{b.title=this.options.text.useDialogTitle;b.text=this.options.text.useDialogDescription}}else{b.title=this.options.text.moveDialogTitle;b.text=this.options.text.moveDialogDescription}if(c.title==""){c.title=b.title
}if(c.text==""){c.text=b.text}if(c.show){c.onOkay=(c.onOkay||Travian.emptyFunction).wrap(function(l,k,m){h(k,m);return l(k,m)});c.onCancel=(c.onCancel||Travian.emptyFunction).wrap(function(l,k,m){f.moveToDrop(j,j.item.placeElement,true);return l(k,m)});this.dialog(c)}}else{h()}return this},moveToMatchingPlace:function(b){if(this.dragStatus==false){var c=b.item.slot;if(b.item.placeElement==$(c)){var a=this.findFirstFreeInventory();this.moveToDrop(b,a)}else{this.moveToDrop(b,$(c))}this.unMark(c)}else{this.dragStatus=false}return this},resetItemDrop:function(a){a.setStyles({left:0,top:0});return this},unMark:function(a){$(a).removeClass("heroMarked");return this}});Travian.Game.Hero.Properties={};Travian.Game.Hero.Properties.PropertyForm=new Class({Extends:Travian.Form,onDirty:function(b){var a=this.elements.saveHeroAttributes.getInput();if(b){a.removeClass("disabled").disabled=false}else{a.addClass("disabled").disabled=true}return this},onClick:function(a){if(a.getName()!="saveHeroAttributes"){return
}var b={cmd:"heroSetAttributes",resource:this.elements.resource.getValue(),attackBehaviour:this.elements.attackBehaviour.getValue()};if(this.elements.properties!==undefined){b.attributes=this.elements.properties.getPropertyValues()}Travian.ajax({data:b});return this}});Travian.Game.Hero.PropertySetter=new Class({Extends:Travian.Form.Element,options:{availablePoints:0,element:null,selectorBtnMinus:".pointsValueSetter.sub a",selectorBtnPlus:".pointsValueSetter.add a",elementAvailablePoints:null},getAvailablePoints:function(){return this.options.availablePoints-this.getSettedPoints()},getPropertyValues:function(){return this.options.attributes.inject({},function(b,a){b[a.getId()]=a.getSettedPoints();return b})},isDirty:function(){return this.getSettedPoints()>0},initialize:function(b,a){var c=this;this.parent(b);this.options=Object.append(this.options,a||{});this.options.attributes.each(function(d){d.setPropertySetter(c)});this.options.element=$(this.options.element);this.options.elementAvailablePoints=$(this.options.elementAvailablePoints);
this.update()},getSettedPoints:function(){return this.options.attributes.inject(0,function(b,a){return b+a.getSettedPoints()})},update:function(){this.options.attributes.each(function(a){a.updateButtons()});this.options.elementAvailablePoints.set("html",this.getAvailablePoints());this.onChange();return this}});Travian.Game.Hero.PropertySetter.Attribute=new Class({Implements:[Options],options:{id:null,element:null,value:null,usedPoints:null,maxPoints:null,elementBtnMinus:".pointsValueSetter.sub a",elementBtnPlus:".pointsValueSetter.add a",elementInput:".points input",elementProgressBar:".progress .bar.setted",elementValue:".current .value"},propertySetter:null,settedPoints:0,addPoint:function(a){if(typeOf(a)=="null"){a=1}if(a<0){a=0}return this.setSettedPoints(this.getSettedPoints()+a)},calculateValue:function(){return 0},getId:function(){return this.options.id},getMaxPoints:function(){return this.options.maxPoints},getPropertySetter:function(){if(this.propertySetter==null){throw"missing propertySetter in Travian.Game.Hero.PropertySetter.Attribute"
}return this.propertySetter},getSettedPoints:function(){return this.settedPoints},getTotalPoints:function(){return this.settedPoints+this.options.usedPoints},initialize:function(b){var f=this;this.setOptions(b);this.options.element=$(this.options.element);this.options.elementBtnMinus=this.options.element.down(this.options.elementBtnMinus);this.options.elementBtnPlus=this.options.element.down(this.options.elementBtnPlus);this.options.elementInput=this.options.element.down(this.options.elementInput);this.options.elementProgressBar=this.options.element.down(this.options.elementProgressBar);this.options.elementValue=this.options.element.down(this.options.elementValue);var h=null;var a=false;var c=function(j,k){k.stop();if(a==false){f[j+"Point"]()}a=false;return false};var e=function(j){j.stop();if(h){clearInterval(h)}j.target.removeClass("click");return false};var g=function(j,k){k.stop();if(h){clearInterval(h)}a=true;k.target.addClass("click");$(document.body).removeEvent("mouseup",e);$(document.body).addEvent("mouseup",e);
f[j+"Point"]();h=f[j+"Point"].periodical(200,f);return false};var d=function(l){var j=null;var k=(l.wheel>0?1:-1);l.stop();if(h){clearInterval(h)}f.setSettedPoints(f.getSettedPoints()+k);if(k>0){j=f.options.elementBtnPlus;f.options.elementBtnMinus.removeClass("click")}else{j=f.options.elementBtnMinus;f.options.elementBtnPlus.removeClass("click")}j.addClass("click");h=(function(){j.removeClass("click")}).delay(100);return false};this.options.elementBtnMinus.addEvents({click:c.curry("sub"),mousedown:g.curry("sub"),mousewheel:d});this.options.elementBtnPlus.addEvents({click:c.curry("add"),mousedown:g.curry("add"),mousewheel:d});this.options.elementInput.addEvents({change:function(k){var j=parseInt(f.options.elementInput.value);if(isNaN(j)){j=f.getTotalPoints()}f.setSettedPoints(j-f.options.usedPoints)},mousewheel:d})},setPropertySetter:function(a){this.propertySetter=a;return this},setSettedPoints:function(b){b=parseInt(b);if(isNaN(b)){b=this.settedPoints}if(b<0){b=0}if(b>this.getMaxPoints()-this.options.usedPoints){b=this.getMaxPoints()-this.options.usedPoints
}var a=this.getPropertySetter().getAvailablePoints();if(this.settedPoints<b&&a<b-this.settedPoints){b=this.settedPoints+a}this.settedPoints=b;return this.update()},subPoint:function(a){if(typeOf(a)=="null"){a=1}if(a<0){a=0}return this.setSettedPoints(this.getSettedPoints()-a)},update:function(){this.options.elementValue.set("html",this.calculateValue());this.options.elementInput.value=this.options.usedPoints+this.getSettedPoints();this.options.elementProgressBar.setStyles({width:Math.max(0,Math.min(100,Math.round(100/Math.min(this.getMaxPoints()+4,100)*this.getSettedPoints())))+"%"});this.getPropertySetter().update();return this},updateButtons:function(){if(this.getTotalPoints()>=this.getMaxPoints()||this.getPropertySetter().getAvailablePoints()==0){this.options.elementBtnPlus.addClass("disabled")}else{this.options.elementBtnPlus.removeClass("disabled")}if(this.getSettedPoints()==0){this.options.elementBtnMinus.addClass("disabled")}else{this.options.elementBtnMinus.removeClass("disabled")
}return this}});Travian.Game.Hero.PropertySetter.Attribute.Power=new Class({Extends:Travian.Game.Hero.PropertySetter.Attribute,options:{valueOfItems:0,valueBonus:0},calculateValue:function(){return 100+this.getTotalPoints()*this.options.valueBonus+this.options.valueOfItems}});Travian.Game.Hero.PropertySetter.Attribute.OffBonus=new Class({Extends:Travian.Game.Hero.PropertySetter.Attribute,calculateValue:function(){return Math.round(this.getTotalPoints()*0.2*10)/10}});Travian.Game.Hero.PropertySetter.Attribute.DefBonus=new Class({Extends:Travian.Game.Hero.PropertySetter.Attribute,calculateValue:function(){return Math.round(this.getTotalPoints()*0.2*10)/10}});Travian.Game.Hero.PropertySetter.Attribute.ProductionPoints=new Class({Extends:Travian.Game.Hero.PropertySetter.Attribute,calculateValue:function(){return this.getTotalPoints()},elementResources:[],getPossibleBonusProductionForResource:function(a){if(a==0){return this.calculateValue()*3*Travian.Game.speed}if(a<=4){return this.calculateValue()*10*Travian.Game.speed
}return 0},initialize:function(a){var c=$("setResource");this.parent(a);if(c){for(var b=0;b<=4;b++){this.elementResources[b]=c.down('label[for="resourceHero'+b+'"] .current')}}},update:function(){var a=this;this.elementResources.each(function(c,b){if(c){c.set("html",a.getPossibleBonusProductionForResource(b))}});return this.parent()}});Travian.Game.Vid=new Class({active:null,initialize:function(b){var a=this;a.active=b;a.setActive(b);a.showDescription(b);$$(".container .vid").addEvents({mouseover:function(c){a.highlight($(c.target).get("id"))},mouseout:function(c){a.unhighlight()},click:function(c){a.setActive($(c.target).get("id"))}})},highlight:function(a){$$(".container ."+a).addClass(a+"Highlight");this.showDescription(a)},unhighlight:function(){$$(".container .vid").removeClass("vid1Highlight").removeClass("vid2Highlight").removeClass("vid3Highlight");this.showDescription(this.active)},showDescription:function(a){$$(".container .description.").hide();$$(".container .description."+a).show()
},setActive:function(a){this.active=a;$$('form input[name="vid"]').set("value",a.substring(3,4));$$(".container .vid").removeClass("vid1Active").removeClass("vid2Active").removeClass("vid3Active");$$(".container ."+a).addClass(a+"Active")}});Travian.Game.Sector=new Class({active:null,initialize:function(b){var a=this;a.setActive(b);$$("#sector .map .sector .highlight").addEvents({mouseover:function(c){var d=$(c.target).up(".sector").get("id");if(d!=a.active&&!$(c.target).hasClass("disabled")){$(c.target).addClass("hover")}},mouseout:function(c){$(c.target).removeClass("hover")},click:function(c){if(!$(c.target).hasClass("disabled")){var d=$(c.target).up(".sector").get("id");$(c.target).removeClass("hover");a.setActive(d)}}});$$('#sector form select[name="sector"]').addEvent("change",function(c){var d=$(c.target).get("value");a.setActive(d)})},show:function(a){$$(".vid .description.").hide();$$(".vid .description."+a).show()},setActive:function(b){this.active=b;$$("#sector .map .sector .highlight").removeClass("active");
$$("#sector .map .sector."+b+" .highlight").addClass("active");var a=$$('#sector form select[name="sector"]');if(a.get("value")!=b){a.set("value",b)}}});Travian.Game.Highlight=new Class({Implements:[Options],active:false,options:{cssHighlighted:"highlighted on",element:null,renderer:"rectangle",rendererOptions:{}},renderer:null,activate:function(){if(this.active===false){this.active=true;this.renderer.activate();this.getElement().addClass(this.options.cssHighlighted)}return this},deactivate:function(){if(this.active===true){this.active=false;this.getElement().removeClass(this.options.cssHighlighted);this.renderer.deactivate()}return this},getElement:function(){return this.options.element},initialize:function(a){var b=this;this.setOptions(a);this.options.element=$(this.options.element);if(this.options.element===null){throw"missing element for highlighting!"}if(typeof Travian.Game.Highlight.Renderer[this.options.renderer.capitalize()]==="undefined"){throw'unknown renderer "'+this.options.renderer.capitalize()+'" defined!'
}this.renderer=new Travian.Game.Highlight.Renderer[this.options.renderer.capitalize()](this.options.rendererOptions,this)},toggle:function(){if(this.active){return this.deactivate()}return this.activate()}});Travian.Game.Highlight.Renderer=new Class({Implements:[Options],options:{},parentContainer:null,activate:function(){return this},deactivate:function(){return this},getElement:function(){return this.parentContainer.getElement()},initialize:function(a,b){this.parentContainer=b;this.setOptions(a);if(this.parentContainer===null){throw"missing parent container of type Travian.Game.Highlight"}}});Travian.Game.Highlight.Renderer.Rectangle=(function(){var a=function(f){var j=f.getElement().getCoordinates();if(f._lastCoordinates&&f._lastCoordinates.left==j.left&&f._lastCoordinates.top==j.top&&f._lastCoordinates.width==j.width&&f._lastCoordinates.height==j.height&&f._lastCoordinates.right==j.right&&f._lastCoordinates.bottom==j.bottom){return}var c=f.getElementLeft();var k=f.getElementTopLeft();
var h=f.getElementTop();var d=f.getElementTopRight();var l=f.getElementRight();var g=f.getElementBottomLeft();var b=f.getElementBottom();var e=f.getElementBottomRight();if(Browser.firefox){j.left+=1}c.show().setStyles({left:j.left-c.getSize().x,top:j.top,height:j.height});k.show().setStyles({left:j.left-k.getSize().x,top:j.top-k.getSize().y});h.show().setStyles({left:j.left,top:j.top-h.getSize().y,width:j.width});d.show().setStyles({left:j.right,top:j.top-d.getSize().y});l.show().setStyles({left:j.right,top:j.top,height:j.height});e.show().setStyles({left:j.right,top:j.bottom});b.show().setStyles({left:j.left,top:j.bottom,width:j.width});g.show().setStyles({left:j.left-g.getSize().x,top:j.bottom});f._lastCoordinates=j};return new Class({Extends:Travian.Game.Highlight.Renderer,elements:{left:null,topLeft:null,top:null,topRight:null,right:null,bottomLeft:null,bottom:null,bottomRight:null},invalidTypes:["area"],options:{cssClassLeft:"highlighted rectangle left",cssClassTopLeft:"highlighted rectangle top left",cssClassTop:"highlighted rectangle top",cssClassTopRight:"highlighted rectangle top right",cssClassRight:"highlighted rectangle right",cssClassBottomLeft:"highlighted rectangle bottom left",cssClassBottom:"highlighted rectangle bottom",cssClassBottomRight:"highlighted rectangle bottom right"},timer:null,activate:function(){clearInterval(this.timer);
a(this);this.timer=a.periodical(50,null,[this]);return this},deactivate:function(){clearInterval(this.timer);this.getElementLeft().hide();this.getElementTopLeft().hide();this.getElementTop().hide();this.getElementTopRight().hide();this.getElementRight().hide();this.getElementBottomLeft().hide();this.getElementBottom().hide();this.getElementBottomRight().hide();return this},getElementBottom:function(){if(this.elements.bottom===null){this.elements.bottom=$(new Element("div",{"class":this.options.cssClassBottom})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.bottom})}return this.elements.bottom},getElementBottomLeft:function(){if(this.elements.bottomLeft===null){this.elements.bottomLeft=$(new Element("div",{"class":this.options.cssClassBottomLeft})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.bottomLeft})}return this.elements.bottomLeft},getElementBottomRight:function(){if(this.elements.bottomRight===null){this.elements.bottomRight=$(new Element("div",{"class":this.options.cssClassBottomRight})).hide().setStyles({position:"absolute",left:0,top:0});
document.body.insert({bottom:this.elements.bottomRight})}return this.elements.bottomRight},getElementLeft:function(){if(this.elements.left===null){this.elements.left=$(new Element("div",{"class":this.options.cssClassLeft})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.left})}return this.elements.left},getElementTop:function(){if(this.elements.top===null){this.elements.top=$(new Element("div",{"class":this.options.cssClassTop})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.top})}return this.elements.top},getElementTopLeft:function(){if(this.elements.topLeft===null){this.elements.topLeft=$(new Element("div",{"class":this.options.cssClassTopLeft})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.topLeft})}return this.elements.topLeft},getElementTopRight:function(){if(this.elements.topRight===null){this.elements.topRight=$(new Element("div",{"class":this.options.cssClassTopRight})).hide().setStyles({position:"absolute",left:0,top:0});
document.body.insert({bottom:this.elements.topRight})}return this.elements.topRight},getElementRight:function(){if(this.elements.right===null){this.elements.right=$(new Element("div",{"class":this.options.cssClassRight})).hide().setStyles({position:"absolute",left:0,top:0});document.body.insert({bottom:this.elements.right})}return this.elements.right},initialize:function(b,c){this.parent(b,c);if(this.invalidTypes.indexOf(this.getElement().tagName.toLowerCase())!=-1){throw"invalid tag type for rectangle-highlighting!"}}})})();Travian.Game.Highlight.Renderer.Image=new Class({Extends:Travian.Game.Highlight.Renderer,elements:{background:null,placeholder:null},options:{borderSurround:5,cssBackground:"highlighted background"},validTypes:["div","span","a","img","input","button"],activate:function(){var b=this.getElement();var a=b.getSize();b.insert({before:this.getElementBackground().setStyles({position:"absolute",left:b.offsetLeft-this.options.borderSurround,right:"auto",top:b.offsetTop-this.options.borderSurround,width:a.x+2*this.options.borderSurround,height:a.y+2*this.options.borderSurround}).show().dispose()});
return this},deactivate:function(){this.getElementBackground().hide();return this},getElementBackground:function(){if(this.elements.background===null){var a=this.getElement();this.elements.background=$(a.cloneNode(false)).hide().addClass(this.options.cssBackground);a.insert({before:this.elements.background})}return this.elements.background},initialize:function(a,b){this.parent(a,b);if(this.validTypes.indexOf(this.getElement().tagName.toLowerCase())==-1){throw"invalid tag type for image-highlighting!"}}});Travian.AdventureList=new Class({openDurationsCalulator:function(){$("durationCalculations").toggleClass("hide");if(!$("durationCalculations").hasClass("hide")){this.calculateDurations()}},calculateDurations:function(){var a=$("adventureListForm");var b=$("changeVillage").value;Travian.ajax({data:{cmd:"calculateDurationsForAdventure",adventureKids:$("adventureListForm").select("input[name*=adventureKid]").inject([],function(d,c){d.push(c.value);return d}),currentKidAndDid:b,originalWalkTimes:$("adventureListForm").select("input[name*=adventureWalktimeOriginalVillage]").inject([],function(d,c){d.push(c.value);
return d})},onSuccess:function(c){if(c.noAdventures==false){Object.each(c.responseArray,function(e,d){$(d).set("html",e)})}}})}});Travian.Game.Marketplace=new Class({merchantsAvailable:0,capacityPerMerchant:0,merchantCapacity:0,initialize:function(a){this.merchantsAvailable=Math.max(a.merchantsAvailable,0);this.capacityPerMerchant=a.capacityPerMerchant;this.merchantCapacity=this.merchantsAvailable*this.capacityPerMerchant;this.autoCompleter=a.autoCompleter;this.updateAutoCompleter()},refresh:function(a){this.merchantsAvailable=Math.max(a,0);this.merchantCapacity=this.merchantsAvailable*this.capacityPerMerchant;$("merchantCapacityValue").set("html",this.merchantCapacity);$("merchantsAvailable").set("html",this.merchantsAvailable);this.visualizeMerchantCapacity()},enableAllLinks:function(){var a;for(a=1;a<=4;a++){linkToUpdate=$("addRessourcesLink"+a);linkToUpdate.removeClass("notClickable");linkToUpdate.disabled=false}},enableAllInputFields:function(){var a=0;for(a=1;a<5;a++){$("r"+a).removeClass("disabled");
$("r"+a).readOnly=0}},disableAllLinks:function(){var a;for(a=1;a<=4;a++){linkToUpdate=$("addRessourcesLink"+a);linkToUpdate.addClass("notClickable");linkToUpdate.disabled=true}},disableAllInputFields:function(){var a=0;for(a=1;a<5;a++){$("r"+a).addClass("disabled");$("r"+a).readOnly=1}},setNotice:function(a){if(a.notice&&a.formular){$("note").set("html",a.notice);$$(".destination").set("html",a.formular);this.enableAllLinks();this.enableAllInputFields();var b=1;for(b=1;b<5;b++){$("r"+b).set("value","")}if(a.button){$("button").set("html",a.button)}$$(".run_dropdown").removeClass("hide")}},setError:function(a){if(a.errorMessage){$("prepareError").set("html",a.errorMessage);$("note").set("html","")}},sendRessources:function(){var a=this;Travian.ajax({data:{cmd:"prepareMarketplace",t:$("t").get("value"),id:$("id").get("value"),a:$("a").get("value"),sz:$("sz").get("value"),kid:$("kid").get("value"),c:$("c").get("value"),x2:$("x2")?$("x2").get("value"):1,r1:$("r1").get("value"),r2:$("r2").get("value"),r3:$("r3").get("value"),r4:$("r4").get("value")},onSuccess:function(b){if(b.errorMessage){a.setError(b)
}else{if(b.notice){$$(".run_dropdown").removeClass("hide");$$("div .destination").set("html",b.formular);a.setNotice(b);a.reloadMarketPlace();resetCounterForAjax();a.updateAutoCompleter()}}}})},prepare:function(){var b=this;var a=$("marketSend");x2=1;if($("x2")){if($("x2").get("type")=="checkbox"){x2=$("x2").get("checked")?2:1}else{x2=$("x2").get("value")}}Travian.ajax({data:{cmd:"prepareMarketplace",r1:$("r1").get("value"),r2:$("r2").get("value"),r3:$("r3").get("value"),r4:$("r4").get("value"),dname:$("enterVillageName").get("value"),x:$("xCoordInput").get("value"),y:$("yCoordInput").get("value"),id:$("id").get("value"),t:$("t").get("value"),x2:x2},onSuccess:function(c){if(c.errorMessage){b.setError(c)}else{if(c.formular){b.disableAllLinks();b.disableAllInputFields();$$(".destination").set("html",c.formular);$$(".run_dropdown").addClass("hide");$("prepareError").set("html","");$("note").set("html","");$("r1").focus()}if(c.button){$("button").set("html",'<div id="prepareError" class="error"></div>'+c.button+'<div class="clear"></div>')
}}return false}})},goBack:function(){var a=this;this.enableAllLinks();this.enableAllInputFields();Travian.ajax({data:{cmd:"marketPlaceGoBack",kid:$("kid").get("value"),x2:$("x2")?$("x2").get("value"):1,dname:$("dname")?$("dname").get("value"):""},onSuccess:function(b){$$("div .destination").set("html",b.formular);$$("div #button").set("html",'<div id="prepareError" class="error"></div>'+b.button+'<div class="clear"></div>');$$(".run_dropdown").removeClass("hide");a.updateAutoCompleter()}})},reloadMarketPlace:function(){var a=this;Travian.ajax({data:{cmd:"reloadMarketplace"},onSuccess:function(b){$("merchantsOnTheWayFormular").set("html",b.merchantsOnTheWay);var g=0;var d;for(d=1;d<5;d++){g=parseInt(b.storage["l"+d]);resources["l"+d].value=g;var f=$("l"+d);var e=f.get("html");var c=e.split("/");f.set("html",g+"/"+c[1]);timer["l"+d].start_res=g}a.refresh(b.merchantsAvailable);resetCounterForAjax()}})},visualizeMerchantCapacity:function(){this.merchantCapacity=this.merchantsAvailable*this.capacityPerMerchant;
var a=this.summarizeInput();this.setSelectedRessourcesInfo(a);this.setNotEnoughMerchantsError(a);this.updateLinks()},validateAndVisualizeMerchantCapacity:function(a){this.validateResources(a);this.visualizeMerchantCapacity()},validateResources:function(d){var b=this.getValue(d);var e=this.clipToStorageMaximum(d,b);var a=b+e;var c=b;if(b>a){c=a}this.setValue(d,c)},rearrangeButtons:function(){},furtherMerchantsAvailable:function(){var b=this.summarizeInput();var a=this.merchantCapacity-b;if(a>=0){return true}else{return false}},updateLinks:function(){var a=null;var c=0;var b;for(b=1;b<=4;b++){a=$("addRessourcesLink"+b);c=this.getValueToAddToRessources(b);if(c==0){a.addClass("notClickable")}else{a.removeClass("notClickable")}}},addRessources:function(c){if($("addRessourcesLink"+c).disabled){return}var b=this.getValueToAddToRessources(c);var a=this.getValue(c);if(b!=0){this.setValue(c,b+a)}this.visualizeMerchantCapacity()},getValueToAddToRessources:function(d){var a=0;var c=this.summarizeInput();
var b=this.merchantCapacity-c;if(b>0){if(b<this.capacityPerMerchant){a=b}else{if(b>=this.capacityPerMerchant){a=this.capacityPerMerchant}}}else{if(b==0){a=0}else{a=b}}a=this.clipToStorageMaximum(d,a);return a},clipToStorageMaximum:function(c,b){var d=this.getStorageFor(c);var a=this.getValue(c);if(b>0){b=Math.min(b,(d-a))}else{if((a+b)>d){b=d-a}}return b},getStorageFor:function(a){var b="l"+(a);currentRes=resources[b].value;return currentRes},setValue:function(b,a){var c=parseInt(a);if(!isNaN(c)){$("r"+b).set("value",Math.max(c,0))}},setSelectedRessourcesInfo:function(a){$("sumResources").set("html",a);if(a>this.merchantCapacity){$("sumResources").addClass("notEnoughMerchants")}else{$("sumResources").removeClass("notEnoughMerchants")}},setNotEnoughMerchantsError:function(b){var d={};var c=this.getNeededMerchants(b);$("merchantsNeededNumber").set("html",c);if(c>this.merchantsAvailable){d={MERCHANTS_NEEDED:c,MERCHANTS_AVAILABLE:this.merchantsAvailable};$("prepareError").set("html","{notEnoughMerchants}".translate().substitute(d,/\\?\[([^\[\]]+)\]/g));
$("note").set("html","");$("prepareError").addClass("error");$("merchantsNeeded").addClass("error");$$(".merchantCapacity").addClass("error");$("sumResources").addClass("error");$("enabledButton").disabled=1;$("enabledButton").addClass("disabled")}else{$("merchantsNeeded").removeClass("error");if($("prepareError")){$("prepareError").set("html","")}else{var a=$("button").get("html");$("button").set("html",'<div id="prepareError" class="error"></div>'+a+'<div class="clear"></div>')}$$(".merchantCapacity").removeClass("error");$("sumResources").removeClass("error");$("enabledButton").disabled=0;$("enabledButton").removeClass("disabled")}},getNeededMerchants:function(a){return Math.ceil(a/this.capacityPerMerchant)},getValue:function(b){var a=parseInt($("r"+b).get("value"));if(!isNaN(a)){return a}return 0},summarizeInput:function(){var b=0;for(var a=1;a<=4;a++){id="r".concat(a);b+=this.getValue(a)}return b},updateAutoCompleter:function(){if(this.autoCompleter){new Travian.Game.AutoCompleter.VillageName("enterVillageName")
}return this}});Travian.Game.MoreGames=new Class({Implements:[Events],activeCounterElement:null,activeCounter:0,autoHoverDelay:3000,timeoutId:0,elements:null,options:{countOfGamesToShow:0},initialize:function(a){this.options=Object.merge(this.options,a);this.elements=$$("div.moreGames .game.game-image");this.events().toggleChildren(this.activeCounter).autoHover()},autoHover:function(){var a=this;if(this.timeoutId){clearTimeout(a.timeoutId)}this.timeoutId=(function(){a.toggleChildren(a.activeCounter);a.toggleChildren((a.activeCounter+1)%a.options.countOfGamesToShow);a.autoHover()}).delay(this.autoHoverDelay);return this},events:function(){var a=this;this.elements.each(function(c,b){c.addEvents({mouseenter:function(d){clearTimeout(a.timeoutId);if(b==a.activeCounter){return}if(a.activeCounterElement){a.toggleChildren(a.activeCounter)}a.toggleChildren(b)},mouseleave:function(d){a.autoHover()}})});return this},toggleChildren:function(a){this.activeCounter=a;this.activeCounterElement=this.elements[a];
this.activeCounterElement.select("img").each(function(b){b.toggleClass("hide")});return this}});var timer=new Object();var counter_plus=new Object();var counter_minus=new Object();var clientTime=Math.round(Date.now()/1000);var in_reload=0;var auto_reload=1;var countdownReachedZero=0;var counterOnZero=[];var inCustomReload=0;var lastReload=0;var resources=new Object();function t_format1(a){p=a.innerHTML.split(":");sek=p[0]*3600+p[1]*60+p[2]*1;return sek}function t_format2(d,f){var a,e,b,c;if(d>-2){a=Math.floor(d/3600);e=Math.floor(d/60)%60;b=d%60;c=a+":";if(e<10){c+="0"}c+=e+":";if(b<10){c+="0"}c+=b}else{c=f?"0:00:0?":(Travian.Game.eventJamHtml||"0:00:0?")}return c}function resetCounterForAjax(){clientTime=Math.round(Date.now()/1000);initTimer("l1","lbar1");initTimer("l2","lbar2");initTimer("l3","lbar3");initTimer("l4","lbar4");countdownReachedZero=0;lastReload=0;inCustomReload=0;counterOnZero=[];in_reload=0;counter_plus={};counter_minus={};initCounter()}function initCounter(){var a=null;
for(var b=1;;b++){a=document.getElementById("tp"+b);if(a!=null){counter_plus[b]=new Object();counter_plus[b].node=a;counter_plus[b].counter_time=t_format1(a)}else{break}}for(b=1;;b++){a=document.getElementById("timer"+b);if(a!=null){counter_minus[b]=new Object();counter_minus[b].node=a;counter_minus[b].counter_time=t_format1(a)}else{break}}executeCounter()}function executeCounter(){for(var a in counter_plus){time_elapsed=Math.round(Date.now()/1000)-clientTime;div_time=t_format2(counter_plus[a].counter_time+time_elapsed);counter_plus[a].node.innerHTML=div_time}for(a in counter_minus){time_elapsed=Math.round(Date.now()/1000)-clientTime;int_time=counter_minus[a].counter_time-time_elapsed;if(in_reload==0&&int_time<1){in_reload=1;if(auto_reload==1){setTimeout("document.location.reload()",1000)}else{if(auto_reload==0){setTimeout("mreload()",1000)}else{if(auto_reload==2){in_reload=0;if(time_elapsed!=lastReload){lastReload=time_elapsed;countdownReachedZero=1;counterOnZero[counterOnZero.length]=a;
if(functionCustomReloadExists()){window.customReload()}}}}}}else{}div_time=t_format2(int_time);counter_minus[a].node.innerHTML=div_time}if(in_reload==0){window.setTimeout("executeCounter()",1000)}}function functionCustomReloadExists(){if("function"==typeof window.customReload){return true}return false}function initTimer(b,k){var f=document.getElementById(b);var e=null;var d=null;var c=null;var h=null;var g=null;var j=null;if(f!=null){resources[b]=new Object();var a=f.innerHTML.match(/(\d+)\/(\d+)/);if(a!=null){e=a[0].split("/");d=parseInt(e[0]);c=parseInt(e[1]);h=resources.production[b];if(h!=0){g=Date.now();timer[b]=new Object();timer[b].start=g;timer[b].production=h;timer[b].start_res=d;timer[b].max_res=c;timer[b].min_res=0;timer[b].ms=3600000/h;timer[b].bar_name=k;j=100;if(timer[b].ms<j){timer[b].ms=j}timer[b].node=f;executeTimer(b)}else{timer[b]=new Object();resources[b].value=d}}}}
function executeTimer(a){time_elapsed=Date.now()-timer[a].start;if(time_elapsed>=0){new_res=Math.round(timer[a].start_res+time_elapsed*(timer[a].production/3600000));if(new_res>=timer[a].max_res){new_res=timer[a].max_res}else{if(new_res<=timer[a].min_res){new_res=timer[a].min_res}else{window.setTimeout("executeTimer('"+a+"')",timer[a].ms)}}resources[a].value=new_res;timer[a].node.innerHTML=new_res+"/"+timer[a].max_res;var c=$(timer[a].bar_name);if(c){var b=Math.round(100*new_res/timer[a].max_res);b=Math.min(b,100);b=Math.max(0,b);c.setStyles({width:b+"%",backgroundColor:(new_res<timer[a].max_res?"#006900":"#CC0000")})}}}
function mreload(){param="reload=auto";url=window.location.href;if(url.indexOf(param)==-1){if(url.indexOf("?")==-1){url+="?"+param}else{url+="&"+param}}document.location.href=url}function http_request(url,callback,method,post_data){if(method===undefined){method="GET"}var httprid;if(window.XMLHttpRequest){httprid=new XMLHttpRequest()}else{if(window.ActiveXObject){try{httprid=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{httprid=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}else{throw"Can not create XMLHTTP-instance"}}httprid.onreadystatechange=function(){if(httprid.readyState==4){if(httprid.status==200){var content_type=httprid.getResponseHeader("Content-Type");
content_type=content_type.substr(0,content_type.indexOf(";"));switch(content_type){case"application/json":callback((httprid.responseText==""?null:eval("("+httprid.responseText+")")));break;case"text/plain":case"text/html":callback(httprid.responseText);break;default:throw"Illegal content type"}}else{throw"An error has occurred during request"}}};httprid.open(method,url,true);if(method=="POST"){httprid.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");var parameters=encode_querystring(post_data)}else{var parameters=null}httprid.send(parameters)}function encode_querystring(b){var a="";var d=true;for(var c in b){a+=(d?"":"&")+c+"="+window.encodeURI(b[c]);if(d){d=false}}return a}Travian.AttackSymbol={attackSysbolState:[],getAttackSymbolState:function(d){var c=this.attackSysbolState[d];if(!c){var a=$("markSymbol_"+d).get("class");var b=parseInt(a.replace(/[^0-9]/gi,""));c={type:b,oldType:b};Travian.AttackSymbol.attackSysbolState[d]=c}return c},drawAttackSymbol:function(b){var a=Travian.AttackSymbol.getAttackSymbolState(b);
$("markSymbol_"+b).set("class","markAttack markAttack"+a.type)},markAttackSymbol:function(b){var a=Travian.AttackSymbol.getAttackSymbolState(b);a.type++;if(a.type==4){a.type=0}Travian.AttackSymbol.drawAttackSymbol(b);Travian.ajax({data:{cmd:"markIncomingAttacks",data:{id:b,state:a.type}},onSuccess:function(c){if(c.result==false){a.type=a.oldType;Travian.AttackSymbol.drawAttackSymbol(b)}else{a.oldType=a.type}}})}};var quest={anmstep:false,open:false};window.addEvent("domready",function(){if(((quest.number===null&&Travian.Game.currentPage!="hero")&&typeof quest.lastparallel=="undefined")||(window.location.href.indexOf("questUpdate")!=-1)){qst_handle()}else{if(typeof quest.lastparallel!="undefined"){qst_showQuest(quest.lastparallel)}}});function rndstring(f,d){if(f===undefined){f=8}if(d===undefined){d=0.5}var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var a="";for(var c=0;c<f;c++){var b=Math.floor((Math.random()+d)*0.5*e.length);a+=e.substring(b,b+1)}return a}function qst_genurl_parameter(){var b="cmd=qst";
var a=(Math.abs(quest.number)+1)/(Math.abs(quest.last)+1);return b+"&cr="+rndstring(4,a)}function qst_genurl(){return"ajax.php?"+qst_genurl_parameter()}function qst_animate(){$(document.getElementById("ce")).set("html","");var a;if(quest.anmstep===false){a={step:{},source:{},current:{},target:{width:448,height:482,top:-1},fps:50,n:10,i:0,anm:{}};a.target[quest.rtl?"right":"left"]="0"}else{a=quest.anmstep;qst_popup(false)}a.anm=document.getElementById("anm");for(var b in a.target){a.source[b]=Number(a.anm.style[b].substr(0,a.anm.style[b].length-2));a.current[b]=a.source[b];a.step[b]=Math.round((a.target[b]-a.source[b])/a.n)}a.timeout=1000/a.fps;quest.cstep=a;quest.anmlock=true;window.setTimeout(anm_step,a.timeout)}function anm_apply(a){for(var b in a.target){a.anm.style[b]=a.current[b]+"px"}}function anm_iterate(a){a.i++;if(a.i==2){a.anm.style.visibility="visible"}for(var b in a.target){a.current[b]+=a.step[b]}return a}function qst_popup(a){if(a===undefined){a=false}var c=document.getElementById("ce");
if(a){quest.open=true;var d="{close}".translate();var b='<div class="popup3 quest"><a class="close" href="#" onclick="qst_handle()"><img src="img/x.gif" class="" title="'+d+'" alt="'+d+'" /></a><div class="questTop"></div><div class="questMiddle"><div id="popup3"></div></div><div class="questBottom"></div></div>';$(c).empty().set("html",b);qst_xlo();qst_wfm();fixPopup();ie6_fixselect(true);popupDragable()}else{quest.open=false;$(c).set("html","");ie6_fixselect(false)}}function ie6_fixselect(d){if(Browser.ie6){var a=d?"hidden":"visible";var c=document.getElementsByTagName("select");var e=c.length;for(var b=0;b<e;b++){c[b].style.visibility=a}}}function anm_step(){step=anm_iterate(quest.cstep);anm_apply(step);if(step.i<step.n){window.setTimeout("anm_step()",step.timeout)}else{step.anm.style.visibility="hidden";quest.anmlock=false;quest.cstep=false;if(quest.anmstep===false){step.current=step.target;step.target=step.source;step.source=step.current;anm_apply(step);step.i=0;qst_popup(true);quest.anmstep=step
}else{quest.anmstep=false;if(quest.number>=quest.last||quest.altstep==9){$(document.getElementById("qge")).set("hmtl","")}}}}function qst_alt_timer(){var b=document.getElementById("qst_timer");if(b&&b.parentNode.style.display!="none"){if(!b.timestamp){b.timestamp=Math.round(Date.now/1000)+t_format1(b)}else{var a=b.timestamp-Math.round(Date.now/1000);if(a<0){b.parentNode.style.display="none";document.getElementById("qst_reshere").style.display="block"}else{$(b).set("html",t_format2(a))}}window.setTimeout(qst_alt_timer,1000)}}function qst_fhandle(){post_data={val:1};http_request(qst_genurl(),function(a){},"POST",post_data);qst_handle()}function qst_handle(){if(quest.anmlock){return false}quest.markup=false;if(quest.anmstep===false){http_request(qst_genurl(),function(a){for(var b in a){quest[b]=a[b]}})}if(Browser.ie6){qst_popup(!quest.open)}else{qst_animate()}if(quest.ar){auto_reload=quest.ar;quest.ar=undefined}}function qst_wfm(){var popup3=document.getElementById("popup3");if(!quest.markup||!popup3){if(!quest.anmlock){window.setTimeout("qst_wfm(true)",50)
}}else{if(quest.js){eval(quest.js)}scr_upd(quest);$(popup3).empty().set("html",quest.markup);popupDragable();quest.markup=false;quest.msg=false}}function qst_weiter(){var b=new URI(window.location.href);var a=window.location.href.fromQueryString().extend(qst_genurl_parameter().fromQueryString());a.questUpdate=1;a.questNext=1;if(a.set_quest){delete (a.set_quest)}window.location.href="http://{host}/{file}?".substitute(b.parsed)+a.toQueryString()}function qst_xlo(){$("popup3").empty().set("html",'<img src="img/x.gif" class="xlo" alt=""/>')}function qst_enter(a){if(a===undefined){a=false}var b;if(a){b={x:document.getElementById("xCoordInputQuest").value,y:document.getElementById("yCoordInputQuest").value}}else{b={val:document.getElementById("qst_val").value}}qst_xlo();http_request(qst_genurl(),function(c){for(var d in c){quest[d]=c[d]}},"POST",b);qst_wfm()}function qst_enter_coords(){qst_enter(true)}function handleUnreadAtNavigationButton(d,b){var c=document.getElementById(d);if(c&&b){var a=$$("#"+d+" .bubble-content")[0];
a.set("html",b);if(b>0){a.getParent().set("styles",{display:"block"})}else{a.getParent().set("styles",{display:"none"})}}}function scr_upd(a){var c=document.getElementById("qgei");if(c&&a.qgsrc){c.className=a.qgsrc}handleUnreadAtNavigationButton("n5",a.be);handleUnreadAtNavigationButton("n6",a.msg);if(a.cookie){var b=new Date();b.setTime(b.getTime()+300000);document.cookie="t3fw=1; expires="+b.toUTCString()+";"}if(a.fest&&Travian.Game.currentPage=="dorf2"){$("content").insert({bottom:a.fest})}window.setTimeout(qst_alt_timer,30)}function qst_showQuest(id){Travian.ajax({data:{cmd:"questP4",id:id},onSuccess:function(data){if(data.js){eval(data.js)}if(document.getElementById("popup3")==null){quest.markup=data.html;quest.reward="";qst_animate()}else{$("popup3").set("html",data.html)}}});return false}function popupDragable(){if($("drag")){return}$$(".popup3")[0].grab(new Element("div",{id:"drag"}),"top").makeDraggable({handle:"drag"})}function fixPopup(){var a=$(window.document).getCoordinates();
if(Browser.ie6&&(a.height<700||a.width<700)){$("ce").setStyles({position:"absolute"});is_too_small=true}else{$("ce").setStyles({position:"absolute"});is_too_small=false}}Travian.Game.Map=(function(){var a=0;return{Containers:null,debug:false,version:1,getNewId:function(){a++;return"mapId"+a},isMapPositionInRect:function(d,b){if(d.x0<=b.x&&d.y0<=b.y&&b.x<=d.x1&&b.y<=d.y1){return true}var c={x:b.x+(b.x<0?+801:-801),y:b.y+(b.y<0?+801:-801)};if(d.x0<=b.x&&d.y0<=b.y&&b.x<=d.x1&&b.y<=d.y1){return true}return false},isPositionInRect:function(c,b){return(c.x0<=b.x&&c.y0<=b.y&&b.x<=c.x1&&b.y<=c.y1)},register:function(b){if(this.debug){if(this.Containers==null){this.Containers=[]}this.Containers.push(b)}},remapShortParameters:function(b){if(typeof b.x!="undefined"&&typeof b.y!="undefined"){b.position={x:b.x,y:b.y};delete (b.x);delete (b.y)}if(typeof b.s!="undefined"){b.symbols=b.s;delete (b.s)}if(typeof b.c!="undefined"){b.title=b.c;delete (b.c)}if(typeof b.t!="undefined"){b.text=b.t;delete (b.t)
}if(typeof b.u!="undefined"){b.uid=b.u;delete (b.u)}if(typeof b.d!="undefined"){b.did=b.d;delete (b.d)}if(typeof b.a!="undefined"){b.aid=b.a;delete (b.a)}return b},xy2id:function(c,b){if(c>400){c-=801}else{if(c<-400){c+=801}}if(b>400){b-=801}else{if(b<-400){b+=801}}$id=(400+c)+(400-b)*801+1;if($id<1||$id>641601){$id=320801}return $id}}})();Travian.Game.Map.Base=new Class({contextMenu:null,id:null,globalProperties:["cookie","dataStore","transition","updater","contextMenu"],element:null,options:null,parentContainer:null,transition:null,classType:"Travian.Game.Map.Base",updater:null,destroy:function(){if(this.element){this.element.destroy()}},getMapCoordinates:function(){if(!this.position||!this.transition){return null}return this.transition.translateToMap(this.position)},initialize:function(a,c){a=Travian.Game.Map.remapShortParameters(a);var b=this;this.options=Object.merge({},a);Object.each(this.options,function(e,d){b[d]=e});if(this.id==null){this.id=Travian.Game.Map.getNewId()}if(c){this.parentContainer=c;
this.globalProperties.each(function(d){if(b.parentContainer[d]){b[d]=b.parentContainer[d]}});if(c.classType=="Travian.Game.Map.Container"){this.mapContainer=c}else{if(c.mapContainer){this.mapContainer=this.parentContainer.mapContainer}}}},isMapPositionInRect:function(a){if(!this.mapCoordinates||!a){return false}var b=Object.clone(this.mapCoordinates);if(!b.right){b.right=b.x}if(!b.bottom){b.bottom=b.y}return(b.x<=a.x&&b.y<=a.y&&a.x<=b.right&&a.y<=b.bottom)},isPositionInRect:function(a){return Travian.Game.Map.isPositionInRect({x0:this.position.x,y0:this.position.y,x1:this.position.x+this.position.width,y1:this.position.y+this.position.height},a)},render:function(a){a=a||{};if(!a.nodeType){a.nodeType="div"}this.element=(new Element(a.nodeType)).disableSelection();return this}});Travian.Game.Map.Container=(function(){var a=function(c){var f=false;var b=false;var l=null;var h=false;var g={count:0,shift:false,control:false,alt:false,keys:{},fn:null};var d={moved:false,x:null,y:null,target:null};
Object.each(c.keyboard,function(o,n){if(typeof c.keyboard[n]=="string"){c.keyboard[n]={fn:c.keyboard[n]}}c.keyboard[n]=Object.append({on:["keydown","keyup"],periodical:1},c.keyboard[n]);if(typeof c.keyboard[n].fn=="string"){g.keys[n]=false}});var m=c.containerRender.getStyle("cursor");var k=function(q,n,r,o){if(!c.isEventsEnabled()){return}if(c.containerViewSize.x<=n&&c.containerViewSize.y<=r&&n<=c.containerViewSize.right&&r<=c.containerViewSize.bottom&&o==c.containerMover&&!q.rightClick){f=true;b=false;l={x:n,y:r};q.stop()}};var e=function(o,n,r){if(c.containerViewSize.x<=n&&c.containerViewSize.y<=r&&n<=c.containerViewSize.right&&r<=c.containerViewSize.bottom){c.currentMousePosition.browserAbsolute.x=n;c.currentMousePosition.browserAbsolute.y=r;c.currentMousePosition.browser.x=n-c.containerSize.x-c.elementSize.x;c.currentMousePosition.browser.y=r-c.containerSize.y-c.elementSize.y;c.currentMousePosition.map=c.transition.translateToMap(c.currentMousePosition.browser)}else{c.currentMousePosition.browserAbsolute.x=null;
c.currentMousePosition.browserAbsolute.y=null;c.currentMousePosition.browser.x=null;c.currentMousePosition.browser.y=null;c.currentMousePosition.map.x=null;c.currentMousePosition.map.y=null}if(!f){return}if(!c.isEventsEnabled()){return}var q={x:n-l.x,y:-(r-l.y)};l={x:n,y:r};b=true;c.containerRender.setStyles({cursor:"move"});c.move(q);o.stop()};var j=function(o,n,r){if(!c.isEventsEnabled()){return}if(n!=null&&r!=null&&c.containerViewSize.x<=n&&c.containerViewSize.y<=r&&n<=c.containerViewSize.right&&r<=c.containerViewSize.bottom&&!o.rightClick&&!b&&f&&!h){var q=c.transition.translateToMap({x:n-c.containerViewSize.x-c.elementSize.x,y:r-c.containerViewSize.y-c.elementSize.y});if(c.tileDisplayInformation.type=="dialog"){h=true;new Travian.Dialog.Ajax(Object.merge({},c.tileDisplayInformation.optionsDialog,{data:{x:q.x,y:q.y},onOpen:function(t,s){$(s).getElements('a[href^="karte.php"]').addEvent("click",function(v){v.stop();var u=new URI(v.target.href);c.moveTo({x:parseInt(u.getData("x")),y:parseInt(u.getData("y"))});
t.close();return false})},onClose:function(){h=false}}))}else{Travian.popup(c.tileDisplayInformation.optionsPopup.url.substitute(q),c.tileDisplayInformation.optionsPopup.windowOptions)}}c.containerRender.setStyles({cursor:m});if(b){o.stop()}f=false;b=false};$(document).addEvents({selectstart:function(n){if(!c.isEventsEnabled()){return}if(!b){return}n.stop();return false},dragstart:function(n){if(!c.isEventsEnabled()){return}if(!b){return}n.stop();return false},mousedown:function(n){k(n,n.page.x,n.page.y,n.target)},mousemove:function(n){e(n,n.page.x,n.page.y)},mouseup:function(n){j(n,n.page.x,n.page.y)},mousewheel:function(n){if(!c.isEventsEnabled()){return}if(c.containerViewSize.x<=n.page.x&&c.containerViewSize.y<=n.page.y&&n.page.x<=c.containerViewSize.right&&n.page.y<=c.containerViewSize.bottom&&n.target==c.containerMover){var o=c.transition.translateToMap({x:n.page.x-c.containerViewSize.x-c.elementSize.x,y:n.page.y-c.containerViewSize.y-c.elementSize.y});if(n.wheel<0){c.zoomOut(o)}else{if(n.wheel>0){c.zoomIn(o)
}}n.stop()}},touchstart:function(n){d.moved=false;d.x=n.event.touches[0].pageX;d.y=n.event.touches[0].pageY;d.target=n.event.touches[0].target;k(n,d.x,d.y,d.target)},touchmove:function(n){d.moved=true;d.x=n.event.touches[0].pageX;d.y=n.event.touches[0].pageY;d.target=n.event.touches[0].target;e(n,d.x,d.y)},touchend:function(n){j(n,d.x,d.y)},keydown:function(n){if(!c.isEventsEnabled()){return}if(n.shift){g.shift=true}if(n.control){g.control=true}if(n.alt){g.alt=true}if(g.keys[n.code]===false&&n.target.nodeName.toLowerCase()!=="input"){if(c.keyboard[n.code].on.contains("keydown")==false){return}g.count++;g.keys[n.code]=true;n.stop();if(!g.fnTimer){g.fn=(function(){Object.each(g.keys,function(s,q){if(s){if(!c.keyboard[q]){return}var u=c.keyboard[q].fn;if(u===false||!c[u]){return}var r="";if(u.substring(0,4)=="move"){r="normal";var o=c.keyboard.speed.slow;var t=c.keyboard.speed.fast;if(g[o]&&!g[t]){r="slow"}else{if(!g[o]&&g[t]){r="fast"}}}else{if(u.substring(0,4)=="zoom"){r=null}}c[u](r)}})
});if(c.keyboard[n.code].periodical==0){g.fn()}else{if(c.keyboard[n.code].periodical>0){g.fnTimer=g.fn.periodical(c.keyboard[n.code].periodical)}}}}},keyup:function(n){if(!c.isEventsEnabled()){return}if(!n.shift){g.shift=false}if(!n.control){g.control=false}if(!n.alt){g.alt=false}if(g.keys[n.code]){if(c.keyboard[n.code].on.contains("keyup")==false){return}g.count--;g.keys[n.code]=false;n.stop();if(g.count==0&&g.fnTimer){clearInterval(g.fnTimer);g.fnTimer=null}}}})};return new Class({Extends:Travian.Game.Map.Base,blocks:null,classType:"Travian.Game.Map.Container",containerRender:null,containerSize:null,containerViewSize:null,currentMousePosition:{browserAbsolute:{x:null,y:null},browser:{x:null,y:null},map:{x:null,y:null}},element:null,elementSize:null,eventsEnabled:true,gridDisplayed:true,loading:false,forcedUpdates:0,addSymbol:function(b){var c=this.blocks.find(function(d){return d.isMapPositionInRect(b.position)});if(c){c.addSymbol(b)}return this},deleteSymbol:function(b){var c=this.blocks.find(function(d){return d.isMapPositionInRect(b.position)
});if(c){c.deleteSymbol(b)}return this},disableEvents:function(){this.eventsEnabled=false;return this},enableEvents:function(){this.eventsEnabled=true;return this},forceUpdateBlocksLayer:function(b){this.forcedUpdates=this.forcedUpdates+1;this.blocks.each(function(c){c.forceUpdateLayer(b)});return this},forceUpdateBlocksSymbols:function(c,b){this.blocks.each(function(d){d.forceUpdateSymbols(c,b)});return this},getContentForTooltip:function(b){var c=this.blocks.find(function(d){return d.isPositionInRect(b)});return c?c.getContentForTooltip(b):false},hideGrid:function(){this.cookie.set("grid",false);this.gridDisplayed=false;return this.updateGrid()},initialize:function(b){var d=this;var c=null;this.loading=true;if(!b){b=Travian.Game.Map.Options.Default}this.parent(b);this.onMove=this.onMove||Travian.emptyFunction;this.onCreate=this.onCreate||Travian.emptyFunction;this.onRender=this.onRender||Travian.emptyFunction;this.onZoom=this.onZoom||Travian.emptyFunction;Travian.Game.Map.register(this);
this.cookie=new Hash.Cookie(this.id);this.containerRender=this.container=$(this.container);this.containerRender._map=this;var e=Object.append(this.containerRender.getDimensions({computeSize:true}),this.containerRender.getPosition());if(!this.containerViewSize){this.containerViewSize={}}if(typeof this.containerViewSize.x=="undefined"){this.containerViewSize.x=e.x}if(typeof this.containerViewSize.y=="undefined"){this.containerViewSize.y=e.y}if(typeof this.containerViewSize.width=="undefined"){this.containerViewSize.width=e.width}if(typeof this.containerViewSize.height=="undefined"){this.containerViewSize.height=e.height}this.containerViewSize.right=this.containerViewSize.x+this.containerViewSize.width;this.containerViewSize.bottom=this.containerViewSize.y+this.containerViewSize.height;this.containerSize={x:this.containerViewSize.x,y:this.containerViewSize.y,width:Math.ceil(this.containerViewSize.width/this.blockSize.width)*this.blockSize.width,height:Math.ceil(this.containerViewSize.height/this.blockSize.height)*this.blockSize.height,right:this.containerViewSize.x+Math.ceil(this.containerViewSize.width/this.blockSize.width)*this.blockSize.width,bottom:this.containerViewSize.y+Math.ceil(this.containerViewSize.height/this.blockSize.height)*this.blockSize.height};
this.globalProperties.each(function(f){if(Travian.Game.Map[f.capitalize()]){d[f]=new Travian.Game.Map[f.capitalize()](d[f]||{},d)}});if(this.data.elements){this.dataStore.setMultiple(Travian.Game.Map.DataStore.TYPE_TILE,this.data.elements)}var c=this.cookie.get("grid");if(c!==null){this.gridDisplayed=c}this.onCreate(this);this.render()},invalidateBlockVersionCache:function(){Object.each(this.blocks,function(b){b.invalidateVersionCache()});return this},isEventsEnabled:function(){return this.eventsEnabled},move:function(b){this.transition.move(b);if(this.blocks!=null){Object.each(this.blocks,function(c){c.move(b)})}if(this.loading){if(!this.blockInitialDelta){this.blockInitialDelta={x:0,y:0}}this.blockInitialDelta.x+=b.x;this.blockInitialDelta.y+=b.y}this.onMove(this,b);return this},moveDown:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:0,y:b})},moveLeft:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:b,y:0})},moveLeftDown:function(b){if(typeof b=="string"){b=this.speeds[b]
}if(!b){return}return this.move({x:b,y:b})},moveLeftUp:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:b,y:-b})},moveRight:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:-b,y:0})},moveRightDown:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:-b,y:b})},moveRightUp:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:-b,y:-b})},moveTo:function(c){var b=this.transition.translateToBrowser({x:Math.floor(c.x),y:Math.floor(c.y)});b.x+=this.blockSize.width/this.transition.elementsPerBlock.x/2;b.y+=this.blockSize.height/this.transition.elementsPerBlock.y/2;b.x+=(this.containerSize.width-this.containerViewSize.width)/2;b.y+=(this.containerSize.height-this.containerViewSize.height)/2;return this.move({x:this.elementSize.width/2-b.x,y:-(this.elementSize.height/2-b.y)})},moveUp:function(b){if(typeof b=="string"){b=this.speeds[b]}if(!b){return}return this.move({x:0,y:-b})
},render:function(){this.container=new Element("div",{styles:{overflow:"hidden",position:"relative",left:0,top:0,width:"100%",height:"100%",right:0,bottom:0}}).disableSelection().inject(this.containerRender,"top").set("oncontextmenu","return (false);");this.elementSize={x:-this.blockSize.width*this.blockOverflow,y:-this.blockSize.height*this.blockOverflow,width:this.containerSize.width+this.blockSize.width*this.blockOverflow*2,height:this.containerSize.height+this.blockSize.height*this.blockOverflow*2};this.parent({nodeType:"div"}).element.setStyles({position:"absolute",left:this.elementSize.x,top:this.elementSize.y,width:this.elementSize.width,height:this.elementSize.height}).inject(this.container,"top");this.containerMover=new Element("div",{styles:{overflow:"hidden",position:"absolute",left:0,top:0,width:this.containerViewSize.width,height:this.containerViewSize.height,zIndex:100,backgroundColor:Browser.ie?"#FFFFFF":"transparent",opacity:Browser.ie?0.001:1}}).disableSelection().inject(this.container,"after");
this.onRender(this);this.moveTo(this.mapInitialPosition);this.renderBlocks();if(this.gridDisplayed){this.showGrid()}a(this);this.loading=false;return this},renderBlocks:function(){if(this.blocks){return this}this.blocks=[];var c=Math.ceil(this.elementSize.width/this.blockSize.width);var b=Math.ceil(this.elementSize.height/this.blockSize.height);var e={x:0,y:0};var g=null;var k=null;var d=null;if(this.blockInitialDelta){e=Object.clone(this.blockInitialDelta);delete (this.blockInitialDelta)}for(var h=0,f=0;h<b;h++){for(var j=0;j<c;j++){g=Travian.Game.Map.Layer.Block.getCorrectPosition({x:j*this.blockSize.width+e.x,y:h*this.blockSize.height-e.y,width:this.blockSize.width,height:this.blockSize.height},this).position;k=this.transition.translateToMap(g);d={id:f++,version:0};if(this.data.blocks[k.x]&&this.data.blocks[k.x][k.y]&&this.data.blocks[k.x][k.y][k.right]&&this.data.blocks[k.x][k.y][k.right][k.bottom]){d=Object.merge(d,this.data.blocks[k.x][k.y][k.right][k.bottom])}this.blocks.push(new Travian.Game.Map.Layer.Block(Object.merge({},this.options.block,{id:d.id,symbolTypes:this.symbolTypes,position:g,mapCoordinates:k,version:d.version}),this))
}}return this},showGrid:function(){this.cookie.set("grid",true);this.gridDisplayed=true;return this.updateGrid()},toggleGrid:function(){var b="showGrid";if(this.gridDisplayed===true){b="hideGrid"}return this[b]()},toggleMiniMap:function(){return this.miniMap.animate()},toggleOutline:function(){return this.outline.animate()},updateGrid:function(){var c=this;var b=c.gridDisplayed?this.grid[this.transition.zoomLevel]:false;this.element.select(".imageMark").each(function(d){d.setStyles({backgroundColor:"transparent",backgroundImage:b!=false?"url("+b+")":"none",backgroundPosition:"left top",backgroundRepeat:"repeat"})});return this},updateSymbolData:function(b){var c=this.blocks.find(function(d){return d.isMapPositionInRect(b.position)});if(c){c.updateSymbolData(b)}return this},zoom:function(c,b){if(this.transition.zoom(c)){this.onZoom(this);this.moveTo(b);if(this.gridDisplayed){this.updateGrid()}}return this},zoomIn:function(b){if(!b){b=this.transition.getPointOfCenterInView()}return this.zoom(-1,b)
},zoomOut:function(b){if(!b){b=this.transition.getPointOfCenterInView()}return this.zoom(1,b)}})})();Travian.Game.Map.Transition=(function(){var a=[];var d=function(g,f){var e=false;do{e=false;if(Math.round(g.x)>f.border.right){g.x=f.border.left+(g.x-f.border.right)-1;e=true}else{if(Math.round(g.x)<f.border.left){g.x=f.border.right-(f.border.left-g.x)+1;e=true}}if(Math.round(g.right)>f.border.right){g.right=f.border.left+(g.right-f.border.right)-1;e=true}else{if(Math.round(g.right)<f.border.left){g.right=f.border.right-(f.border.left-g.right)+1;e=true}}if(Math.round(g.y)>f.border.bottom){g.y=f.border.top+(g.y-f.border.bottom)-1;e=true}else{if(Math.round(g.y)<f.border.top){g.y=f.border.bottom-(f.border.top-g.y)+1;e=true}}if(Math.round(g.bottom)>f.border.bottom){g.bottom=f.border.top+(g.bottom-f.border.bottom)-1;e=true}else{if(Math.round(g.bottom)<f.border.top){g.bottom=f.border.bottom-(f.border.top-g.bottom)+1;e=true}}}while(e);return g};var b=function(e){e.elementsPerBlock=e.zoomOptions.sizes[e.zoomLevel-1];
e.pixelPerTile={x:e.mapContainer.blockSize.width/e.elementsPerBlock.x,y:e.mapContainer.blockSize.height/e.elementsPerBlock.y};e.elementsInView={x:e.elementsPerBlock.x*e.mapContainer.containerSize.width/e.mapContainer.blockSize.width,y:e.elementsPerBlock.y*e.mapContainer.containerSize.height/e.mapContainer.blockSize.height}};var c=function(h,f){var g={x:h.mapContainer.containerSize.x+h.mapContainer.elementSize.x,y:h.mapContainer.containerSize.y+h.mapContainer.elementSize.y};var e=h.mapContainer.blockSize.height/h.elementsPerBlock.y;return{x:(f.x-h.positionOrigin.map.x)*h.pixelPerTile.x+h.positionOrigin.browser.x-g.x,y:(h.positionOrigin.map.y-f.y)*h.pixelPerTile.y-e-g.y+h.positionOrigin.browser.y}};return new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.Transition",elementsPerBlock:null,pixelPerTile:null,zoomLevel:null,correctCoordinates:function(e){return d(e,this)},getPointOfCenterInView:function(){var e={x:this.mapContainer.containerViewSize.x+this.mapContainer.containerViewSize.width/2,y:this.mapContainer.containerViewSize.y+this.mapContainer.containerViewSize.height/2};
e.x-=this.mapContainer.containerSize.x;e.y-=this.mapContainer.containerSize.y;e.x-=this.mapContainer.elementSize.x;e.y-=this.mapContainer.elementSize.y;return this.translateToMap(e)},initialize:function(e,g){var f=this;this.parent(e,g);this.onMove=this.onMove||Travian.emptyFunction;this.onCreate=this.onCreate||Travian.emptyFunction;this.onZoom=this.onZoom||Travian.emptyFunction;this.border.width=this.border.right-this.border.left+1;this.border.height=this.border.bottom-this.border.top+1;this.zoomLevel=this.zoomOptions.level;this.zoomOptions.sizes.each(function(j,h){if(typeof j=="number"){f.zoomOptions.sizes[h]={x:Math.floor(f.zoomOptions.sizes[h]*f.mapContainer.blockSize.width/f.mapContainer.containerSize.width),y:Math.floor(f.zoomOptions.sizes[h]*f.mapContainer.blockSize.height/f.mapContainer.containerSize.height)}}});this.positionOrigin={browser:{x:this.mapContainer.containerSize.x,y:this.mapContainer.containerSize.y+this.mapContainer.containerSize.height},map:{x:0,y:0}};b(this);this.onCreate(this)
},move:function(e){this.positionOrigin.browser.x+=e.x;this.positionOrigin.browser.y-=e.y;this.onMove(this,e);return this},registerCallbackOnZoom:function(e){a.push(e);return this},translateToBrowser:function(f){var g={x:this.mapContainer.containerSize.x+this.mapContainer.elementSize.x,y:this.mapContainer.containerSize.y+this.mapContainer.elementSize.y};var e=this.mapContainer.blockSize.height/this.elementsPerBlock.y;return{x:(f.x-this.positionOrigin.map.x)*this.pixelPerTile.x+this.positionOrigin.browser.x-g.x,y:(this.positionOrigin.map.y-f.y)*this.pixelPerTile.y-e-g.y+this.positionOrigin.browser.y}},translateToMap:function(g,h){h=Object.merge({round:true,correct:true},h||{});var j={x:this.mapContainer.containerSize.x+this.mapContainer.elementSize.x,y:this.mapContainer.containerSize.y+this.mapContainer.elementSize.y};var f=this.mapContainer.blockSize.height/this.elementsPerBlock.y;if(typeof g.height!="undefined"){f=g.height}var e=null;if(h.round){e={x:Math.floor((g.x+j.x-this.positionOrigin.browser.x)/this.pixelPerTile.x)+this.positionOrigin.map.x,y:this.positionOrigin.map.y-Math.floor((g.y+f+(j.y-this.positionOrigin.browser.y))/this.pixelPerTile.y)}
}else{e={x:((g.x+j.x-this.positionOrigin.browser.x)/this.pixelPerTile.x)+this.positionOrigin.map.x-1,y:this.positionOrigin.map.y-((g.y+f+(j.y-this.positionOrigin.browser.y))/this.pixelPerTile.y)}}if(g.width){e.right=e.x+g.width/this.pixelPerTile.x-1}if(g.height){e.bottom=e.y+g.height/this.pixelPerTile.y-1}if(h.correct){e=d(e,this)}return e},zoom:function(f){var e=this;if(f==0||(f<0&&this.zoomLevel+f<1)||(f>0&&this.zoomLevel+f>this.zoomOptions.sizes.length)){return false}this.zoomLevel+=f;b(this);this.onZoom(this);a.each(function(g){g(e)});return true}})})();Travian.Game.Map.Transition.Precision=2;Travian.Game.Map.Updater=(function(){var c=window.location.href.split("/").slice(0,-1).join("/")+"/";var b=function(g){if(g.objects.ajax.getLength()<=0){return false}g.updateWorking(+1);var f=[];g.objects.ajax.each(function(j){var h=j.getRequestData();if(h!==false){f.push(h)}});g.requestObject.multiple=Travian.ajax({url:g.url,data:Object.merge({},g.parameters.multiple,{data:f,zoomLevel:g.transition.zoomLevel}),onSuccess:function(h){g.updateWorking(-1);
g.setContentDataAndRefresh(h);d(g)},onFailure:function(h){g.updateWorking(-1);g.setContentDataAndRefresh(h);d(g)}});return true};var a=function(h,g){h.updateWorking(+1);var f={x0:g.position.x+h.options.positionOptions.areaAroundPosition[h.transition.zoomLevel].left,y0:g.position.y+h.options.positionOptions.areaAroundPosition[h.transition.zoomLevel].top,x1:g.position.x+h.options.positionOptions.areaAroundPosition[h.transition.zoomLevel].right,y1:g.position.y+h.options.positionOptions.areaAroundPosition[h.transition.zoomLevel].bottom};if(h.requestObject.position){h.requestObject.position.cancel();h.requestObject.position=null;h.updateWorking(-1)}h.requestObject.position=Travian.ajax({url:h.url,data:Object.merge({},h.parameters.position,{data:Object.merge({},g.position,{zoomLevel:h.transition.zoomLevel,ignorePositions:h.dataStore.getPositionsOfData(g.dataStoreType).inject([],function(k,j){if(Travian.Game.Map.isMapPositionInRect(f,j)){k.push(Travian.Game.Map.xy2id(j.x,j.y))}return k})})}),onSuccess:function(j){h.updateWorking(-1);
(g.onSuccess||Travian.emptyFunction)(j)},onFailure:function(j){h.updateWorking(-1);(g.onFailure||Travian.emptyFunction)(j)}})};var e=function(g,f){f.element.src=f.srcUrl;if(f.finishedLoading){f.finishedLoading()}delete (g.loadings[f.blockContainer.updaterId][f.updaterId]);if(g.loadings[f.blockContainer.updaterId].getLength()==0){f.blockContainer.layers.loading.hide()}g.requestCountImages--;g.updateWorking(-1);d(g)};var d=function(f){if(f.requestCountImages>=f.maxRequestCount){return}if(f.objects.images.getLength()==0){return}f.objects.images.sort(function(k,j){var h=k.getPriority();var g=j.getPriority();if(h<g){return -1}else{if(h>g){return 1}}return 0}).some(function(j,h){var g=e.pass([f,j]);delete (f.objects.images[j.updaterId]);f.requestCountImages++;f.updateWorking(+1);if(j.element.src.replace(c,"")==j.srcUrl){g.delay(1)}else{if(!j.imageLoader){j.imageLoader=$(new Image()).addEvent("load",g)}j.refreshSrcUrl();j.imageLoader.src=j.srcUrl}return f.requestCountImages>=f.maxRequestCount})
};return new Class({Extends:Travian.Game.Map.Base,lastRequestPosition:{x:null,y:null},loadings:{},requestCount:0,requestCountImages:0,requestDelayId:{multiple:null,position:null},requestImages:$H({}),requestObject:{multiple:null,position:null},objects:null,classType:"Travian.Game.Map.Updater",initialize:function(f,g){this.parent(f,g);this.objects={ajax:$H({}),images:$H({})};this.elementWorking=$(this.elementWorking)},register:function(g,f){var h=this;if(!this.objects[g]){return this}if(!f.updaterId){f.updaterId=Travian.Game.Map.getNewId()}if(!this.objects[g][f.updaterId]){this.objects[g][f.updaterId]=f}if(g=="images"){if(!f.blockContainer.updaterId){f.blockContainer.updaterId=Travian.Game.Map.getNewId()}if(!this.loadings[f.blockContainer.updaterId]){this.loadings[f.blockContainer.updaterId]=$H({})}this.loadings[f.blockContainer.updaterId][f.updaterId]=true;f.blockContainer.layers.loading.show()}this.request();return this},request:function(){var f=this;if(this.requestObject.multiple&&this.requestObject.multiple.cancel){this.requestObject.multiple.cancel();
this.requestObject.multiple=null;this.updateWorking(-1)}if(this.requestDelayId.multiple){clearTimeout(this.requestDelayId.multiple);this.requestDelayId.multiple=null}this.requestDelayId.multiple=(function(){if(b(f)===false){d(f)}}).delay(this.requestDelayTime.multiple);return this},requestPosition:function(f){var g=this;if(this.lastRequestPosition.x==f.position.x&&this.lastRequestPosition.y==f.position.y){return this}this.lastRequestPosition.x=f.position.x;this.lastRequestPosition.y=f.position.y;if(this.requestObject.position&&this.requestObject.position.cancel){this.requestObject.position.cancel();this.requestObject.position=null;this.updateWorking(-1)}if(this.requestDelayId.position){clearTimeout(this.requestDelayId.position);this.requestDelayId.position=null}this.requestDelayId.position=(function(){a(g,f)}).delay(this.requestDelayTime.position);return this},setContentDataAndRefresh:function(f){var g=this;if(f.blocks){Object.each(f.blocks,function(j,h){Object.each(j,function(k,l){Object.each(k,function(n,m){Object.each(n,function(s,q){var o={x:h,y:l,right:m,bottom:q};
var r=Object.merge({},g.dataStore.get(Travian.Game.Map.DataStore.TYPE_BLOCKS,o,"block")||{},s);g.dataStore.push({type:Travian.Game.Map.DataStore.TYPE_BLOCKS,position:o,index:"block",data:r})})})})});this.mapContainer.invalidateBlockVersionCache()}if(f.elements){this.dataStore.setMultiple(Travian.Game.Map.DataStore.TYPE_TILE,f.elements)}this.objects.ajax.each(function(h){if(h.refreshContent){h.refreshContent()}delete (g.objects.ajax[h.updaterId])});return this},updateWorking:function(f){this.requestCount+=f;if(this.requestCount<0){this.requestCount=0}if(this.elementWorking){if(this.requestCount>0){this.elementWorking.setStyles({visibility:"visible"})}else{this.elementWorking.setStyles({visibility:"hidden"})}this.elementWorking.set("html",this.requestCount)}return this}})})();Travian.Game.Map.ContextMenu=new Class({Implements:[Options,Events],options:{actions:{},menu:"contextmenu",stopEvent:true,targets:"body",trigger:"contextmenu",offsets:{x:0,y:0},onShow:Travian.emptyFunction,onHide:Travian.emptyFunction,onClick:Travian.emptyFunction,fadeSpeed:200},classType:"Travian.Game.Map.ContextMenu",parentContainer:null,mapPosition:null,addAction:function(b){var d=this;
var c=false;b.element=$(b.element);if(b.element&&Browser.ie6){c=b.element.hasClass("hideIE6")}if(b.element&&!c){var a=b.element.down("a");if(a){a.addEvent("click",function(f){b.fn(d,d.mapPosition,d.contentData)});this.actions.push(b)}else{b.element.hide()}}return this},disable:function(){this.options.disabled=true;return this},disableItem:function(a){this.menu.getElements("a[href$="+a+"]").addClass("disabled");return this},enable:function(){this.options.disabled=false;return this},enableItem:function(a){this.menu.getElements("a[href$="+a+"]").removeClass("disabled");return this},execute:function(b,a){if(this.options.actions[b]){this.options.actions[b](a,this)}return this},hide:function(){if(this.shown){this.fx.start(0);this.parentContainer.enableEvents();this.fireEvent("hide");this.shown=false}return this},initialize:function(a,c){var b=this;this.setOptions(a);this.parentContainer=c;this.menu=document.id(this.options.menu);this.targets=$$(this.options.targets);this.fx=new Fx.Tween(this.menu,{property:"opacity",duration:this.options.fadeSpeed,onComplete:function(){b.menu.setStyles({display:b.shown?"block":"none"})
}});this.hide().startListener();this.menu.setStyles({position:"absolute",top:"-900000px",display:"block"});$(a.menu).dispose().inject(document.body);this.actions=[];a.actions.each(function(d){b.addAction(d)});this.targets.each(function(d){d.addEvent(b.options.trigger,function(f){b.mapPosition=b.parentContainer.transition.translateToMap({x:f.page.x-b.parentContainer.containerSize.x-b.parentContainer.elementSize.x,y:f.page.y-b.parentContainer.containerSize.y-b.parentContainer.elementSize.y});b.update()})})},show:function(){this.fx.start(1);this.parentContainer.disableEvents();this.fireEvent("show");this.shown=true;return this},startListener:function(){var a=this;this.targets.each(function(b){b.addEvent(a.options.trigger,function(c){if(c.target==a.parentContainer.containerMover&&!a.options.disabled){if(a.options.stopEvent){c.stop()}a.options.element=document.id(b);a.menu.setStyles({top:(c.page.y+a.options.offsets.y),left:(c.page.x+a.options.offsets.x),position:"absolute"});a.show()}})});this.menu.getElements("a").each(function(b){b.addEvent("click",function(c){if(!b.hasClass("disabled")){a.execute(b.get("href").split("#")[1],document.id(a.options.element));
a.fireEvent("click",[b,c])}})});document.id(document.body).addEvent("click",function(){a.hide()});return this},update:function(){var a=this;if(this.options.disabled||!this.shown){return this}this.contentData=this.parentContainer.dataStore.get(Travian.Game.Map.DataStore.TYPE_TOOLTIP,this.mapPosition);this.actions.each(function(b){if(b.displayOn===true||(a.contentData!=null&&a.contentData[b.displayOn])){b.element.show()}else{b.element.hide()}});Object.each(this.options.separators,function(d){var c=a.menu.down(d.selector);if(!c){return}var b=0;d.elements.each(function(e){var f=a.menu.down(e);if(!f){return}if(f.isDisplayed()){b++}return});c[b>0?"show":"hide"]().getPrevious()[b>0?"show":"hide"]()});return this}});Travian.Game.Map.DataStore=(function(){var f=0;var e=function(g){Object.each(g.options.useStorageForType,function(j,h){if(j){Travian.Storage.set("mapDataContainer."+h,g.data[h],g.options.persistentStorage)}})};var c=function(j,m,g){var k=g.x;var n=g.y;var h=typeof g.right!="undefined"?g.right:k;
var l=typeof g.bottom!="undefined"?g.bottom:n;if(!j.data[m]){j.data[m]={all:$H()}}if(!j.data[m][k]){j.data[m][k]={}}if(!j.data[m][k][n]){j.data[m][k][n]={}}if(!j.data[m][k][n][h]){j.data[m][k][n][h]={}}if(!j.data[m][k][n][h][l]){j.data[m][k][n][h][l]={}}if(!j.data[m][k][n][h][l].id){f++;j.data[m][k][n][h][l].id=f}j.data[m][k][n][h][l].position=g;return j.data[m][k][n][h][l]};var b=function(j,m,g){var k=g.x;var n=g.y;var h=typeof g.right!="undefined"?g.right:k;var l=typeof g.bottom!="undefined"?g.bottom:n;if(!j.data[m]){return null}if(!j.data[m][k]){return null}if(!j.data[m][k][n]){return null}if(!j.data[m][k][n][h]){return null}if(!j.data[m][k][n][h][l]){return null}if(d(j,j.data[m][k][n][h][l],m)){return null}return j.data[m][k][n][h][l]};var d=function(g,j,h){return j.time!==false&&(new Date()).getTime()-j.time>g.cachingTimeForType[h]};var a=new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.DataStore",data:null,get:function(j,g,h){var k=b(this,j,g);if(k==null){return null
}if(typeof h!="undefined"){if(k.data[h]){return k.data[h]}return null}return k.data},getDataForArea:function(k,h,n){var l=this;var g=[];var m=null;var j=Object.clone(h);if(!this.data[k]||!this.data[k].all){return g}if(j.x>j.right){j.right+=this.parentContainer.transition.border.width}if(j.y>j.bottom){j.bottom+=this.parentContainer.transition.border.height}this.data[k].all.each(function(o){var q={x:o.position.x,y:o.position.y};if(j.x>q.x){q.x+=l.parentContainer.transition.border.width}if(j.y>q.y){q.y+=l.parentContainer.transition.border.height}if(d(l,o,k)===false&&j.x<=q.x&&q.x<=j.right&&j.y<=q.y&&q.y<=j.bottom){if(n){Object.each(o.data,function(r){g.push(r)})}else{g.push(o.data)}}});return g},getPositionsOfData:function(g){var h=this;if(!this.data[g]||!this.data[g].all){return[]}return this.data[g].all.inject([],function(k,j){if(d(h,j,g)===false){k.push(j.position)}return k})},initialize:function(g,j){var h=this;this.parent(g,j);this.data={};Object.each(this.options.clearStorageForType,function(l,k){if(l){Travian.Storage.clear("mapDataContainer."+k,h.options.persistentStorage)
}});this.options.useStorageForType=$H(this.options.useStorageForType).inject($H(),function(m,n,k){if(n){m[k]=true;h.data[k]=Travian.Storage.get("mapDataContainer."+k,h.options.persistentStorage)||{};if(!h.data[k].all){h.data[k].all=$H({})}else{h.data[k].all=$H(h.data[k].all);var l=h.data[k].all.getKeys().max();if(l>f){f=l}}}return m})},push:function(g){if(typeof g.time=="undefined"){g.time=(new Date()).getTime()}if(g.time==-1){g.time=false}g=Travian.Game.Map.remapShortParameters(g);var h=c(this,g.type,g.position);if(!h.data){h.data={}}h.data[g.index]=g.data;h.time=g.time;this.data[g.type].all[h.id]=h;return this},refresh:function(g){var h=b(this,g.type,g.position);if(h!=null){if(typeof g.time=="undefined"){g.time=(new Date()).getTime()}if(g.time==-1){g.time=false}h.time=g.time}return this},remove:function(j,g,h){var k=b(this,j,g);if(k==null){return this}if(typeof h!="undefined"){if(k.data[h]){delete (k.data[h])}return this}k.time=0;return this},saveDataToStorage:function(){e(this);return this
},set:function(g){var h=this;if(typeof g.time=="undefined"){g.time=(new Date()).getTime()}if(g.time==-1){g.time=false}g=Travian.Game.Map.remapShortParameters(g);var j=c(this,g.type,g.position);j.data=g.data;j.time=g.time;this.data[g.type].all[j.id]=j;if(g.data.symbols){g.data.symbols.each(function(l,k){if(!l.dataId){l.dataId=l.type+"-"+k}l=Travian.Game.Map.remapShortParameters(l);if(!l.position){l.position=g.position}h.push({type:Travian.Game.Map.DataStore.TYPE_SYMBOL,position:g.position,data:l,index:l.dataId,time:false})})}return this},setMultiple:function(h,g,k){var j=this;g.each(function(l){l=Travian.Game.Map.remapShortParameters(l);j.set({type:h,position:l.position,data:l,time:k})});e(this);return this}});a.TYPE_BLOCKS="blocks";a.TYPE_SYMBOL="symbol";a.TYPE_TILE="tile";a.TYPE_TOOLTIP="tooltip";return a})();Travian.Game.Map.Tips={lastText:"",lastTitle:"",tooltipHtml:'<span class="xCoord">({x}</span><span class="pi">|</span><span class="yCoord">{y})</span><span class="clear"></span>',render:function(c,a){var b=this;
a.setTitle({title:"",text:""}).addEvents({mousemove:function(g){var f={x:g.page.x-c.containerSize.x-c.elementSize.x,y:g.page.y-c.containerSize.y-c.elementSize.y};var d=c.getContentForTooltip(f,g);if(d===false){d={title:"",text:b.tooltipHtml.substitute(c.transition.translateToMap(f))}}if(b.lastText!=d.text||b.lastTitle!=d.title){d.unescaped=true;Travian.Tip.show(d);b.lastText=d.text;b.lastTitle=d.title}}});return this}};Travian.Game.Map.Rulers=(function(){var b=function(g,f){f+=g.delta.x[g.transition.zoomLevel];if(f<g.transition.border.left){f=g.transition.border.right-(g.transition.border.left-f)+1}else{if(f>g.transition.border.right){f=g.transition.border.left+(f-g.transition.border.right)-1}}return f};var a=function(g,f){f+=g.delta.y[g.transition.zoomLevel];if(f<g.transition.border.top){f=g.transition.border.bottom-(g.transition.border.top-f)+1}else{if(f>g.transition.border.bottom){f=g.transition.border.top+(f-g.transition.border.bottom)-1}}return f};var e=function(f){f.elements.moverX.setStyles({backgroundImage:"url("+f.imgSource.x.substitute({zoomLevel:f.transition.zoomLevel})+")"});
f.elements.moverY.setStyles({backgroundImage:"url("+f.imgSource.y.substitute({zoomLevel:f.transition.zoomLevel})+")"})};var d=function(m){if(m.elements.coordinates){m.elements.coordinates.x.invoke("dispose");m.elements.coordinates.y.invoke("dispose")}m.elements.coordinates={x:[],y:[]};var n=m.transition.elementsInView.x+m.transition.elementsPerBlock.x*2;var l=m.steps.x[m.transition.zoomLevel];for(var f=0,g=null,j=null;f<n;f+=l){g=(new Element("div",{"class":"coordinate zoom"+m.transition.zoomLevel,styles:{position:"absolute",left:f*m.mapContainer.blockSize.width/m.transition.elementsPerBlock.x,top:0,width:l*m.mapContainer.blockSize.width/m.transition.elementsPerBlock.x,height:m.containerSize.height}})).inject(m.elements.moverX,"bottom");g.rulerLeft=f*m.mapContainer.blockSize.width/m.transition.elementsPerBlock.x;j=g.getDimensions({computeSize:true});g.setStyles({width:j.width-j["padding-left"]-j["padding-right"],height:j.height-j["padding-top"]-j["padding-bottom"]});m.elements.coordinates.x[f]=g
}var k=m.transition.elementsInView.y+m.transition.elementsPerBlock.y*2;var h=m.steps.y[m.transition.zoomLevel];for(var f=0,g=null,j=null;f<k;f+=h){g=(new Element("div",{"class":"coordinate zoom"+m.transition.zoomLevel,styles:{position:"absolute",left:0,top:f*m.mapContainer.blockSize.height/m.transition.elementsPerBlock.y,width:m.containerSize.width,height:h*m.mapContainer.blockSize.height/m.transition.elementsPerBlock.y}})).inject(m.elements.moverY,"bottom");g.rulerTop=f*m.mapContainer.blockSize.height/m.transition.elementsPerBlock.y;j=g.getDimensions({computeSize:true});if(j.height-j["padding-top"]-j["padding-bottom"]>0){g.setStyles({width:j.width-j["padding-left"]-j["padding-right"],height:j.height-j["padding-top"]-j["padding-bottom"]})}else{g.setStyles({height:0})}m.elements.coordinates.y[f]=g}c(m,true,true)};var c=function(j,g,f){var h=false;do{h=false;if(j.position.x<-2*j.mapContainer.blockSize.width){j.position.x+=1*j.mapContainer.blockSize.width;g=true;h=true}if(j.position.x>0){j.position.x+=-1*j.mapContainer.blockSize.width;
g=true;h=true}if(j.position.y<-2*j.mapContainer.blockSize.height){j.position.y+=1*j.mapContainer.blockSize.height;f=true;h=true}if(j.position.y>0){j.position.y+=-1*j.mapContainer.blockSize.height;f=true;h=true}}while(h);j.elements.moverX.setStyles({left:j.position.x});j.elements.moverY.setStyles({top:j.position.y});if(g&&j.elements.coordinates){j.elements.coordinates.x.each(function(m,k){if(m){var l=j.transition.translateToMap({x:j.position.x+m.rulerLeft-j.mapContainer.elementSize.x,y:0});m.set("html",b(j,l.x))}})}if(f&&j.elements.coordinates){j.elements.coordinates.y.each(function(l){if(l){var k=j.transition.translateToMap({x:0,y:j.position.y+l.rulerTop-j.mapContainer.elementSize.y});l.set("html",a(j,k.y))}})}};return new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.Rulers",destroy:function(){this.elements.containerX.dispose();this.elements.containerY.dispose();return this},initialize:function(f,g){if(!f.direction){f.direction=$(document.body).getStyle("direction")}this.parent(f,g);
this.position={x:0,y:0}},render:function(){var f=this;this.position={x:this.mapContainer.blockSize.width,y:this.mapContainer.blockSize.height};Object.each(this.mapContainer.blocks,function(g){if(f.position.x>g.position.x){f.position.x=g.position.x}if(f.position.y>g.position.y){f.position.y=g.position.y}});this.elements={containerX:(new Element("div")).addClass(this.cls.x).inject(this.mapContainer.containerRender,"bottom").setStyles({position:"absolute",left:0,right:0,width:this.mapContainer.containerViewSize.width,overflow:"hidden"}),containerY:(new Element("div")).addClass(this.cls.y).inject(this.mapContainer.containerRender,"bottom").setStyles({position:"absolute",top:0,bottom:0,height:this.mapContainer.containerViewSize.height,overflow:"hidden"})};this.containerSize={width:this.elements.containerY.getDimensions({computeSize:true}).width,height:this.elements.containerX.getDimensions({computeSize:true}).height};this.elements.containerX.setStyles({height:this.containerSize.height});if(this.direction.toLowerCase()=="ltr"){this.elements.containerY.setStyles({left:-this.containerSize.width})
}else{if(this.direction.toLowerCase()=="rtl"){this.elements.containerY.setStyles({right:-this.containerSize.width})}}this.elements.moverX=new Element("div",{styles:{position:"absolute",left:0,top:0,width:this.mapContainer.containerSize.width+2*this.mapContainer.blockSize.width,height:"100%",backgroundPosition:"left top",backgroundColor:"transparent",backgroundRepeat:"repeat-x"}}).inject(this.elements.containerX,"bottom");this.elements.moverY=new Element("div",{styles:{position:"absolute",left:0,top:0,width:"100%",height:this.mapContainer.containerSize.height+2*this.mapContainer.blockSize.height,backgroundPosition:"left top",backgroundColor:"transparent",backgroundRepeat:"repeat-y"}}).inject(this.elements.containerY,"bottom");e(this);d(this);c(this);return this},move:function(f){this.position.x+=f.x;this.position.y-=f.y;c(this);return this},zoom:function(){e(this);d(this);c(this);return this}})})();Travian.Game.Map.MiniMap=(function(){var c=Travian.emptyFunction;if(Browser.opera){c=function(e){var d=e.elements.background.getStyle("bottom");
e.elements.background.setStyles({bottom:0});(function(){e.elements.background.setStyles({bottom:d})}).delay(0.1)}}var b=function(k){var f=k.transition.translateToMap({x:-k.mapContainer.elementSize.x,y:-k.mapContainer.elementSize.y},false);var j=k.transition.translateToMap({x:0,y:0,width:k.mapContainer.containerViewSize.width,height:k.mapContainer.containerViewSize.height},{round:false,correct:false});j.width=j.right-j.x;j.height=j.bottom-j.y;var h={x:k.containerSize.width/k.transition.border.width,y:k.containerSize.height/k.transition.border.height};k.position.width=j.width*h.x;k.position.height=j.height*h.y;k.position.x=f.x*h.x;k.position.x+=k.containerSize.width/2;k.position.y=-f.y*h.y;k.position.y+=k.containerSize.height/2;var g={x:k.position.x-k.elementSize["border-left-width"],y:k.position.y-k.elementSize["border-top-width"]-k.elementSize["border-bottom-width"],width:k.position.width+k.elementSize["border-left-width"]+k.elementSize["border-right-width"],height:k.position.height+k.elementSize["border-top-width"]+k.elementSize["border-bottom-width"]};
if(g.width>=k.containerSize.width){g.x=-1}if(g.height>=k.containerSize.height){g.y=-1}k.element.setStyles({left:g.x,top:g.y,width:g.width,height:g.height});var e=Object.clone(g);var d=false;if(g.width>=k.containerSize.width){d=true}else{if(g.x<0){g.x+=k.containerSize.width;d=true}else{if(g.x+g.width>k.containerSize.width){g.x-=k.containerSize.width;d=true}}}if(g.height>=k.containerSize.height){d=true}else{if(g.y<0){g.y+=k.containerSize.height;d=true}else{if(g.y+g.height>k.containerSize.height){g.y-=k.containerSize.height;d=true}}}k.elementHelpers[0].setStyles({left:g.x,top:g.y,width:g.width,height:g.height,display:d?"block":"none"});k.elementHelpers[1].setStyles({left:e.x,top:g.y,width:g.width,height:g.height,display:(g.x<0&&g.y<0&&g.x+g.width>0&&g.y+g.height>0)?"block":"none"});k.elementHelpers[2].setStyles({left:g.x,top:e.y,width:g.width,height:g.height,display:(g.x<0&&g.y<0&&g.x+g.width>0&&g.y+g.height>0)?"block":"none"})};var a=function(g,f){var d={x:f.containerSize.width/f.transition.border.width,y:f.containerSize.height/f.transition.border.height};
return{x:Math.floor((g.page.x-f.containerPosition.x)/d.x-Math.abs(f.transition.border.left)),y:-Math.floor((g.page.y-f.containerPosition.y)/d.y-Math.abs(f.transition.border.top))}};return new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.MiniMap",expanded:false,animate:function(){var d=this;if(this.elements.headlineExpander._fx&&this.elements.headlineExpander._fx.cancel){this.elements.headlineExpander._fx.cancel()}if(this.elements.headlineExpander.hasClass("expand")){this.expanded=true;this.cookie.set("minimap-expanded",true);this.elements.headlineExpander.removeClass("expand").addClass("collapse");this.elements.headlineExpander._fx=(new Fx.Morph(this.elements.container,{onComplete:function(){c(d)}})).start({height:[this.elements.container.getSize().y,this.elements.container._height.max]});this.parentContainer.outline.update(this.elements.container.getSize().y-this.elements.container._height.max)}else{this.expanded=false;this.cookie.set("minimap-expanded",false);this.elements.headlineExpander.removeClass("collapse").addClass("expand");
this.elements.headlineExpander._fx=(new Fx.Morph(this.elements.container,{onComplete:function(){c(d)}})).start({height:[this.elements.container.getSize().y,this.elements.container._height.min]});this.parentContainer.outline.update(this.elements.container.getSize().y-this.elements.container._height.min)}return this},getContentForTooltip:function(d,g){var f=a(g,this);return{text:this.tooltipHtml.substitute(f)}},initialize:function(d,e){this.parent(d,e);this.position={x:0,y:0,width:0,height:0}},render:function(){var f=this;this.container=$(this.container).setStyles({overflow:"hidden"}).disableSelection().addEvent("click",function(h){f.mapContainer.moveTo(a(h,f))});this.parent({nodeType:"div"}).element.addClass("view").setStyles({position:"absolute",zIndex:3}).inject(this.container,"bottom");(new Element("div",{"class":"inner",styles:{height:"100%",opacity:0.25,width:"100%"}})).inject(this.element,"bottom");this.elementHelpers=[];for(var e=0;e<3;e++){var d=(new Element("div",{"class":"view",styles:{position:"absolute",zIndex:3,display:"none"}})).inject(this.container,"bottom");
(new Element("div",{"class":"inner",styles:{height:"100%",opacity:0.25,width:"100%"}})).inject(d,"bottom");this.elementHelpers.push(d)}this.containerSize=this.container.getDimensions({computeSize:!(Browser.chrome||Browser.safari)});this.containerPosition=this.container.getPosition();this.elementSize=this.element.getDimensions({computeSize:true});if(this.showToolTip){Travian.Game.Map.Tips.render(this,this.container.down("img"))}b(this);this.elements={container:$(this.containerContent),headline:$(this.containerContent).down(".headline"),headlineExpander:$(this.containerContent).down(".headline").down(".iconButton"),background:$(this.containerContent).down(".background")};this.elements.headlineExpander.addClass(this.cookie.get("minimap-expanded")===true?"collapse":"expand");var g=function(){f.elements.container._height={max:f.elements.container.getSize().y,min:f.elements.headline.getSize().y+parseInt(f.elements.headline.getStyle("margin-top"))+parseInt(f.elements.headline.getStyle("margin-bottom"))};
if(f.elements.container._height.min<0){f.elements.container._height.min=0}if(f.elements.container._height.max<0){f.elements.container._height.max=0}if(f.cookie.get("minimap-expanded")!==true){f.elements.container.setStyles({height:f.elements.container._height.min});c(f)}f.elements.headlineExpander.addEvent("click",function(h){f.animate()})};if(Browser.chrome||Browser.safari){g.delay(300)}else{g()}},move:function(){b(this);return this},zoom:function(){b(this);return this}})})();Travian.Game.Map.Toolbar=new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.Toolbar",initialize:function(a,b){this.parent(a,b)},render:function(){var c=this;var a=null;this.element=$(this.element);this.zoomIn=this.element.down(".zoomIn").addEvent("click",function(d){c.mapContainer.zoomIn()});this.zoomOut=this.element.down(".zoomOut").addEvent("click",function(d){c.mapContainer.zoomOut()});var b=function(){c.zoomDropDownDataContainer._dropped=false;c.zoomDropDownDataContainer.setStyles({height:c.zoomDropDownDataContainer._styleBackup.height});
c.zoomDropDownEntries.each(function(d){if(d.hasClass("selected")){d.addClass("display")}d.addClass("hide").removeClass("selected")});c.zoomDropDownEntries[c.transition.zoomLevel-1].removeClass("hide").addClass("display")};this.zoomDropDownDataContainer=this.element.down(".dropdown .dataContainer");this.zoomDropDownEntries=this.zoomDropDownDataContainer.getElements(".entry");this.zoomDropDownDataContainer._styleBackup={height:this.zoomDropDownDataContainer.getStyle("height"),maxHeight:this.zoomDropDownEntries.inject(0,function(e,d){return e+parseInt(d.getStyle("height"))})};this.zoomDropDownClick=this.element.down(".dropdown .dropDownImage").addEvent("click",function(d){if(!c.mapContainer.isEventsEnabled()){return}d.stop();if(c.zoomDropDownDataContainer._dropped){b();return}c.zoomDropDownDataContainer._dropped=true;c.zoomDropDownEntries.each(function(e){if(e.hasClass("display")){e.addClass("selected")}e.removeClass("display").removeClass("hide")});c.zoomDropDownDataContainer.setStyles({height:Browser.opera?"auto":c.zoomDropDownDataContainer._styleBackup.maxHeight})
});this.zoomDropDownEntries.each(function(e,d){e.addEvent("click",function(f){f.stop();if(!c.zoomDropDownDataContainer._dropped){return}c.zoomDropDownDataContainer._dropped=false;c.zoomDropDownDataContainer.setStyles({height:c.zoomDropDownDataContainer._styleBackup.height});c.zoomDropDownEntries.each(function(g){g.addClass("hide").removeClass("selected")});e.removeClass("hide").addClass("display");c.mapContainer.zoom(d+1-c.mapContainer.transition.zoomLevel,c.mapContainer.transition.getPointOfCenterInView())})});$(document.body).addEvent("click",function(){if(c.zoomDropDownDataContainer._dropped){b();return}});a=this.element.down(".viewFull");if(a){this.viewFull=a.addEvent("click",function(d){window.location.href=c.viewFullScreenUrl.substitute(Object.merge({},c.mapContainer.transition.getPointOfCenterInView(),{zoom:c.mapContainer.transition.zoomLevel}))})}a=this.element.down(".viewNormal");if(a){this.viewNormal=this.element.down(".viewNormal").addEvent("click",function(d){window.location.href=c.viewNormalUrl.substitute(Object.merge({},c.mapContainer.transition.getPointOfCenterInView(),{zoom:c.mapContainer.transition.zoomLevel}))
})}this.filterPlayer=this.element.down(".filterMy").addEvent("click",function(d){Travian.ajax({data:{cmd:"mapSetting",data:{type:"outline",outline:"user"}},onSuccess:function(e){c.filterPlayer[e.result?"addClass":"removeClass"]("checked");c.filterPlayer.checked=e.result;c.mapContainer.forceUpdateBlocksLayer("imageMark").forceUpdateBlocksSymbols("player",e.result)}})});this.filterPlayer.checked=this.filterPlayer.hasClass("checked");this.filterAlliance=this.element.down(".filterAlliance");if(!this.filterAlliance.hasClass("disabled")){this.filterAlliance.addEvent("click",function(d){Travian.ajax({data:{cmd:"mapSetting",data:{type:"outline",outline:"alliance"}},onSuccess:function(e){c.filterAlliance[e.result?"addClass":"removeClass"]("checked");c.filterAlliance.checked=e.result;c.mapContainer.forceUpdateBlocksLayer("imageMark").forceUpdateBlocksSymbols("alliance",e.result)}})});this.filterAlliance.checked=this.filterAlliance.hasClass("checked")}a=this.element.down(".linkCropfinder");if(a){a.addEvent("click",function(d){window.location.href="cropfinder.php"
})}this.coordinateEnter=$("mapCoordEnter").addEvent("submit",function(d){var f={x:parseInt(c.coordinateEnter.down("input.coordinates.x").value),y:parseInt(c.coordinateEnter.down("input.coordinates.y").value)};if(!f.x.isNaN()&&!f.y.isNaN()){c.mapContainer.moveTo(f)}d.stop();return false});this.update()},update:function(){var a=this;if(this.transition.zoomLevel==1){this.zoomIn.addClass("disabled");this.zoomOut.removeClass("disabled")}else{if(this.transition.zoomLevel==this.transition.zoomOptions.sizes.length){this.zoomIn.removeClass("disabled");this.zoomOut.addClass("disabled")}else{this.zoomIn.removeClass("disabled");this.zoomOut.removeClass("disabled")}}this.zoomDropDownEntries.each(function(b){if(a.zoomDropDownDataContainer._dropped){b.removeClass("selected")}else{b.addClass("hide").removeClass("display")}});this.zoomDropDownEntries[this.transition.zoomLevel-1].removeClass("hide").addClass(this.zoomDropDownDataContainer._dropped?"selected":"display")},zoom:function(){this.update()}});Travian.Game.Map.Outline=(function(){var a=Travian.emptyFunction;
if(Browser.opera){a=function(c){var b=c.elements.background.getStyle("top");c.elements.background.setStyles({top:0});(function(){c.elements.background.setStyles({top:b})}).delay(0.1)}}return new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.Outline",expanded:false,animate:function(){var b=this;if(this.elements.headlineExpander._fx&&this.elements.headlineExpander._fx.cancel){this.elements.headlineExpander._fx.cancel()}if(this.expanded==false){this.expanded=true;this.elements.tabContainer.show();this.cookie.set("outline-expanded",true);this.elements.headlineExpander.removeClass("expand").addClass("collapse");this.elements.headlineExpander._fx=(new Fx.Morph(this.element,{onComplete:function(){a(b);Object.each(b.parentContainer.mapMarks,function(c){c.update(false)})}})).start({height:[this.element.getSize().y,this.element._height.max]})}else{this.expanded=false;this.cookie.set("outline-expanded",false);this.elements.headlineExpander.removeClass("collapse").addClass("expand");
this.elements.headlineExpander._fx=(new Fx.Morph(this.element,{onComplete:function(){a(b);b.elements.tabContainer.hide()}})).start({height:[this.element.getSize().y,this.element._height.min]})}return this},initialize:function(b,c){this.parent(b,c);this.render()},render:function(){var b=this;this.selector="#"+this.element;this.element=$(this.element);this.elements={headline:this.element.down(".headline"),headlineExpander:this.element.down(".headline").down(".iconButton"),tabContainer:this.element.down(".tabContainer"),mapMarks:this.element.down("#mapMarks"),background:this.element.down(".background")};this.elements.headlineExpander.addClass(this.cookie.get("outline-expanded")===true?"collapse":"expand");var c=function(){b.element._height={max:b.parentContainer.containerViewSize.height-parseInt(b.element.getStyle("bottom"))-b.parentContainer.miniMap.elements.container.getSize().y-2,min:b.element.getSize().y};if(b.element._height.min<0){b.element._height.min=0}if(b.element._height.max<0){b.element._height.max=0
}b.elements.tabContainer.hide();if(b.cookie.get("outline-expanded")===true){b.expanded=true;b.elements.tabContainer.show();b.element.setStyles({height:b.element._height.max});Object.each(b.parentContainer.mapMarks,function(d){d.update(false)});a(b)}b.elements.headlineExpander.addEvent("click",function(d){b.animate()})};if(Browser.chrome||Browser.safari){c.delay(300)}else{c()}return this},update:function(b){var c=this;this.element._height.max+=b;if(this.element._height.min<0){this.element._height.min=0}if(this.element._height.max<0){this.element._height.max=0}if(this.expanded){if(this.elements.headlineExpander._fx&&this.elements.headlineExpander._fx.cancel){this.elements.headlineExpander._fx.cancel()}this.elements.headlineExpander._fx=(new Fx.Morph(this.element,{onComplete:function(){Object.each(c.parentContainer.mapMarks,function(d){d.update(false)});a(c)}})).start({height:[this.element.getSize().y,this.element._height.max]})}return this}})})();Travian.Game.Map.Layer=(function(){return new Class({Extends:Travian.Game.Map.Base,element:null,index:null,position:null,classType:"Travian.Game.Map.Layer",finishedLoading:function(){return this
},forceUpdateContent:function(){return this},getContentForTooltip:function(a){return false},getRequestData:function(){return false},hide:function(){this.element.hide();return this},initialize:function(a,c){this.parent(a,c);if(this.position==null&&this.parentContainer!=null){var b=this.parentContainer.element.getSize();this.position={x:0,y:0,width:b.x,height:b.y}}if(this.parentContainer.classType=="Travian.Game.Map.Layer.Block"){this.blockContainer=this.parentContainer}else{if(this.parentContainer.blockContainer){this.blockContainer=this.parentContainer.blockContainer}}if(typeof a.version!="undefined"){this.setVersion(a.version)}this.render()},refreshContent:function(){return this},render:function(a){this.parent(a);if(this.id!=null){this.element.addClass(this.id)}if(this.position){this.element.setStyles({position:"absolute",left:this.position.x,top:this.position.y,width:this.position.width,height:this.position.height})}if(this.zIndex){this.element.setStyles({zIndex:this.zIndex+1})}if(this.parentContainer&&this.parentContainer.element){this.element.inject(this.parentContainer.element,"bottom")
}return this},setVersion:function(a){return this},show:function(){this.element.show();return this},update:function(){this.element.setStyles({left:this.position.x+"px",top:this.position.y+"px"});return this},updateContent:function(){return this}})})();Travian.Game.Map.Layer.Block=(function(){var b=function(l,k,j){if(typeof k.x=="undefined"){k.x=j.x}if(typeof k.y=="undefined"){k.y=j.y}k=Travian.Game.Map.remapShortParameters(k);if(typeof k.text=="undefined"&&typeof k.title=="undefined"){k.text=l.tooltipHtml.substitute(k.position)}return k};var c=function(r,o){var l=Object.clone(o);var k=r.transition.getPointOfCenterInView();var m=Object.clone(r.mapCoordinates);l.x=parseFloat(l.x);l.y=parseFloat(l.y);k.x=parseFloat(k.x);k.y=parseFloat(k.y);m.x=parseFloat(m.x);m.y=parseFloat(m.y);var n={x:(r.transition.border.right-Math.abs(l.x)<r.transition.border.right/2),y:(r.transition.border.bottom-Math.abs(l.y)<r.transition.border.bottom/2)};var q={x:(r.transition.border.right-Math.abs(k.x)<r.transition.border.right/2),y:(r.transition.border.bottom-Math.abs(k.y)<r.transition.border.bottom/2)};
var j={x:(r.transition.border.right-Math.abs(m.x)<r.transition.border.right/2),y:(r.transition.border.bottom-Math.abs(m.y)<r.transition.border.bottom/2)};if((n.x||q.x)&&(l.x.sgn()+k.x.sgn()==0&&l.x.sgn()!=k.x.sgn())){l.x+=k.x.sgn()*r.transition.border.width}if((n.y||q.y)&&(l.y.sgn()+k.y.sgn()==0&&l.y.sgn()!=k.y.sgn())){l.y+=k.y.sgn()*r.transition.border.height}if((j.x||q.x)&&(m.x.sgn()+k.x.sgn()==0&&m.x.sgn()!=k.x.sgn())){m.x+=k.x.sgn()*r.transition.border.width}if((j.y||q.y)&&(m.y.sgn()+k.y.sgn()==0&&m.y.sgn()!=k.y.sgn())){m.y+=k.y.sgn()*r.transition.border.height}return{x:(l.x-m.x)*r.transition.pixelPerTile.x,y:(r.transition.elementsPerBlock.y-(l.y-m.y)-1)*r.transition.pixelPerTile.y}};var g=function(r,o,l){if(!o.type){throw"Missing symbol type for symbol: "+o.dataId;return}var n=r.symbolTypes[o.type];if(!n||!n["class"]||!n.visibleInZoom[r.transition.zoomLevel]){return}if(!r.symbols[o.position.x]){r.symbols[o.position.x]={}}if(!r.symbols[o.position.x][o.position.y]){r.symbols[o.position.x][o.position.y]=$H({})
}var m=n.sizes[r.transition.zoomLevel];var q=c(r,l);var k=r.symbols[o.position.x][o.position.y];var j=e(r,n,k);k[o.dataId]=new n["class"](Object.merge({},n,o,{positionOfTile:{x:q.x,y:q.y},positionInTile:j,position:{x:q.x+j.x,y:q.y+j.y,width:n.sizes[r.transition.zoomLevel].width,height:n.sizes[r.transition.zoomLevel].height},positionDefault:{x:q.x+j.x,y:q.y+j.y,width:n.sizes[r.transition.zoomLevel].width,height:n.sizes[r.transition.zoomLevel].height},symbolSize:{width:n.sizes[r.transition.zoomLevel].width,height:n.sizes[r.transition.zoomLevel].height}}),r)};var f=function(j){h(j);j.symbols={};j.dataStore.getDataForArea(Travian.Game.Map.DataStore.TYPE_SYMBOL,j.mapCoordinates,true).each(function(k){g(j,k,k.position)})};var h=function(j){if(j.symbols){Object.each(j.symbols,function(k){Object.each(k,function(l){l.each(function(m){m.destroy();delete (l[m.dataId])})})});delete (j.symbols)}};var e=function(o,n,k){var j={x:false,y:false};var l=n.sizes[o.transition.zoomLevel].width;var m=k.getKeys().reverse().find(function(q){return k[q].position.x==k[q].positionDefault.x&&k[q].position.y==k[q].positionDefault.y&&k[q].position.width==k[q].positionDefault.width&&k[q].position.height==k[q].positionDefault.height
});if(m){j.x=k[m].positionInTile.x;j.x+=l}if(j.x===false){j.x=0}if(j.x+l>(o.position.width/o.transition.elementsPerBlock.x)){j.x=0;j.y+=n.sizes[o.transition.zoomLevel].height}return j};var a=function(l,j,k){if(typeof k=="undefined"){k={}}if(typeof k.tiles!="undefined"&&k.tiles.length!=0){Object.each(k.tiles,function(m){m=b(l,m,j);if(m.position.x==j.x&&m.position.y==j.y){k.tile=m}l.dataStore.set({position:m.position,type:Travian.Game.Map.DataStore.TYPE_TOOLTIP,data:m})})}if(typeof k.tile=="undefined"){k.tile={};k.tile=b(l,k.tile,j);l.dataStore.set({position:k.tile.position,type:Travian.Game.Map.DataStore.TYPE_TOOLTIP,data:k.tile})}if(typeof k.tiles!="undefined"||typeof k.tile=="undefined"){l.dataStore.saveDataToStorage()}if(l.mapContainer.currentMousePosition.map.x==null||l.mapContainer.currentMousePosition.map.y==null){return}if(j.x!=l.mapContainer.currentMousePosition.map.x||j.y!=l.mapContainer.currentMousePosition.map.y){return}l.mapContainer.containerMover.setTitle({unescaped:true,title:k.tile.title,text:k.tile.text});
l.mapContainer.contextMenu.update()};var d=function(l,j,k){if(l.mapContainer.currentMousePosition.map.x==null||l.mapContainer.currentMousePosition.map.y==null){return}if(j.x!=l.mapContainer.currentMousePosition.map.x||j.y!=l.mapContainer.currentMousePosition.map.y){return}l.mapContainer.containerMover.setTitle({title:"",text:"{x}|{y}".substitute(j)})};return new Class({Extends:Travian.Game.Map.Layer,mapCoordinates:null,layers:null,versionCache:null,classType:"Travian.Game.Map.Layer.Block",addSymbol:function(j){g(this,j,j.position);return this},deleteSymbol:function(j){if(!this.symbols||!this.symbols[j.position.x]||!this.symbols[j.position.x][j.position.y]){return this}if(this.symbols[j.position.x][j.position.y][j.dataId]){this.symbols[j.position.x][j.position.y][j.dataId].destroy();delete (this.symbols[j.position.x][j.position.y][j.dataId])}return this},forceUpdateLayer:function(j){if(this.layers[j]){this.layers[j].forceUpdateContent()}return this},forceUpdateSymbols:function(k,j){if(this.symbols){Object.each(this.symbols,function(l){Object.each(l,function(m){m.each(function(n){if(n.layer==k){n.forceUpdate(j)
}})})})}return this},getContentForTooltip:function(j){var n=this;var k=this.transition.translateToMap(j);if(this.symbols&&this.symbols[k.x]&&this.symbols[k.x][k.y]&&this.symbols[k.x][k.y]!=0){var o=false;var m=this.symbols[k.x][k.y].find(function(q){o=q.getContentForTooltip();return o!==false&&q.isPositionInRect({x:j.x-n.position.x,y:j.y-n.position.y})});if(m&&o!==false){return o}}var l=this.dataStore.get(Travian.Game.Map.DataStore.TYPE_TOOLTIP,k);if(l!=null&&(l.text!=undefined||l.title!=undefined)){l={text:l.text,title:l.title}}else{l={title:"",text:this.tooltipHtml.translate(k)};this.requestDataForPosition(k)}return l},getData:function(){return Object.merge({loaded:false,version:0},this.dataStore.get(Travian.Game.Map.DataStore.TYPE_BLOCKS,this.mapCoordinates,"block")||{})},getRequestData:function(){return{position:{x0:this.mapCoordinates.x,y0:this.mapCoordinates.y,x1:this.mapCoordinates.right,y1:this.mapCoordinates.bottom}}},getVersion:function(){if(this.versionCache==null){this.versionCache=this.getData().version
}return this.versionCache},invalidateVersionCache:function(){this.versionCache=null;return this},move:function(k){if(k.x==0&&k.y==0){return this}this.position.x+=k.x;this.position.y-=k.y;var j=Travian.Game.Map.Layer.Block.getCorrectPosition(this.position,this.mapContainer);this.position=j.position;this.mapCoordinates=this.transition.translateToMap(this.position);this.update(j.updateInnerContent);return this},refreshContent:function(j){if(j){var k=this.getData();k.loaded=true;this.setData(k)}this.parent();Object.each(this.layers,function(l){l.refreshContent()});f(this);return this},render:function(){var k=this;this.layers={};this.parent({nodeType:"div"});this.mapCoordinates=this.transition.registerCallbackOnZoom(function(){k.mapCoordinates=k.transition.translateToMap(k.position);k.update(true)}).translateToMap(this.position);this.mapContainer.layers.each(function(m,l){if(!m["class"]){return}var n={};Object.append(n,m);n.index=l;k.layers[n.id]=new m["class"](n,k)});var j=this.getData();j.loaded=true;
this.setData(j);f(this);return this},requestDataForPosition:function(j){var k=this;this.updater.requestPosition({dataStoreType:Travian.Game.Map.DataStore.TYPE_TOOLTIP,position:j,onSuccess:function(m,l){a(k,j,m)},onFailure:function(m,l){d(k,j,m)}});return this},setData:function(j){this.dataStore.push({type:Travian.Game.Map.DataStore.TYPE_BLOCKS,position:this.mapCoordinates,index:"block",data:Object.merge({loaded:false,version:0},j)});return this},setVersion:function(j){var k=this.getData();k.version=j;return this.setData(k)},update:function(j){this.parent();this.updateContent(j);return this},updateContent:function(j){this.parent();Object.each(this.layers,function(k){k.updateContent(j)});if(j){h(this);if(this.getData.loaded){this.refreshContent(false)}else{this.updater.register("ajax",this)}}return this},updateSymbolData:function(j){if(!this.symbols||!this.symbols[j.position.x]||!this.symbols[j.position.x][j.position.y]){return this}if(this.symbols[j.position.x][j.position.y][j.dataId]){this.symbols[j.position.x][j.position.y][j.dataId].updateData(j)
}return this}})})();Travian.Game.Map.Layer.Block.getCorrectPosition=function(b,c){var a={position:b,updateInnerContent:false,updateBlockPosition:false};do{a.updateBlockPosition=false;if(a.position.x<0&&Math.abs(a.position.x)>=c.blockSize.width){a.position.x=c.elementSize.width+a.position.x;a.updateInnerContent=true;a.updateBlockPosition=true}else{if(a.position.x+a.position.width>c.elementSize.width){a.position.x=a.position.x-c.elementSize.width;a.updateInnerContent=true;a.updateBlockPosition=true}}if(a.position.y<0&&Math.abs(a.position.y)>=c.blockSize.height){a.position.y=c.elementSize.height+a.position.y;a.updateInnerContent=true;a.updateBlockPosition=true}else{if(a.position.y+a.position.height>c.elementSize.height){a.position.y=a.position.y-c.elementSize.height;a.updateInnerContent=true;a.updateBlockPosition=true}}}while(a.updateBlockPosition);return a};Travian.Game.Map.Layer.Image=new Class({Extends:Travian.Game.Map.Layer,image:null,srcUrl:null,classType:"Travian.Game.Map.Layer.Image",getPriority:function(){var c={x:this.blockContainer.mapCoordinates.x+(this.blockContainer.mapCoordinates.right-this.blockContainer.mapCoordinates.x)/2,y:this.blockContainer.mapCoordinates.y+(this.blockContainer.mapCoordinates.bottom-this.blockContainer.mapCoordinates.y)/2};
var a=this.transition.getPointOfCenterInView();var b={x:a.x-c.x,y:a.y-c.y};return Math.pow(b.x,2)+Math.pow(b.y,2)},getSrcUrl:function(){return this.src.substitute({x:this.parentContainer.mapCoordinates.x,y:this.parentContainer.mapCoordinates.y,right:this.parentContainer.mapCoordinates.right,bottom:this.parentContainer.mapCoordinates.bottom,width:this.position.width,height:this.position.height,time:this.time,forcedUpdates:this.mapContainer.forcedUpdates,version:this.blockContainer.getVersion()})},refreshSrcUrl:function(){this.srcUrl=this.getSrcUrl();return this},render:function(){var a=this;this.parent({nodeType:"img"});if(this.srcInit){this.element.src=this.srcInit}this.time=(new Date()).getTime();this.updateContent();return this},updateContent:function(a){var b=this.getSrcUrl();if(this.srcUrl!=b||a){this.refreshSrcUrl();this.updater.register("images",this)}return this}});Travian.Game.Map.Layer.ImageMark=new Class({Extends:Travian.Game.Map.Layer.Image,classType:"Travian.Game.Map.Layer.ImageMark",finishedLoading:function(){this.parent();
this.show();return this},forceUpdateContent:function(){this.time=(new Date()).getTime();this.updateContent(true);return this},updateContent:function(a){this.parent(a);if(a){this.hide()}return this}});Travian.Game.Map.Layer.Loading=new Class({Extends:Travian.Game.Map.Layer,classType:"Travian.Game.Map.Layer.Loading",render:function(){this.parent({nodeType:"div"}).element.setStyles(this.styles).hide();return this},updateContent:function(a){return this}});Travian.Game.Map.Layer.Symbol=new Class({Extends:Travian.Game.Map.Layer,byUser:false,classType:"Travian.Game.Map.Layer.Symbol",visible:true,destroy:function(){if(this.element){this.element.destroy()}return this},forceUpdate:function(a){if(this.byUser){this.visible=a;this.element[a?"show":"hide"]()}return this},getContentForTooltip:function(){if(this.visible&&(this.title||this.text)){return{title:this.title,text:this.text}}return false},initialize:function(a,c){var b=this;a.mapCoordinates=a.mapCoordinates||c.transition.translateToMap({x:a.position.x+c.position.x,y:a.position.y+c.position.y});
a.id=a.id||Travian.Game.Map.getNewId();a.parameters=a.parameters||{};this.parent(a,c)},render:function(){this.parent({nodeType:"img"}).element.set("src",this.imgSource.substitute(Object.merge({},this.parameters,{width:this.symbolSize.width,height:this.symbolSize.height,zoomLevel:this.transition.zoomLevel}))).setStyles({position:"absolute",left:this.position.x,top:this.position.y,width:this.position.width,height:this.position.height});return this},updateData:function(a){this.title=a.title;this.text=a.text}});Travian.Game.Map.Layer.Symbol.Flag=new Class({Extends:Travian.Game.Map.Layer.Symbol,classType:"Travian.Game.Map.Layer.Symbol.Flag",index:null,render:function(){this.parameters.index=this.index||1;this.parent();var a=Travian.Game.Map.Options.Toolbar;var b="filterPlayer";if(this.layer=="alliance"){var b="filterAlliance"}if(this.mapContainer.toolbar){a=this.mapContainer.toolbar}this.forceUpdate(a[b].checked)},updateData:function(a){this.parent(a);this.parameters.index=this.index=a.index;
this.element.set("src",this.imgSource.substitute(Object.merge({},this.parameters,{zoomLevel:this.transition.zoomLevel,width:this.symbolSize.width,height:this.symbolSize.height})))}});Travian.Game.Map.Layer.Symbol.Attack=new Class({Extends:Travian.Game.Map.Layer.Symbol,classType:"Travian.Game.Map.Layer.Symbol.Attack"});Travian.Game.Map.Layer.Symbol.BattleGround=new Class({Extends:Travian.Game.Map.Layer.Symbol,classType:"Travian.Game.Map.Layer.Symbol.BattleGround",getContentForTooltip:function(){return false},render:function(){this.position={x:this.positionOfTile.x,y:this.positionOfTile.y,width:this.transition.pixelPerTile.x,height:this.transition.pixelPerTile.y};this.parent()}});Travian.Game.Map.Layer.Symbol.Adventure=new Class({Extends:Travian.Game.Map.Layer.Symbol,classType:"Travian.Game.Map.Layer.Symbol.Adventure",render:function(){this.position={x:this.positionOfTile.x+this.transition.pixelPerTile.x-this.position.width,y:this.positionOfTile.y+this.transition.pixelPerTile.y-this.position.height,width:this.position.width,height:this.position.height};
this.parent()}});Travian.Game.Map.MapMark=new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.MapMark",initialize:function(a,b){this.parent(a,b);this.render()},render:function(){var a=this;this.element=$(this.element);Object.each(this.layers,function(c,b){a.layers[b]=new c["class"](c,a)});this.update(false);this.data.each(function(b){if(!b.layer||!a.layers[b.layer]){return}a.layers[b.layer].addData(b)});return this},update:function(d){var b=this.element.isDisplayed();this.element.show();var e=[];var a=this.element.getSize().y;var c=0;Object.each(this.layers,function(g,f){if(g.expanded){c++}e.push({layer:g,expanded:g.expanded,elementCollapse:g.elements.expandContainer,heightCurrent:g.elements.expandContainer.getSize().y});var h=g.element.getDimensions({computeSize:true});a-=(h.height-g.elements.expandContainer.getSize().y);a-=h["border-top-width"];a-=h["border-bottom-width"];a-=h["padding-top"];a-=h["padding-bottom"];a-=g.element.getStyle("margin-top").toInt();a-=g.element.getStyle("margin-bottom").toInt();
if(g._fx&&g._fx.cancel){g._fx.cancel()}});if(c!=0){a=a/c-1}if(a<0){a=0}e.each(function(f){if(d===false){f.elementCollapse.setStyles({height:f.expanded?a:0});if(f.expanded){f.layer.jScroll.refresh()}}else{if(f.expanded){f._fx=new Fx.Morph(f.elementCollapse,{onComplete:function(){f.layer.jScroll.refresh()}}).start({height:[f.heightCurrent,a]})}else{if(!f.expanded){f._fx=new Fx.Morph(f.elementCollapse).start({height:[f.heightCurrent,0]})}}}});if(b==false){this.element.hide()}}});Travian.Game.Map.MapMark.Layer=new Class({Extends:Travian.Game.Map.Base,classType:"Travian.Game.Map.MapMark.Layer",addData:function(a){return this},deleteData:function(a){if(this.datas[a.id]){delete (this.datas[a.id])}return this},initialize:function(b,c){this.parent(b,c);var a=this.cookie.get("markLayer-"+this.parentContainer.typeId+"-"+this.typeId+"-expanded");if(a!=null){this.expanded==a}this.datas={};this.render()},render:function(a){var b=this;this.element=(new Element("div")).addClass("collapseContainer").set("html",this.html.substitute(Object.merge({},a||{},{data:"dataContainer",add:"addButton",expandButton:"expandButton",expandContainer:"expandContainer",title:this.title}))).inject(this.parentContainer.element,"bottom");
this.elements={data:this.element.down(".dataContainer"),add:this.element.down(".addButton"),expandButton:this.element.down(".expandButton"),expandContainer:this.element.down(".expandContainer")};if(!this.editable&&this.elements.add){this.elements.add.hide()}if(this.elements.expandButton){this.elements.expandButton.addClass(this.expanded?"collapse":"expand");this.elements.expandButton.addEvent("click",function(c){if(b.expanded){}else{Object.each(b.parentContainer.layers,function(d){d.expanded=false;d.elements.expandButton.removeClass("collapse").addClass("expand");b.cookie.set("markLayer-"+d.parentContainer.typeId+"-"+d.typeId+"-expanded",d.expanded)});b.expanded=true;b.elements.expandButton.removeClass("expand").addClass("collapse");b.cookie.set("markLayer-"+b.parentContainer.typeId+"-"+b.typeId+"-expanded",true)}b.parentContainer.update()})}this.jScroll=new jScroll({container:this.elements.expandContainer});return this}});Travian.Game.Map.MapMark.Layer.Mark=new Class({Extends:Travian.Game.Map.MapMark.Layer,classType:"Travian.Game.Map.MapMark.Layer.Mark",dialogInstance:null,addData:function(a){var b=new Travian.Game.Map.MapMark.Layer.Data.Mark(Object.merge({},a,this.optionsData,{editable:this.editable}),this);
this.datas[b.id]=b;return this},add:function(a){var b=this;if(!this.editable){return this}a=Travian.Game.Map.remapShortParameters(a);Travian.ajax({data:{cmd:"mapMultiMarkAdd",data:{x:a.position.x,y:a.position.y,type:this.typeId,color:a.color||0,owner:this.parentContainer.typeId,text:a.text||undefined,title:a.title||undefined}},onSuccess:function(c){b.addData(c);b.mapContainer.forceUpdateBlocksLayer("imageMark");b.dialogInstance.close();b.dialogInstance=null},onFailure:function(d,c){b.dialogInstance.enableForm().toElement().down(".errorMessage").set("html",c);return false}});return this},initialize:function(a,c){var b=this;this.parent(a,c);this.colorsArray=[];Object.each(this.colors,function(d){if(typeof d=="string"){b.colorsArray.push(d)}})},render:function(){var a=this;this.parent();this.elements.add.addEvent("click",function(b){a.showDialog()});return this},showDialog:function(a){var b=this;a=Object.merge({color:this.color,onOkay:this.add.bind(this),onOpen:Travian.emptyFunction,position:{x:"",y:""}},a||{});
this.color=a.color;this.dialogInstance=this.dialog.html.substitute({select:"select",textX:this.dialog.textX,textY:this.dialog.textY,textDisplay:"textDisplay",coord:"coord",inputX:"inputX",inputY:"inputY"}).dialog({keepOpen:true,relativeTo:this.mapContainer.container,elementFocus:a.position.x==""?this.dialog.elementFocusNew:this.dialog.elementFocusEdit,buttonTextOk:this.dialog.textOkay,buttonTextCancel:this.dialog.textCancel,title:this.dialog.title,onOpen:function(d,e){e.down(".inputX").value=a.position.x;e.down(".inputY").value=a.position.y;var c=(new Travian.Game.ColorPicker(e.down(".select"),{colors:b.colorsArray,defaultColor:b.color})).addEvent("change",function(f,g){b.colorsArray.find(function(h,j){if(h==f){b.color=j}})});a.onOpen(d,e,c)},onOkay:function(c,d){a.onOkay({color:b.color,position:{x:d.down(".inputX").value,y:d.down(".inputY").value}},c,d)}}).dialog;return this}});Travian.Game.Map.MapMark.Layer.Flag=new Class({Extends:Travian.Game.Map.MapMark.Layer,classType:"Travian.Game.Map.MapMark.Layer.Flag",dialogInstance:null,add:function(a){var b=this;
if(!this.editable){return this}a=Travian.Game.Map.remapShortParameters(a);if(a.index<this.indexes.min){a.index=this.indexes.max}if(a.index>this.indexes.max){a.index=this.indexes.min}Travian.ajax({data:{cmd:"mapFlagAdd",data:{x:a.position.x,y:a.position.y,color:a.index||this.indexes.min,owner:this.parentContainer.typeId,text:a.text||undefined,title:a.title||undefined}},onSuccess:function(c){c.type="flag";b.dataStore.push({type:Travian.Game.Map.DataStore.TYPE_SYMBOL,index:c.dataId,position:c.position,data:c,time:false});b.addData(c);c.position=a.position;c.layer=b.parentContainer.typeId;b.mapContainer.addSymbol(c);b.dialogInstance.close();b.dialogInstance=null},onFailure:function(d,c){b.dialogInstance.enableForm().toElement().down(".errorMessage").set("html",c);return false}});return this},addData:function(b){var a=new Travian.Game.Map.MapMark.Layer.Data.Flag(Object.merge({},b,this.optionsData,{editable:this.editable}),this);this.datas[a.id]=a;return this},initialize:function(a,c){this.parent(a,c);
this.imagesArray=[];for(var b=this.indexes.min;b<=this.indexes.max;b++){this.imagesArray.push(this.imgSource.substitute({index:b}))}},render:function(){var a=this;this.parent();this.elements.add.addEvent("click",function(b){a.showDialog()});return this},showDialog:function(a){var b=this;a=Object.merge({index:this.index,onOkay:this.add.bind(this),onOpen:Travian.emptyFunction,text:"",position:{x:"",y:""}},a||{});this.index=a.index;this.dialogInstance=this.dialog.html.substitute({select:"select",textX:this.dialog.textX,textY:this.dialog.textY,textDisplay:"textDisplay",coord:"coord",inputX:"inputX",inputY:"inputY",inputText:"inputText"}).dialog({keepOpen:true,relativeTo:this.mapContainer.container,elementFocus:a.position.x==""?this.dialog.elementFocusNew:this.dialog.elementFocusEdit,buttonTextOk:this.dialog.textOkay,buttonTextCancel:this.dialog.textCancel,title:this.dialog.title,onOpen:function(d,e){e.down(".inputX").value=a.position.x;e.down(".inputY").value=a.position.y;e.down(".inputText").value=a.text;
var c=(new Travian.Game.ImagePicker(e.down(".select"),{images:b.imagesArray,defaultImage:b.index-b.indexes.min})).addEvent("change",function(g,f){b.imagesArray.find(function(j,h){if(j==g){b.index=h+1}})});a.onOpen(d,e,c)},onOkay:function(c,d){if(b.index<b.indexes.min){b.index+=b.indexes.min-1}a.onOkay({index:b.index,text:d.down(".inputText").value,position:{x:d.down(".inputX").value,y:d.down(".inputY").value}},c,d)}}).dialog;return this}});Travian.Game.Map.MapMark.Layer.Data=new Class({Extends:Travian.Game.Map.MapMark.Layer,classType:"Travian.Game.Map.MapMark.Layer.Data",del:function(){this.destroy();this.parentContainer.deleteData(this);return this},render:function(a){var b=this;this.element=(new Element("div")).set("html",this.html.substitute(Object.merge({},a||{},{entry:this.id,text:"textContainer","delete":"deleteButton",select:"selectLink",editDelete:"editDeleteContainer"}))).inject(this.parentContainer.elements.data,"bottom");this.elements={text:this.element.down(".textContainer"),"delete":this.element.down(".deleteButton"),select:this.element.down(".selectLink"),editDelete:this.element.down(".editDeleteContainer")};
this.elements["delete"].addEvent("click",function(c){b.del()});this.elements.text.set("html",this.text);if(!this.editable&&this.elements.editDelete){this.elements.editDelete.hide()}if(this.parentContainer.expanded){this.parentContainer.jScroll.refresh()}return this}});Travian.Game.Map.MapMark.Layer.Data.Mark=(function(){var a=function(b){b.elements.color.setStyles({backgroundColor:b.parentContainer.colors[b.color]})};return new Class({Extends:Travian.Game.Map.MapMark.Layer.Data,classType:"Travian.Game.Map.MapMark.Layer.Data.Mark",del:function(){var b=this;if(!this.editable){return this}Travian.ajax({data:{cmd:"mapFlagOrMultiMarkDelete",data:{dataId:this.dataId,owner:this.parentContainer.parentContainer.typeId,type:"mark"}},onSuccess:function(c){if(c.result){b.destroy();b.mapContainer.forceUpdateBlocksLayer("imageMark");if(b.parentContainer.expanded){b.parentContainer.jScroll.refresh()}}}});return this},initialize:function(b,c){b.color=Number(b.color);this.parent(b,c)},render:function(b){var c=this;
this.parent({color:"colorContainer",urlLink:"urlLink"});this.elements.color=this.element.down(".colorContainer");this.elements.urlLink=this.element.down(".urlLink");if(this.elements.urlLink){this.elements.urlLink.href=this.urlLink.substitute({markId:this.markId})}if(this.editable){this.elements.select.addEvent("click",function(d){c.parentContainer.showDialog({color:c.color,onOpen:function(f,g,e){g.select(".coord").each(function(h){h.hide()});g.down(".textDisplay").show().set("html",c.text)},onOkay:function(e,f,g){c.setColor(e.color)}})})}a(this);return this},setColor:function(b){var c=this;if(!this.editable){return this}if(typeof b!="number"){return this}if(b<this.parentContainer.colors.min){b=this.parentContainer.colors.max}if(b>this.parentContainer.colors.max){b=this.parentContainer.colors.min}Travian.ajax({data:{cmd:"mapMultiMarkUpdate",data:{color:b,dataId:this.dataId,owner:this.parentContainer.parentContainer.typeId}},onSuccess:function(d){if(d){c.color=b;a(c);c.mapContainer.forceUpdateBlocksLayer("imageMark")
}c.dialogInstance.close();c.dialogInstance=null},onFailure:function(e,d){c.parentContainer.dialogInstance.enableForm().toElement().down(".errorMessage").set("html",d);return false}});return this}})})();Travian.Game.Map.MapMark.Layer.Data.Flag=(function(){var a=function(b){b.elements.text.set("html",b.text);b.elements.index.set("html",'<img src="'+b.parentContainer.imgSource.substitute({index:b.index})+'" alt="" />')};return new Class({Extends:Travian.Game.Map.MapMark.Layer.Data,classType:"Travian.Game.Map.MapMark.Layer.Data.Flag",del:function(){var b=this;if(!this.editable){return this}Travian.ajax({data:{cmd:"mapFlagOrMultiMarkDelete",data:{dataId:this.dataId,owner:this.parentContainer.parentContainer.typeId,type:"flag"}},onSuccess:function(c){if(c.result){b.destroy();b.dataStore.remove(Travian.Game.Map.DataStore.TYPE_SYMBOL,b.position,b.dataId);b.mapContainer.deleteSymbol({position:b.position,dataId:b.dataId});if(b.parentContainer.expanded){b.parentContainer.jScroll.refresh()}}}});return this
},initialize:function(b,c){b.index=Number(b.index);this.parent(b,c)},render:function(b){var c=this;this.parent({index:"indexContainer",urlLink:"urlLink"});this.elements.index=this.element.down(".indexContainer");this.elements.urlLink=this.element.down(".urlLink");if(this.editable){this.elements.select.addEvent("click",function(d){c.parentContainer.showDialog({index:c.index,text:c.text,position:c.position,onOpen:function(f,g,e){c.dialogInstance=f;g.down(".inputX").disabled=true;g.down(".inputY").disabled=true},onOkay:function(e,f,g){c.setIndex(e.index,e.text)}})})}this.elements.urlLink.addEvent("click",function(d){if(c.mapContainer.isEventsEnabled()){c.mapContainer.moveTo(c.position)}});a(this);return this},setIndex:function(b,d){var c=this;if(!this.editable){return this}if(typeof b!="number"){return this}if(b<this.parentContainer.indexes.min){b=this.parentContainer.indexes.max}if(b>this.parentContainer.indexes.max){b=this.parentContainer.indexes.min}Travian.ajax({data:{cmd:"mapFlagUpdate",data:{index:b,text:d,dataId:this.dataId,owner:this.parentContainer.parentContainer.typeId}},onSuccess:function(e){if(e){c.index=b;
c.text=d;a(c);var f=c.dataStore.get(Travian.Game.Map.DataStore.TYPE_SYMBOL,c.position,c.dataId);f.index=c.index;f.text=c.text;c.dataStore.push({type:Travian.Game.Map.DataStore.TYPE_SYMBOL,position:c.position,index:c.dataId,data:f,time:false});c.mapContainer.updateSymbolData({position:c.position,dataId:c.dataId,index:c.index,text:c.text})}c.dialogInstance.close();c.dialogInstance=null},onFailure:function(f,e){c.parentContainer.dialogInstance.enableForm().toElement().down(".errorMessage").set("html",e);return false}});return this}})})();Travian.Game.Map.Options={};Travian.Game.Map.Options.Symbols={flag:{"class":Travian.Game.Map.Layer.Symbol.Flag,imgSource:"img/map/flag/flag-{index}/{width}x{height}.png",byUser:true,zIndex:10,visibleInZoom:{1:true,2:true,3:false,4:false},sizes:{1:{width:16,height:16},2:{width:10,height:10},3:{width:6,height:6},4:{width:4,height:4}}},attack:{"class":Travian.Game.Map.Layer.Symbol.Attack,imgSource:"img/map/attack/attack-{attackType}/{width}x{height}.gif",zIndex:10,visibleInZoom:{1:true,2:true,3:false,4:false},sizes:{1:{width:16,height:16},2:{width:10,height:10},3:{width:6,height:6},4:{width:4,height:4}}},battleGround:{"class":Travian.Game.Map.Layer.Symbol.BattleGround,imgSource:"img/map/battleground/battleground-{center}-{north}-{east}-{south}-{west}-{width}x{height}.png",zIndex:9,visibleInZoom:{1:true,2:true,3:false,4:false},sizes:{1:{width:16,height:16},2:{width:8,height:8},3:{width:4,height:4},4:{width:4,height:4}}},adventure:{"class":Travian.Game.Map.Layer.Symbol.Adventure,imgSource:"img/map/adventure/difficulty-{difficulty}/{width}x{height}.png",zIndex:10,visibleInZoom:{1:true,2:true,3:false,4:false},sizes:{1:{width:16,height:16},2:{width:8,height:8},3:{width:6,height:6},4:{width:4,height:4}}}};
Travian.Game.Map.Options.Rulers={direction:null,imgSource:{x:"img/map/rulers/x-{zoomLevel}.gif",y:"img/map/rulers/y-{zoomLevel}.gif"},cls:{x:"ruler x",y:"ruler y"},steps:{x:{1:1,2:1,3:10,4:20},y:{1:1,2:1,3:10,4:20}},delta:{x:{1:0,2:0,3:0,4:0},y:{1:0,2:0,3:-9,4:-19}}};Travian.Game.Map.Options.MiniMap={container:"miniMap",containerContent:"minimapContainer",showToolTip:true,classLines:{x:"lines",y:"lines"},tooltipHtml:'<span class="xCoord">({x}</span><span class="pi">|</span><span class="yCoord">{y})</span><span class="clear"></span>'};Travian.Game.Map.Options.Toolbar={element:"toolbar",viewFullScreenUrl:"karte.php?fullscreen=1&x={x}&y={y}&zoom={zoom}",viewNormalUrl:"karte.php?x={x}&y={y}&zoom={zoom}",filterPlayer:{checked:true},filterAlliance:{checked:true}};Travian.Game.Map.Options.Outline={element:"outline"};Travian.Game.Map.Options.MapMark=Travian.Game.Map.Options.MapMark||{};Travian.Game.Map.Options.MapMark.Mark={"class":Travian.Game.Map.MapMark.Layer.Mark,title:"",typeId:"player",editable:true,expanded:false,color:0,colors:{0:"#C0C0C0",1:"#FF7722",2:"#B15BDB",3:"#DF4E78",4:"#34822F",5:"#3F90C5",6:"#C2AF09",7:"#8B1C1C",8:"#575BD2",9:"#4FE600",min:0,max:9},html:'<div class="title">{title} <a href="#" class="add {add}">+</a></div><div class="iconButton {expandButton} small"></div><div class="clear"></div><div class="{expandContainer}"><div class="{data}"></div></div>',dialog:{title:"",textOkay:"okay",textCancel:"cancel",textX:"X:",textY:"Y:",elementFocusNew:"coordinateDialogX",elementFocusEdit:"coordinateDialogX",html:'<div class="mapMarkMark"><div class="color {select}"></div><div class="{coord}"><span>{textX}</span><input id="coordinateDialogX" class="text coordinates x {inputX}" type="text" /><span>{textY}</span><input class="text coordinates y {inputY}" type="text" /></div><div class="{textDisplay}"></div></div>'},optionsData:{urlLink:"spieler.php?uid={markId}",html:'<div class="entry flag {entry}"><div class="marker color"><a href="#" class="{select} {color}"></a></div><div class="text"><a href="#" class="{urlLink} {text}"></a></div><div class="iconButton delete small {editDelete} {delete}"></div><div class="clear"></div></div>'}};
Travian.Game.Map.Options.MapMark=Travian.Game.Map.Options.MapMark||{};Travian.Game.Map.Options.MapMark.Flag={"class":Travian.Game.Map.MapMark.Layer.Flag,title:"",editable:true,expanded:true,typeId:"flag",index:1,indexes:{min:1,max:20},imgSource:Travian.Game.Map.Options.Symbols.flag.imgSource.substitute({index:"{index}",zoomLevel:1,width:16,height:16}),html:'<div class="title">{title} <a href="#" class="add {add}">+</a></div><div class="iconButton {expandButton} small"></div><div class="clear"></div><div class="{expandContainer}"><div class="{data}"></div></div>',dialog:{title:"",textOkay:"okay",textCancel:"cancel",textX:"X:",textY:"Y:",elementFocusNew:"coordinateDialogX",elementFocusEdit:"coordinateDialogText",html:'<div class="mapMarkField"><div class="flag {select}"></div><div class="{coord}"><span>{textX}</span><input id="coordinateDialogX" class="text coordinates x {inputX}" type="text" /><span>{textY}</span><input class="text coordinates y {inputY}" type="text" /></div><div class="{textDisplay}"><input id="coordinateDialogText" class="text {inputText}" type="text" /></div><p class="error errorMessage"></p></div>'},optionsData:{html:'<div class="entry flag {entry}"><div class="marker index"><a href="#" class="{select} {index}"></a></div><div class="text"><a href="#" class="{urlLink} {text}"></a></div><div class="iconButton delete small {editDelete} {delete}"></div><div class="clear"></div></div>'}};
Travian.Game.Map.Options.Default={container:"mapContainer",containerViewSize:null,tileDisplayInformation:{type:"dialog",optionsPopup:{url:"position_details.php?x={x}&y={y}",windowOptions:{}},optionsDialog:{buttonOk:false,data:{cmd:"viewTileDetails",x:null,y:null}}},blockOverflow:1,blockSize:{width:170,height:150},mapInitialPosition:{x:0,y:0},grid:{1:"/img/map/grid/grid-1.gif",2:"/img/map/grid/grid-2.gif",3:"/img/map/grid/grid-3.gif",4:false},speeds:{slow:5,normal:20,fast:40},symbolTypes:Travian.Game.Map.Options.Symbols,onCreate:function(a){},onRender:function(a){(function(){Travian.Game.Map.Tips.render(a,a.containerMover);a.rulers=new Travian.Game.Map.Rulers(Travian.Game.Map.Options.Rulers,a);a.rulers.render();a.miniMap=new Travian.Game.Map.MiniMap(Travian.Game.Map.Options.MiniMap,a);a.miniMap.render();if(a.mapMarks){Object.each(a.mapMarks,function(b,c){if(b.enabled===true){a.mapMarks[c]=new Travian.Game.Map.MapMark(b,a)}else{delete (a.mapMarks[c])}})}a.outline=new Travian.Game.Map.Outline(Travian.Game.Map.Options.Outline,a);
a.toolbar=new Travian.Game.Map.Toolbar(Travian.Game.Map.Options.Toolbar,a);a.toolbar.render()}).delay(500)},onMove:function(a,b){if(a.rulers){a.rulers.move(b)}if(a.miniMap){a.miniMap.move()}},onZoom:function(a){if(a.rulers){a.rulers.zoom()}if(a.miniMap){a.miniMap.zoom()}if(a.toolbar){a.toolbar.zoom()}}};Travian.Game.Map.Options.Default.contextMenu={targets:"#mapContainer",zIndex:2000,menu:"contextmenu",separators:[{selector:".separatorActions",elements:["#contextMenuSendTroops","#contextMenuSendTraders"]}],actions:[{element:"contextMenuSendTroops",displayOn:"did",fn:function(c,b,a){window.location.href="build.php?gid=16&tt=2&x="+a.position.x+"&y="+a.position.y}},{element:"contextMenuSendTraders",displayOn:"uid",fn:function(c,b,a){window.location.href="build.php?gid=17&t=5&x="+a.position.x+"&y="+a.position.y}},{element:"contextMenuMarkPlayerAlliance",displayOn:"aid",fn:function(c,b,a){c.parentContainer.mapMarks.player.layers.alliance.showDialog({position:b})}},{element:"contextMenuMarkPlayerPlayer",displayOn:"uid",fn:function(c,b,a){c.parentContainer.mapMarks.player.layers.player.showDialog({position:b})
}},{element:"contextMenuFlagPlayer",displayOn:true,fn:function(c,b,a){c.parentContainer.mapMarks.player.layers.flag.showDialog({position:b})}},{element:"contextMenuMarkAllianceAlliance",displayOn:"aid",fn:function(c,b,a){c.parentContainer.mapMarks.alliance.layers.alliance.showDialog({position:b})}},{element:"contextMenuMarkAlliancePlayer",displayOn:"uid",fn:function(c,b,a){c.parentContainer.mapMarks.alliance.layers.player.showDialog({position:b})}},{element:"contextMenuFlagAlliance",displayOn:true,fn:function(c,b,a){c.parentContainer.mapMarks.alliance.layers.flag.showDialog({position:b})}}]};Travian.Game.Map.Options.Default.transition={onCreate:function(a){},onMove:function(a,b){},onZoom:function(a){},zoomOptions:{level:1,sizes:[{x:5,y:5},{x:10,y:10},{x:51,y:51},{x:135,y:135},]},border:{left:-400,top:-400,right:400,bottom:400}};Travian.Game.Map.Options.Default.layers=[{id:"loading",styles:{background:"#000000 url(img/loading.gif) center center no-repeat",opacity:0.5},"class":Travian.Game.Map.Layer.Loading,zIndex:20},{id:"image",src:"map_block.php?tx0={x}&ty0={y}&tx1={right}&ty1={bottom}&w={width}&h={height}&version={version}",srcInit:"img/x.gif","class":Travian.Game.Map.Layer.Image,zIndex:1},{id:"imageMark",src:"map_mark.php?tx0={x}&ty0={y}&tx1={right}&ty1={bottom}&w={width}&h={height}&updates={forcedUpdates}",srcInit:"img/x.gif","class":Travian.Game.Map.Layer.ImageMark,zIndex:2}];
Travian.Game.Map.Options.Default.block={tooltipHtml:'<span class="xCoord">({x}</span><span class="pi">|</span><span class="yCoord">{y})</span><span class="clear"></span><br />{k.loadingData}'};Travian.Game.Map.Options.Default.updater={maxRequestCount:5,parameters:{multiple:{cmd:"mapInfo"},position:{cmd:"mapPositionData"}},requestDelayTime:{multiple:100,position:300},url:"ajax.php",elementWorking:"working",positionOptions:{areaAroundPosition:{1:{left:-5,top:-4,right:5,bottom:4},2:{left:-10,top:-8,right:10,bottom:8},3:{left:-25,top:-25,right:25,bottom:25},4:{left:-25,top:-25,right:25,bottom:25}}}};Travian.Game.Map.Options.Default.keyboard={37:"moveLeft",65:"moveLeft",100:!Browser.opera?"moveLeft":false,52:Browser.opera?"moveLeft":false,39:"moveRight",68:"moveRight",102:!Browser.opera?"moveRight":false,54:Browser.opera?"moveRight":false,38:"moveUp",87:"moveUp",104:!Browser.opera?"moveUp":false,56:Browser.opera?"moveUp":false,40:"moveDown",83:"moveDown",98:!Browser.opera?"moveDown":false,50:Browser.opera?"moveDown":false,61:"zoomIn",107:!Browser.opera?"zoomIn":false,43:Browser.opera?"zoomIn":false,109:"zoomOut",45:Browser.opera?"zoomOut":false,103:!Browser.opera?"moveLeftUp":false,55:Browser.opera?"moveLeftUp":false,97:!Browser.opera?"moveLeftDown":false,49:Browser.opera?"moveLeftDown":false,105:!Browser.opera?"moveRightUp":false,57:Browser.opera?"moveRightUp":false,99:!Browser.opera?"moveRightDown":false,51:Browser.opera?"moveRightDown":false,speed:{slow:"control",fast:"shift"},71:{fn:"toggleGrid",periodical:0},77:{fn:"toggleMiniMap",periodical:0},79:{fn:"toggleOutline",periodical:0}};
Travian.Game.Map.Options.Default.dataStore={cachingTimeForType:{blocks:30*60*1000,symbol:10*60*1000,tile:10*60*1000,tooltip:2*60*1000},persistentStorage:false,useStorageForType:{blocks:false,symbol:false,tile:false,tooltip:true},clearStorageForType:{blocks:false,symbol:false,tile:false,tooltip:false}};Travian.Game.Map.Options.Default.data={elements:[]};Travian.Game.Map.Options.Default.mapMarks={player:{enabled:true,data:[],element:"tabPlayer",typeId:"player",layers:{alliance:Object.merge({},Travian.Game.Map.Options.MapMark.Mark,{typeId:"alliance"}),player:Object.merge({},Travian.Game.Map.Options.MapMark.Mark,{typeId:"player"}),flag:Object.merge({},Travian.Game.Map.Options.MapMark.Flag,{indexes:{min:1,max:10}})}},alliance:{enabled:true,data:[],element:"tabAlliance",typeId:"alliance",layers:{alliance:Object.merge({},Travian.Game.Map.Options.MapMark.Mark,{typeId:"alliance"}),player:Object.merge({},Travian.Game.Map.Options.MapMark.Mark,{typeId:"player"}),flag:Object.merge({},Travian.Game.Map.Options.MapMark.Flag,{indexes:{min:11,max:20}})}}};