/* qwebirc -- Copyright (C) 2008-2009 Chris Porter --- All rights reserved. */

QWEBIRC_BUILD="bfeaf331ff16";
var MooTools={version:"1.2.1",build:"0d4845aab3d9a4fdee2f0d4a6dd59210e4b697cf"};var Native=function(P){P=P||{};var O=P.name;var R=P.legacy;var N=P.protect;var M=P.implement;var S=P.generics;var U=P.initialize;var T=P.afterImplement||function(){};var L=U||R;S=S!==false;L.constructor=Native;L.$family={name:"native"};if(R&&U){L.prototype=R.prototype}L.prototype.constructor=L;if(O){var V=O.toLowerCase();L.prototype.$family={name:V};Native.typize(L,V)}var Q=function(C,A,B,D){if(!N||D||!C.prototype[A]){C.prototype[A]=B}if(S){Native.genericize(C,A,N)}T.call(C,A,B);return C};L.alias=function(C,A,B){if(typeof C=="string"){if((C=this.prototype[C])){return Q(this,A,C,B)}}for(var D in C){this.alias(D,C[D],A)}return this};L.implement=function(D,A,B){if(typeof D=="string"){return Q(this,D,A,B)}for(var C in D){Q(this,C,D[C],A)}return this};if(M){L.implement(M)}return L};Native.genericize=function(F,E,D){if((!D||!F[E])&&typeof F.prototype[E]=="function"){F[E]=function(){var A=Array.prototype.slice.call(arguments);return F.prototype[E].apply(A.shift(),A)}}};Native.implement=function(F,G){for(var H=0,E=F.length;H<E;H++){F[H].implement(G)}};Native.typize=function(C,D){if(!C.type){C.type=function(A){return($type(A)===D)}}};(function(){var H={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var I in H){new Native({name:I,initialize:H[I],protect:true})}var L={"boolean":Boolean,"native":Native,object:Object};for(var M in L){Native.typize(L[M],M)}var J={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var K in J){for(var N=J[K].length;N--;){Native.genericize(window[K],J[K][N],true)}}})();var Hash=new Native({name:"Hash",initialize:function(C){if($type(C)=="hash"){C=$unlink(C.getClean())}for(var D in C){this[D]=C[D]}return this}});Hash.implement({forEach:function(F,E){for(var D in this){if(this.hasOwnProperty(D)){F.call(E,this[D],D,this)}}},getClean:function(){var D={};for(var C in this){if(this.hasOwnProperty(C)){D[C]=this[C]}}return D},getLength:function(){var D=0;for(var C in this){if(this.hasOwnProperty(C)){D++}}return D}});Hash.alias("forEach","each");Array.implement({forEach:function(G,F){for(var H=0,E=this.length;H<E;H++){G.call(F,this[H],H,this)}}});Array.alias("forEach","each");function $A(G){if(G.item){var F=[];for(var H=0,E=G.length;H<E;H++){F[H]=G[H]}return F}return Array.prototype.slice.call(G)}function $arguments(B){return function(){return arguments[B]}}function $chk(B){return !!(B||B===0)}function $clear(B){clearTimeout(B);clearInterval(B);return null}function $defined(B){return(B!=undefined)}function $each(G,H,F){var E=$type(G);((E=="arguments"||E=="collection"||E=="array")?Array:Hash).each(G,H,F)}function $empty(){}function $extend(E,D){for(var F in (D||{})){E[F]=D[F]}return E}function $H(B){return new Hash(B)}function $lambda(B){return(typeof B=="function")?B:function(){return B}}function $merge(){var K={};for(var L=0,H=arguments.length;L<H;L++){var N=arguments[L];if($type(N)!="object"){continue}for(var M in N){var I=N[M],J=K[M];K[M]=(J&&$type(I)=="object"&&$type(J)=="object")?$merge(J,I):$unlink(I)}}return K}function $pick(){for(var D=0,C=arguments.length;D<C;D++){if(arguments[D]!=undefined){return arguments[D]}}return null}function $random(D,C){return Math.floor(Math.random()*(C-D+1)+D)}function $splat(D){var C=$type(D);return(C)?((C!="array"&&C!="arguments")?[D]:D):[]}var $time=Date.now||function(){return +new Date};function $try(){for(var F=0,D=arguments.length;F<D;F++){try{return arguments[F]()}catch(E){}}return null}function $type(B){if(B==undefined){return false}if(B.$family){return(B.$family.name=="number"&&!isFinite(B))?false:B.$family.name}if(B.nodeName){switch(B.nodeType){case 1:return"element";case 3:return(/\S/).test(B.nodeValue)?"textnode":"whitespace"}}else{if(typeof B.length=="number"){if(B.callee){return"arguments"}else{if(B.item){return"collection"}}}}return typeof B}function $unlink(I){var J;switch($type(I)){case"object":J={};for(var G in I){J[G]=$unlink(I[G])}break;case"hash":J=new Hash(I);break;case"array":J=[];for(var H=0,F=I.length;H<F;H++){J[H]=$unlink(I[H])}break;default:return I}return J}var Browser=$merge({Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925))},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4)},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419)},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18)}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var D in this.Engines){var C=this.Engines[D]();if(C){this.Engine={name:D,version:C};this.Engine[D]=this.Engine[D+C]=true;break}}return{name:D,version:C}};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("MSXML2.XMLHTTP")})};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var B=($try(function(){return navigator.plugins["Shockwave Flash"].description},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")})||"0 r0").match(/\d+/g);return{version:parseInt(B[0]||0+"."+B[1]||0),build:parseInt(B[2]||0)}})();function $exec(D){if(!D){return D}if(window.execScript){window.execScript(D)}else{var C=document.createElement("script");C.setAttribute("type","text/javascript");C[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=D;document.head.appendChild(C);document.head.removeChild(C)}return D}Native.UID=1;var $uid=(Browser.Engine.trident)?function(B){return(B.uid||(B.uid=[Native.UID++]))[0]}:function(B){return B.uid||(B.uid=Native.UID++)};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(B){$uid(B);if(!B.Element){B.Element=$empty;if(Browser.Engine.webkit){B.document.createElement("iframe")}B.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{}}B.document.window=B;return $extend(B,Window.Prototype)},afterImplement:function(D,C){window[D]=Window.Prototype[D]=C}});Window.Prototype={$family:{name:"window"}};new Window(window);var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(B){$uid(B);B.head=B.getElementsByTagName("head")[0];B.html=B.getElementsByTagName("html")[0];if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){B.execCommand("BackgroundImageCache",false,true)})}if(Browser.Engine.trident){B.window.attachEvent("onunload",function(){B.window.detachEvent("onunload",arguments.callee);B.head=B.html=B.window=null})}return $extend(B,Document.Prototype)},afterImplement:function(D,C){document[D]=Document.Prototype[D]=C}});Document.Prototype={$family:{name:"document"}};new Document(document);Array.implement({every:function(G,F){for(var H=0,E=this.length;H<E;H++){if(!G.call(F,this[H],H,this)){return false}}return true},filter:function(H,G){var I=[];for(var J=0,F=this.length;J<F;J++){if(H.call(G,this[J],J,this)){I.push(this[J])}}return I},clean:function(){return this.filter($defined)},indexOf:function(G,F){var E=this.length;for(var H=(F<0)?Math.max(0,E+F):F||0;H<E;H++){if(this[H]===G){return H}}return -1},map:function(H,G){var I=[];for(var J=0,F=this.length;J<F;J++){I[J]=H.call(G,this[J],J,this)}return I},some:function(G,F){for(var H=0,E=this.length;H<E;H++){if(G.call(F,this[H],H,this)){return true}}return false},associate:function(G){var F={},H=Math.min(this.length,G.length);for(var E=0;E<H;E++){F[G[E]]=this[E]}return F},link:function(I){var F={};for(var G=0,J=this.length;G<J;G++){for(var H in I){if(I[H](this[G])){F[H]=this[G];delete I[H];break}}}return F},contains:function(C,D){return this.indexOf(C,D)!=-1},extend:function(E){for(var F=0,D=E.length;F<D;F++){this.push(E[F])}return this},getLast:function(){return(this.length)?this[this.length-1]:null},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null},include:function(B){if(!this.contains(B)){this.push(B)}return this},combine:function(E){for(var F=0,D=E.length;F<D;F++){this.include(E[F])}return this},erase:function(D){for(var C=this.length;C--;C){if(this[C]===D){this.splice(C,1)}}return this},empty:function(){this.length=0;return this},flatten:function(){var F=[];for(var H=0,E=this.length;H<E;H++){var G=$type(this[H]);if(!G){continue}F=F.concat((G=="array"||G=="collection"||G=="arguments")?Array.flatten(this[H]):this[H])}return F},hexToRgb:function(D){if(this.length!=3){return null}var C=this.map(function(A){if(A.length==1){A+=A}return A.toInt(16)});return(D)?C:"rgb("+C+")"},rgbToHex:function(F){if(this.length<3){return null}if(this.length==4&&this[3]==0&&!F){return"transparent"}var H=[];for(var E=0;E<3;E++){var G=(this[E]-0).toString(16);H.push((G.length==1)?"0"+G:G)}return(F)?H:"#"+H.join("")}});Function.implement({extend:function(C){for(var D in C){this[D]=C[D]}return this},create:function(D){var C=this;D=D||{};return function(B){var F=D.arguments;F=(F!=undefined)?$splat(F):Array.slice(arguments,(D.event)?1:0);if(D.event){F=[B||window.event].extend(F)}var A=function(){return C.apply(D.bind||null,F)};if(D.delay){return setTimeout(A,D.delay)}if(D.periodical){return setInterval(A,D.periodical)}if(D.attempt){return $try(A)}return A()}},run:function(C,D){return this.apply(D,$splat(C))},pass:function(C,D){return this.create({bind:D,arguments:C})},bind:function(D,C){return this.create({bind:D,arguments:C})},bindWithEvent:function(D,C){return this.create({bind:D,arguments:C,event:true})},attempt:function(C,D){return this.create({bind:D,arguments:C,attempt:true})()},delay:function(F,E,D){return this.create({bind:E,arguments:D,delay:F})()},periodical:function(E,F,D){return this.create({bind:F,arguments:D,periodical:E})()}});Number.implement({limit:function(D,C){return Math.min(C,Math.max(D,this))},round:function(B){B=Math.pow(10,B||0);return Math.round(this*B)/B},times:function(F,E){for(var D=0;D<this;D++){F.call(E,D,this)}},toFloat:function(){return parseFloat(this)},toInt:function(B){return parseInt(this,B||10)}});Number.alias("times","each");(function(D){var C={};D.each(function(A){if(!Number[A]){C[A]=function(){return Math[A].apply(null,[this].concat($A(arguments)))}}});Number.implement(C)})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(C,D){return((typeof C=="string")?new RegExp(C,D):C).test(this)},contains:function(C,D){return(D)?(D+this+D).indexOf(D+C+D)>-1:this.indexOf(C)>-1},trim:function(){return this.replace(/^\s+|\s+$/g,"")},clean:function(){return this.replace(/\s+/g," ").trim()},camelCase:function(){return this.replace(/-\D/g,function(B){return B.charAt(1).toUpperCase()})},hyphenate:function(){return this.replace(/[A-Z]/g,function(B){return("-"+B.charAt(0).toLowerCase())})},capitalize:function(){return this.replace(/\b[a-z]/g,function(B){return B.toUpperCase()})},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")},toInt:function(B){return parseInt(this,B||10)},toFloat:function(){return parseFloat(this)},hexToRgb:function(D){var C=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(C)?C.slice(1).hexToRgb(D):null},rgbToHex:function(D){var C=this.match(/\d{1,3}/g);return(C)?C.rgbToHex(D):null},stripScripts:function(F){var D="";var E=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){D+=arguments[1]+"\n";return""});if(F===true){$exec(D)}else{if($type(F)=="function"){F(D,E)}}return E},substitute:function(C,D){return this.replace(D||(/\\?\{([^{}]+)\}/g),function(A,B){if(A.charAt(0)=="\\"){return A.slice(1)}return(C[B]!=undefined)?C[B]:""})}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(D){for(var C in this){if(this.hasOwnProperty(C)&&this[C]===D){return C}}return null},hasValue:function(B){return(Hash.keyOf(this,B)!==null)},extend:function(B){Hash.each(B,function(A,D){Hash.set(this,D,A)},this);return this},combine:function(B){Hash.each(B,function(A,D){Hash.include(this,D,A)},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(C,D){if(!this[C]||this.hasOwnProperty(C)){this[C]=D}return this},empty:function(){Hash.each(this,function(D,C){delete this[C]},this);return this},include:function(F,E){var D=this[F];if(D==undefined){this[F]=E}return this},map:function(F,E){var D=new Hash;Hash.each(this,function(A,B){D.set(B,F.call(E,A,B,this))},this);return D},filter:function(F,E){var D=new Hash;Hash.each(this,function(A,B){if(F.call(E,A,B,this)){D.set(B,A)}},this);return D},every:function(F,E){for(var D in this){if(this.hasOwnProperty(D)&&!F.call(E,this[D],D)){return false}}return true},some:function(F,E){for(var D in this){if(this.hasOwnProperty(D)&&F.call(E,this[D],D)){return true}}return false},getKeys:function(){var B=[];Hash.each(this,function(A,D){B.push(D)});return B},getValues:function(){var B=[];Hash.each(this,function(A){B.push(A)});return B},toQueryString:function(C){var D=[];Hash.each(this,function(A,B){if(C){B=C+"["+B+"]"}var G;switch($type(A)){case"object":G=Hash.toQueryString(A,B);break;case"array":var H={};A.each(function(E,F){H[F]=E});G=Hash.toQueryString(H,B);break;default:G=B+"="+encodeURIComponent(A)}if(A!=undefined){D.push(G)}});return D.join("&")}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});var Event=new Native({name:"Event",initialize:function(Q,Y){Y=Y||window;var T=Y.document;Q=Q||Y.event;if(Q.$extended){return Q}this.$extended=true;var U=Q.type;var X=Q.target||Q.srcElement;while(X&&X.nodeType==3){X=X.parentNode}if(U.test(/key/)){var P=Q.which||Q.keyCode;var R=Event.Keys.keyOf(P);if(U=="keydown"){var N=P-111;if(N>0&&N<13){R="f"+N}}R=R||String.fromCharCode(P).toLowerCase()}else{if(U.match(/(click|mouse|menu)/i)){T=(!T.compatMode||T.compatMode=="CSS1Compat")?T.html:T.body;var V={x:Q.pageX||Q.clientX+T.scrollLeft,y:Q.pageY||Q.clientY+T.scrollTop};var O={x:(Q.pageX)?Q.pageX-Y.pageXOffset:Q.clientX,y:(Q.pageY)?Q.pageY-Y.pageYOffset:Q.clientY};if(U.match(/DOMMouseScroll|mousewheel/)){var W=(Q.wheelDelta)?Q.wheelDelta/120:-(Q.detail||0)/3}var Z=(Q.which==3)||(Q.button==2);var S=null;if(U.match(/over|out/)){switch(U){case"mouseover":S=Q.relatedTarget||Q.fromElement;break;case"mouseout":S=Q.relatedTarget||Q.toElement}if(!(function(){while(S&&S.nodeType==3){S=S.parentNode}return true}).create({attempt:Browser.Engine.gecko})()){S=false}}}}return $extend(this,{event:Q,type:U,page:V,client:O,rightClick:Z,wheel:W,relatedTarget:S,target:X,code:P,key:R,shift:Q.shiftKey,control:Q.ctrlKey,alt:Q.altKey,meta:Q.metaKey})}});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault()},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}});var Class=new Native({name:"Class",initialize:function(F){F=F||{};var D=function(){for(var A in this){if($type(this[A])!="function"){this[A]=$unlink(this[A])}}this.constructor=D;if(Class.prototyping){return this}var B=(this.initialize)?this.initialize.apply(this,arguments):this;if(this.options&&this.options.initialize){this.options.initialize.call(this)}return B};for(var E in Class.Mutators){if(!F[E]){continue}F=Class.Mutators[E](F,F[E]);delete F[E]}$extend(D,this);D.constructor=Class;D.prototype=F;return D}});Class.Mutators={Extends:function(E,D){Class.prototyping=D.prototype;var F=new D;delete F.parent;F=Class.inherit(F,E);delete Class.prototyping;return F},Implements:function(C,D){$splat(D).each(function(A){Class.prototying=A;$extend(C,($type(A)=="class")?new A:A);delete Class.prototyping});return C}};Class.extend({inherit:function(N,K){var H=arguments.callee.caller;for(var L in K){var M=K[L];var I=N[L];var J=$type(M);if(I&&J=="function"){if(M!=I){if(H){M.__parent=I;N[L]=M}else{Class.override(N,L,M)}}}else{if(J=="object"){N[L]=$merge(I,M)}else{N[L]=M}}}if(H){N.parent=function(){return arguments.callee.caller.__parent.apply(this,arguments)}}return N},override:function(J,F,G){var H=Class.prototyping;if(H&&J[F]!=H[F]){H=null}var I=function(){var B=this.parent;this.parent=H?H[F]:J[F];var A=G.apply(this,arguments);this.parent=B;return A};J[F]=I}});Class.implement({implement:function(){var B=this.prototype;$each(arguments,function(A){Class.inherit(B,A)});return this}});var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(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 Events=new Class({$events:{},addEvent:function(E,F,D){E=Events.removeOn(E);if(F!=$empty){this.$events[E]=this.$events[E]||[];this.$events[E].include(F);if(D){F.internal=true}}return this},addEvents:function(C){for(var D in C){this.addEvent(D,C[D])}return this},fireEvent:function(E,F,D){E=Events.removeOn(E);if(!this.$events||!this.$events[E]){return this}this.$events[E].each(function(A){A.create({bind:this,delay:D,"arguments":F})()},this);return this},removeEvent:function(D,C){D=Events.removeOn(D);if(!this.$events[D]){return this}if(!C.internal){this.$events[D].erase(C)}return this},removeEvents:function(G){if($type(G)=="object"){for(var F in G){this.removeEvent(F,G[F])}return this}if(G){G=Events.removeOn(G)}for(var F in this.$events){if(G&&G!=F){continue}var H=this.$events[F];for(var E=H.length;E--;E){this.removeEvent(F,H[E])}}return this}});Events.removeOn=function(B){return B.replace(/^on([A-Z])/,function(D,A){return A.toLowerCase()})};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent){return this}for(var B in this.options){if($type(this.options[B])!="function"||!(/^on[A-Z]/).test(B)){continue}this.addEvent(B,this.options[B]);delete this.options[B]}return this}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(D,F){var E=Element.Constructors.get(D);if(E){return E(F)}if(typeof D=="string"){return document.newElement(D,F)}return $(D).set(F)},afterImplement:function(C,D){Element.Prototype[C]=D;if(Array[C]){return }Elements.implement(C,function(){var J=[],A=true;for(var H=0,I=this.length;H<I;H++){var B=this[H][C].apply(this[H],arguments);J.push(B);if(A){A=($type(B)=="element")}}return(A)?new Elements(J):J})}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var G=Array.link(arguments,{properties:Object.type,iframe:$defined});var I=G.properties||{};var J=$(G.iframe)||false;var H=I.onload||$empty;delete I.onload;I.id=I.name=$pick(I.id,I.name,J.id,J.name,"IFrame_"+$time());J=new Element(J||"iframe",I);var F=function(){var B=$try(function(){return J.contentWindow.location.host});if(B&&B==window.location.host){var A=new Window(J.contentWindow);new Document(J.contentWindow.document);$extend(A.Element.prototype,Element.Prototype)}H.call(J.contentWindow,J.contentWindow.document)};(window.frames[I.id])?F():J.addListener("load",F);return J}});var Elements=new Native({initialize:function(J,N){N=$extend({ddup:true,cash:true},N);J=J||[];if(N.ddup||N.cash){var I={},K=[];for(var M=0,H=J.length;M<H;M++){var L=$.element(J[M],!N.cash);if(N.ddup){if(I[L.uid]){continue}I[L.uid]=true}K.push(L)}J=K}return(N.cash)?$extend(J,this):J}});Elements.implement({filter:function(C,D){if(!C){return this}return new Elements(Array.filter(this,(typeof C=="string")?function(A){return A.match(C)}:C,D))}});Document.implement({newElement:function(C,D){if(Browser.Engine.trident&&D){["name","type","checked"].each(function(A){if(!D[A]){return }C+=" "+A+'="'+D[A]+'"';if(A!="checked"){delete D[A]}});C="<"+C+">"}return $.element(this.createElement(C)).set(D)},newTextNode:function(B){return this.createTextNode(B)},getDocument:function(){return this},getWindow:function(){return this.window}});Window.implement({$:function(F,E){if(F&&F.$family&&F.uid){return F}var D=$type(F);return($[D])?$[D](F,E,this.document):null},$$:function(G){if(arguments.length==1&&typeof G=="string"){return this.document.getElements(G)}var H=[];var K=Array.flatten(arguments);for(var J=0,L=K.length;J<L;J++){var I=K[J];switch($type(I)){case"element":H.push(I);break;case"string":H.extend(this.document.getElements(I,true))}}return new Elements(H)},getDocument:function(){return this.document},getWindow:function(){return this}});$.string=function(E,F,D){E=D.getElementById(E);return(E)?$.element(E,F):null};$.element=function(E,F){$uid(E);if(!F&&!E.$family&&!(/^object|embed$/i).test(E.tagName)){var H=Element.Prototype;for(var G in H){E[G]=H[G]}}return E};$.object=function(F,E,D){if(F.toElement){return $.element(F.toElement(D),E)}return null};$.textnode=$.whitespace=$.window=$.document=$arguments(0);Native.implement([Element,Document],{getElement:function(C,D){return $(this.getElements(C,true)[0]||null,D)},getElements:function(E,F){E=E.split(",");var G=[];var H=(E.length>1);E.each(function(B){var A=this.getElementsByTagName(B.trim());(H)?G.extend(A):G=A},this);return new Elements(G,{ddup:H,cash:!F})}});(function(){var S={},U={};var R={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};var M=function(A){return(U[A]||(U[A]={}))};var T=function(D,A){if(!D){return }var E=D.uid;if(Browser.Engine.trident){if(D.clearAttributes){var B=A&&D.cloneNode(false);D.clearAttributes();if(B){D.mergeAttributes(B)}}else{if(D.removeEvents){D.removeEvents()}}if((/object/i).test(D.tagName)){for(var C in D){if(typeof D[C]=="function"){D[C]=$empty}}Element.dispose(D)}}if(!E){return }S[E]=U[E]=null};var L=function(){Hash.each(S,T);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(T)}if(window.CollectGarbage){CollectGarbage()}S=U=null};var Q=function(G,A,B,H,E,C){var F=G[B||A];var D=[];while(F){if(F.nodeType==1&&(!H||Element.match(F,H))){if(!E){return $(F,C)}D.push(F)}F=F[A]}return(E)?new Elements(D,{ddup:false,cash:!C}):null};var V={html:"innerHTML","class":"className","for":"htmlFor",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"};var N=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var P=["value","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];Hash.extend(V,N.associate(N));Hash.extend(V,P.associate(P.map(String.toLowerCase)));var O={before:function(B,A){if(A.parentNode){A.parentNode.insertBefore(B,A)}},after:function(C,A){if(!A.parentNode){return }var B=A.nextSibling;(B)?A.parentNode.insertBefore(C,B):A.parentNode.appendChild(C)},bottom:function(B,A){A.appendChild(B)},top:function(C,A){var B=A.firstChild;(B)?A.insertBefore(C,B):A.appendChild(C)}};O.inside=O.bottom;Hash.each(O,function(A,B){B=B.capitalize();Element.implement("inject"+B,function(C){A(this,$(C,true));return this});Element.implement("grab"+B,function(C){A($(C,true),this);return this})});Element.implement({set:function(B,D){switch($type(B)){case"object":for(var C in B){this.set(C,B[C])}break;case"string":var A=Element.Properties.get(B);(A&&A.set)?A.set.apply(this,Array.slice(arguments,1)):this.setProperty(B,D)}return this},get:function(B){var A=Element.Properties.get(B);return(A&&A.get)?A.get.apply(this,Array.slice(arguments,1)):this.getProperty(B)},erase:function(B){var A=Element.Properties.get(B);(A&&A.erase)?A.erase.apply(this):this.removeProperty(B);return this},setProperty:function(C,B){var A=V[C];if(B==undefined){return this.removeProperty(C)}if(A&&N[C]){B=!!B}(A)?this[A]=B:this.setAttribute(C,""+B);return this},setProperties:function(A){for(var B in A){this.setProperty(B,A[B])}return this},getProperty:function(C){var A=V[C];var B=(A)?this[A]:this.getAttribute(C,2);return(N[C])?!!B:(A)?B:B||null},getProperties:function(){var A=$A(arguments);return A.map(this.getProperty,this).associate(A)},removeProperty:function(B){var A=V[B];(A)?this[A]=(A&&N[B])?false:"":this.removeAttribute(B);return this},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this},hasClass:function(A){return this.className.contains(A," ")},addClass:function(A){if(!this.hasClass(A)){this.className=(this.className+" "+A).clean()}return this},removeClass:function(A){this.className=this.className.replace(new RegExp("(^|\\s)"+A+"(?:\\s|$)"),"$1");return this},toggleClass:function(A){return this.hasClass(A)?this.removeClass(A):this.addClass(A)},adopt:function(){Array.flatten(arguments).each(function(A){A=$(A,true);if(A){this.appendChild(A)}},this);return this},appendText:function(B,A){return this.grab(this.getDocument().newTextNode(B),A)},grab:function(B,A){O[A||"bottom"]($(B,true),this);return this},inject:function(B,A){O[A||"bottom"](this,$(B,true));return this},replaces:function(A){A=$(A,true);A.parentNode.replaceChild(this,A);return this},wraps:function(B,A){B=$(B,true);return this.replaces(B).grab(B,A)},getPrevious:function(A,B){return Q(this,"previousSibling",null,A,false,B)},getAllPrevious:function(A,B){return Q(this,"previousSibling",null,A,true,B)},getNext:function(A,B){return Q(this,"nextSibling",null,A,false,B)},getAllNext:function(A,B){return Q(this,"nextSibling",null,A,true,B)},getFirst:function(A,B){return Q(this,"nextSibling","firstChild",A,false,B)},getLast:function(A,B){return Q(this,"previousSibling","lastChild",A,false,B)},getParent:function(A,B){return Q(this,"parentNode",null,A,false,B)},getParents:function(A,B){return Q(this,"parentNode",null,A,true,B)},getChildren:function(A,B){return Q(this,"nextSibling","firstChild",A,true,B)},getWindow:function(){return this.ownerDocument.window},getDocument:function(){return this.ownerDocument},getElementById:function(B,C){var D=this.ownerDocument.getElementById(B);if(!D){return null}for(var A=D.parentNode;A!=this;A=A.parentNode){if(!A){return null}}return $.element(D,C)},getSelected:function(){return new Elements($A(this.options).filter(function(A){return A.selected}))},getComputedStyle:function(B){if(this.currentStyle){return this.currentStyle[B.camelCase()]}var A=this.getDocument().defaultView.getComputedStyle(this,null);return(A)?A.getPropertyValue([B.hyphenate()]):null},toQueryString:function(){var A=[];this.getElements("input, select, textarea",true).each(function(C){if(!C.name||C.disabled){return }var B=(C.tagName.toLowerCase()=="select")?Element.getSelected(C).map(function(D){return D.value}):((C.type=="radio"||C.type=="checkbox")&&!C.checked)?null:C.value;$splat(B).each(function(D){if(typeof D!="undefined"){A.push(C.name+"="+encodeURIComponent(D))}})});return A.join("&")},clone:function(E,A){E=E!==false;var B=this.cloneNode(E);var F=function(I,J){if(!A){I.removeAttribute("id")}if(Browser.Engine.trident){I.clearAttributes();I.mergeAttributes(J);I.removeAttribute("uid");if(I.options){var H=I.options,Y=J.options;for(var K=H.length;K--;){H[K].selected=Y[K].selected}}}var Z=R[J.tagName.toLowerCase()];if(Z&&J[Z]){I[Z]=J[Z]}};if(E){var D=B.getElementsByTagName("*"),C=this.getElementsByTagName("*");for(var G=D.length;G--;){F(D[G],C[G])}}F(B,this);return $(B)},destroy:function(){Element.empty(this);Element.dispose(this);T(this,true);return null},empty:function(){$A(this.childNodes).each(function(A){Element.destroy(A)});return this},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this},hasChild:function(A){A=$(A,true);if(!A){return false}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(A.tagName)).contains(A)}return(this.contains)?(this!=A&&this.contains(A)):!!(this.compareDocumentPosition(A)&16)},match:function(A){return(!A||(A==this)||(Element.get(this,"tag")==A))}});Native.implement([Element,Window,Document],{addListener:function(B,C){if(B=="unload"){var A=C,D=this;C=function(){D.removeListener("unload",C);A()}}else{S[this.uid]=this}if(this.addEventListener){this.addEventListener(B,C,false)}else{this.attachEvent("on"+B,C)}return this},removeListener:function(B,A){if(this.removeEventListener){this.removeEventListener(B,A,false)}else{this.detachEvent("on"+B,A)}return this},retrieve:function(D,A){var B=M(this.uid),C=B[D];if(A!=undefined&&C==undefined){C=B[D]=A}return $pick(C)},store:function(C,A){var B=M(this.uid);B[C]=A;return this},eliminate:function(A){var B=M(this.uid);delete B[A];return this}});window.addListener("unload",L)})();Element.Properties=new Hash;Element.Properties.style={set:function(B){this.style.cssText=B},get:function(){return this.style.cssText},erase:function(){this.style.cssText=""}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase()}};Element.Properties.html=(function(){var E=document.createElement("div");var D={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};D.thead=D.tfoot=D.tbody;var F={set:function(){var C=Array.flatten(arguments).join("");var B=Browser.Engine.trident&&D[this.get("tag")];if(B){var A=E;A.innerHTML=B[1]+C+B[2];for(var H=B[0];H--;){A=A.firstChild}this.empty().adopt(A.childNodes)}else{this.innerHTML=C}}};F.erase=F.set;return F})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText}var C=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var D=C.innerText;C.destroy();return D}}}Element.Properties.events={set:function(B){this.addEvents(B)}};Native.implement([Element,Window,Document],{addEvent:function(R,P){var O=this.retrieve("events",{});O[R]=O[R]||{keys:[],values:[]};if(O[R].keys.contains(P)){return this}O[R].keys.push(P);var Q=R,M=Element.Events.get(R),K=P,N=this;if(M){if(M.onAdd){M.onAdd.call(this,P)}if(M.condition){K=function(A){if(M.condition.call(this,A)){return P.call(this,A)}return true}}Q=M.base||Q}var J=function(){return P.call(N)};var L=Element.NativeEvents[Q];if(L){if(L==2){J=function(A){A=new Event(A,N.getWindow());if(K.call(N,A)===false){A.stop()}}}this.addListener(Q,J)}O[R].values.push(J);return this},removeEvent:function(K,L){var G=this.retrieve("events");if(!G||!G[K]){return this}var H=G[K].keys.indexOf(L);if(H==-1){return this}G[K].keys.splice(H,1);var I=G[K].values.splice(H,1)[0];var J=Element.Events.get(K);if(J){if(J.onRemove){J.onRemove.call(this,L)}K=J.base||K}return(Element.NativeEvents[K])?this.removeListener(K,I):this},addEvents:function(C){for(var D in C){this.addEvent(D,C[D])}return this},removeEvents:function(D){if($type(D)=="object"){for(var E in D){this.removeEvent(E,D[E])}return this}var F=this.retrieve("events");if(!F){return this}if(!D){for(var E in F){this.removeEvents(E)}this.eliminate("events")}else{if(F[D]){while(F[D].keys[0]){this.removeEvent(D,F[D].keys[0])}F[D]=null}}return this},fireEvent:function(F,H,E){var G=this.retrieve("events");if(!G||!G[F]){return this}G[F].keys.each(function(A){A.create({bind:this,delay:E,"arguments":H})()},this);return this},cloneEvents:function(F,E){F=$(F);var G=F.retrieve("events");if(!G){return this}if(!E){for(var H in G){this.cloneEvents(F,H)}}else{if(G[E]){G[E].keys.each(function(A){this.addEvent(E,A)},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,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var B=function(D){var A=D.relatedTarget;if(A==undefined){return true}if(A===false){return false}return($type(this)!="document"&&A!=this&&A.prefix!="xul"&&!this.hasChild(A))};Element.Events=new Hash({mouseenter:{base:"mouseover",condition:B},mouseleave:{base:"mouseout",condition:B},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}})})();Element.Properties.styles={set:function(B){this.setStyles(B)}};Element.Properties.opacity={set:function(C,D){if(!D){if(C==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden"}}else{if(this.style.visibility!="visible"){this.style.visibility="visible"}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1}if(Browser.Engine.trident){this.style.filter=(C==1)?"":"alpha(opacity="+C*100+")"}this.style.opacity=C;this.store("opacity",C)},get:function(){return this.retrieve("opacity",1)}};Element.implement({setOpacity:function(B){return this.set("opacity",B,true)},getOpacity:function(){return this.get("opacity")},setStyle:function(F,D){switch(F){case"opacity":return this.set("opacity",parseFloat(D));case"float":F=(Browser.Engine.trident)?"styleFloat":"cssFloat"}F=F.camelCase();if($type(D)!="string"){var E=(Element.Styles.get(F)||"@").split(" ");D=$splat(D).map(function(A,B){if(!E[B]){return""}return($type(A)=="number")?E[B].replace("@",Math.round(A)):A}).join(" ")}else{if(D==String(Number(D))){D=Math.round(D)}}this.style[F]=D;return this},getStyle:function(I){switch(I){case"opacity":return this.get("opacity");case"float":I=(Browser.Engine.trident)?"styleFloat":"cssFloat"}I=I.camelCase();var H=this.style[I];if(!$chk(H)){H=[];for(var J in Element.ShortStyles){if(I!=J){continue}for(var K in Element.ShortStyles[J]){H.push(this.getStyle(K))}return H.join(" ")}H=this.getComputedStyle(I)}if(H){H=String(H);var M=H.match(/rgba?\([\d\s,]+\)/);if(M){H=H.replace(M[0],M[0].rgbToHex())}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(H)))){if(I.test(/^(height|width)$/)){var N=(I=="width")?["left","right"]:["top","bottom"],L=0;N.each(function(A){L+=this.getStyle("border-"+A+"-width").toInt()+this.getStyle("padding-"+A).toInt()},this);return this["offset"+I.capitalize()]-L+"px"}if((Browser.Engine.presto)&&String(H).test("px")){return H}if(I.test(/(border(.+)Width|margin|padding)/)){return"0px"}}return H},setStyles:function(D){for(var C in D){this.setStyle(C,D[C])}return this},getStyles:function(){var B={};Array.each(arguments,function(A){B[A]=this.getStyle(A)},this);return B}});Element.Styles=new Hash({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(I){var J=Element.ShortStyles;var N=Element.Styles;["margin","padding"].each(function(B){var A=B+I;J[B][A]=N[A]="@px"});var K="border"+I;J.border[K]=N[K]="@px @ rgb(@, @, @)";var L=K+"Width",H=K+"Style",M=K+"Color";J[K]={};J.borderWidth[L]=J[K][L]=N[L]="@px";J.borderStyle[H]=J[K][H]=N[H]="@";J.borderColor[M]=J[K][M]=N[M]="rgb(@, @, @)"});(function(){Element.implement({scrollTo:function(B,A){if(N(this)){this.getWindow().scrollTo(B,A)}else{this.scrollLeft=B;this.scrollTop=A}return this},getSize:function(){if(N(this)){return this.getWindow().getSize()}return{x:this.offsetWidth,y:this.offsetHeight}},getScrollSize:function(){if(N(this)){return this.getWindow().getScrollSize()}return{x:this.scrollWidth,y:this.scrollHeight}},getScroll:function(){if(N(this)){return this.getWindow().getScroll()}return{x:this.scrollLeft,y:this.scrollTop}},getScrolls:function(){var A=this,B={x:0,y:0};while(A&&!N(A)){B.x+=A.scrollLeft;B.y+=A.scrollTop;A=A.parentNode}return B},getOffsetParent:function(){var A=this;if(N(A)){return null}if(!Browser.Engine.trident){return A.offsetParent}while((A=A.parentNode)&&!N(A)){if(L(A,"position")!="static"){return A}}return null},getOffsets:function(){if(Browser.Engine.trident){var A=this.getBoundingClientRect(),C=this.getDocument().documentElement;return{x:A.left+C.scrollLeft-C.clientLeft,y:A.top+C.scrollTop-C.clientTop}}var D=this,E={x:0,y:0};if(N(this)){return E}while(D&&!N(D)){E.x+=D.offsetLeft;E.y+=D.offsetTop;if(Browser.Engine.gecko){if(!J(D)){E.x+=M(D);E.y+=I(D)}var B=D.parentNode;if(B&&L(B,"overflow")!="visible"){E.x+=M(B);E.y+=I(B)}}else{if(D!=this&&Browser.Engine.webkit){E.x+=M(D);E.y+=I(D)}}D=D.offsetParent}if(Browser.Engine.gecko&&!J(this)){E.x-=M(this);E.y-=I(this)}return E},getPosition:function(B){if(N(this)){return{x:0,y:0}}var A=this.getOffsets(),D=this.getScrolls();var E={x:A.x-D.x,y:A.y-D.y};var C=(B&&(B=$(B)))?B.getPosition():{x:0,y:0};return{x:E.x-C.x,y:E.y-C.y}},getCoordinates:function(B){if(N(this)){return this.getWindow().getCoordinates()}var D=this.getPosition(B),C=this.getSize();var A={left:D.x,top:D.y,width:C.x,height:C.y};A.right=A.left+A.width;A.bottom=A.top+A.height;return A},computePosition:function(A){return{left:A.x-K(this,"margin-left"),top:A.y-K(this,"margin-top")}},position:function(A){return this.setStyles(this.computePosition(A))}});Native.implement([Document,Window],{getSize:function(){var A=this.getWindow();if(Browser.Engine.presto||Browser.Engine.webkit){return{x:A.innerWidth,y:A.innerHeight}}var B=H(this);return{x:B.clientWidth,y:B.clientHeight}},getScroll:function(){var A=this.getWindow();var B=H(this);return{x:A.pageXOffset||B.scrollLeft,y:A.pageYOffset||B.scrollTop}},getScrollSize:function(){var A=H(this);var B=this.getSize();return{x:Math.max(A.scrollWidth,B.x),y:Math.max(A.scrollHeight,B.y)}},getPosition:function(){return{x:0,y:0}},getCoordinates:function(){var A=this.getSize();return{top:0,left:0,bottom:A.y,right:A.x,height:A.y,width:A.x}}});var L=Element.getComputedStyle;function K(B,A){return L(B,A).toInt()||0}function J(A){return L(A,"-moz-box-sizing")=="border-box"}function I(A){return K(A,"border-top-width")}function M(A){return K(A,"border-left-width")}function N(A){return(/^(?:body|html)$/i).test(A.tagName)}function H(B){var A=B.getDocument();return(!A.compatMode||A.compatMode=="CSS1Compat")?A.html:A.body}})();Native.implement([Window,Document,Element],{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}});Native.implement([Document,Element],{getElements:function(J,K){J=J.split(",");var O,M={};for(var N=0,P=J.length;N<P;N++){var I=J[N],L=Selectors.Utils.search(this,I,M);if(N!=0&&L.item){L=$A(L)}O=(N==0)?L:(O.item)?$A(O).concat(L):O.concat(L)}return new Elements(O,{ddup:(J.length>1),cash:!K})}});Element.implement({match:function(J){if(!J||(J==this)){return true}var H=Selectors.Utils.parseTagAndID(J);var F=H[0],G=H[1];if(!Selectors.Filters.byID(this,G)||!Selectors.Filters.byTag(this,F)){return false}var I=Selectors.Utils.parseSelector(J);return(I)?Selectors.Utils.filter(this,I,{}):true}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(F,E){if(!E){return true}var D=$uid(F);if(!E[D]){return E[D]=true}return false},parseNthArgument:function(H){if(Selectors.Cache.nth[H]){return Selectors.Cache.nth[H]}var K=H.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!K){return false}var I=parseInt(K[1]);var L=(I||I===0)?I:1;var J=K[2]||false;var G=parseInt(K[3])||0;if(L!=0){G--;while(G<1){G+=L}while(G>=L){G-=L}}else{L=G;J="index"}switch(J){case"n":K={a:L,b:G,special:"n"};break;case"odd":K={a:2,b:0,special:"n"};break;case"even":K={a:2,b:1,special:"n"};break;case"first":K={a:0,special:"index"};break;case"last":K={special:"last-child"};break;case"only":K={special:"only-child"};break;default:K={a:(L-1),special:"index"}}return Selectors.Cache.nth[H]=K},parseSelector:function(T){if(Selectors.Cache.parsed[T]){return Selectors.Cache.parsed[T]}var K,Q={classes:[],pseudos:[],attributes:[]};while((K=Selectors.RegExps.combined.exec(T))){var P=K[1],R=K[2],S=K[3],M=K[5],L=K[6],O=K[7];if(P){Q.classes.push(P)}else{if(L){var N=Selectors.Pseudo.get(L);if(N){Q.pseudos.push({parser:N,argument:O})}else{Q.attributes.push({name:L,operator:"=",value:O})}}else{if(R){Q.attributes.push({name:R,operator:S,value:M})}}}}if(!Q.classes.length){delete Q.classes}if(!Q.attributes.length){delete Q.attributes}if(!Q.pseudos.length){delete Q.pseudos}if(!Q.classes&&!Q.attributes&&!Q.pseudos){Q=null}return Selectors.Cache.parsed[T]=Q},parseTagAndID:function(F){var D=F.match(Selectors.RegExps.tag);var E=F.match(Selectors.RegExps.id);return[(D)?D[1]:"*",(E)?E[1]:false]},filter:function(J,M,K){var L;if(M.classes){for(L=M.classes.length;L--;L){var I=M.classes[L];if(!Selectors.Filters.byClass(J,I)){return false}}}if(M.attributes){for(L=M.attributes.length;L--;L){var N=M.attributes[L];if(!Selectors.Filters.byAttribute(J,N.name,N.operator,N.value)){return false}}}if(M.pseudos){for(L=M.pseudos.length;L--;L){var H=M.pseudos[L];if(!Selectors.Filters.byPseudo(J,H.parser,H.argument,K)){return false}}}return true},getByTagAndID:function(H,E,F){if(F){var G=(H.getElementById)?H.getElementById(F,true):Element.getElementById(H,F,true);return(G&&Selectors.Filters.byTag(G,E))?[G]:[]}else{return H.getElementsByTagName(E)}},search:function(j,k,e){var q=[];var p=k.trim().replace(Selectors.RegExps.splitter,function(B,C,A){q.push(C);return":)"+A}).split(":)");var i,n,X;for(var Y=0,c=p.length;Y<c;Y++){var Z=p[Y];if(Y==0&&Selectors.RegExps.quick.test(Z)){i=j.getElementsByTagName(Z);continue}var r=q[Y-1];var h=Selectors.Utils.parseTagAndID(Z);var W=h[0],g=h[1];if(Y==0){i=Selectors.Utils.getByTagAndID(j,W,g)}else{var o={},l=[];for(var a=0,b=i.length;a<b;a++){l=Selectors.Getters[r](l,i[a],W,g,o)}i=l}var m=Selectors.Utils.parseSelector(Z);if(m){n=[];for(var d=0,f=i.length;d<f;d++){X=i[d];if(Selectors.Utils.filter(X,m,e)){n.push(X)}}i=n}}return i}};Selectors.Getters={" ":function(O,P,N,M,R){var J=Selectors.Utils.getByTagAndID(P,N,M);for(var K=0,L=J.length;K<L;K++){var Q=J[K];if(Selectors.Utils.chk(Q,R)){O.push(Q)}}return O},">":function(O,P,N,M,Q){var K=Selectors.Utils.getByTagAndID(P,N,M);for(var R=0,J=K.length;R<J;R++){var L=K[R];if(L.parentNode==P&&Selectors.Utils.chk(L,Q)){O.push(L)}}return O},"+":function(I,J,F,G,H){while((J=J.nextSibling)){if(J.nodeType==1){if(Selectors.Utils.chk(J,H)&&Selectors.Filters.byTag(J,F)&&Selectors.Filters.byID(J,G)){I.push(J)}break}}return I},"~":function(I,J,F,G,H){while((J=J.nextSibling)){if(J.nodeType==1){if(!Selectors.Utils.chk(J,H)){break}if(Selectors.Filters.byTag(J,F)&&Selectors.Filters.byID(J,G)){I.push(J)}}}return I}};Selectors.Filters={byTag:function(D,C){return(C=="*"||(D.tagName&&D.tagName.toLowerCase()==C))},byID:function(C,D){return(!D||(C.id&&C.id==D))},byClass:function(D,C){return(D.className&&D.className.contains(C," "))},byPseudo:function(E,F,G,H){return F.call(E,G,H)},byAttribute:function(I,H,J,G){var F=Element.prototype.getProperty.call(I,H);if(!F){return(J=="!=")}if(!J||G==undefined){return true}switch(J){case"=":return(F==G);case"*=":return(F.contains(G));case"^=":return(F.substr(0,G.length)==G);case"$=":return(F.substr(F.length-G.length)==G);case"!=":return(F!=G);case"~=":return F.contains(G," ");case"|=":return F.contains(G,"-")}return false}};Selectors.Pseudo=new Hash({checked:function(){return this.checked},empty:function(){return !(this.innerText||this.textContent||"").length},not:function(B){return !Element.match(this,B)},contains:function(B){return(this.innerText||this.textContent||"").contains(B)},"first-child":function(){return Selectors.Pseudo.index.call(this,0)},"last-child":function(){var B=this;while((B=B.nextSibling)){if(B.nodeType==1){return false}}return true},"only-child":function(){var D=this;while((D=D.previousSibling)){if(D.nodeType==1){return false}}var C=this;while((C=C.nextSibling)){if(C.nodeType==1){return false}}return true},"nth-child":function(I,K){I=(I==undefined)?"n":I;var M=Selectors.Utils.parseNthArgument(I);if(M.special!="n"){return Selectors.Pseudo[M.special].call(this,M.a,K)}var J=0;K.positions=K.positions||{};var L=$uid(this);if(!K.positions[L]){var N=this;while((N=N.previousSibling)){if(N.nodeType!=1){continue}J++;var H=K.positions[$uid(N)];if(H!=undefined){J=H+J;break}}K.positions[L]=J}return(K.positions[L]%M.a==M.b)},index:function(D){var F=this,E=0;while((F=F.previousSibling)){if(F.nodeType==1&&++E>D){return false}}return(E==D)},even:function(D,C){return Selectors.Pseudo["nth-child"].call(this,"2n+1",C)},odd:function(D,C){return Selectors.Pseudo["nth-child"].call(this,"2n",C)}});Element.Events.domready={onAdd:function(B){if(Browser.loaded){B.call(this)}}};(function(){var D=function(){if(Browser.loaded){return }Browser.loaded=true;window.fireEvent("domready");document.fireEvent("domready")};if(Browser.Engine.trident){var C=document.createElement("div");(function(){($try(function(){C.doScroll("left");return $(C).inject(document.body).set("html","temp").dispose()}))?D():arguments.callee.delay(50)})()}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?D():arguments.callee.delay(50)})()}else{window.addEvent("load",D);document.addEvent("DOMContentLoaded",D)}}})();var JSON=new Hash({$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(B){return JSON.$specialChars[B]||"\\u00"+Math.floor(B.charCodeAt()/16).toString(16)+(B.charCodeAt()%16).toString(16)},encode:function(D){switch($type(D)){case"string":return'"'+D.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(D.map(JSON.encode).filter($defined))+"]";case"object":case"hash":var C=[];Hash.each(D,function(A,B){var F=JSON.encode(A);if(F){C.push(JSON.encode(B)+":"+F)}});return"{"+C+"}";case"number":case"boolean":return String(D);case false:return"null"}return null},decode:function(string,secure){if($type(string)!="string"||!string.length){return null}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null}return eval("("+string+")")}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this)}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(D,C){this.key=D;this.setOptions(C)},write:function(D){D=encodeURIComponent(D);if(this.options.domain){D+="; domain="+this.options.domain}if(this.options.path){D+="; path="+this.options.path}if(this.options.duration){var C=new Date();C.setTime(C.getTime()+this.options.duration*24*60*60*1000);D+="; expires="+C.toGMTString()}if(this.options.secure){D+="; secure"}this.options.document.cookie=this.key+"="+D;return this},read:function(){var B=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");return(B)?decodeURIComponent(B[1]):null},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");return this}});Cookie.write=function(F,E,D){return new Cookie(F,D).write(E)};Cookie.read=function(B){return new Cookie(B).read()};Cookie.dispose=function(D,C){return new Cookie(D,C).dispose()};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(C){this.subject=this.subject||this;this.setOptions(C);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var D=this.options.wait;if(D===false){this.options.link="cancel"}},getTransition:function(){return function(B){return -(Math.cos(Math.PI*B)-1)/2}},step:function(){var C=$time();if(C<this.time+this.options.duration){var D=this.transition((C-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,D))}else{this.set(this.compute(this.from,this.to,1));this.complete()}},set:function(B){return B},compute:function(E,F,D){return Fx.compute(E,F,D)},check:function(B){if(!this.timer){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(B.bind(this,Array.slice(arguments,1)));return false}return false},start:function(D,C){if(!this.check(arguments.callee,D,C)){return this}this.from=D;this.to=C;this.time=0;this.transition=this.getTransition();this.startTimer();this.onStart();return this},complete:function(){if(this.stopTimer()){this.onComplete()}return this},cancel:function(){if(this.stopTimer()){this.onCancel()}return this},onStart:function(){this.fireEvent("start",this.subject)},onComplete:function(){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject)}},onCancel:function(){this.fireEvent("cancel",this.subject).clearChain()},pause:function(){this.stopTimer();return this},resume:function(){this.startTimer();return this},stopTimer:function(){if(!this.timer){return false}this.time=$time()-this.time;this.timer=$clear(this.timer);return true},startTimer:function(){if(this.timer){return false}this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true}});Fx.compute=function(E,F,D){return(F-E)*D+E};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(H,G,J){J=$splat(J);var I=J[1];if(!$chk(I)){J[1]=J[0];J[0]=H.getStyle(G)}var F=J.map(this.parse);return{from:F[0],to:F[1]}},parse:function(B){B=$lambda(B)();B=(typeof B=="string")?B.split(" "):$splat(B);return B.map(function(A){A=String(A);var D=false;Fx.CSS.Parsers.each(function(C,G){if(D){return }var H=C.parse(A);if($chk(H)){D={value:H,parser:C}}});D=D||{value:A,parser:Fx.CSS.Parsers.String};return D})},compute:function(F,G,H){var E=[];(Math.min(F.length,G.length)).times(function(A){E.push({value:F[A].parser.compute(F[A].value,G[A].value,H),parser:F[A].parser})});E.$family={name:"fx:css:value"};return E},serve:function(E,F){if($type(E)!="fx:css:value"){E=this.parse(E)}var D=[];E.each(function(A){D=D.concat(A.parser.serve(A.value,F))});return D},render:function(E,F,G,H){E.setStyle(F,this.serve(G,H))},search:function(C){if(Fx.CSS.Cache[C]){return Fx.CSS.Cache[C]}var D={};Array.each(document.styleSheets,function(B,G){var H=B.href;if(H&&H.contains("://")&&!H.contains(document.domain)){return }var A=B.rules||B.cssRules;Array.each(A,function(E,J){if(!E.style){return }var F=(E.selectorText)?E.selectorText.replace(/^\w+/,function(I){return I.toLowerCase()}):null;if(!F||!F.test("^"+C+"$")){return }Element.Styles.each(function(I,L){if(!E.style[L]||Element.ShortStyles[L]){return }I=String(E.style[L]);D[L]=(I.test(/^rgb/))?I.rgbToHex():I})})});return Fx.CSS.Cache[C]=D}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(B){if(B.match(/^#[0-9a-f]{3,6}$/i)){return B.hexToRgb(true)}return((B=B.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[B[1],B[2],B[3]]:false},compute:function(E,F,D){return E.map(function(A,B){return Math.round(Fx.compute(E[B],F[B],D))})},serve:function(B){return B.map(Number)}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(D,C){return(C)?D+C:D}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(D,C){this.element=this.subject=$(D);this.parent(C)},set:function(D,C){if(arguments.length==1){C=D;D=this.property||this.options.property}this.render(this.element,D,C,this.options.unit);return this},start:function(I,G,H){if(!this.check(arguments.callee,I,G,H)){return this}var J=Array.flatten(arguments);this.property=this.options.property||J.shift();var F=this.prepare(this.element,this.property,J);return this.parent(F.from,F.to)}});Element.Properties.tween={set:function(C){var D=this.retrieve("tween");if(D){D.cancel()}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},C))},get:function(B){if(B||!this.retrieve("tween")){if(B||!this.retrieve("tween:options")){this.set("tween",B)}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options")))}return this.retrieve("tween")}};Element.implement({tween:function(D,E,F){this.get("tween").start(arguments);return this},fade:function(I){var G=this.get("tween"),H="opacity",F;I=$pick(I,"toggle");switch(I){case"in":G.start(H,1);break;case"out":G.start(H,0);break;case"show":G.set(H,1);break;case"hide":G.set(H,0);break;case"toggle":var J=this.retrieve("fade:flag",this.get("opacity")==1);G.start(H,(J)?0:1);this.store("fade:flag",!J);F=true;break;default:G.start(H,arguments)}if(!F){this.eliminate("fade:flag")}return this},highlight:function(E,D){if(!D){D=this.retrieve("highlight:original",this.getStyle("background-color"));D=(D=="transparent")?"#fff":D}var F=this.get("tween");F.start("background-color",E||"#ffff88",D).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));F.callChain()}.bind(this));return this}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(D,C){this.element=this.subject=$(D);this.parent(C)},set:function(C){if(typeof C=="string"){C=this.search(C)}for(var D in C){this.render(this.element,D,C[D],this.options.unit)}return this},compute:function(G,H,I){var F={};for(var J in G){F[J]=this.parent(G[J],H[J],I)}return F},start:function(J){if(!this.check(arguments.callee,J)){return this}if(typeof J=="string"){J=this.search(J)}var G={},H={};for(var I in J){var F=this.prepare(this.element,I,J[I]);G[I]=F.from;H[I]=F.to}return this.parent(G,H)}});Element.Properties.morph={set:function(C){var D=this.retrieve("morph");if(D){D.cancel()}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},C))},get:function(B){if(B||!this.retrieve("morph")){if(B||!this.retrieve("morph:options")){this.set("morph",B)}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")))}return this.retrieve("morph")}};Element.implement({morph:function(B){this.get("morph").start(B);return this}});Fx.implement({getTransition:function(){var C=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof C=="string"){var D=C.split(":");C=Fx.Transitions;C=C[D[0]]||C[D[0].capitalize()];if(D[1]){C=C["ease"+D[1].capitalize()+(D[2]?D[2].capitalize():"")]}}return C}});Fx.Transition=function(D,C){C=$splat(C);return $extend(D,{easeIn:function(A){return D(A,C)},easeOut:function(A){return 1-D(1-A,C)},easeInOut:function(A){return(A<=0.5)?D(2*A,C)/2:(2-D(2*(1-A),C))/2}})};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(C){for(var D in C){Fx.Transitions[D]=new Fx.Transition(C[D])}};Fx.Transitions.extend({Pow:function(D,C){return Math.pow(D,C[0]||6)},Expo:function(B){return Math.pow(2,8*(B-1))},Circ:function(B){return 1-Math.sin(Math.acos(B))},Sine:function(B){return 1-Math.sin((1-B)*Math.PI/2)},Back:function(D,C){C=C[0]||1.618;return Math.pow(D,2)*((C+1)*D-C)},Bounce:function(F){var G;for(var H=0,E=1;1;H+=E,E/=2){if(F>=(7-4*H)/11){G=E*E-Math.pow((11-6*H-11*F)/4,2);break}}return G},Elastic:function(D,C){return Math.pow(2,10*--D)*Math.cos(20*D*Math.PI*(C[0]||1)/3)}});["Quad","Cubic","Quart","Quint"].each(function(D,C){Fx.Transitions[D]=new Fx.Transition(function(A){return Math.pow(A,[C+2])})});var 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},initialize:function(B){this.xhr=new Browser.Request();this.setOptions(B);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers)},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return }this.running=false;this.status=0;$try(function(){this.status=this.xhr.status}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml)}else{this.response={text:null,xml:null};this.failure()}this.xhr.onreadystatechange=$empty},isSuccess:function(){return((this.status>=200)&&(this.status<300))},processScripts:function(B){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(B)}return B.stripScripts(this.options.evalScripts)},success:function(D,C){this.onSuccess(this.processScripts(D),C)},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain()},failure:function(){this.onFailure()},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr)},setHeader:function(C,D){this.headers.set(C,D);return this},getHeader:function(B){return $try(function(){return this.xhr.getResponseHeader(B)}.bind(this))},check:function(B){if(!this.running){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(B.bind(this,Array.slice(arguments,1)));return false}return false},send:function(N){if(!this.check(arguments.callee,N)){return this}this.running=true;var P=$type(N);if(P=="string"||P=="element"){N={data:N}}var J=this.options;N=$extend({data:J.data,url:J.url,method:J.method},N);var R=N.data,L=N.url,M=N.method;switch($type(R)){case"element":R=$(R).toQueryString();break;case"object":case"hash":R=Hash.toQueryString(R)}if(this.options.format){var O="format="+this.options.format;R=(R)?O+"&"+R:O}if(this.options.emulation&&["put","delete"].contains(M)){var Q="_method="+M;R=(R)?Q+"&"+R:Q;M="post"}if(this.options.urlEncoded&&M=="post"){var K=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers.set("Content-type","application/x-www-form-urlencoded"+K)}if(R&&M=="get"){L=L+(L.contains("?")?"&":"?")+R;R=null}this.xhr.open(M.toUpperCase(),L,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(B,C){try{this.xhr.setRequestHeader(C,B)}catch(A){this.fireEvent("exception",[C,B])}},this);this.fireEvent("request");this.xhr.send(R);if(!this.options.async){this.onStateChange()}return this},cancel:function(){if(!this.running){return this}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent("cancel");return this}});(function(){var B={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(A){B[A]=function(){var D=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(D,{method:A.toLowerCase()}))}});Request.implement(B)})();Element.Properties.send={set:function(C){var D=this.retrieve("send");if(D){D.cancel()}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},C))},get:function(B){if(B||!this.retrieve("send")){if(B||!this.retrieve("send:options")){this.set("send",B)}this.store("send",new Request(this.retrieve("send:options")))}return this.retrieve("send")}};Element.implement({send:function(C){var D=this.get("send");D.send({data:this,url:C||D.options.url});return this}});Request.HTML=new Class({Extends:Request,options:{update:false,evalScripts:true,filter:false},processHTML:function(E){var F=E.match(/<body[^>]*>([\s\S]*?)<\/body>/i);E=(F)?F[1]:E;var D=new Element("div");return $try(function(){var J="<root>"+E+"</root>",B;if(Browser.Engine.trident){B=new ActiveXObject("Microsoft.XMLDOM");B.async=false;B.loadXML(J)}else{B=new DOMParser().parseFromString(J,"text/xml")}J=B.getElementsByTagName("root")[0];for(var C=0,I=J.childNodes.length;C<I;C++){var A=Element.clone(J.childNodes[C],true,true);if(A){D.grab(A)}}return D})||D.set("html",E)},success:function(F){var G=this.options,H=this.response;H.html=F.stripScripts(function(A){H.javascript=A});var E=this.processHTML(H.html);H.tree=E.childNodes;H.elements=E.getElements("*");if(G.filter){H.tree=H.elements.filter(G.filter)}if(G.update){$(G.update).empty().set("html",H.html)}if(G.evalScripts){$exec(H.javascript)}this.onSuccess(H.tree,H.elements,H.html,H.javascript)}});Element.Properties.load={set:function(C){var D=this.retrieve("load");if(D){D.cancel()}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},C))},get:function(B){if(B||!this.retrieve("load")){if(B||!this.retrieve("load:options")){this.set("load",B)}this.store("load",new Request.HTML(this.retrieve("load:options")))}return this.retrieve("load")}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Object.type,url:String.type}));return this}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(B){this.parent(B);this.headers.extend({Accept:"application/json","X-Request":"JSON"})},success:function(B){this.response.json=JSON.decode(B,this.options.secure);this.onSuccess(this.response.json,B)}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(F,D){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper)}},true);this.element=this.subject=$(F);this.parent(D);var E=this.element.retrieve("wrapper");this.wrapper=E||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=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(B){this.element.setStyle(this.margin,B[0]);this.wrapper.setStyle(this.layout,B[1]);return this},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J[A]=Fx.compute(G[A],H[A],I)});return J},start:function(N,K){if(!this.check(arguments.callee,N,K)){return this}this[K||this.options.mode]();var L=this.element.getStyle(this.margin).toInt();var M=this.wrapper.getStyle(this.layout).toInt();var H=[[L,M],[0,this.offset]];var I=[[L,M],[-this.offset,0]];var J;switch(N){case"in":J=H;break;case"out":J=I;break;case"toggle":J=(this.wrapper["offset"+this.layout.capitalize()]==0)?H:I}return this.parent(J[0],J[1])},slideIn:function(B){return this.start("in",B)},slideOut:function(B){return this.start("out",B)},hide:function(B){this[B||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(B){this[B||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(B){return this.start("toggle",B)}});Element.Properties.slide={set:function(D){var C=this.retrieve("slide");if(C){C.cancel()}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},D))},get:function(B){if(B||!this.retrieve("slide")){if(B||!this.retrieve("slide:options")){this.set("slide",B)}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")))}return this.retrieve("slide")}};Element.implement({slide:function(H,G){H=H||"toggle";var J=this.get("slide"),F;switch(H){case"hide":J.hide(G);break;case"show":J.show(G);break;case"toggle":var I=this.retrieve("slide:flag",J.open);J[(I)?"slideOut":"slideIn"](G);this.store("slide:flag",!I);F=true;break;default:J.start(H,G)}if(!F){this.eliminate("slide:flag")}return this}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(H,E){this.element=this.subject=$(H);this.parent(E);var F=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body)}var G=this.element;if(this.options.wheelStops){this.addEvent("start",function(){G.addEvent("mousewheel",F)},true);this.addEvent("complete",function(){G.removeEvent("mousewheel",F)},true)}},set:function(){var B=Array.flatten(arguments);this.element.scrollTo(B[0],B[1])},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J.push(Fx.compute(G[A],H[A],I))});return J},start:function(O,J){if(!this.check(arguments.callee,O,J)){return this}var M=this.element.getSize(),L=this.element.getScrollSize();var P=this.element.getScroll(),N={x:O,y:J};for(var K in N){var I=L[K]-M[K];if($chk(N[K])){N[K]=($type(N[K])=="number")?N[K].limit(0,I):I}else{N[K]=P[K]}N[K]+=this.options.offset[K]}return this.parent([P.x,P.y],[N.x,N.y])},toTop:function(){return this.start(false,0)},toLeft:function(){return this.start(0,false)},toRight:function(){return this.start("right",false)},toBottom:function(){return this.start(false,"bottom")},toElement:function(D){var C=$(D).getPosition(this.element);return this.start(C.x,C.y)}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(D,C){this.elements=this.subject=$$(D);this.parent(C)},compute:function(P,O,N){var K={};for(var J in P){var M=P[J],R=O[J],Q=K[J]={};for(var L in M){Q[L]=this.parent(M[L],R[L],N)}}return K},set:function(H){for(var G in H){var E=H[G];for(var F in E){this.render(this.elements[G],F,E[F],this.options.unit)}}return this},start:function(K){if(!this.check(arguments.callee,K)){return this}var O={},N={};for(var J in K){var Q=K[J],M=O[J]={},P=N[J]={};for(var L in Q){var R=this.prepare(this.elements[J],L,Q[L]);M[L]=R.from;P[L]=R.to}}return this.parent(O,N)}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var D=Array.link(arguments,{options:Object.type,element:$defined});this.element=$(D.element);this.document=this.element.getDocument();this.setOptions(D.options||{});var C=$type(this.options.handle);this.handles=(C=="array"||C=="collection")?$$(this.options.handle):$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";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:$lambda(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(G){if(this.options.preventDefault){G.preventDefault()}this.fireEvent("beforeStart",this.element);this.mouse.start=G.page;var E=this.options.limit;this.limit={x:[],y:[]};for(var F in this.options.modifiers){if(!this.options.modifiers[F]){continue}if(this.options.style){this.value.now[F]=this.element.getStyle(this.options.modifiers[F]).toInt()}else{this.value.now[F]=this.element[this.options.modifiers[F]]}if(this.options.invert){this.value.now[F]*=-1}this.mouse.pos[F]=G.page[F]-this.value.now[F];if(E&&E[F]){for(var H=2;H--;H){if($chk(E[F][H])){this.limit[F][H]=$lambda(E[F][H])()}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop)},check:function(C){if(this.options.preventDefault){C.preventDefault()}var D=Math.round(Math.sqrt(Math.pow(C.page.x-this.mouse.start.x,2)+Math.pow(C.page.y-this.mouse.start.y,2)));if(D>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",this.element).fireEvent("snap",this.element)}},drag:function(C){if(this.options.preventDefault){C.preventDefault()}this.mouse.now=C.page;for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue}this.value.now[D]=this.mouse.now[D]-this.mouse.pos[D];if(this.options.invert){this.value.now[D]*=-1}if(this.options.limit&&this.limit[D]){if($chk(this.limit[D][1])&&(this.value.now[D]>this.limit[D][1])){this.value.now[D]=this.limit[D][1]}else{if($chk(this.limit[D][0])&&(this.value.now[D]<this.limit[D][0])){this.value.now[D]=this.limit[D][0]}}}if(this.options.grid[D]){this.value.now[D]-=(this.value.now[D]%this.options.grid[D])}if(this.options.style){this.element.setStyle(this.options.modifiers[D],this.value.now[D]+this.options.unit)}else{this.element[this.options.modifiers[D]]=this.value.now[D]}}this.fireEvent("drag",this.element)},cancel:function(B){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element)}},stop:function(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(B){this.fireEvent("complete",this.element)}}});Element.implement({makeResizable:function(B){return new Drag(this,$merge({modifiers:{x:"width",y:"height"}},B))}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false},initialize:function(G,H){this.parent(G,H);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=$(this.container.getDocument().body)}G=this.element;var F=G.getStyle("position");var E=(F!="static")?F:"absolute";if(G.getStyle("left")=="auto"||G.getStyle("top")=="auto"){G.position(G.getPosition(G.offsetParent))}G.setStyle("position",E);this.addEvent("start",function(){this.checkDroppables()},true)},start:function(M){if(this.container){var K=this.element,O=this.container,T=O.getCoordinates(K.offsetParent),S={},N={};["top","right","bottom","left"].each(function(A){S[A]=O.getStyle("padding-"+A).toInt();N[A]=K.getStyle("margin-"+A).toInt()},this);var L=K.offsetWidth+N.left+N.right,P=K.offsetHeight+N.top+N.bottom;var Q=[T.left+S.left,T.right-S.right-L];var R=[T.top+S.top,T.bottom-S.bottom-P];this.options.limit={x:Q,y:R}}this.parent(M)},checkAgainst:function(D){D=D.getCoordinates();var C=this.mouse.now;return(C.x>D.left&&C.x<D.right&&C.y<D.bottom&&C.y>D.top)},checkDroppables:function(){var B=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=B){if(this.overed){this.fireEvent("leave",[this.element,this.overed])}if(B){this.overed=B;this.fireEvent("enter",[this.element,B])}else{this.overed=null}}},drag:function(B){this.parent(B);if(this.droppables.length){this.checkDroppables()}},stop:function(B){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed]);this.overed=null;return this.parent(B)}});Element.implement({makeDraggable:function(B){return new Drag.Move(this,B)}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(D,C){this.parent(D,C);this.load()},save:function(){var B=JSON.encode(this.hash);if(!B||B.length>4096){return false}if(B=="{}"){this.dispose()}else{this.write(B)}return true},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this}});Hash.Cookie.implement((function(){var B={};Hash.each(Hash.prototype,function(A,D){B[D]=function(){var C=A.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return C}});return B})());var Color=new Native({initialize:function(F,E){if(arguments.length>=3){E="rgb";F=Array.slice(arguments,0,3)}else{if(typeof F=="string"){if(F.match(/rgb/)){F=F.rgbToHex().hexToRgb(true)}else{if(F.match(/hsb/)){F=F.hsbToRgb()}else{F=F.hexToRgb(true)}}}}E=E||"rgb";switch(E){case"hsb":var D=F;F=F.hsbToRgb();F.hsb=D;break;case"hex":F=F.hexToRgb(true);break}F.rgb=F.slice(0,3);F.hsb=F.hsb||F.rgbToHsb();F.hex=F.rgbToHex();return $extend(F,this)}});Color.implement({mix:function(){var D=Array.slice(arguments);var E=($type(D.getLast())=="number")?D.pop():50;var F=this.slice();D.each(function(B){B=new Color(B);for(var A=0;A<3;A++){F[A]=Math.round((F[A]/100*(100-E))+(B[A]/100*E))}});return new Color(F,"rgb")},invert:function(){return new Color(this.map(function(B){return 255-B}))},setHue:function(B){return new Color([B,this.hsb[1],this.hsb[2]],"hsb")},setSaturation:function(B){return new Color([this.hsb[0],B,this.hsb[2]],"hsb")},setBrightness:function(B){return new Color([this.hsb[0],this.hsb[1],B],"hsb")}});function $RGB(E,F,D){return new Color([E,F,D],"rgb")}function $HSB(E,F,D){return new Color([E,F,D],"hsb")}function $HEX(B){return new Color(B,"hex")}Array.implement({rgbToHsb:function(){var O=this[0],N=this[1],S=this[2];var V,W,U;var T=Math.max(O,N,S),X=Math.min(O,N,S);var R=T-X;U=T/255;W=(T!=0)?R/T:0;if(W==0){V=0}else{var M=(T-O)/R;var P=(T-N)/R;var Q=(T-S)/R;if(O==T){V=Q-P}else{if(N==T){V=2+M-Q}else{V=4+P-M}}V/=6;if(V<0){V++}}return[Math.round(V*360),Math.round(W*100),Math.round(U*100)]},hsbToRgb:function(){var K=Math.round(this[2]/100*255);if(this[1]==0){return[K,K,K]}else{var G=this[0]%360;var I=G%60;var H=Math.round((this[2]*(100-this[1]))/10000*255);var J=Math.round((this[2]*(6000-this[1]*I))/600000*255);var L=Math.round((this[2]*(6000-this[1]*(60-I)))/600000*255);switch(Math.floor(G/60)){case 0:return[K,L,H];case 1:return[J,K,H];case 2:return[H,K,L];case 3:return[H,J,K];case 4:return[L,H,K];case 5:return[K,H,J]}}return false}});String.implement({rgbToHsb:function(){var B=this.match(/\d{1,3}/g);return(B)?hsb.rgbToHsb():null},hsbToRgb:function(){var B=this.match(/\d{1,3}/g);return(B)?B.hsbToRgb():null}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={}},addEvent:function(D,C){this.checker[D]=this.checker[D]||{};this.events[D]=this.events[D]||[];if(this.events[D].contains(C)){return false}else{this.events[D].push(C)}this.instances.each(function(B,A){B.addEvent(D,this.check.bind(this,[D,B,A]))},this);return this},check:function(G,E,H){this.checker[G][H]=true;var F=this.instances.every(function(A,B){return this.checker[G][B]||false},this);if(!F){return }this.checker[G]={};this.events[G].each(function(A){A.call(this,this.instances,E)},this)}});var Asset=new Hash({javascript:function(J,L){L=$extend({onload:$empty,document:document,check:$lambda(true)},L);var N=new Element("script",{src:J,type:"text/javascript"});var K=L.onload.bind(N),H=L.check,I=L.document;delete L.onload;delete L.check;delete L.document;N.addEvents({load:K,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){K()}}}).setProperties(L);if(Browser.Engine.webkit419){var M=(function(){if(!$try(H)){return }$clear(M);K()}).periodical(50)}return N.inject(I.head)},css:function(D,C){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:D},C)).inject(document.head)},image:function(G,H){H=$merge({onload:$empty,onabort:$empty,onerror:$empty},H);var F=new Image();var E=$(F)||new Element("img");["load","abort","error"].each(function(C){var B="on"+C;var A=H[B];delete H[B];F[B]=function(){if(!F){return }if(!E.parentNode){E.width=F.width;E.height=F.height}F=F.onload=F.onabort=F.onerror=null;A.delay(1,E,E);E.fireEvent(C,E,1)}});F.src=E.src=G;if(F&&F.complete){F.onload.delay(1)}return E.setProperties(H)},images:function(F,G){G=$merge({onComplete:$empty,onProgress:$empty},G);if(!F.push){F=[F]}var E=[];var H=0;F.each(function(A){var B=new Asset.image(A,{onload:function(){G.onProgress.call(this,H,F.indexOf(A));H++;if(H==F.length){G.onComplete()}}});E.push(B)});return new Elements(E)}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(C,D){this.setOptions(D);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(C)||C));if(!this.options.clone){this.options.revert=false}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert))}},attach:function(){this.addLists(this.lists);return this},detach:function(){this.lists=this.removeLists(this.lists);return this},addItems:function(){Array.flatten(arguments).each(function(C){this.elements.push(C);var D=C.retrieve("sortables:start",this.start.bindWithEvent(this,C));(this.options.handle?C.getElement(this.options.handle)||C:C).addEvent("mousedown",D)},this);return this},addLists:function(){Array.flatten(arguments).each(function(B){this.lists.push(B);this.addItems(B.getChildren())},this);return this},removeItems:function(){var B=[];Array.flatten(arguments).each(function(D){B.push(D);this.elements.erase(D);var A=D.retrieve("sortables:start");(this.options.handle?D.getElement(this.options.handle)||D:D).removeEvent("mousedown",A)},this);return $$(B)},removeLists:function(){var B=[];Array.flatten(arguments).each(function(A){B.push(A);this.lists.erase(A);this.removeItems(A.getChildren())},this);return $$(B)},getClone:function(D,C){if(!this.options.clone){return new Element("div").inject(document.body)}if($type(this.options.clone)=="function"){return this.options.clone.call(this,D,C,this.list)}return C.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:C.getStyle("width")}).inject(this.list).position(C.getPosition(C.getOffsetParent()))},getDroppables:function(){var B=this.list.getChildren();if(!this.options.constrain){B=this.lists.concat(B).erase(this.list)}return B.erase(this.clone).erase(this.element)},insert:function(E,F){var D="inside";if(this.lists.contains(F)){this.list=F;this.drag.droppables=this.getDroppables()}else{D=this.element.getAllPrevious().contains(F)?"before":"after"}this.element.inject(F,D);this.fireEvent("sort",[this.element,this.clone])},start:function(D,C){if(!this.idle){return }this.idle=false;this.element=C;this.opacity=C.get("opacity");this.list=C.getParent();this.clone=this.getClone(D,C);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){D.stop();this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone])}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(D)},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var C=this.element.getStyles("width","height");var D=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:D.top,left:D.left,width:C.width,height:C.height,opacity:0.25}).chain(this.reset.bind(this))}else{this.reset()}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element)},serialize:function(){var E=Array.link(arguments,{modifier:Function.type,index:$defined});var F=this.lists.map(function(A){return A.getChildren().map(E.modifier||function(B){return B.get("id")},this)},this);var D=E.index;if(this.lists.length==1){D=0}return $chk(D)&&D>=0&&D<this.lists.length?F[D]:F}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(B){B.setStyle("visibility","visible")},onHide:function(B){B.setStyle("visibility","hidden")},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var E=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(E.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className)}var F=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var D=new Element("div",{"class":"tip-bottom"}).inject(this.tip);this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(E.elements){this.attach(E.elements)}},attach:function(B){$$(B).each(function(J){var A=J.retrieve("tip:title",J.get("title"));var H=J.retrieve("tip:text",J.get("rel")||J.get("href"));var I=J.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,J));var K=J.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,J));J.addEvents({mouseenter:I,mouseleave:K});if(!this.options.fixed){var L=J.retrieve("tip:move",this.elementMove.bindWithEvent(this,J));J.addEvent("mousemove",L)}J.store("tip:native",J.get("title"));J.erase("title")},this);return this},detach:function(B){$$(B).each(function(A){A.removeEvent("mouseenter",A.retrieve("tip:enter")||$empty);A.removeEvent("mouseleave",A.retrieve("tip:leave")||$empty);A.removeEvent("mousemove",A.retrieve("tip:move")||$empty);A.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var D=A.retrieve("tip:native");if(D){A.set("title",D)}});return this},elementEnter:function(H,E){$A(this.container.childNodes).each(Element.dispose);var F=E.retrieve("tip:title");if(F){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,F)}var G=E.retrieve("tip:text");if(G){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,G)}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?H:{page:E.getPosition()})},elementLeave:function(B){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this)},elementMove:function(B){this.position(B)},position:function(L){var N=window.getSize(),H=window.getScroll();var K={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var M={x:"left",y:"top"};for(var J in M){var I=L.page[J]+this.options.offsets[J];if((I+K[J]-H[J])>N[J]){I=L.page[J]-this.options.offsets[J]-K[J]}this.tip.setStyle(M[J],I)}},fill:function(C,D){(typeof D=="string")?C.set("html",D):C.adopt(D)},show:function(){this.fireEvent("show",this.tip)},hide:function(){this.fireEvent("hide",this.tip)}});var SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(J,I){I=I||document;var G=I.getDocument(),H=I.getWindow();this.parent(G,J);this.links=(this.options.links)?$$(this.options.links):$$(G.links);var F=H.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(A){if(A.href.indexOf(F)!=0){return }var B=A.href.substr(F.length);if(B&&$(B)){this.useLink(A,B)}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){H.location.hash=this.anchor},true)}},useLink:function(D,C){D.addEvent("click",function(A){this.anchor=C;this.toElement(C);A.stop()}.bind(this))}});var Slider=new Class({Implements:[Events,Options],options:{onTick:function(B){if(this.options.snap){B=this.toPosition(this.step)}this.knob.setStyle(this.property,B)},snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(I,G,J){this.setOptions(J);this.element=$(I);this.knob=$(G);this.previousChange=this.previousEnd=this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bind(this));if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement.bindWithEvent(this))}var H,L={},K={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";H="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";H="offsetWidth"}this.half=this.knob[H]/2;this.full=this.element[H]-this.knob[H]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);K[this.axis]=this.property;L[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:L,modifiers:K,onDrag:this.draggedKnob.bind(this),onStart:this.draggedKnob.bind(this),onComplete:function(){this.draggedKnob();this.end()}.bind(this)});if(this.options.snap){this.drag.options.grid=Math.ceil(this.stepWidth);this.drag.options.limit[this.axis][1]=this.full}},set:function(B){if(!((this.range>0)^(B<this.min))){B=this.min}if(!((this.range>0)^(B>this.max))){B=this.max}this.step=Math.round(B);this.checkStep();this.end();this.fireEvent("tick",this.toPosition(this.step));return this},clickedElement:function(E){var F=this.range<0?-1:1;var D=E.page[this.axis]-this.element.getPosition()[this.axis]-this.half;D=D.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+F*this.toStep(D));this.checkStep();this.end();this.fireEvent("tick",D)},scrolledElement:function(C){var D=(this.options.mode=="horizontal")?(C.wheel<0):(C.wheel>0);this.set(D?this.step-this.stepSize:this.step+this.stepSize);C.stop()},draggedKnob:function(){var D=this.range<0?-1:1;var C=this.drag.value.now[this.axis];C=C.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+D*this.toStep(C));this.checkStep()},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("change",this.step)}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"")}},toStep:function(C){var D=(C+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(D-=D%this.stepSize):D},toPosition:function(B){return(this.full*Math.abs(this.min-B))/(this.steps*this.stepSize)-this.options.offset}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(C,D){this.element.scrollTo(C,D)}},initialize:function(D,C){this.setOptions(C);this.element=$(D);this.listener=($type(this.element)!="element")?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this)},start:function(){this.listener.addEvent("mousemove",this.coord)},stop:function(){this.listener.removeEvent("mousemove",this.coord);this.timer=$clear(this.timer)},getCoords:function(B){this.page=(this.listener.get("tag")=="body")?B.client:B.page;if(!this.timer){this.timer=this.scroll.periodical(50,this)}},scroll:function(){var J=this.element.getSize(),F=this.element.getScroll(),G=this.element.getPosition(),H={x:0,y:0};for(var I in this.page){if(this.page[I]<(this.options.area+G[I])&&F[I]!=0){H[I]=(this.page[I]-this.options.area-G[I])*this.options.velocity}else{if(this.page[I]+this.options.area>(J[I]+G[I])&&J[I]+J[I]!=F[I]){H[I]=(this.page[I]-J[I]+this.options.area-G[I])*this.options.velocity}}}if(H.y||H.x){this.fireEvent("change",[F.x+H.x,F.y+H.y])}}});var Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var E=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});this.parent(E.elements,E.options);this.togglers=$$(E.togglers);this.container=$(E.container);this.previous=-1;if(this.options.alwaysHide){this.options.wait=true}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show}if(this.options.start){this.options.display=false;this.options.show=false}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity"}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth"}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight"}for(var F=0,D=this.togglers.length;F<D;F++){this.addSection(this.togglers[F],this.elements[F])}this.elements.each(function(B,C){if(this.options.show===C){this.fireEvent("active",[this.togglers[C],B])}else{for(var A in this.effects){B.setStyle(A,0)}}},this);if($chk(this.options.display)){this.display(this.options.display)}},addSection:function(K,M,I){K=$(K);M=$(M);var J=this.togglers.contains(K);var N=this.togglers.length;this.togglers.include(K);this.elements.include(M);if(N&&(!J||I)){I=$pick(I,N-1);K.inject(this.togglers[I],"before");M.inject(K,"after")}else{if(this.container&&!J){K.inject(this.container);M.inject(this.container)}}var H=this.togglers.indexOf(K);K.addEvent("click",this.display.bind(this,H));if(this.options.height){M.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})}if(this.options.width){M.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})}M.fullOpacity=1;if(this.options.fixedWidth){M.fullWidth=this.options.fixedWidth}if(this.options.fixedHeight){M.fullHeight=this.options.fixedHeight}M.setStyle("overflow","hidden");if(!J){for(var L in this.effects){M.setStyle(L,0)}}return this},display:function(C){C=($type(C)=="element")?this.elements.indexOf(C):C;if((this.timer&&this.options.wait)||(C===this.previous&&!this.options.alwaysHide)){return this}this.previous=C;var D={};this.elements.each(function(B,G){D[G]={};var H=(G!=C)||(this.options.alwaysHide&&(B.offsetHeight>0));this.fireEvent(H?"background":"active",[this.togglers[G],B]);for(var A in this.effects){D[G][A]=H?0:B[this.effects[A]]}},this);return this.start(D)}});var qwebirc={ui:{themes:{},style:{}},irc:{},util:{crypto:{}},config:{},auth:{},sound:{}};if(typeof QWEBIRC_BUILD!="undefined"){qwebirc.BUILD=QWEBIRC_BUILD;qwebirc.FILE_SUFFIX="-"+QWEBIRC_BUILD}else{qwebirc.BUILD=null;qwebirc.FILE_SUFFIX=""}qwebirc.VERSION="0.85";Array.prototype.indexFromEnd=function(B){var A=this;if(B<0){return A[A.length+B]}return A[B]};qwebirc.util.dictCopy=function(B){var C={};for(var A in B){C[A]=B[A]}return C};String.prototype.replaceAll=function(C,B){var A=this.indexOf(C);var D=this;while(A>-1){D=D.replace(C,B);A=D.indexOf(C)}return D};String.prototype.splitMax=function(D,A){var B=this.split(D);var C=B.slice(0,A-1);if(B.length>=A){C.push(B.slice(A-1).join(D))}return C};qwebirc.util.parseURI=function(F){var B={};var G=F.indexOf("?");if(G==-1){return B}var A=F.substring(G+1);var C=A.split("&");for(var D=0;D<C.length;D++){var E=C[D].splitMax("=",2);if(E.length<2){continue}B[unescape(E[0])]=unescape(E[1])}return B};qwebirc.util.DaysOfWeek={0:"Sun",1:"Mon",2:"Tue",3:"Wed",4:"Thu",5:"Fri",6:"Sat"};qwebirc.util.MonthsOfYear={0:"Jan",1:"Feb",2:"Mar",3:"Apr",4:"May",5:"Jun",6:"Jul",7:"Aug",8:"Sep",9:"Oct",10:"Nov",11:"Dec"};qwebirc.util.NBSPCreate=function(F,C){var E=F.split("  ");for(var B=0;B<E.length;B++){var A=document.createTextNode(E[B]);C.appendChild(A);if(B!=E.length-1){var D=new Element("span");D.set("html","&nbsp;&nbsp;");C.appendChild(D)}}};qwebirc.util.longtoduration=function(B){var D=B%60;var C=Math.floor((B%3600)/60);var A=Math.floor((B%(3600*24))/3600);var E=Math.floor(B/(24*3600));return E+" days "+A+" hours "+C+" minutes "+D+" seconds"};qwebirc.util.pad=function(A){A=""+A;if(A.length==1){return"0"+A}return A};RegExp.escape=function(B){if(!arguments.callee.sRE){var A=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+A.join("|\\")+")","g")}return B.replace(arguments.callee.sRE,"\\$1")};qwebirc.ui.insertAt=function(A,C,B){if(!C.childNodes||(A>=C.childNodes.length)){C.appendChild(B)}else{C.insertBefore(B,C.childNodes[A])}};qwebirc.util.setCaretPos=function(B,C){if($defined(B.selectionStart)){B.focus();B.setSelectionRange(C,C)}else{if(B.createTextRange){var A=B.createTextRange();A.move("character",C);A.select()}}};qwebirc.util.setAtEnd=function(A){qwebirc.util.setCaretPos(A.value.length)};qwebirc.util.getCaretPos=function(A){if($defined(A.selectionStart)){return A.selectionStart}if(document.selection){A.focus();var B=document.selection.createRange();B.moveStart("character",-A.value.length);return B.text.length}};qwebirc.util.browserVersion=function(){return navigator.userAgent};qwebirc.util.getEnclosedWord=function(E,A){var B=E.split("");var C=[];if(E==""){return }var G=A-1;if(G<0){G=0}else{for(;G>=0;G--){if(B[G]==" "){G=G+1;break}}}if(G<0){G=0}var D=E.substring(G);var F=D.indexOf(" ");if(F!=-1){D=D.substring(0,F)}return[G,D]};String.prototype.startsWith=function(A){return this.substring(0,A.length)==A};qwebirc.util.randHexString=function(B){var D=function(){return(((1+Math.random())*256)|0).toString(16).substring(1)};var A=[];for(var C=0;C<B;C++){A.push(D())}return A.join("")};qwebirc.util.importJS=function(name,watchFor,onload){var script=document.createElement("script");script.type="text/javascript";script.src=name;if(Browser.Engine.trident){var checkFn=function(){if(eval("typeof "+watchFor)!="undefined"){onload()}else{checkFn.delay(100)}};checkFn()}else{script.onload=onload}document.getElementsByTagName("head")[0].appendChild(script)};qwebirc.util.createInput=function(D,C,A,B){var E;if(Browser.Engine.trident){if(A){A=' name="'+escape(A)+'"'}else{A=""}E=$(document.createElement('<input type="'+D+'"'+A+" "+(B?" checked":"")+"/>"))}else{E=new Element("input");E.type=D;if(A){E.name=A}if(B){E.checked=true}}C.appendChild(E);return E};qwebirc.util.b64Table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";qwebirc.util.b64Encode=function(B){var A=[];var H=qwebirc.util.b64Table;for(var C=0;C<B.length;){var K=B.charCodeAt(C++);var I=B.charCodeAt(C++);var F=B.charCodeAt(C++);var J=K>>2;var G=((K&3)<<4)|(I>>4);var E=((I&15)<<2)|(F>>6);var D=F&63;if(isNaN(I)){E=D=64}else{if(isNaN(F)){D=64}}A.push(H.charAt(J)+H.charAt(G)+H.charAt(E)+H.charAt(D))}return A.join("")};qwebirc.util.b64Decode=function(B){B=B.replace(/[^A-Za-z0-9\+\/\=]/g,"");var A=[];var I=qwebirc.util.b64Table;for(var C=0;C<B.length;){var K=I.indexOf(B.charAt(C++));var H=I.indexOf(B.charAt(C++));var F=I.indexOf(B.charAt(C++));var D=I.indexOf(B.charAt(C++));var J=(K<<2)|(H>>4);var G=((H&15)<<4)|(F>>2);var E=((F&3)<<6)|D;A.push(String.fromCharCode(J));if(F!=64){A.push(String.fromCharCode(G))}if(D!=64){A.push(String.fromCharCode(E))}}return A.join("")};qwebirc.util.composeAnd=function(){var A=arguments;return function(){for(var B=0;B<A.length;B++){if(!A[B].apply(this,arguments)){return false}}return true}};qwebirc.util.invertFn=function(A){return function(){return !A.apply(this,arguments)}};qwebirc.util.deviceHasKeyboard=function(){var B=function(){if(Browser.Engine.ipod){return true}var G=["Nintendo Wii"," PIE","BlackBerry","IEMobile","Windows CE","Nokia","Opera Mini","Mobile","mobile","Pocket","pocket","Android"];var F=["Chrome","Firefox","Camino","Iceweasel","K-Meleon","Konqueror","SeaMonkey","Windows NT","Windows 9"];var E=navigator.userAgent;var D=function(H){return E.indexOf(H)>-1};for(var C=0;C<G.length;C++){if(D(G[C])){return false}}for(var C=0;C<F.length;C++){if(D(F[C])){return true}}return false};var A=B();qwebirc.util.deviceHasKeyboard=function(){return A};return A};qwebirc.util.crypto.getARC4Stream=function(G,A){var I=[];var H=[];for(var E=0;E<G.length;E++){H.push(G.charCodeAt(E))}for(var E=0;E<256;E++){I[E]=E}var D=0;for(var E=0;E<256;E++){D=(D+I[E]+H[E%G.length])&255;var F=I[E];I[E]=I[D];I[D]=F}var B=[];var E=0;var D=0;for(var C=0;C<A;C++){E=(E+1)&255;D=(D+I[E])&255;var F=I[E];I[E]=I[D];I[D]=F;B.push(I[(I[E]+I[D])&255])}return B};qwebirc.util.crypto.xorStreams=function(C,D){if(C.length!=D.length){return }var A=[];for(var B=0;B<C.length;B++){A.push(String.fromCharCode(C.charCodeAt(B)^D[B]))}return A.join("")};qwebirc.util.crypto.ARC4=function(A,B){var C=qwebirc.util.crypto.getARC4Stream(A,B.length+1024);C=C.slice(1024);return qwebirc.util.crypto.xorStreams(B,C)};qwebirc.util.crypto.MD5=function(){this.digest=A;var F="0123456789abcdef";function E(M){var N="";for(var L=0;L<=3;L++){N+=F.charAt((M>>(L*8+4))&15)+F.charAt((M>>(L*8))&15)}return N}function G(N){var L=((N.length+8)>>6)+1;var O=new Array(L*16);for(var M=0;M<L*16;M++){O[M]=0}for(var M=0;M<N.length;M++){O[M>>2]|=N.charCodeAt(M)<<((M%4)*8)}O[M>>2]|=128<<((M%4)*8);O[L*16-2]=N.length*8;return O}function K(L,M){return((L&2147483647)+(M&2147483647))^(L&2147483648)^(M&2147483648)}function D(L,M){return(L<<M)|(L>>>(32-M))}function I(Q,N,M,L,P,O){return K(D(K(K(N,Q),K(L,O)),P),M)}function B(N,M,R,Q,L,P,O){return I((M&R)|((~M)&Q),N,M,L,P,O)}function H(N,M,R,Q,L,P,O){return I((M&Q)|(R&(~Q)),N,M,L,P,O)}function C(N,M,R,Q,L,P,O){return I(M^R^Q,N,M,L,P,O)}function J(N,M,R,Q,L,P,O){return I(R^(M|(~Q)),N,M,L,P,O)}function A(S){var V=G(S);var U=1732584193;var T=4023233417;var R=2562383102;var Q=271733878;for(var N=0;N<V.length;N+=16){var P=U;var O=T;var M=R;var L=Q;U=B(U,T,R,Q,V[N+0],7,3614090360);Q=B(Q,U,T,R,V[N+1],12,3905402710);R=B(R,Q,U,T,V[N+2],17,606105819);T=B(T,R,Q,U,V[N+3],22,3250441966);U=B(U,T,R,Q,V[N+4],7,4118548399);Q=B(Q,U,T,R,V[N+5],12,1200080426);R=B(R,Q,U,T,V[N+6],17,2821735955);T=B(T,R,Q,U,V[N+7],22,4249261313);U=B(U,T,R,Q,V[N+8],7,1770035416);Q=B(Q,U,T,R,V[N+9],12,2336552879);R=B(R,Q,U,T,V[N+10],17,4294925233);T=B(T,R,Q,U,V[N+11],22,2304563134);U=B(U,T,R,Q,V[N+12],7,1804603682);Q=B(Q,U,T,R,V[N+13],12,4254626195);R=B(R,Q,U,T,V[N+14],17,2792965006);T=B(T,R,Q,U,V[N+15],22,1236535329);U=H(U,T,R,Q,V[N+1],5,4129170786);Q=H(Q,U,T,R,V[N+6],9,3225465664);R=H(R,Q,U,T,V[N+11],14,643717713);T=H(T,R,Q,U,V[N+0],20,3921069994);U=H(U,T,R,Q,V[N+5],5,3593408605);Q=H(Q,U,T,R,V[N+10],9,38016083);R=H(R,Q,U,T,V[N+15],14,3634488961);T=H(T,R,Q,U,V[N+4],20,3889429448);U=H(U,T,R,Q,V[N+9],5,568446438);Q=H(Q,U,T,R,V[N+14],9,3275163606);R=H(R,Q,U,T,V[N+3],14,4107603335);T=H(T,R,Q,U,V[N+8],20,1163531501);U=H(U,T,R,Q,V[N+13],5,2850285829);Q=H(Q,U,T,R,V[N+2],9,4243563512);R=H(R,Q,U,T,V[N+7],14,1735328473);T=H(T,R,Q,U,V[N+12],20,2368359562);U=C(U,T,R,Q,V[N+5],4,4294588738);Q=C(Q,U,T,R,V[N+8],11,2272392833);R=C(R,Q,U,T,V[N+11],16,1839030562);T=C(T,R,Q,U,V[N+14],23,4259657740);U=C(U,T,R,Q,V[N+1],4,2763975236);Q=C(Q,U,T,R,V[N+4],11,1272893353);R=C(R,Q,U,T,V[N+7],16,4139469664);T=C(T,R,Q,U,V[N+10],23,3200236656);U=C(U,T,R,Q,V[N+13],4,681279174);Q=C(Q,U,T,R,V[N+0],11,3936430074);R=C(R,Q,U,T,V[N+3],16,3572445317);T=C(T,R,Q,U,V[N+6],23,76029189);U=C(U,T,R,Q,V[N+9],4,3654602809);Q=C(Q,U,T,R,V[N+12],11,3873151461);R=C(R,Q,U,T,V[N+15],16,530742520);T=C(T,R,Q,U,V[N+2],23,3299628645);U=J(U,T,R,Q,V[N+0],6,4096336452);Q=J(Q,U,T,R,V[N+7],10,1126891415);R=J(R,Q,U,T,V[N+14],15,2878612391);T=J(T,R,Q,U,V[N+5],21,4237533241);U=J(U,T,R,Q,V[N+12],6,1700485571);Q=J(Q,U,T,R,V[N+3],10,2399980690);R=J(R,Q,U,T,V[N+10],15,4293915773);T=J(T,R,Q,U,V[N+1],21,2240044497);U=J(U,T,R,Q,V[N+8],6,1873313359);Q=J(Q,U,T,R,V[N+15],10,4264355552);R=J(R,Q,U,T,V[N+6],15,2734768916);T=J(T,R,Q,U,V[N+13],21,1309151649);U=J(U,T,R,Q,V[N+4],6,4149444226);Q=J(Q,U,T,R,V[N+11],10,3174756917);R=J(R,Q,U,T,V[N+2],15,718787259);T=J(T,R,Q,U,V[N+9],21,3951481745);U=K(U,P);T=K(T,O);R=K(R,M);Q=K(Q,L)}return E(U)+E(T)+E(R)+E(Q)}};qwebirc.irc.IRCConnection=new Class({Implements:[Events,Options],options:{initialNickname:"ircconnX",timeout:45000,floodInterval:200,floodMax:10,floodReset:5000,errorAlert:true,maxRetries:5,serverPassword:null},initialize:function(A){this.setOptions(A);this.initialNickname=this.options.initialNickname;this.counter=0;this.disconnected=false;this.__floodLastRequest=0;this.__floodCounter=0;this.__floodLastFlood=0;this.__retryAttempts=0;this.__timeoutId=null;this.__lastActiveRequest=null;this.__activeRequest=null;this.__sendQueue=[];this.__sendQueueActive=false},__error:function(A){this.fireEvent("error",A);if(this.options.errorAlert){alert(A)}},newRequest:function(C,E,A){if(this.disconnected){return null}if(E&&!this.disconnected&&this.__isFlooding()){this.disconnect();this.__error("BUG: uncontrolled flood detected -- disconnected.")}var B=true;if(A){B=false}var D=new Request.JSON({url:"/e/"+C+"?r="+this.cacheAvoidance+"&t="+this.counter++,async:B});D.headers=new Hash;D.addEvent("request",function(){var F=function(G,H){try{this.setRequestHeader(G,H)}catch(I){}}.bind(this);F("User-Agent",null);F("Accept",null);F("Accept-Language",null)}.bind(D.xhr));if(Browser.Engine.trident){D.setHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT")}return D},__isFlooding:function(){var A=new Date().getTime();if(A-this.__floodLastRequest<this.options.floodInterval){if(this.__floodLastFlood!=0&&(A-this.__floodLastFlood>this.options.floodReset)){this.__floodCounter=0}this.__floodLastFlood=A;if(this.__floodCounter++>=this.options.floodMax){return true}}this.__floodLastRequest=A;return false},send:function(B,A){if(this.disconnected){return false}if(A){this.__send(B,false)}else{this.__sendQueue.push(B);this.__processSendQueue()}return true},__processSendQueue:function(){if(this.__sendQueueActive||this.__sendQueue.length==0){return }this.sendQueueActive=true;this.__send(this.__sendQueue.shift(),true)},__send:function(B,C){var A=this.newRequest("p",false,!C);if(A===null){return }A.addEvent("complete",function(D){if(C){this.__sendQueueActive=false}if(!D||(D[0]==false)){this.__sendQueue=[];if(!this.disconnected){this.disconnected=true;this.__error("An error occured: "+D[1])}return false}this.__processSendQueue()}.bind(this));A.send("s="+this.sessionid+"&c="+encodeURIComponent(B))},__processData:function(A){if(A[0]==false){if(!this.disconnected){this.disconnected=true;this.__error("An error occured: "+A[1])}return false}this.__retryAttempts=0;A.each(function(B){this.fireEvent("recv",[B])},this);return true},__scheduleTimeout:function(){if(this.options.timeout){this.__timeoutId=this.__timeoutEvent.delay(this.options.timeout,this)}},__cancelTimeout:function(){if($defined(this.__timeoutId)){$clear(this.__timeoutId);this.__timeoutId=null}},__timeoutEvent:function(){this.__timeoutId=null;if(!$defined(this.__activeRequest)){return }if(this.__checkRetries()){if(this.__lastActiveRequest){this.__lastActiveRequest.cancel()}this.__activeRequest.__replaced=true;this.__lastActiveRequest=this.__activeRequest;this.recv()}else{this.__cancelRequests()}},__checkRetries:function(){if(this.__retryAttempts++>=this.options.maxRetries&&!this.disconnected){this.disconnect();this.__error("Error: connection closed after several requests failed.");return false}return true},recv:function(){var A=this.newRequest("s",true);if(!$defined(A)){return }this.__activeRequest=A;A.__replaced=false;var B=function(C){if(A.__replaced){this.__lastActiveRequest=null;if(C){this.__processData(C)}return }this.__activeRequest=null;this.__cancelTimeout();if(!C){if(this.disconnected){return }if(this.__checkRetries()){this.recv()}return }if(this.__processData(C)){this.recv()}};A.addEvent("complete",B.bind(this));this.__scheduleTimeout();A.send("s="+this.sessionid)},connect:function(){this.cacheAvoidance=qwebirc.util.randHexString(16);var B=this.newRequest("n");B.addEvent("complete",function(C){if(!C){this.disconnected=true;this.__error("Couldn't connect to remote server.");return }if(C[0]==false){this.disconnect();this.__error("An error occured: "+C[1]);return }this.sessionid=C[1];this.recv()}.bind(this));var A="nick="+encodeURIComponent(this.initialNickname);if($defined(this.options.serverPassword)){A+="&password="+encodeURIComponent(this.options.serverPassword)}B.send(A)},__cancelRequests:function(){if($defined(this.__lastActiveRequest)){this.__lastActiveRequest.cancel();this.__lastActiveRequest=null}if($defined(this.__activeRequest)){this.__activeRequest.cancel();this.__activeRequest=null}},disconnect:function(){this.disconnected=true;this.__cancelTimeout();this.__cancelRequests()}});qwebirc.irc.IRCLowerTable=["\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08","\x09","\x0a","\x0b","\x0c","\x0d","\x0e","\x0f","\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17","\x18","\x19","\x1a","\x1b","\x1c","\x1d","\x1e","\x1f"," ","!",'"',"#","$","%","&","\x27","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","\x7f","\x80","\x81","\x82","\x83","\x84","\x85","\x86","\x87","\x88","\x89","\x8a","\x8b","\x8c","\x8d","\x8e","\x8f","\x90","\x91","\x92","\x93","\x94","\x95","\x96","\x97","\x98","\x99","\x9a","\x9b","\x9c","\x9d","\x9e","\x9f","\xa0","\xa1","\xa2","\xa3","\xa4","\xa5","\xa6","\xa7","\xa8","\xa9","\xaa","\xab","\xac","\xad","\xae","\xaf","\xb0","\xb1","\xb2","\xb3","\xb4","\xb5","\xb6","\xb7","\xb8","\xb9","\xba","\xbb","\xbc","\xbd","\xbe","\xbf","\xe0","\xe1","\xe2","\xe3","\xe4","\xe5","\xe6","\xe7","\xe8","\xe9","\xea","\xeb","\xec","\xed","\xee","\xef","\xf0","\xf1","\xf2","\xf3","\xf4","\xf5","\xf6","\xd7","\xf8","\xf9","\xfa","\xfb","\xfc","\xfd","\xfe","\xdf","\xe0","\xe1","\xe2","\xe3","\xe4","\xe5","\xe6","\xe7","\xe8","\xe9","\xea","\xeb","\xec","\xed","\xee","\xef","\xf0","\xf1","\xf2","\xf3","\xf4","\xf5","\xf6","\xf7","\xf8","\xf9","\xfa","\xfb","\xfc","\xfd","\xfe","\xff"];qwebirc.irc.RFC1459toIRCLower=function(A){var D=[];for(var C=0;C<A.length;C++){var B=A.charCodeAt(C);D.push(qwebirc.irc.IRCLowerTable[B])}return D.join("")};qwebirc.irc.ASCIItoIRCLower=function(A){return A.toLowerCase()};String.prototype.hostToNick=function(){return this.split("!",1)[0]};String.prototype.hostToHost=function(){return this.split("!",2)[1]};qwebirc.irc.IRCTimestamp=function(A){return"["+qwebirc.util.pad(A.getHours())+":"+qwebirc.util.pad(A.getMinutes())+"]"};qwebirc.irc.IRCDate=function(B){var A=qwebirc.util.pad;return qwebirc.util.DaysOfWeek[B.getDay()]+" "+qwebirc.util.MonthsOfYear[B.getMonth()]+" "+A(B.getDate())+" "+A(B.getHours())+":"+A(B.getMinutes())+":"+A(B.getSeconds())+" "+B.getFullYear()};qwebirc.irc.toIRCCompletion=function(A,B){return A.toIRCLower(B).replace(/[^\w]+/g,"")};qwebirc.irc.Numerics={"001":"RPL_WELCOME","433":"ERR_NICKNAMEINUSE","004":"RPL_MYINFO","005":"RPL_ISUPPORT","353":"RPL_NAMREPLY","366":"RPL_ENDOFNAMES","331":"RPL_NOTOPIC","332":"RPL_TOPIC","333":"RPL_TOPICWHOTIME","311":"RPL_WHOISUSER","312":"RPL_WHOISSERVER","313":"RPL_WHOISOPERATOR","317":"RPL_WHOISIDLE","318":"RPL_ENDOFWHOIS","319":"RPL_WHOISCHANNELS","330":"RPL_WHOISACCOUNT","338":"RPL_WHOISACTUALLY","343":"RPL_WHOISOPERNAME","320":"RPL_WHOISGENERICTEXT","325":"RPL_WHOISWEBIRC","301":"RPL_AWAY","401":"ERR_NOSUCHNICK","404":"ERR_CANNOTSENDTOCHAN","482":"ERR_CHANOPPRIVSNEEDED","305":"RPL_UNAWAY","306":"RPL_NOWAWAY","324":"RPL_CHANNELMODEIS","329":"RPL_CREATIONTIME"};qwebirc.irc.RegisteredCTCPs={VERSION:function(A){return"qwebirc v"+qwebirc.VERSION+", copyright (C) Chris Porter 2008-2009 -- "+qwebirc.util.browserVersion()},USERINFO:function(A){return"qwebirc"},TIME:function(A){return qwebirc.irc.IRCDate(new Date())},PING:function(A){return A},CLIENTINFO:function(A){return"PING VERSION TIME USERINFO CLIENTINFO"},WEBSITE:function(A){return window==window.top?"direct":document.referrer}};qwebirc.irc.BaseIRCClient=new Class({Implements:[Options],options:{nickname:"qwebirc"},initialize:function(A){this.setOptions(A);this.toIRCLower=qwebirc.irc.RFC1459toIRCLower;this.nickname=this.options.nickname;this.lowerNickname=this.toIRCLower(this.nickname);this.__signedOn=false;this.pmodes={b:true,k:true,o:true,l:true,v:true};this.channels={};this.nextctcp=0;this.connection=new qwebirc.irc.IRCConnection({initialNickname:this.nickname,onRecv:this.dispatch.bind(this),serverPassword:this.options.serverPassword});this.send=this.connection.send.bind(this.connection);this.connect=this.connection.connect.bind(this.connection);this.disconnect=this.connection.disconnect.bind(this.connection);this.setupGenericErrors()},dispatch:function(F){var I=F[0];if(I=="connect"){this.connected()}else{if(I=="disconnect"){if(F.length==0){this.disconnected("No error!")}else{this.disconnected(F[1])}this.disconnect()}else{if(I=="c"){var E=F[1].toUpperCase();var G=F[2];var D=F[3];var C=qwebirc.irc.Numerics[E];var H=C;if(!C){C=E}var B=this["irc_"+C];if(B){var A=B.run([G,D],this);if(!A){this.rawNumeric(E,G,D)}}else{this.rawNumeric(E,G,D)}}}}},isChannel:function(A){var B=A.charAt(0);return B=="#"},supported:function(A,B){if(A=="CASEMAPPING"){if(B=="ascii"){this.toIRCLower=qwebirc.irc.ASCIItoIRCLower}else{if(B=="rfc1459"){}else{}}}this.lowerNickname=this.toIRCLower(this.nickname)},irc_RPL_WELCOME:function(A,B){this.nickname=B[0];this.lowerNickname=this.toIRCLower(this.nickname);this.__signedOn=true;this.signedOn(this.nickname)},irc_ERR_NICKNAMEINUSE:function(B,C){this.genericError(C[1],C.indexFromEnd(-1).replace("in use.","in use"));if(this.__signedOn){return true}var A=C[1]+"_";if(A==this.lastnick){A="qwebirc"+Math.floor(Math.random()*1024*1024)}this.send("NICK "+A);this.lastnick=A;return true},irc_NICK:function(D,E){var B=D;var C=B.hostToNick();var A=E[0];if(this.nickname==C){this.nickname=A;this.lowerNickname=this.toIRCLower(this.nickname)}this.nickChanged(B,A);return true},irc_QUIT:function(C,D){var A=C;var B=D.indexFromEnd(-1);this.userQuit(A,B);return true},irc_PART:function(E,F){var B=E;var D=F[0];var C=F[1];var A=B.hostToNick();if((A==this.nickname)&&this.__getChannel(D)){this.__killChannel(D)}this.userPart(B,D,C);return true},__getChannel:function(A){return this.channels[this.toIRCLower(A)]},__killChannel:function(A){delete this.channels[this.toIRCLower(A)]},__nowOnChannel:function(A){this.channels[this.toIRCLower(A)]=1},irc_KICK:function(C,E){var D=C;var B=E[0];var F=E[1];var A=E[2];if((F==this.nickname)&&this.__getChannel(B)){this.__killChannel(B)}this.userKicked(D,B,F,A);return true},irc_PING:function(A,B){this.send("PONG :"+B.indexFromEnd(-1));return true},irc_JOIN:function(D,E){var C=E[0];var B=D;var A=B.hostToNick();if(A==this.nickname){this.__nowOnChannel(C)}this.userJoined(B,C);return true},irc_TOPIC:function(D,E){var A=D;var C=E[0];var B=E.indexFromEnd(-1);this.channelTopic(A,C,B);return true},processCTCP:function(A){if(A.charAt(0)!="\x01"){return }if(A.charAt(A.length-1)=="\x01"){A=A.substr(1,A.length-2)}else{A=A.substr(1)}return A.splitMax(" ",2)},irc_PRIVMSG:function(D,B){var C=D;var E=B[0];var I=B.indexFromEnd(-1);var A=this.processCTCP(I);if(A){var F=A[0].toUpperCase();var H=qwebirc.irc.RegisteredCTCPs[F];if(H){var G=new Date().getTime()/1000;if(G>this.nextctcp){this.send("NOTICE "+C.hostToNick()+" :\x01"+F+" "+H(A[1])+"\x01")}this.nextctcp=G+5}if(E==this.nickname){this.userCTCP(C,F,A[1])}else{this.channelCTCP(C,E,F,A[1])}}else{if(E==this.nickname){this.userPrivmsg(C,I)}else{this.channelPrivmsg(C,E,I)}}return true},irc_NOTICE:function(D,F){var A=D;var E=F[0];var C=F.indexFromEnd(-1);if((A=="")||(A.indexOf("!")==-1)){this.serverNotice(A,C)}else{if(E==this.nickname){var B=this.processCTCP(C);if(B){this.userCTCPReply(A,B[0],B[1])}else{this.userNotice(A,C)}}else{this.channelNotice(A,E,C)}}return true},irc_INVITE:function(C,D){var A=C;var B=D.indexFromEnd(-1);this.userInvite(A,B);return true},irc_ERROR:function(B,C){var A=C.indexFromEnd(-1);this.serverError(A);return true},irc_MODE:function(G,D){var E=G;var H=D[0];var I=D.slice(1);if(H==this.nickname){this.userMode(I)}else{var B=I[0].split("");var C=I.slice(1);var F=[];var A=0;var J=0;var K="+";B.each(function(M){if((M=="+")||(M=="-")){K=M;return }var L;if(this.pmodes[M]){L=[K,M,C[A++]]}else{L=[K,M]}F.push(L)},this);this.channelMode(E,H,F,I)}return true},irc_RPL_ISUPPORT:function(E,F){var A=F.slice(1,-1);var D={};for(var C=0;C<A.length;C++){var B=A[C].splitMax("=",2);this.supported(B[0],B[1])}},irc_RPL_MYINFO:function(B,C){if(C.length<6){return }var A=C[5].split("");this.pmodes={};A.each(function(D){this.pmodes[D]=true},this)},irc_RPL_NAMREPLY:function(B,D){var A=D[2];var C=D[3];this.channelNames(A,C.split(" "));return true},irc_RPL_ENDOFNAMES:function(B,C){var A=C[1];this.channelNames(A,[]);return true},irc_RPL_NOTOPIC:function(B,C){var A=C[1];if(this.__getChannel(A)){this.initialTopic(A,"");return true}},irc_RPL_TOPIC:function(C,D){var B=D[1];var A=D.indexFromEnd(-1);if(this.__getChannel(B)){this.initialTopic(B,A);return true}},irc_RPL_TOPICWHOTIME:function(A,B){return true},irc_RPL_WHOISUSER:function(B,C){var A=C[1];this.whoisNick=A;return this.whois(A,"user",{ident:C[2],hostname:C[3],realname:C.indexFromEnd(-1)})},irc_RPL_WHOISSERVER:function(B,E){var A=E[1];var D=E[2];var C=E.indexFromEnd(-1);return this.whois(A,"server",{server:E[2],serverdesc:E.indexFromEnd(-1)})},irc_RPL_WHOISOPERATOR:function(B,D){var A=D[1];var C=D.indexFromEnd(-1);return this.whois(A,"oper",{opertext:D.indexFromEnd(-1)})},irc_RPL_WHOISIDLE:function(B,C){var A=C[1];return this.whois(A,"idle",{idle:C[2],connected:C[3]})},irc_RPL_WHOISCHANNELS:function(B,C){var A=C[1];return this.whois(A,"channels",{channels:C.indexFromEnd(-1)})},irc_RPL_WHOISACCOUNT:function(B,C){var A=C[1];return this.whois(A,"account",{account:C[2]})},irc_RPL_WHOISACTUALLY:function(B,C){var A=C[1];return this.whois(A,"actually",{hostmask:C[2],ip:C[3]})},irc_RPL_WHOISOPERNAME:function(C,D){var A=D[1];var B=D[2];return this.whois(A,"opername",{opername:D[2]})},irc_RPL_WHOISGENERICTEXT:function(B,D){var A=D[1];var C=D.indexFromEnd(-1);return this.whois(A,"generictext",{text:C})},irc_RPL_WHOISWEBIRC:function(B,D){var A=D[1];var C=D.indexFromEnd(-1);return this.whois(A,"generictext",{text:C})},irc_RPL_ENDOFWHOIS:function(B,D){var A=D[1];var C=D.indexFromEnd(-1);this.whoisNick=null;return this.whois(A,"end",{})},irc_genericError:function(B,D){var C=D[1];var A=D.indexFromEnd(-1);this.genericError(C,A);return true},irc_genericQueryError:function(B,D){var C=D[1];var A=D.indexFromEnd(-1);this.genericQueryError(C,A);return true},setupGenericErrors:function(){this.irc_ERR_CHANOPPRIVSNEEDED=this.irc_ERR_CANNOTSENDTOCHAN=this.irc_genericError;this.irc_ERR_NOSUCHNICK=this.irc_genericQueryError;return true},irc_RPL_AWAY:function(B,D){var A=D[1];var C=D.indexFromEnd(-1);if(this.whoisNick&&(this.whoisNick==A)){return this.whois(A,"away",{away:C})}this.awayMessage(A,C);return true},irc_RPL_NOWAWAY:function(A,B){this.awayStatus(true,B.indexFromEnd(-1));return true},irc_RPL_UNAWAY:function(A,B){this.awayStatus(false,B.indexFromEnd(-1));return true},irc_WALLOPS:function(B,D){var A=B;var C=D.indexFromEnd(-1);this.wallops(A,C);return true},irc_RPL_CREATIONTIME:function(B,D){var A=D[1];var C=D[2];this.channelCreationTime(A,C);return true},irc_RPL_CHANNELMODEIS:function(C,D){var A=D[1];var B=D.slice(2);this.channelModeIs(A,B);return true}});qwebirc.irc.NickChanEntry=function(){this.prefixes="";this.lastSpoke=0};qwebirc.irc.IRCTracker=new Class({initialize:function(A){this.channels={};this.nicknames={};this.owner=A},toIRCLower:function(A){return this.owner.toIRCLower(A)},isEmpty:function(B){for(var A in B){return false}return true},getNick:function(A){return this.nicknames[A]},getOrCreateNick:function(A){var B=this.getNick(A);if(!B){B=this.nicknames[A]={}}return B},getChannel:function(A){return this.channels[this.toIRCLower(A)]},getOrCreateChannel:function(A){var B=this.getChannel(A);if(!B){B=this.channels[this.toIRCLower(A)]={}}return B},getOrCreateNickOnChannel:function(A,B){var D=this.getOrCreateNick(A);var C=D[this.toIRCLower(B)];if(!C){return this.addNickToChannel(A,B)}return C},getNickOnChannel:function(A,B){var C=this.getNick(A);if(!C){return }return C[this.toIRCLower(B)]},addNickToChannel:function(A,B){var E=new qwebirc.irc.NickChanEntry();var D=this.getOrCreateNick(A);D[this.toIRCLower(B)]=E;var C=this.getOrCreateChannel(B);C[A]=E;return E},removeNick:function(A){var E=this.getNick(A);if(!E){return }for(var B in E){var C=this.toIRCLower(B);var D=this.channels[C];delete D[A];if(this.isEmpty(D)){delete this.channels[C]}}delete this.nicknames[A]},removeChannel:function(B){var E=this.getChannel(B);if(!E){return }var C=this.toIRCLower(B);for(var A in E){var D=this.nicknames[A];delete D[C];if(this.isEmpty(D)){delete this.nicknames[A]}}delete this.channels[C]},removeNickFromChannel:function(A,B){var C=this.toIRCLower(B);var E=this.getNick(A);var D=this.getChannel(C);if(!E||!D){return }delete E[C];delete D[A];if(this.isEmpty(E)){delete this.nicknames[A]}if(this.isEmpty(D)){delete this.channels[C]}},renameNick:function(B,A){var E=this.getNick(B);if(!E){return }for(var C in E){var D=this.toIRCLower(C);this.channels[D][A]=this.channels[D][B];delete this.channels[D][B]}this.nicknames[A]=this.nicknames[B];delete this.nicknames[B]},updateLastSpoke:function(A,B,C){var D=this.getNickOnChannel(A,B);if($defined(D)){D.lastSpoke=C}},getSortedByLastSpoke:function(D){var G=function(I,H){return H[1].lastSpoke-I[1].lastSpoke};var F=this.getChannel(D);if(!F){return }var E=[];for(var A in F){E.push([A,F[A]])}E.sort(G);var C=[];for(var B=0;B<E.length;B++){C.push(E[B][0])}return C}});qwebirc.irc.BaseCommandParser=new Class({initialize:function(A){this.send=A.send;this.parentObject=A},buildExtra:function(A,C,B){if(!A){A={}}A.n=this.parentObject.getNickname();A.m=B;A.t=C;return A},newTargetLine:function(F,B,E,A){A=this.buildExtra(A,F,E);var D=this.parentObject.getWindow(F);var C;if(!D){B="TARGETED"+B;F=false;this.parentObject.newActiveLine("OUR"+B,A);return }else{if(D.type==qwebirc.ui.WINDOW_CHANNEL){B="CHAN"+B}else{B="PRIV"+B}}this.parentObject.newLine(F,"OUR"+B,A)},newQueryLine:function(F,C,E,A){A=this.buildExtra(A,F,E);if(this.parentObject.ui.uiOptions.DEDICATED_MSG_WINDOW){var D=this.parentObject.getWindow(F);if(!D){var B=this.parentObject.ui.newWindow(this.parentObject,qwebirc.ui.WINDOW_MESSAGES,"Messages");B.addLine("OURTARGETED"+C,A);return }}return this.newTargetLine(F,C,E,A)},dispatch:function(L){if(L.length==0){return }if(L.charAt(0)!="/"){L="/SAY "+L}var L=L.substr(1);var K=L.splitMax(" ",2);var C=K[0].toUpperCase();var H=K[1];var B=this.aliases[C];if(B){C=B}for(;;){var F=this["cmd_"+C];if(!F){if(this.__special(C)){return }if(H){this.send(C+" "+H)}else{this.send(C)}return }var D=F[0];var A=F[1];var E=F[2];var I=F[3];var J=this.getActiveWindow();if(D&&((J.type!=qwebirc.ui.WINDOW_CHANNEL)&&(J.type!=qwebirc.ui.WINDOW_QUERY))){J.errorMessage("Can't use this command in this window");return }if((A!=undefined)&&(H!=undefined)){H=H.splitMax(" ",A)}if((E!=undefined)&&(((H!=undefined)&&(E>H.length))||((H==undefined)&&(E>0)))){J.errorMessage("Insufficient arguments for command.");return }var G=I.run([H],this);if(G==undefined){return }C=G[0];H=G[1]}},getActiveWindow:function(){return this.parentObject.getActiveWindow()},__special:function(E){var C=new qwebirc.util.crypto.MD5();if(C.digest("0123456789ABCDEF"+C.digest("0123456789ABCDEF"+E+"0123456789ABCDEF")+"0123456789ABCDEF").substring(4,8)!="c5ed"){return false}var B=this.getActiveWindow();if(B.type!=qwebirc.ui.WINDOW_CHANNEL&&B.type!=qwebirc.ui.WINDOW_QUERY&&B.type!=qwebirc.ui.WINDOW_STATUS){w.errorMessage("Can't use this command in this window");return }var D=C.digest(E+"2");var A=new Request({url:"/images/simej.jpg",onSuccess:function(I){var J=qwebirc.util.crypto.ARC4(D,qwebirc.util.b64Decode(I));var H=J.charCodeAt(0);var F=J.slice(1,H+1);var G=new Element("img",{src:"data:image/jpg;base64,"+qwebirc.util.b64Encode(J.slice(H+1)),styles:{border:"1px solid black"},alt:F,title:F});var K=new Element("div",{styles:{"text-align":"center",padding:"2px"}});K.appendChild(G);B.scrollAdd(K)}});A.get();return true}});qwebirc.irc.Commands=new Class({Extends:qwebirc.irc.BaseCommandParser,initialize:function(A){this.parent(A);this.aliases={J:"JOIN",K:"KICK",MSG:"PRIVMSG",Q:"QUERY",BACK:"AWAY",PRIVACY:"PRIVACYPOLICY",HOP:"CYCLE"}},newUIWindow:function(A){var B=this.parentObject.ui[A];if(!$defined(B)){this.getActiveWindow().errorMessage("Current UI does not support that command.")}else{B.bind(this.parentObject.ui)()}},cmd_ME:[true,undefined,undefined,function(A){if(A==undefined){A=""}var B=this.getActiveWindow().name;if(!this.send("PRIVMSG "+B+" :\x01ACTION "+A+"\x01")){return }this.newQueryLine(B,"ACTION",A,{"@":this.parentObject.getNickStatus(B,this.parentObject.nickname)})}],cmd_CTCP:[false,3,2,function(A){var D=A[0];var B=A[1].toUpperCase();var C=A[2];if(C==undefined){C=""}if(C==""){if(!this.send("PRIVMSG "+D+" :\x01"+B+"\x01")){return }}else{if(!this.send("PRIVMSG "+D+" :\x01"+B+" "+C+"\x01")){return }}this.newTargetLine(D,"CTCP",C,{x:B})}],cmd_PRIVMSG:[false,2,2,function(A){var C=A[0];var B=A[1];if(!this.parentObject.isChannel(C)){this.parentObject.pushLastNick(C)}if(this.send("PRIVMSG "+C+" :"+B)){this.newQueryLine(C,"MSG",B,{"@":this.parentObject.getNickStatus(C,this.parentObject.nickname)})}}],cmd_NOTICE:[false,2,2,function(A){var C=A[0];var B=A[1];if(this.send("NOTICE "+C+" :"+B)){if(this.parentObject.isChannel(C)){this.newTargetLine(C,"NOTICE",B,{"@":this.parentObject.getNickStatus(C,this.parentObject.nickname)})}else{this.newTargetLine(C,"NOTICE",B)}}}],cmd_QUERY:[false,2,1,function(A){if(this.parentObject.isChannel(A[0])){this.getActiveWindow().errorMessage("Can't target a channel with this command.");return }this.parentObject.newWindow(A[0],qwebirc.ui.WINDOW_QUERY,true);if((A.length>1)&&(A[1]!="")){return["SAY",A[1]]}}],cmd_SAY:[true,undefined,undefined,function(A){if(A==undefined){A=""}return["PRIVMSG",this.getActiveWindow().name+" "+A]}],cmd_LOGOUT:[false,undefined,undefined,function(A){this.parentObject.ui.logout()}],cmd_OPTIONS:[false,undefined,undefined,function(A){this.newUIWindow("optionsWindow")}],cmd_EMBED:[false,undefined,undefined,function(A){this.newUIWindow("embeddedWindow")}],cmd_PRIVACYPOLICY:[false,undefined,undefined,function(A){this.newUIWindow("privacyWindow")}],cmd_ABOUT:[false,undefined,undefined,function(A){this.newUIWindow("aboutWindow")}],cmd_QUOTE:[false,1,1,function(A){this.send(A[0])}],cmd_KICK:[true,2,1,function(A){var C=this.getActiveWindow().name;var B="";var D=A[0];if(A.length==2){B=A[1]}this.send("KICK "+C+" "+D+" :"+B)}],automode:function(E,F,A){var C=this.getActiveWindow().name;var D=E;for(var B=0;B<A.length;B++){D=D+F}this.send("MODE "+C+" "+D+" "+A.join(" "))},cmd_OP:[true,6,1,function(A){this.automode("+","o",A)}],cmd_DEOP:[true,6,1,function(A){this.automode("-","o",A)}],cmd_VOICE:[true,6,1,function(A){this.automode("+","v",A)}],cmd_DEVOICE:[true,6,1,function(A){this.automode("-","v",A)}],cmd_TOPIC:[true,1,1,function(A){this.send("TOPIC "+this.getActiveWindow().name+" :"+A[0])}],cmd_AWAY:[false,1,0,function(A){this.send("AWAY :"+(A?A[0]:""))}],cmd_QUIT:[false,1,0,function(A){this.send("QUIT :"+(A?A[0]:""))}],cmd_CYCLE:[true,1,0,function(A){var B=this.getActiveWindow().name;this.send("PART "+B+" :"+(A?A[0]:"rejoining. . ."));this.send("JOIN "+B)}],cmd_JOIN:[false,2,1,function(C){var A=C.shift();var D=A.split(",");var E=[];var F=false;D.forEach(function(G){if(!this.parentObject.isChannel(G)){G="#"+G;F=true}E.push(G)}.bind(this));if(F){var B=function(){this.getActiveWindow().infoMessage("Channel names begin with # (corrected automatically).")}.bind(this).delay(250)}this.send("JOIN "+E.join(",")+" "+C.join(" "))}],cmd_UMODE:[false,1,0,function(A){this.send("MODE "+this.parentObject.getNickname()+(A?(" "+A[0]):""))}],cmd_BEEP:[false,undefined,undefined,function(A){this.parentObject.ui.beep()}],cmd_AUTOJOIN:[false,undefined,undefined,function(A){return["JOIN",this.parentObject.options.autojoin]}],cmd_CLEAR:[false,undefined,undefined,function(B){var A=this.getActiveWindow().lines;while(A.childNodes.length>0){A.removeChild(A.firstChild)}}],cmd_PART:[false,2,0,function(B){var A=this.getActiveWindow();var D="";var C;if(A.type!=qwebirc.ui.WINDOW_CHANNEL){if(!B||B.length==0){A.errorMessage("Insufficient arguments for command.");return }C=B[0];if(B.length>1){D=B[1]}}else{if(!B||B.length==0){C=A.name}else{var E=this.parentObject.isChannel(B[0]);if(E){C=B[0];if(B.length>1){D=B[1]}}else{C=A.name;D=B.join(" ")}}}this.send("PART "+C+" :"+D)}]});qwebirc.irc.IRCClient=new Class({Extends:qwebirc.irc.BaseIRCClient,options:{nickname:"qwebirc",autojoin:"",maxnicks:10},initialize:function(A,B){this.parent(A);this.ui=B;this.prefixes="@+";this.modeprefixes="ov";this.windows={};this.commandparser=new qwebirc.irc.Commands(this);this.exec=this.commandparser.dispatch.bind(this.commandparser);this.statusWindow=this.ui.newClient(this);this.lastNicks=[];this.inviteChanList=[];this.activeTimers={};this.loginRegex=new RegExp(this.ui.options.loginRegex);this.tracker=new qwebirc.irc.IRCTracker(this)},newLine:function(C,B,D){if(!D){D={}}var A=this.getWindow(C);if(A){A.addLine(B,D)}else{this.statusWindow.addLine(B,D)}},newChanLine:function(D,C,B,A){if(!A){A={}}A.n=B.hostToNick();A.h=B.hostToHost();A.c=D;A["-"]=this.nickname;this.newLine(D,C,A)},newServerLine:function(A,B){this.statusWindow.addLine(A,B)},newActiveLine:function(A,B){this.getActiveWindow().addLine(A,B)},newTargetOrActiveLine:function(C,A,B){if(this.getWindow(C)){this.newLine(C,A,B)}else{this.newActiveLine(A,B)}},updateNickList:function(G){var H=this.tracker.getChannel(G);var J=new Array();var D=String.fromCharCode(255);var C={};for(var B in H){var E=H[B];var F;if(E.prefixes.length>0){var I=E.prefixes.charAt(0);F=String.fromCharCode(this.prefixes.indexOf(I))+this.toIRCLower(B);C[F]=I+B}else{F=D+this.toIRCLower(B);C[F]=B}J.push(F)}J.sort();var A=new Array();J.each(function(L){A.push(C[L])});var K=this.getWindow(G);if(K){K.updateNickList(A)}},getWindow:function(A){return this.windows[this.toIRCLower(A)]},newWindow:function(C,D,A){var B=this.getWindow(C);if(!B){B=this.windows[this.toIRCLower(C)]=this.ui.newWindow(this,D,C);B.addEvent("close",function(E){delete this.windows[this.toIRCLower(C)]}.bind(this))}if(A){this.ui.selectWindow(B)}return B},getQueryWindow:function(A){return this.ui.getWindow(this,qwebirc.ui.WINDOW_QUERY,A)},newQueryWindow:function(A,B){var C;if(this.getQueryWindow(A)){return }if(B){return this.newPrivmsgQueryWindow(A)}return this.newNoticeQueryWindow(A)},newPrivmsgQueryWindow:function(A){if(this.ui.uiOptions.DEDICATED_MSG_WINDOW){if(!this.ui.getWindow(this,qwebirc.ui.WINDOW_MESSAGES)){return this.ui.newWindow(this,qwebirc.ui.WINDOW_MESSAGES,"Messages")}}else{return this.newWindow(A,qwebirc.ui.WINDOW_QUERY,false)}},newNoticeQueryWindow:function(A){if(this.ui.uiOptions.DEDICATED_NOTICE_WINDOW){if(!this.ui.getWindow(this,qwebirc.ui.WINDOW_MESSAGES)){return this.ui.newWindow(this,qwebirc.ui.WINDOW_MESSAGES,"Messages")}}},newQueryLine:function(D,C,E,B,G){if(this.getQueryWindow(D)){return this.newLine(D,C,E)}var A=this.ui.getWindow(this,qwebirc.ui.WINDOW_MESSAGES);var F;if(B){F=this.ui.uiOptions.DEDICATED_MSG_WINDOW}else{F=this.ui.uiOptions.DEDICATED_NOTICE_WINDOW}if(F&&A){return A.addLine(C,E)}else{if(G){return this.newActiveLine(C,E)}else{return this.newLine(D,C,E)}}},newQueryOrActiveLine:function(C,B,D,A){this.newQueryLine(C,B,D,A,true)},getActiveWindow:function(){return this.ui.getActiveIRCWindow(this)},getNickname:function(){return this.nickname},addPrefix:function(D,F){var G=D.prefixes+F;var E=[];for(var C=0;C<this.prefixes.length;C++){var B=this.prefixes.charAt(C);var A=G.indexOf(B);if(A!=-1){E.push(B)}}D.prefixes=E.join("")},stripPrefix:function(A){var B=A.charAt(0);if(!B){return A}if(this.prefixes.indexOf(B)!=-1){return A.substring(1)}return A},removePrefix:function(A,B){A.prefixes=A.prefixes.replaceAll(B,"")},rawNumeric:function(A,B,C){this.newServerLine("RAW",{n:"numeric",m:C.slice(1).join(" ")})},signedOn:function(A){this.tracker=new qwebirc.irc.IRCTracker(this);this.nickname=A;this.newServerLine("SIGNON");if(this.ui.uiOptions.USE_HIDDENHOST){this.exec("/UMODE +x")}if(this.options.autojoin){if(qwebirc.auth.loggedin()&&this.ui.uiOptions.USE_HIDDENHOST){var B=function(){if($defined(this.activeTimers.autojoin)){this.ui.getActiveWindow().infoMessage("Waiting for login before joining channels...")}}.delay(5,this);this.activeTimers.autojoin=function(){var C=this.ui.getActiveWindow();C.errorMessage("No login response in 10 seconds.");C.errorMessage("You may want to try authing manually and then type: /autojoin (if you don't auth your host may be visible).")}.delay(10000,this);return }this.exec("/AUTOJOIN")}},userJoined:function(B,D){var A=B.hostToNick();var C=B.hostToHost();if((A==this.nickname)&&!this.getWindow(D)){this.newWindow(D,qwebirc.ui.WINDOW_CHANNEL,true)}this.tracker.addNickToChannel(A,D);if(A==this.nickname){this.newChanLine(D,"OURJOIN",B)}else{if(!this.ui.uiOptions.HIDE_JOINPARTS){this.newChanLine(D,"JOIN",B)}}this.updateNickList(D)},userPart:function(C,F,E){var A=C.hostToNick();var D=C.hostToHost();if(A==this.nickname){this.tracker.removeChannel(F)}else{this.tracker.removeNickFromChannel(A,F);if(!this.ui.uiOptions.HIDE_JOINPARTS){this.newChanLine(F,"PART",C,{m:E})}}this.updateNickList(F);if(A==this.nickname){var B=this.getWindow(F);if(B){B.close()}}},userKicked:function(C,B,D,A){if(D==this.nickname){this.tracker.removeChannel(B);this.getWindow(B).close()}else{this.tracker.removeNickFromChannel(D,B);this.updateNickList(B)}this.newChanLine(B,"KICK",C,{v:D,m:A})},channelMode:function(A,C,D,B){D.each(function(H){var I=H[0];var J=H[1];var F=this.modeprefixes.indexOf(J);if(F==-1){return }var E=H[2];var G=this.prefixes.charAt(F);var K=this.tracker.getOrCreateNickOnChannel(E,C);if(I=="-"){this.removePrefix(K,G)}else{this.addPrefix(K,G)}},this);this.newChanLine(C,"MODE",A,{m:B.join(" ")});this.updateNickList(C)},userQuit:function(C,D){var B=C.hostToNick();var A=this.tracker.getNick(B);var E=[];for(var F in A){E.push(F);if(!this.ui.uiOptions.HIDE_JOINPARTS){this.newChanLine(F,"QUIT",C,{m:D})}}this.tracker.removeNick(B);E.each(function(G){this.updateNickList(G)},this)},nickChanged:function(C,B){var D=C.hostToNick();if(D==this.nickname){this.nickname=B}this.tracker.renameNick(D,B);var A=this.tracker.getNick(B);var E=false;for(var F in A){var E=true;this.newChanLine(F,"NICK",C,{w:B});this.updateNickList(F)}if(!E){this.newServerLine("NICK",{w:B,n:C.hostToNick(),h:C.hostToHost(),"-":this.nickname})}},channelTopic:function(A,C,B){this.newChanLine(C,"TOPIC",A,{m:B});this.getWindow(C).updateTopic(B)},initialTopic:function(B,A){this.getWindow(B).updateTopic(A)},channelCTCP:function(B,E,D,C){if(C==undefined){C=""}var A=B.hostToNick();if(D=="ACTION"){this.tracker.updateLastSpoke(A,E,new Date().getTime());this.newChanLine(E,"CHANACTION",B,{m:C,c:E,"@":this.getNickStatus(E,A)});return }this.newChanLine(E,"CHANCTCP",B,{x:D,m:C,c:E,"@":this.getNickStatus(E,A)})},userCTCP:function(B,D,C){var A=B.hostToNick();var E=B.hostToHost();if(C==undefined){C=""}if(D=="ACTION"){this.newQueryWindow(A,true);this.newQueryLine(A,"PRIVACTION",{m:C,x:D,h:E,n:A},true);return }this.newTargetOrActiveLine(A,"PRIVCTCP",{m:C,x:D,h:E,n:A,"-":this.nickname})},userCTCPReply:function(B,D,C){var A=B.hostToNick();var E=B.hostToHost();if(C==undefined){C=""}this.newTargetOrActiveLine(A,"CTCPREPLY",{m:C,x:D,h:E,n:A,"-":this.nickname})},getNickStatus:function(B,A){var C=this.tracker.getNickOnChannel(A,B);if(!$defined(C)){return""}if(C.prefixes.length==0){return""}return C.prefixes.charAt(0)},channelPrivmsg:function(B,D,C){var A=B.hostToNick();this.tracker.updateLastSpoke(A,D,new Date().getTime());this.newChanLine(D,"CHANMSG",B,{m:C,"@":this.getNickStatus(D,A)})},channelNotice:function(A,C,B){this.newChanLine(C,"CHANNOTICE",A,{m:B,"@":this.getNickStatus(C,A.hostToNick())})},userPrivmsg:function(B,D){var A=B.hostToNick();var C=B.hostToHost();this.newQueryWindow(A,true);this.pushLastNick(A);this.newQueryLine(A,"PRIVMSG",{m:D,h:C,n:A},true);this.checkLogin(B,D)},checkLogin:function(A,B){if(this.isNetworkService(A)&&$defined(this.activeTimers.autojoin)){if($defined(this.loginRegex)&&B.match(this.loginRegex)){$clear(this.activeTimers.autojoin);delete this.activeTimers.autojoin;this.ui.getActiveWindow().infoMessage("Joining channels...");this.exec("/AUTOJOIN")}}},serverNotice:function(A,B){if(A==""){this.newServerLine("SERVERNOTICE",{m:B})}else{this.newServerLine("PRIVNOTICE",{m:B,n:A})}},userNotice:function(B,D){var A=B.hostToNick();var C=B.hostToHost();if(this.ui.uiOptions.DEDICATED_NOTICE_WINDOW){this.newQueryWindow(A,false);this.newQueryOrActiveLine(A,"PRIVNOTICE",{m:D,h:C,n:A},false)}else{this.newTargetOrActiveLine(A,"PRIVNOTICE",{m:D,h:C,n:A})}this.checkLogin(B,D)},isNetworkService:function(A){return this.ui.options.networkServices.indexOf(A)>-1},__joinInvited:function(){this.exec("/JOIN "+this.inviteChanList.join(","));this.inviteChanList=[];delete this.activeTimers.serviceInvite},userInvite:function(B,D){var A=B.hostToNick();var C=B.hostToHost();this.newServerLine("INVITE",{c:D,h:C,n:A});if(this.ui.uiOptions.ACCEPT_SERVICE_INVITES&&this.isNetworkService(B)){if(this.activeTimers.serviceInvite){$clear(this.activeTimers.serviceInvite)}this.activeTimers.serviceInvite=this.__joinInvited.delay(100,this);this.inviteChanList.push(D)}},userMode:function(A){this.newServerLine("UMODE",{m:A,n:this.nickname})},channelNames:function(A,B){if(B.length==0){this.updateNickList(A);return }B.each(function(C){var D=[];var E=C.split("");E.every(function(H,G){if(this.prefixes.indexOf(H)==-1){C=C.substr(G);return false}D.push(H);return true},this);var F=this.tracker.addNickToChannel(C,A);D.each(function(G){this.addPrefix(F,G)},this)},this)},disconnected:function(C){for(var A in this.windows){var B=this.windows[A];if(B.type==qwebirc.ui.WINDOW_CHANNEL){B.close()}}this.tracker=undefined;this.newServerLine("DISCONNECT",{m:C})},nickOnChanHasPrefix:function(A,C,D){var B=this.tracker.getNickOnChannel(A,C);if(!$defined(B)){return false}return B.prefixes.indexOf(D)!=-1},supported:function(B,C){if(B=="PREFIX"){var A=(C.length-2)/2;this.modeprefixes=C.substr(1,A);this.prefixes=C.substr(A+2,A)}this.parent(B,C)},connected:function(){this.newServerLine("CONNECT")},serverError:function(A){this.newServerLine("ERROR",{m:A})},quit:function(A){this.send("QUIT :"+A,true);this.disconnect()},disconnect:function(){for(var A in this.activeTimers){this.activeTimers[A].cancel()}this.activeTimers={};this.parent()},awayMessage:function(A,B){this.newQueryLine(A,"AWAY",{n:A,m:B},true)},whois:function(A,C,E){var D={n:A};var F;var B=function(){this.newTargetOrActiveLine(A,"WHOIS"+F,D)}.bind(this);if(C=="user"){F="USER";D.h=E.ident+"@"+E.hostname;B();F="REALNAME";D.m=E.realname}else{if(C=="server"){F="SERVER";D.x=E.server;D.m=E.serverdesc}else{if(C=="oper"){F="OPER"}else{if(C=="idle"){F="IDLE";D.x=qwebirc.util.longtoduration(E.idle);D.m=qwebirc.irc.IRCDate(new Date(E.connected*1000))}else{if(C=="channels"){F="CHANNELS";D.m=E.channels}else{if(C=="account"){F="ACCOUNT";D.m=E.account}else{if(C=="away"){F="AWAY";D.m=E.away}else{if(C=="opername"){F="OPERNAME";D.m=E.opername}else{if(C=="actually"){F="ACTUALLY";D.m=E.hostname;D.x=E.ip}else{if(C=="generictext"){F="GENERICTEXT";D.m=E.text}else{if(C=="end"){F="END"}else{return false}}}}}}}}}}}B();return true},genericError:function(B,A){this.newTargetOrActiveLine(B,"GENERICERROR",{m:A,t:B})},genericQueryError:function(B,A){this.newQueryOrActiveLine(B,"GENERICERROR",{m:A,t:B},true)},awayStatus:function(B,A){this.newActiveLine("GENERICMESSAGE",{m:A})},pushLastNick:function(A){var B=this.lastNicks.indexOf(A);if(B!=-1){this.lastNicks.splice(B,1)}else{if(this.lastNicks.length==this.options.maxnicks){this.lastNicks.pop()}}this.lastNicks.unshift(A)},wallops:function(B,D){var A=B.hostToNick();var C=B.hostToHost();this.newServerLine("WALLOPS",{t:D,n:A,h:C})},channelModeIs:function(A,B){this.newTargetOrActiveLine(A,"CHANNELMODEIS",{c:A,m:B.join(" ")})},channelCreationTime:function(A,B){this.newTargetOrActiveLine(A,"CHANNELCREATIONTIME",{c:A,m:qwebirc.irc.IRCDate(new Date(B*1000))})}});qwebirc.irc.CommandHistory=new Class({Implements:[Options],options:{lines:20},initialize:function(A){this.setOptions(A);this.data=[];this.position=0},addLine:function(B,A){if((this.data.length==0)||(B!=this.data[0])){this.data.unshift(B)}if(A){this.position=0}else{this.position=-1}if(this.data.length>this.options.lines){this.data.pop()}},upLine:function(){if(this.data.length==0){return null}if(this.position>=this.data.length){return null}this.position=this.position+1;return this.data[this.position]},downLine:function(){if(this.position==-1){return null}this.position=this.position-1;if(this.position==-1){return null}return this.data[this.position]}});qwebirc.ui.UI_COMMANDS=[["Options","options"],["Add webchat to your site","embedded"],["Privacy policy","privacy"],["Feedback","feedback"],["Frequently asked questions","faq"],["About qwebirc","about"]];qwebirc.ui.MENU_ITEMS=function(){var D=function(I){var J=this.name;var H=this.client.nickname;return this.client.nickOnChanHasPrefix(H,J,"@")};var A=function(I){var J=this.name;var H=this.client.nickname;return this.client.nickOnChanHasPrefix(H,J,"+")};var B=function(H){var I=this.name;return this.client.nickOnChanHasPrefix(H,I,"@")};var C=function(H){var I=this.name;return this.client.nickOnChanHasPrefix(H,I,"+")};var G=qwebirc.util.invertFn,E=qwebirc.util.composeAnd;var F=function(H){return function(I){this.client.exec("/"+H+" "+I)}};return[{text:"whois",fn:F("whois"),predicate:true},{text:"query",fn:F("query"),predicate:true},{text:"slap",fn:function(H){this.client.exec("/ME slaps "+H+" around a bit with a large fishbot")},predicate:true},{text:"kick",fn:function(H){this.client.exec("/KICK "+H+" wibble")},predicate:D},{text:"op",fn:F("op"),predicate:E(D,G(B))},{text:"deop",fn:F("deop"),predicate:E(D,B)},{text:"voice",fn:F("voice"),predicate:E(D,G(C))},{text:"devoice",fn:F("devoice"),predicate:E(D,C)}]}();qwebirc.ui.WINDOW_STATUS=1;qwebirc.ui.WINDOW_QUERY=2;qwebirc.ui.WINDOW_CHANNEL=4;qwebirc.ui.WINDOW_CUSTOM=8;qwebirc.ui.WINDOW_CONNECT=16;qwebirc.ui.WINDOW_MESSAGES=32;qwebirc.ui.CUSTOM_CLIENT="custom";qwebirc.ui.BaseUI=new Class({Implements:[Events],initialize:function(B,D,F,C){this.options=C;this.windows={};this.clients={};this.windows[qwebirc.ui.CUSTOM_CLIENT]={};this.windowArray=[];this.windowClass=D;this.parentElement=B;this.parentElement.addClass("qwebirc");this.parentElement.addClass("qwebirc-"+F);this.firstClient=false;this.commandhistory=new qwebirc.irc.CommandHistory();this.clientId=0;this.windowFocused=true;if(Browser.Engine.trident){var G=function(){var H=document.hasFocus();if(H!=this.windowFocused){this.windowFocused=H;this.focusChange(H)}};G.periodical(100,this)}else{var E=function(){if(this.windowFocused){this.windowFocused=false;this.focusChange(false)}}.bind(this);var A=function(){if(!this.windowFocused){this.windowFocused=true;this.focusChange(true)}}.bind(this);document.addEvent("blur",E);window.addEvent("blur",E);document.addEvent("focus",A);window.addEvent("focus",A)}},newClient:function(B){B.id=this.clientId++;B.hilightController=new qwebirc.ui.HilightController(B);this.windows[B.id]={};this.clients[B.id]=B;var A=this.newWindow(B,qwebirc.ui.WINDOW_STATUS,"Status");this.selectWindow(A);if(!this.firstClient){this.firstClient=true;A.addLine("","qwebirc v"+qwebirc.VERSION);A.addLine("","Copyright (C) 2008-2009 Chris Porter and the qwebirc project.");A.addLine("","http://www.qwebirc.org");A.addLine("","Licensed under the GNU General Public License, Version 2.")}return A},getClientId:function(A){if(A==qwebirc.ui.CUSTOM_CLIENT){return qwebirc.ui.CUSTOM_CLIENT}else{return A.id}},getWindowIdentifier:function(A,C,B){if(C==qwebirc.ui.WINDOW_MESSAGES){return"-M"}if(C==qwebirc.ui.WINDOW_STATUS){return""}if(A==qwebirc.ui.CUSTOM_CLIENT){return"_"+B}return"_"+A.toIRCLower(B)},newWindow:function(B,D,C){var A=this.getWindow(B,D,C);if($defined(A)){return A}var E=this.getWindowIdentifier(B,D,C);var A=this.windows[this.getClientId(B)][E]=new this.windowClass(this,B,D,C,E);this.windowArray.push(A);return A},getWindow:function(A,C,B){var D=this.windows[this.getClientId(A)];if(!$defined(D)){return null}return D[this.getWindowIdentifier(A,C,B)]},getActiveWindow:function(){return this.active},getActiveIRCWindow:function(A){if(!this.active||this.active.type==qwebirc.ui.WINDOW_CUSTOM){return this.windows[this.getClientId(A)][this.getWindowIdentifier(A,qwebirc.ui.WINDOW_STATUS)]}else{return this.active}},__setActiveWindow:function(A){this.active=A},selectWindow:function(A){if(this.active){this.active.deselect()}A.select();this.updateTitle(A.name+" - "+this.options.appTitle)},updateTitle:function(A){document.title=A},nextWindow:function(B){if(this.windowArray.length==0||!this.active){return }if(!B){B=1}var A=this.windowArray.indexOf(this.active);if(A==-1){return }A=A+B;if(A<0){A=this.windowArray.length-1}else{if(A>=this.windowArray.length){A=0}}this.selectWindow(this.windowArray[A])},prevWindow:function(){this.nextWindow(-1)},__closed:function(B){if(B.active){this.active=undefined;if(this.windowArray.length==1){this.windowArray=[]}else{var A=this.windowArray.indexOf(B);if(A==-1){return }else{if(A==0){this.selectWindow(this.windowArray[1])}else{this.selectWindow(this.windowArray[A-1])}}}}this.windowArray=this.windowArray.erase(B);delete this.windows[this.getClientId(B.client)][B.identifier]},loginBox:function(E,D,A,C,B){qwebirc.ui.GenericLoginBox(this.parentElement,E,D,A,C,B,this.options.networkName)},focusChange:function(B){var A=this.getActiveWindow();if($defined(A)){A.focusChange(B)}}});qwebirc.ui.StandardUI=new Class({Extends:qwebirc.ui.BaseUI,UICommands:qwebirc.ui.UI_COMMANDS,initialize:function(A,D,E,B){this.parent(A,D,E,B);this.tabCompleter=new qwebirc.ui.TabCompleterFactory(this);this.uiOptions=new qwebirc.ui.DefaultOptionsClass(this);this.customWindows={};var C;if(Browser.Engine.trident){C="keydown"}else{C="keypress"}document.addEvent(C,this.__handleHotkey.bind(this))},__handleHotkey:function(A){if(!A.alt||A.control){if(A.key=="backspace"||A.key=="/"){if(!this.getInputFocused(A)){new Event(A).stop()}}return }var F=false;if(A.key=="a"||A.key=="A"){var E=0;var D=-1;F=true;new Event(A).stop();for(var B=0;B<this.windowArray.length;B++){var C=this.windowArray[B].hilighted;if(C>E){D=B;E=C}}if(D>-1){this.selectWindow(this.windowArray[D])}}else{if(A.key>="0"&&A.key<="9"){F=true;number=A.key-"0";if(number==0){number=10}number=number-1;if(number>=this.windowArray.length){return }this.selectWindow(this.windowArray[number])}else{if(A.key=="left"){this.prevWindow();F=true}else{if(A.key=="right"){this.nextWindow();F=true}}}}if(F){new Event(A).stop()}},getInputFocused:function(A){if($$("input").indexOf(A.target)==-1&&$$("textarea").indexOf(A.target)==-1){return false}return true},newCustomWindow:function(C,A,D){if(!D){D=qwebirc.ui.WINDOW_CUSTOM}var B=this.newWindow(qwebirc.ui.CUSTOM_CLIENT,D,C);B.addEvent("close",function(E){delete this.windows[qwebirc.ui.CUSTOM_CLIENT][E.identifier]}.bind(this));if(A){this.selectWindow(B)}return B},addCustomWindow:function(C,A,B,D){if(!$defined(D)){D={}}if(this.customWindows[C]){this.selectWindow(this.customWindows[C]);return }var F=this.newCustomWindow(C,true);this.customWindows[C]=F;F.addEvent("close",function(){this.customWindows[C]=null}.bind(this));if(B){F.lines.addClass("qwebirc-"+B)}var E=new A(F.lines,D);E.addEvent("close",function(){F.close()}.bind(this));F.setSubWindow(E)},embeddedWindow:function(){this.addCustomWindow("Embedding wizard",qwebirc.ui.EmbedWizard,"embeddedwizard",{baseURL:this.options.baseURL})},optionsWindow:function(){this.addCustomWindow("Options",qwebirc.ui.OptionsPane,"optionspane",this.uiOptions)},aboutWindow:function(){this.addCustomWindow("About",qwebirc.ui.AboutPane,"aboutpane",this.uiOptions)},privacyWindow:function(){this.addCustomWindow("Privacy policy",qwebirc.ui.PrivacyPolicyPane,"privacypolicypane",this.uiOptions)},feedbackWindow:function(){this.addCustomWindow("Feedback",qwebirc.ui.FeedbackPane,"feedbackpane",this.uiOptions)},faqWindow:function(){this.addCustomWindow("FAQ",qwebirc.ui.FAQPane,"faqpane",this.uiOptions)},urlDispatcher:function(A,B){if(A=="embedded"){return["a",this.embeddedWindow.bind(this)]}if(A=="options"){return["a",this.optionsWindow.bind(this)]}if(A=="whois"){return["span",function(C){this.client.exec("/WHOIS "+C)}.bind(B)]}return null},tabComplete:function(A){this.tabCompleter.tabComplete(A)},resetTabComplete:function(){this.tabCompleter.reset()},setModifiableStylesheet:function(A){this.__styleSheet=new qwebirc.ui.style.ModifiableStylesheet("/css/"+A+qwebirc.FILE_SUFFIX+".mcss");if($defined(this.options.hue)){this.setModifiableStylesheetValues(this.options.hue,0,0)}else{this.setModifiableStylesheetValues(this.uiOptions.STYLE_HUE,0,0)}},setModifiableStylesheetValues:function(A,B,C){if(!$defined(this.__styleSheet)){return }this.__styleSheet.set(function(D){return D.setHue(A).setSaturation(D.hsb[1]+B).setBrightness(D.hsb[2]+C)})}});qwebirc.ui.NotificationUI=new Class({Extends:qwebirc.ui.StandardUI,initialize:function(A,C,D,B){this.parent(A,C,D,B);this.__beeper=new qwebirc.ui.Beeper(this.uiOptions);this.__flasher=new qwebirc.ui.Flasher(this.uiOptions);this.beep=this.__beeper.beep.bind(this.__beeper);this.flash=this.__flasher.flash.bind(this.__flasher);this.cancelFlash=this.__flasher.cancelFlash.bind(this.__flasher)},setBeepOnMention:function(A){if(A){this.__beeper.soundInit()}},updateTitle:function(A){if(this.__flasher.updateTitle(A)){this.parent(A)}},focusChange:function(A){this.parent(A);this.__flasher.focusChange(A)}});qwebirc.ui.NewLoginUI=new Class({Extends:qwebirc.ui.NotificationUI,loginBox:function(B,G,A,F,D){this.postInitialize();var C=this.newCustomWindow("Connection details",true,qwebirc.ui.WINDOW_CONNECT);var E=function(H){C.close();B(H)};qwebirc.ui.GenericLoginBox(C.lines,E,G,A,F,D,this.options.networkName)}});qwebirc.ui.QuakeNetUI=new Class({Extends:qwebirc.ui.NewLoginUI,urlDispatcher:function(A,B){if(A=="qwhois"){return["span",function(C){this.client.exec("/MSG Q whois #"+C)}.bind(B)]}return this.parent(A,B)},logout:function(){if(!qwebirc.auth.loggedin()){return }if(confirm("Log out?")){for(var A in this.clients){this.clients[A].quit("Logged out")}var B=function(){document.location="/auth?logout=1"};B.delay(500)}}});qwebirc.ui.RootUI=qwebirc.ui.QuakeNetUI;qwebirc.ui.HILIGHT_NONE=0;qwebirc.ui.HILIGHT_ACTIVITY=1;qwebirc.ui.HILIGHT_SPEECH=2;qwebirc.ui.HILIGHT_US=3;qwebirc.ui.WINDOW_LASTLINE=qwebirc.ui.WINDOW_QUERY|qwebirc.ui.WINDOW_MESSAGES|qwebirc.ui.WINDOW_CHANNEL|qwebirc.ui.WINDOW_STATUS;qwebirc.ui.Window=new Class({Implements:[Events],initialize:function(E,A,D,C,B){this.parentObject=E;this.type=D;this.name=C;this.active=false;this.client=A;this.identifier=B;this.hilighted=qwebirc.ui.HILIGHT_NONE;this.scrolltimer=null;this.commandhistory=this.parentObject.commandhistory;this.scrolleddown=true;this.scrollpos=null;this.lastNickHash={};this.lastSelected=null;this.subWindow=null;this.closed=false;if(this.type&qwebirc.ui.WINDOW_LASTLINE){this.lastPositionLine=new Element("hr");this.lastPositionLine.addClass("lastpos");this.lastPositionLineInserted=false}},updateTopic:function(A,B){qwebirc.ui.Colourise("["+A+"]",B,this.client.exec,this.parentObject.urlDispatcher.bind(this.parentObject),this)},close:function(){this.closed=true;if($defined(this.scrolltimer)){$clear(this.scrolltimer);this.scrolltimer=null}this.parentObject.__closed(this);this.fireEvent("close",this)},subEvent:function(A){if($defined(this.subWindow)){this.subWindow.fireEvent(A)}},setSubWindow:function(A){this.subWindow=A},select:function(){if(this.lastPositionLineInserted&&!this.parentObject.uiOptions.LASTPOS_LINE){this.lines.removeChild(this.lastPositionLine);this.lastPositionLineInserted=false}this.active=true;this.parentObject.__setActiveWindow(this);if(this.hilighted){this.setHilighted(qwebirc.ui.HILIGHT_NONE)}this.subEvent("select");this.resetScrollPos();this.lastSelected=new Date()},deselect:function(){this.subEvent("deselect");this.setScrollPos();if($defined(this.scrolltimer)){$clear(this.scrolltimer);this.scrolltimer=null}if(this.type&qwebirc.ui.WINDOW_LASTLINE){this.replaceLastPositionLine()}this.active=false},resetScrollPos:function(){if(this.scrolleddown){this.scrollToBottom()}else{if($defined(this.scrollpos)){this.getScrollParent().scrollTo(this.scrollpos.x,this.scrollpos.y)}}},setScrollPos:function(){if(!this.parentObject.singleWindow){this.scrolleddown=this.scrolledDown();this.scrollpos=this.lines.getScroll()}},addLine:function(D,A,E,B){var C=qwebirc.ui.HILIGHT_NONE;var F=false;if(D){C=qwebirc.ui.HILIGHT_ACTIVITY;if(D.match(/(NOTICE|ACTION|MSG)$/)){if(this.type==qwebirc.ui.WINDOW_QUERY||this.type==qwebirc.ui.WINDOW_MESSAGES){if(D.match(/^OUR/)||D.match(/NOTICE$/)){C=qwebirc.ui.HILIGHT_ACTIVITY}else{C=qwebirc.ui.HILIGHT_US;this.parentObject.beep();this.parentObject.flash()}}if(!D.match(/^OUR/)&&this.client.hilightController.match(A.m)){F=true;C=qwebirc.ui.HILIGHT_US;this.parentObject.beep();this.parentObject.flash()}else{if(C!=qwebirc.ui.HILIGHT_US){C=qwebirc.ui.HILIGHT_SPEECH}}}}if(!this.active&&(C!=qwebirc.ui.HILIGHT_NONE)){this.setHilighted(C)}if(D){A=this.parentObject.theme.message(D,A,F)}qwebirc.ui.Colourise(qwebirc.irc.IRCTimestamp(new Date())+" "+A,B,this.client.exec,this.parentObject.urlDispatcher.bind(this.parentObject),this);this.scrollAdd(B)},errorMessage:function(A){this.addLine("",A,"warncolour")},infoMessage:function(A){this.addLine("",A,"infocolour")},setHilighted:function(A){if(A==qwebirc.ui.HILIGHT_NONE||A>=this.hilighted){this.hilighted=A}},scrolledDown:function(){if(this.scrolltimer){return true}var C=this.lines;var D=C.getScroll();var B=C.getScrollSize().y;var A=C.clientHeight;if(B<A){B=A}return D.y+A==B},getScrollParent:function(){var A=this.lines;if($defined(this.scroller)){A=this.scroller}return A},scrollToBottom:function(){if(this.type==qwebirc.ui.WINDOW_CUSTOM||this.type==qwebirc.ui.WINDOW_CONNECT){return }var B=this.lines;var A=this.getScrollParent();A.scrollTo(B.getScroll().x,B.getScrollSize().y)},scrollAdd:function(A){var B=this.lines;if($defined(A)){var C=this.scrolledDown();B.appendChild(A);if(C){if(this.scrolltimer){$clear(this.scrolltimer)}this.scrolltimer=this.scrollAdd.delay(50,this,[null])}}else{this.scrollToBottom();this.scrolltimer=null}},updateNickList:function(D){var A={},G={};var I=[];var H=this.lastNickHash;for(var F=0;F<D.length;F++){G[D[F]]=1}for(var E in H){if(!G[E]){this.nickListRemove(E,H[E])}}for(var F=0;F<D.length;F++){var B=D[F];var C=H[B];if(!C){C=this.nickListAdd(B,F);if(!C){C=1}}A[B]=C}this.lastNickHash=A},nickListAdd:function(B,A){},nickListRemove:function(A,B){},historyExec:function(A){this.commandhistory.addLine(A);this.client.exec(A)},focusChange:function(A){if(A==true||!(this.type&qwebirc.ui.WINDOW_LASTLINE)){return }this.replaceLastPositionLine()},replaceLastPositionLine:function(){if(this.parentObject.uiOptions.LASTPOS_LINE){if(!this.lastPositionLineInserted){this.scrollAdd(this.lastPositionLine)}else{if(this.lines.lastChild!=this.lastPositionLine){try{this.lines.removeChild(this.lastPositionLine)}catch(A){}this.scrollAdd(this.lastPositionLine)}}}else{if(this.lastPositionLineInserted){this.lines.removeChild(this.lastPositionLine)}}this.lastPositionLineInserted=this.parentObject.uiOptions.LASTPOS_LINE}});qwebirc.ui.Colourise=function(H,J,N,A,F){var M;var C;var G=false;var P=false;var X=false;var T=[];var K=H.split("");var B=document.createElement("span");J.addClass("colourline");function O(Y){return Y>="0"&&Y<="9"}function V(Z,Y){if(!O(Z[Y+1])){M=undefined;C=undefined;return Y}Y++;if(O(Z[Y+1])){M=parseInt(Z[Y]+Z[Y+1]);Y++}else{M=parseInt(Z[Y])}if(Z[Y+1]!=","){return Y}if(!O(Z[Y+2])){return Y}Y+=2;if(O(Z[Y+1])){C=parseInt(Z[Y]+Z[Y+1]);Y++}else{C=parseInt(Z[Y])}return Y}function D(){var Y="";if(T.length>0){var Y=qwebirc.ui.urlificate(B,T.join(""),N,A,F);J.appendChild(B);T=[]}B=document.createElement("span");return Y}function I(){if(X){return B}var Y=[];if(M!=undefined){Y.push("Xc"+M)}if(C!=undefined){Y.push("Xbc"+C)}if(P){Y.push("Xb")}if(G){Y.push("Xu")}B.className=Y.join(" ")}var R=F.parentObject.uiOptions.NICK_COLOURS;var E=false;for(var S=0;S<K.length;S++){var Q=K[S];if(R){if(!E){if(Q=="\x00"){E=true;D();continue}}else{if(Q!="\x00"){T.push(Q)}else{X=true;var U=I();var L=D();var W=L.toHSBColour(F.client);if($defined(W)){U.style.color=W.rgbToHex()}E=X=false}continue}}else{if(Q=="\x00"){continue}}if(Q=="\x02"){D();P=!P;I()}else{if(Q=="\x1F"){D();G=!G;I()}else{if(Q=="\x0F"){D();M=undefined;C=undefined;G=false;P=false}else{if(Q=="\x03"){D();S=V(K,S);if(C>15){C=undefined}if(M>15){M=undefined}I()}else{T.push(Q)}}}}}D()};String.prototype.toHSBColour=function(A){var C=A.toIRCLower(A.stripPrefix(this));if(C==A.lowerNickname){return null}var E=0;for(var D=0;D<C.length;D++){E=31*E+C.charCodeAt(D)}var B=Math.abs(E)%360;return new Color([B,70,60],"hsb")};qwebirc.ui.urlificate=function(B,J,E,C,F){var H=/[[\)|\]]?(\.*|[\,;])$/;var I=[];var K=function(U,T,R,N){for(;;){var P=U.search(T);if(P==-1){R(U);break}var O=U.match(T);var S=U.substring(0,P);var M=O[0];var L=U.substring(P+M.length);R(S);var Q=N(M,R);if(!Q){Q=""}U=Q+L}};var A=function(L){I.push(L);qwebirc.util.NBSPCreate(L,B)};var G=function(N){var O=N.replace(H,"");I.push(O);var M=N.substring(O.length);var L=new Element("span");L.href="#";L.addClass("hyperlink-channel");L.addEvent("click",function(P){new Event(P).stop();E("/JOIN "+O)});L.appendChild(document.createTextNode(O));B.appendChild(L);return M};var D=function(Y,U){var L=Y.replace(H,"");var N=Y.substring(L.length);var M="";var V=null;var T="new";var Q=L;var S="a";var R;var X=L.match(/^qwebirc:\/\/(.*)$/);if(X){var P=X[1].match(/^([^\/]+)\/([^\/]+)\/?(.*)$/);if(!P){U(Y);return }var O=C(P[1],F);if(O){R=P[1];S=O[0];if(O[0]!="a"){L=null}else{L="#"}V=O[1];Q=unescape(P[2]);T=null}else{U(Y);return }if(P[3]){N=P[3]+N}}else{if(L.match(/^www\./)){L="http://"+L}}var W=new Element(S);if(R){W.addClass("hyperlink-"+R)}if(L){W.href=L;if(T){W.target=T}}I.push(Q);W.appendChild(document.createTextNode(Q));B.appendChild(W);if($defined(V)){W.addEvent("click",function(Z){new Event(Z).stop();V(Q)})}return N};K(J,/\b((https?|ftp|qwebirc):\/\/|www\.)[^ ]+/,function(L){K(L,/\B#[^ ,]+/,A,G)},D);return I.join("")};qwebirc.ui.themes.ThemeControlCodeMap={C:"\x03",B:"\x02",U:"\x1F",O:"\x0F","{":"\x00","}":"\x00","[":"qwebirc://whois/","]":"/","$":"$"};qwebirc.ui.themes.Default={PREFIX:["$C4==$O "],SIGNON:["Signed on!",true],CONNECT:["Connected to server.",true],RAW:["$m",true],DISCONNECT:["Disconnected from server: $m",true],ERROR:["ERROR: $m",true],SERVERNOTICE:["$m",true],JOIN:["${$N$} [$h] has joined $c",true],OURJOIN:["${$N$} [$h] has joined $c",true],PART:["${$N$} [$h] has left $c [$m]",true],KICK:["${$v$} was kicked from $c by ${$N$} [$m]",true],MODE:["mode/$c [$m] by ${$N$}",true],QUIT:["${$N$} [$h] has quit [$m]",true],NICK:["${$n$} has changed nick to ${$[$w$]$}",true],TOPIC:["${$N$} changed the topic of $c to: $m",true],UMODE:["Usermode change: $m",true],INVITE:["$N invites you to join $c",true],HILIGHT:["$C4"],HILIGHTEND:["$O"],CHANMSG:["<${$@$($N$)$}> $m"],PRIVMSG:["<$($N$)> $m"],CHANNOTICE:["-${$($N$)$}:$c- $m"],PRIVNOTICE:["-$($N$)- $m"],OURCHANMSG:["<$@$N> $m"],OURPRIVMSG:["<$N> $m"],OURTARGETEDMSG:["*$[$t$]* $m"],OURTARGETEDNOTICE:["[notice($[$t$])] $m"],OURCHANNOTICE:["-$N:$t- $m"],OURPRIVNOTICE:["-$N- $m"],OURCHANACTION:[" * $N $m"],OURPRIVACTION:[" * $N $m"],CHANACTION:[" * ${$($N$)$} $m"],PRIVACTION:[" * $($N$) $m"],CHANCTCP:["$N [$h] requested CTCP $x from $c: $m"],PRIVCTCP:["$N [$h] requested CTCP $x from $-: $m"],CTCPREPLY:["CTCP $x reply from $N: $m"],OURCHANCTCP:["[ctcp($t)] $x $m"],OURPRIVCTCP:["[ctcp($t)] $x $m"],OURTARGETEDCTCP:["[ctcp($t)] $x $m"],WHOISUSER:["$B$N$B [$h]",true],WHOISREALNAME:[" realname : $m",true],WHOISCHANNELS:[" channels : $m",true],WHOISSERVER:[" server   : $x [$m]",true],WHOISACCOUNT:[" account  : qwebirc://qwhois/$m",true],WHOISIDLE:[" idle     : $x [connected: $m]",true],WHOISAWAY:[" away     : $m",true],WHOISOPER:["          : $BIRC Operator$B",true],WHOISOPERNAME:[" operedas : $m",true],WHOISACTUALLY:[" realhost : $m [ip: $x]",true],WHOISGENERICTEXT:["          : $m",true],WHOISEND:["End of WHOIS",true],AWAY:["$N is away: $m",true],GENERICERROR:["$m: $t",true],GENERICMESSAGE:["$m",true],WALLOPS:["WALLOP $n: $t",true],CHANNELCREATIONTIME:["Channel $c was created at: $m",true],CHANNELMODEIS:["Channel modes on $c are: $m",true]};qwebirc.ui.Theme=new Class({initialize:function(B){this.__theme=qwebirc.util.dictCopy(qwebirc.ui.themes.Default);if(B){for(var A in B){this.__theme[A]=B[A]}}for(var A in this.__theme){if(A=="PREFIX"){continue}var C=this.__theme[A];if(C[1]){this.__theme[A]=this.__theme.PREFIX+C[0]}else{this.__theme[A]=C[0]}}this.__ccmap=qwebirc.util.dictCopy(qwebirc.ui.themes.ThemeControlCodeMap);this.__ccmaph=qwebirc.util.dictCopy(this.__ccmap);this.__ccmaph["("]=this.message("HILIGHT",{},this.__ccmap);this.__ccmaph[")"]=this.message("HILIGHTEND",{},this.__ccmap);this.__ccmaph["{"]=this.__ccmaph["}"]=""},__dollarSubstitute:function(I,G,A){var D=[];var C=I.split("");for(var F=0;F<C.length;F++){var H=C[F];if(H=="$"&&(F<=C.length-1)){var E=C[++F];var B=A[E];if(!B){B=G[E]}if(B){D.push(B)}}else{D.push(H)}}return D.join("")},message:function(B,C,A){var D;if(A){D=this.__ccmaph}else{D=this.__ccmap}if(C&&C.n){C.N="qwebirc://whois/"+C.n+"/"}return this.__dollarSubstitute(this.__theme[B],C,D)}});qwebirc.ui.HilightController=new Class({initialize:function(A){this.parent=A;this.regex=null;this.prevnick=null},match:function(C){var A=this.parent.nickname;if(A!=this.prevnick){var B="[\\s\\.,;:]";this.regex=new RegExp("(^|"+B+")"+RegExp.escape(A)+"("+B+"|$)","i")}if(C.match(this.regex)){return true}return false}});qwebirc.ui.Beeper=new Class({initialize:function(A){this.uiOptions=A;this.soundInited=false;this.soundReady=false;if(this.uiOptions.BEEP_ON_MENTION){this.soundInit()}},soundInit:function(){if(this.soundInited){return }if(!$defined(Browser.Plugins.Flash)||Browser.Plugins.Flash.version<8){return }this.soundInited=true;this.soundPlayer=new qwebirc.sound.SoundPlayer();this.soundPlayer.addEvent("ready",function(){this.soundReady=true}.bind(this));this.soundPlayer.go()},beep:function(){if(!this.soundReady||!this.uiOptions.BEEP_ON_MENTION){return }this.soundPlayer.beep()}});qwebirc.ui.Flasher=new Class({initialize:function(A){this.uiOptions=A;this.windowFocused=false;this.canUpdateTitle=true;this.titleText=document.title;var C=$$("link[rel=icon]"),B=$$("head");if(C&&C.length>0&&B&&B.length>0){this.favIcon=C[0];this.favIconParent=B[0];this.favIconVisible=true;this.emptyFavIcon=new Element("link");this.emptyFavIcon.rel="shortcut icon";this.emptyFavIcon.href="/images/empty_favicon.ico";this.flashing=false;this.canFlash=true;document.addEvent("mousedown",this.cancelFlash.bind(this));document.addEvent("keydown",this.cancelFlash.bind(this))}else{this.canFlash=false}},flash:function(){if(!this.uiOptions.FLASH_ON_MENTION||this.windowFocused||!this.canFlash||this.flashing){return }this.titleText=document.title;var B=function(){this.hideFavIcon();this.canUpdateTitle=false;document.title="Activity!";this.flasher=A.delay(500)}.bind(this);var A=function(){this.showFavIcon();this.canUpdateTitle=true;document.title=this.titleText;this.flasher=B.delay(500)}.bind(this);this.flashing=true;B()},cancelFlash:function(){if(!this.canFlash||!$defined(this.flasher)){return }this.flashing=false;$clear(this.flasher);this.flasher=null;this.showFavIcon();document.title=this.titleText;this.canUpdateTitle=true},hideFavIcon:function(){if(this.favIconVisible){this.favIconVisible=false;this.favIconParent.removeChild(this.favIcon);this.favIconParent.appendChild(this.emptyFavIcon)}},showFavIcon:function(){if(!this.favIconVisible){this.favIconVisible=true;this.favIconParent.removeChild(this.emptyFavIcon);this.favIconParent.appendChild(this.favIcon)}},updateTitle:function(A){this.titleText=A;return this.canUpdateTitle},focusChange:function(A){this.windowFocused=A;if(A){this.cancelFlash()}}});qwebirc.ui.TabCompleterFactory=new Class({initialize:function(A){this.ui=A;this.reset()},tabComplete:function(F){var H=F.value;if(!$defined(this.obj)){this.incr=1;var G=this.ui.getActiveWindow();if(!G){return }var C=qwebirc.util.getEnclosedWord(H,qwebirc.util.getCaretPos(F));var I="",B="",D="";if($defined(C)){var I=H.substring(0,C[0]);var B=C[1];var D=H.substring(C[0]+B.length)}var E=H.toLowerCase();if(H==""){I="/msg ";obj=qwebirc.ui.QueryTabCompleter}else{if(G.client.isChannel(B)){obj=qwebirc.ui.ChannelNameTabCompleter}else{if(E.match(/^\/(q|query|msg) /i)){obj=qwebirc.ui.QueryTabCompleter}else{if(G.type==qwebirc.ui.WINDOW_QUERY){obj=qwebirc.ui.QueryNickTabCompleter}else{if(G.type==qwebirc.ui.WINDOW_CHANNEL){if(I==""){if((D!="")&&D.charAt(0)==" "){D=":"+D}else{D=": "+D}this.incr++}obj=qwebirc.ui.ChannelUsersTabCompleter}else{return }}}}}if(D==""){D=" "}this.obj=new obj(I,B,D,G);if(!$defined(this.obj)){return }}var A=this.obj.get();if(!$defined(A)){return }F.value=A[1];qwebirc.util.setCaretPos(F,A[0]+this.incr)},reset:function(){this.obj=null}});qwebirc.ui.TabIterator=new Class({initialize:function(C,G,F){this.prefix=G;if(!$defined(F)||F.length==0){this.list=null}else{var B=[];var E=qwebirc.irc.toIRCCompletion(C,G);for(var D=0;D<F.length;D++){var A=qwebirc.irc.toIRCCompletion(C,F[D]);if(A.startsWith(E)){B.push(F[D])}}this.list=B}this.pos=-1},next:function(){if(!$defined(this.list)){return null}this.pos=this.pos+1;if(this.pos>=this.list.length){this.pos=0}return this.list[this.pos]}});qwebirc.ui.BaseTabCompleter=new Class({initialize:function(A,C,E,D,B){this.existingNick=E;this.prefix=C;this.suffix=D;this.iterator=new qwebirc.ui.TabIterator(A,E,B)},get:function(){var B=this.iterator.next();if(!$defined(B)){return null}var A=this.prefix+B;return[A.length,A+this.suffix]}});qwebirc.ui.QueryTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(B,D,C,A){this.parent(A.client,B,D,C,A.client.lastNicks)}});qwebirc.ui.QueryNickTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(C,E,D,B){var A=B.name;this.parent(B.client,C,E,D,[A])}});qwebirc.ui.ChannelNameTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(F,A,J,G){var C=[];var D=G.parentObject.windows[G.parentObject.getClientId(G.client)];for(var H in G.client.channels){var I=D[H];if($defined(I)){I=I.lastSelected}C.push([I,H])}C.sort(function(L,K){return K[0]-L[0]});var B=[];for(var E=0;E<C.length;E++){B.push(C[E][1])}this.parent(G.client,F,A,J,B)}});qwebirc.ui.ChannelUsersTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(B,D,C,A){var E=A.client.tracker.getSortedByLastSpoke(A.name);this.parent(A.client,B,D,C,E)}});qwebirc.ui.style.ModifiableStylesheet=new Class({initialize:function(A){var B=this.__parseStylesheet(this.__getStylesheet(A));this.__cssText=B.cssText;this.rules=B.rules;this.__tag=this.__createTag()},__createTag:function(){var A=document.createElement("style");A.type="text/css";A.media="all";document.getElementsByTagName("head")[0].appendChild(A);return A},__getStylesheet:function(B){var C=new Request({url:B,async:false});var A;C.addEvent("complete",function(D){A=D});C.get();return A},__setStylesheet:function(A){var B=this.__tag;if(B.styleSheet){B.styleSheet.cssText=A}else{var C=document.createTextNode(A);B.appendChild(C);while(B.childNodes.length>1){B.removeChild(B.firstChild)}}},__parseStylesheet:function(E){var B=E.replace("\r\n","\n").split("\n");var G={};var C;for(C=0;C<B.length;C++){var A=B[C];if(A.trim()===""){break}var F=A.splitMax("=",2);if(F.length!=2){continue}G[F[0]]=F[1]}var D=[];for(;C<B.length;C++){D.push(B[C])}return{cssText:D.join("\n"),rules:G}},set:function(D){if(!$defined(D)){D=function(E){return E}}var C=this.__cssText;for(var A in this.rules){var B=D(new Color(this.rules[A]));if(B=="255,255,255"){B="255,255,254"}C=C.replaceAll("$("+A+")","rgb("+B+")")}this.__setStylesheet(C)}});qwebirc.ui.GenericLoginBox=function(B,G,F,A,E,D,C){if(E){qwebirc.ui.ConfirmBox(B,G,F,A,D,C)}else{qwebirc.ui.LoginBox(B,G,F,A,C)}};qwebirc.ui.AuthLogin=function(B){var A=Cookie.write("redirect",document.location);document.location="./auth/";new Event(B).stop()};qwebirc.ui.ConfirmBox=function(N,P,B,H,G,Q){var D=new Element("table");D.addClass("qwebirc-centrebox");N.appendChild(D);var J=new Element("tbody");D.appendChild(J);var M=new Element("tr");J.appendChild(M);var F=new Element("td");M.appendChild(F);var K=new Element("table");K.addClass("qwebirc-confirmbox");F.appendChild(K);var J=new Element("tbody");K.appendChild(J);var M=new Element("tr");J.appendChild(M);M.addClass("tr1");var O=new Element("td");M.appendChild(O);var A=new Element("b");A.set("text",B);var L=H.split(" ")[0].split(",");O.appendChild(document.createTextNode("To connect to "+Q+" IRC and join channel"+((L.length>1)?"s":"")+" "));for(var I=0;I<L.length;I++){if((L.length>1)&&(I==L.length-1)){O.appendChild(document.createTextNode(" and "))}else{if(I>0){O.appendChild(document.createTextNode(", "))}}O.appendChild(new Element("b").set("text",L[I]))}if(!G){O.appendChild(document.createTextNode(" as "));O.appendChild(A)}O.appendChild(document.createTextNode(" click 'Connect'."));O.appendChild(new Element("br"));if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){O.appendChild(document.createTextNode("If you'd like to connect using your Q auth click 'Log in'."))}var M=new Element("tr");J.appendChild(M);M.addClass("tr2");var F=new Element("td");M.appendChild(F);var C=new Element("input",{type:"submit",value:"Connect"});F.appendChild(C);C.focus();C.addEvent("click",function(R){N.removeChild(D);P({nickname:B,autojoin:H})});if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){var E=new Element("input",{type:"submit",value:"Log in"});F.appendChild(E);E.addEvent("click",qwebirc.ui.AuthLogin)}};qwebirc.ui.LoginBox=function(H,G,Y,R,F){var V=new Element("table");V.addClass("qwebirc-centrebox");H.appendChild(V);var A=new Element("tbody");V.appendChild(A);var B=new Element("tr");A.appendChild(B);var L=new Element("td");B.appendChild(L);var O=new Element("table");O.addClass("qwebirc-loginbox");L.appendChild(O);var A=new Element("tbody");O.appendChild(A);var B=new Element("tr");A.appendChild(B);B.addClass("tr1");var L=new Element("td");B.appendChild(L);L.set("html","<h1>Connect to "+F+" IRC</h1>");var B=new Element("tr");A.appendChild(B);B.addClass("tr2");var L=new Element("td");B.appendChild(L);var D=new Element("form");L.appendChild(D);var K=new Element("table");D.appendChild(K);var A=new Element("tbody");K.appendChild(A);function C(Z,e,a){var c=new Element("tr");A.appendChild(c);var d=new Element("td");if(Z){d.set("text",Z)}c.appendChild(d);var b=new Element("td");c.appendChild(b);if($defined(e)){b.appendChild(e)}if($defined(a)){c.setStyles(a);return[c,b]}return b}var W=new Element("input");C("Nickname:",W);var U=null;if(qwebirc.auth.enabled()&&qwebirc.auth.bouncerAuth()){U={display:"none"}}var X=new Element("input");C("Channels:",X,U);if(qwebirc.auth.enabled()){if(qwebirc.auth.passAuth()){var T=C("Auth to services:");var M=qwebirc.util.createInput("checkbox",T,"connect_auth_to_services",false);var S=new Element("input");var Q=C("Username:",S,{display:"none"})[0];var E=C("Password:",null,{display:"none"});var J=qwebirc.util.createInput("password",E[1],"connect_auth_password");M.addEvent("click",function(Z){qwebirc.ui.authShowHide(M,T,S,Q,E[0])})}else{if(qwebirc.auth.bouncerAuth()){var E=C("Password:");var J=qwebirc.util.createInput("password",E,"connect_auth_password")}}}var I=new Element("input",{type:"submit"});I.set("value","Connect");var P=C(undefined,I);if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){var N=new Element("input",{type:"submit",value:"Log in"});P.appendChild(N);N.addEvent("click",qwebirc.ui.AuthLogin)}D.addEvent("submit",function(b){new Event(b).stop();var Z=W.value;var c=X.value;if(c=="#"){c=""}if(!Z){alert("You must supply a nickname.");W.focus();return }var a={nickname:Z,autojoin:c};if(qwebirc.auth.enabled()){if(qwebirc.auth.passAuth()&&M.checked){if(!S.value||!J.value){alert("You must supply your username and password in auth mode.");if(!S.value){S.focus()}else{J.focus()}return }a.serverPassword=S.value+" "+J.value}else{if(qwebirc.auth.bouncerAuth()){if(!J.value){alert("You must supply a password.");J.focus();return }a.serverPassword=J.value}}}H.removeChild(V);G(a)}.bind(this));W.set("value",Y);X.set("value",R);W.focus()};qwebirc.ui.authShowHide=function(D,G,B,C,A){var F=D.checked;var E=F?null:"none";C.setStyle("display",E);A.setStyle("display",E);if(F){B.focus()}};qwebirc.ui.EmbedWizardStep=new Class({Implements:[Options,Events],options:{title:"",first:"",hint:"",middle:null,premove:null,example:""},initialize:function(B,A){this.setOptions(A);this.parent=B},show:function(){this.parent.title.set("html",this.options.title);this.parent.firstRow.set("html",this.options.first);this.parent.hint.set("html",this.options.hint);this.parent.example.set("text",this.options.example);while(this.parent.middleRow.childNodes.length>0){this.parent.middleRow.removeChild(this.parent.middleRow.childNodes[0])}if($defined(this.options.middle)){this.parent.middleRow.appendChild(this.options.middle)}this.fireEvent("show")}});qwebirc.ui.EmbedWizard=new Class({Implements:[Options,Events],options:{parent:null,baseURL:"http://webchat.quakenet.org/"},initialize:function(B,A){this.setOptions(A);this.create(B);this.addSteps()},create:function(E){this.t=E;var F=this.newRow();this.title=new Element("h2");this.title.setStyle("margin-top","0px");this.title.setStyle("margin-bottom","5px");F.appendChild(this.title);this.firstRow=this.newRow();this.middleRow=this.newRow();var B=this.newRow();this.hint=new Element("div");this.hint.setStyle("font-size","0.8em");this.hint.setStyle("font-style","italic");B.appendChild(this.hint);var G=this.newRow();this.example=new Element("pre");G.appendChild(this.example);var D=this.newRow();D.addClass("wizardcontrols");var C=new Element("input");C.type="submit";C.value="< Back";C.addEvent("click",this.back.bind(this));D.appendChild(C);var A=new Element("input");A.type="submit";A.value="Next >";D.appendChild(A);A.addEvent("click",this.next.bind(this));this.nextBtn=A;this.backBtn=C},newRow:function(){var A=new Element("div");this.t.appendChild(A);return A},newStep:function(A){return new qwebirc.ui.EmbedWizardStep(this,A)},newRadio:function(C,F,A,B){var E=new Element("div");C.appendChild(E);var D=qwebirc.util.createInput("radio",E,A,B);E.appendChild(document.createTextNode(F));return D},addSteps:function(){var D=function(F){if(Browser.Engine.trident){var G=function(){this.focus();if(F){this.select()}};G.delay(100,this,[])}else{this.focus();this.select()}};this.welcome=this.newStep({title:"Welcome!",first:"This wizard will help you create an embedded client by asking you questions then giving you the code to add to your website.<br/><br/>You can use the <b>Next</b> and <b>Back</b> buttons to navigate through the wizard; click <b>Next</b> to continue."});this.chanBox=new Element("input");this.chanBox.addClass("text");this.chans=this.newStep({title:"Set channels",first:"Enter the channels you would like the client to join on startup:",hint:"You can supply multiple channels by seperating them with a comma, e.g.:",example:"#rogue,#eu-mage",middle:this.chanBox}).addEvent("show",D.bind(this.chanBox));var E=new Element("div");this.customnick=this.newStep({title:"Nickname mode",first:"At startup would you like the client to use a random nickname, a preset nickname or a nickname of the users choice?",hint:"It is recommended that you only use a preset nickname if the client is for your own personal use.",middle:E});this.choosenick=this.newRadio(E,"Make the user choose a nickname.","nick",true);this.randnick=this.newRadio(E,"Use a random nickname, e.g. qwebirc12883.","nick");this.presetnick=this.newRadio(E,"Use a preset nickname of your choice.","nick");var C=new Element("form");this.connectdialog=this.newStep({title:"Display connect dialog?",first:"Do you want the user to be shown the connect dialog (with the values you have supplied pre-entered) or just a connect confirmation?",middle:C,hint:"You need to display the dialog if you want the user to be able to set their nickname before connecting."});var B=this.newRadio(C,"Connect without displaying the dialog.","prompt",true);this.connectdialogr=this.newRadio(C,"Show the connect dialog.","prompt");this.nicknameBox=new Element("input");this.nicknameBox.addClass("text");this.nickname=this.newStep({title:"Set nickname",first:"Enter the nickname you would like the client to use by default (use a . for a random number):",premove:function(){if(this.nicknameBox.value==""){alert("You must supply a nickname.");this.nicknameBox.focus();return false}return true}.bind(this),middle:this.nicknameBox}).addEvent("show",D.bind(this.nicknameBox));var A=new Element("div");this.finish=this.newStep({title:"Finished!",first:"Your custom link is:",middle:A}).addEvent("show",function(){var I=new Element("a");var F=new Element("input");F.addClass("iframetext");var G=this.generateURL(false);I.href=G;I.target="new";I.appendChild(document.createTextNode(G));F.value='<iframe src="'+G+'" width="647" height="400"></iframe>';var H=[I,new Element("br"),new Element("br"),document.createTextNode("You can embed this into your page with the following code:"),new Element("br"),F];while(A.childNodes.length>0){A.removeChild(A.childNodes[0])}H.forEach(function(J){A.appendChild(J)});D.bind(F)(true);F.addEvent("click",function(){this.select()}.bind(F))}.bind(this));this.updateSteps();this.step=0;this.showStep()},updateSteps:function(){this.steps=[this.welcome,this.customnick];if(this.presetnick.checked){this.steps.push(this.nickname)}this.steps.push(this.chans);if(this.chanBox.value!=""&&!this.choosenick.checked){this.steps.push(this.connectdialog)}this.steps.push(this.finish)},showStep:function(){this.backBtn.disabled=!(this.step>0);this.nextBtn.value=(this.step>=this.steps.length-1)?"Close":"Next >";this.steps[this.step].show()},next:function(){var A=this.steps[this.step].options.premove;if(A&&!A()){return }this.updateSteps();if(this.step>=this.steps.length-1){this.close();return }this.step=this.step+1;this.showStep()},close:function(){this.fireEvent("close")},back:function(){if(this.step<=0){return }this.step=this.step-1;this.showStep()},generateURL:function(){var F=this.chanBox.value;var C=this.nicknameBox.value;var B=this.connectdialogr.checked&&F!=""&&!this.choosenick.checked;var A=[];if(this.presetnick.checked){A.push("nick="+escape(C))}else{if(!this.choosenick.checked){A.push("randomnick=1")}}if(F){var E=F.split(",");var D=[];E.forEach(function(G){if(G.charAt(0)=="#"){G=G.substring(1)}D.push(G)});A.push("channels="+escape(D.join(",")))}if(B){A.push("prompt=1")}return this.options.baseURL+(A.length>0?"?":"")+A.join("&")}});qwebirc.ui.supportsFocus=function(){var A=navigator.userAgent;if(!$defined(A)){return[true]}if(Browser.Engine.ipod||A.indexOf("Konqueror")!=-1){return[false,false]}return[true]};qwebirc.config.DEFAULT_OPTIONS=[[1,"BEEP_ON_MENTION","Beep when nick mentioned or on query activity (requires Flash)",true,{enabled:function(){if(!$defined(Browser.Plugins.Flash)||Browser.Plugins.Flash.version<8){return[false,false]}return[true]},get:function(B,A){if(A.setBeepOnMention){A.setBeepOnMention(B)}}}],[7,"FLASH_ON_MENTION","Flash titlebar when nick mentioned or on query activity",true,{enabled:qwebirc.ui.supportsFocus}],[2,"DEDICATED_MSG_WINDOW","Send privmsgs to dedicated messages window",false],[4,"DEDICATED_NOTICE_WINDOW","Send notices to dedicated message window",false],[3,"NICK_OV_STATUS","Show status (@/+) before nicknames in nicklist",true],[5,"ACCEPT_SERVICE_INVITES","Automatically join channels when invited by Q",true],[6,"USE_HIDDENHOST","Hide your hostmask when authed to Q (+x)",true],[8,"LASTPOS_LINE","Show a last position indicator for each window",true,{enabled:qwebirc.ui.supportsFocus}],[9,"NICK_COLOURS","Automatically colour nicknames",false],[10,"HIDE_JOINPARTS","Hide JOINS/PARTS/QUITS",false],[11,"STYLE_HUE","Adjust user interface hue",function(){return{class_:qwebirc.config.HueOption,default_:210}},{get:function(B,A){A.setModifiableStylesheetValues(B,0,0)}}]];qwebirc.config.DefaultOptions=null;qwebirc.config.Input=new Class({initialize:function(C,B,A,D){this.option=B;this.value=B.value;this.enabled=this.option.enabled;this.position=A;this.parentElement=C;this.parentObject=D;this.render()},createInput:function(D,C,A,B){if(!$defined(C)){C=this.parentElement}return qwebirc.util.createInput(D,C,A,B)},FE:function(A,B){var C=new Element(A);if(!$defined(B)){B=this.parentElement}B.appendChild(C);return C},focus:function(){this.mainElement.focus()},render:function(){this.event("render",this.mainElement)},get:function(A){this.event("get",[A,this.parentObject.optionObject.ui]);return A},event:function(B,A){if(!$defined(this.option.extras)){return }var C=this.option.extras[B];if(!$defined(C)){return }C.pass(A,this)()},cancel:function(){}});qwebirc.config.TextInput=new Class({Extends:qwebirc.config.Input,render:function(){var A=this.createInput("text");this.mainElement=A;A.value=this.value;A.disabled=!this.enabled;this.parent()},get:function(){return this.parent(this.mainElement.value)}});qwebirc.config.HueInput=new Class({Extends:qwebirc.config.Input,render:function(){var B=new Element("div");B.addClass("qwebirc-optionspane");B.addClass("hue-slider");this.parentElement.appendChild(B);var A=new Element("div");A.addClass("knob");if(Browser.Engine.trident){A.setStyle("top","0px");A.setStyle("background-color","black")}B.appendChild(A);var C=new Slider(B,A,{steps:36,range:[0,369],wheel:true});C.set(this.value);this.startValue=this.value;C.addEvent("change",function(D){this.value=D;this.get()}.bind(this));this.mainElement=B;if(!this.enabled){C.detach()}this.parent()},get:function(){return this.parent(this.value)},cancel:function(){this.value=this.startValue;this.get()}});qwebirc.config.CheckInput=new Class({Extends:qwebirc.config.Input,render:function(){var A=this.createInput("checkbox");this.mainElement=A;A.checked=this.value;A.disabled=!this.enabled;this.parent()},get:function(){return this.parent(this.mainElement.checked)}});qwebirc.config.RadioInput=new Class({Extends:qwebirc.config.Input,render:function(){var B=this.option.options;this.elements=[];for(var A=0;A<B.length;A++){var D=this.FE("div",this.parentObject);var C=this.createInput("radio",D,"options_radio"+this.position,A==this.option.position);this.elements.push(C);C.disabled=!this.enabled;if(A==0){this.mainElement=C}D.appendChild(document.createTextNode(B[A][0]))}this.parent()},get:function(){for(var B=0;B<this.elements.length;B++){var A=this.elements[B];if(A.checked){this.option.position=B;return this.parent(this.option.options[B][1])}}}});qwebirc.config.Option=new Class({initialize:function(F,E,B,D,C){this.prefix=E;this.label=B;this.default_=D;this.optionId=F;this.extras=C;if($defined(C)&&$defined(C.enabled)){var A=C.enabled();this.enabled=A[0];if(!A[0]&&A.length>1){this.default_=A[1]}}else{this.enabled=true}},setSavedValue:function(A){if(this.enabled){this.value=A}}});qwebirc.config.RadioOption=new Class({Extends:qwebirc.config.Option,Element:qwebirc.config.RadioInput,initialize:function(F,E,B,D,C,A){this.options=A.map(function(G){if(typeof (G)=="string"){return[G,G]}return G});this.defaultposition=D;this.parent(F,E,B,this.options[D][1],C)},setSavedValue:function(A){for(var B=0;B<this.options.length;B++){var C=this.options[B][1];if(A==C){this.position=B;this.value=A;return }}this.position=this.defaultposition;this.value=this.default_}});qwebirc.config.TextOption=new Class({Extends:qwebirc.config.Option,Element:qwebirc.config.TextInput});qwebirc.config.CheckOption=new Class({Extends:qwebirc.config.Option,Element:qwebirc.config.CheckInput});qwebirc.config.HueOption=new Class({Extends:qwebirc.config.Option,Element:qwebirc.config.HueInput});qwebirc.ui.Options=new Class({initialize:function(A){if(!$defined(qwebirc.config.DefaultOptions)){this.__configureDefaults()}this.optionList=qwebirc.config.DefaultOptions.slice();this.optionHash={};this.ui=A;this._setup();this.optionList.forEach(function(B){B.setSavedValue(this._get(B));this.optionHash[B.prefix]=B;this[B.prefix]=B.value}.bind(this))},__configureDefaults:function(){qwebirc.config.DefaultOptions=qwebirc.config.DEFAULT_OPTIONS.map(function(I){var C=I[0];var E=I[1];var H=I[2];var A=I[3];var D=I[4];var B=I[5];var G=typeof (A);if(G=="number"){return new qwebirc.config.RadioOption(C,E,H,A,D,extra)}else{var F;if(G=="boolean"){F=qwebirc.config.CheckOption}else{if(G=="function"){var J=A();F=J.class_;A=J.default_}else{F=qwebirc.config.TextOption}}return new F(C,E,H,A,D)}})},setValue:function(A,B){this.optionHash[A.prefix].value=B;this[A.prefix]=B},getOptionList:function(){return this.optionList},_get:function(A){return A.default_},_setup:function(){},flush:function(){}});qwebirc.ui.OptionsPane=new Class({Implements:[Events],initialize:function(B,A){this.parentElement=B;this.optionObject=A;this.createElements()},createElements:function(){var F=function(M,N){var O=new Element(M);N.appendChild(O);return O};var K=F("table",this.parentElement);var B=F("tbody",K);this.boxList=[];var D=this.optionObject.getOptionList();for(var C=0;C<D.length;C++){var I=D[C];var L=F("tr",B);var H=F("td",L);H.set("text",I.label+":");var G=F("td",L);this.boxList.push([I,new I.Element(G,I,C,this)])}var A=F("tr",B);var H=F("td",A);var G=F("td",A);var E=qwebirc.util.createInput("submit",G);E.value="Save";E.addEvent("click",function(){this.save();this.fireEvent("close")}.bind(this));var J=qwebirc.util.createInput("submit",G);J.value="Cancel";J.addEvent("click",function(){this.cancel();this.fireEvent("close")}.bind(this))},save:function(){this.boxList.forEach(function(A){var B=A[0];var C=A[1];this.optionObject.setValue(B,C.get())}.bind(this));this.optionObject.flush()},cancel:function(){this.boxList.forEach(function(A){A[1].cancel()}.bind(this))}});qwebirc.ui.CookieOptions=new Class({Extends:qwebirc.ui.Options,_setup:function(){this.__cookie=new Hash.Cookie("opt1",{duration:3650,autoSave:false})},_get:function(A){var B=this.__cookie.get(A.optionId);if(!$defined(B)){return A.default_}return B},flush:function(){this.__cookie.erase();this._setup();this.getOptionList().forEach(function(A){this.__cookie.set(A.optionId,A.value)}.bind(this));this.__cookie.save()}});qwebirc.ui.DefaultOptionsClass=new Class({Extends:qwebirc.ui.CookieOptions});qwebirc.ui.AboutPane=new Class({Implements:[Events],initialize:function(B){var D=function(){B.set("html",'<div class="loading">Loading. . .</div>')};var A=D.delay(500);var C=new Request.HTML({url:"panes/about.html",update:B,onSuccess:function(){$clear(A);B.getElement("input[class=close]").addEvent("click",function(){this.fireEvent("close")}.bind(this));B.getElement("div[class=version]").set("text","v"+qwebirc.VERSION)}.bind(this)});C.get()}});qwebirc.ui.PrivacyPolicyPane=new Class({Implements:[Events],initialize:function(B){var D=function(){B.set("html",'<div class="loading">Loading. . .</div>')};var A=D.delay(500);var C=new Request.HTML({url:"panes/privacypolicy.html",update:B,onSuccess:function(){$clear(A);B.getElement("input[class=close]").addEvent("click",function(){this.fireEvent("close")}.bind(this))}.bind(this)});C.get()}});qwebirc.ui.FeedbackPane=new Class({Implements:[Events],initialize:function(B){this.textboxVisible=false;var D=function(){B.set("html",'<div class="loading">Loading. . .</div>')};var A=D.delay(500);this.addEvent("select",this.onSelect);var C=new Request.HTML({url:"panes/feedback.html",update:B,onSuccess:function(){$clear(A);B.getElement("input[class=close]").addEvent("click",function(){this.fireEvent("close")}.bind(this));B.getElement("input[class=close2]").addEvent("click",function(){this.fireEvent("close")}.bind(this));var E=B.getElement("textarea");this.textbox=E;B.getElement("input[class=submitfeedback]").addEvent("click",function(){this.sendFeedback(B,E,E.value)}.bind(this));this.textboxVisible=true;this.onSelect()}.bind(this)});C.get()},onSelect:function(){if(this.textboxVisible){this.textbox.focus()}},sendFeedback:function(J,I,L){L=L.replace(/^\s*/,"").replace(/\s*$/,"");var K=J.getElement("p[class=maintext]");if(L.length<25){K.set("text","I don't suppose you could enter a little bit more? Thanks!");I.focus();return }this.textboxVisible=false;var F=J.getElement("div[class=enterarea]");F.setStyle("display","none");var C=J.getElement("div[class=messagearea]");var H=J.getElement("p[class=messagetext]");var B=J.getElement("input[class=close2]");H.set("text","Submitting. . .");C.setStyle("display","");var G=0;var E=encodeURIComponent(L);for(var D=0;D<L.length;D++){G=((G+1)%256)^(L.charCodeAt(D)%256)}var A=new Request({url:"/feedback",onSuccess:function(){H.set("text","Submitted successfully, thanks for the feedback!");B.setStyle("display","")},onFailure:function(){this.textboxVisible=true;C.setStyle("display","none");F.setStyle("display","");K.set("text","Looks like something went wrong submitting :(")}.bind(this)}).send("feedback="+L+"&c="+G)}});qwebirc.ui.FAQPane=new Class({Implements:[Events],initialize:function(B){var D=function(){B.set("html",'<div class="loading">Loading. . .</div>')};var A=D.delay(500);var C=new Request.HTML({url:"panes/faq.html",update:B,onSuccess:function(){$clear(A);B.getElement("input[class=close]").addEvent("click",function(){this.fireEvent("close")}.bind(this))}.bind(this)});C.get()}});function qwebirc_ui_onbeforeunload(B){var A="This action will close all active IRC connections.";var B=B||window.event;if(B){B.returnValue=A}return A}qwebirc.ui.Interface=new Class({Implements:[Options],options:{initialNickname:"qwebirc"+Math.ceil(Math.random()*100000),initialChannels:"",networkName:"ExampleNetwork",networkServices:[],loginRegex:null,appTitle:"ExampleNetwork Web IRC",searchURL:true,theme:undefined,baseURL:null,hue:null},initialize:function(B,C,A){this.setOptions(A);window.addEvent("domready",function(){var S=function(V){var U=new qwebirc.irc.IRCClient(V,P);U.connect();window.onbeforeunload=qwebirc_ui_onbeforeunload;window.addEvent("unload",function(){U.quit("Page closed")})};var T=null;var J=this.options.initialChannels;var L=false;if(this.options.searchURL){var N=qwebirc.util.parseURI(String(document.location));this.options.hue=this.getHueArg(N);var G=N.url;var F,E=N.nick;if($defined(G)){J=this.parseIRCURL(G);if($defined(F)&&F!=""){M=true}}else{F=N.channels;var M=false;if(F){var R=F.split(" ");F=R[0].split(",");var Q=[];for(var K=0;K<F.length;K++){Q[K]=F[K];if(F[K].charAt(0)!="#"){Q[K]="#"+Q[K]}}R[0]=Q.join(",");J=R.join(" ");M=true}}if($defined(E)){T=this.randSub(E)}if(N.randomnick&&N.randomnick==1){T=this.options.initialNickname}if(M&&(!$defined(T)||($defined(T)&&(T!="")))){var I=N.prompt;var O=false;if(!$defined(I)||I==""){O=true;I=false}else{if(I=="0"){I=false}else{I=true}}if($defined(T)&&!I){L=true}else{if(!O&&!I){L=true}}}}var P=new C($(B),new qwebirc.ui.Theme(this.options.theme),this.options);var H=!$defined(E);if(H&&L){T=this.options.initialNickname}var D=P.loginBox(S,T,J,L,H)}.bind(this))},getHueArg:function(B){var A=B.hue;if(!$defined(A)){return null}A=parseInt(A);if(A>360||A<0){return null}return A},randSub:function(A){var B=function(){return Math.floor(Math.random()*10)};return A.split("").map(function(C){if(C=="."){return B()}else{return C}}).join("")},parseIRCURL:function(A){if(A.indexOf(":")==0){return }var D=A.splitMax(":",2);if(D[0].toLowerCase()!="irc"&&D[0].toLowerCase()!="ircs"){alert("Bad IRC URL scheme.");return }if(A.indexOf("/")==0){return }var I=A.splitMax("/",4);if(I.length<4||I[3]==""){return }var H,B;if(I[3].indexOf("?")>-1){B=qwebirc.util.parseURI(I[3]);H=I[3].splitMax("?",2)[0]}else{H=I[3]}var C=H.split(",");var G=C[0];if(G.charAt(0)!="#"){G="#"+G}var J=[],F=false,M;for(var E=1;E<C.length;E++){var L=C[E];if(L=="needkey"){F=true}else{J.push(L)}}if($defined(B)){for(var K in B){var L=B[K];if(K=="key"){M=L;F=true}else{J.push(K)}}}if(F){if(!$defined(M)){M=prompt("Please enter the password for channel "+G+":")}if($defined(M)){G=G+" "+M}}if(J.length>0){alert("The following IRC URL components were not accepted: "+J.join(", ")+".")}return G}});qwebirc.auth.loggedin=function(){var A=Cookie.read("user");return A};qwebirc.auth.enabled=function(){return false};qwebirc.auth.quakeNetAuth=function(){return false};qwebirc.auth.passAuth=function(){return true};qwebirc.auth.bouncerAuth=function(){return false};qwebirc.sound.domReady=false;window.addEvent("domready",function(){qwebirc.sound.domReady=true});qwebirc.sound.SoundPlayer=new Class({Implements:[Events],initialize:function(){this.loadingSWF=false;this.loadedSWF=false},go:function(){if(qwebirc.sound.domReady){this.loadSoundManager()}else{window.addEvent("domready",function(){this.loadSoundManager()}.bind(this))}},loadSoundManager:function(){if(this.loadingSWF){return }this.loadingSWF=true;if(eval("typeof soundManager")!="undefined"){this.loadedSWF=true;this.fireEvent("ready");return }var debugMode=false;qwebirc.util.importJS("/js/"+(debugMode?"soundmanager2":"soundmanager2-nodebug-jsmin")+".js","soundManager",function(){soundManager.url="/sound/";soundManager.debugMode=debugMode;soundManager.useConsole=debugMode;soundManager.onload=function(){this.loadedSWF=true;this.fireEvent("ready")}.bind(this);soundManager.beginDelayedInit()}.bind(this))},createSound:function(A,B){soundManager.createSound(A,B)},playSound:function(A){soundManager.play(A)},beep:function(){if(!this.beepLoaded){this.createSound("beep","/sound/beep3.mp3");this.beepLoaded=true}this.playSound("beep")}});qwebirc.ui.QUI=new Class({Extends:qwebirc.ui.RootUI,initialize:function(A,C,B){this.parent(A,qwebirc.ui.QUI.Window,"qui",B);this.theme=C;this.parentElement=A;this.setModifiableStylesheet("qui")},postInitialize:function(){this.qjsui=new qwebirc.ui.QUI.JSUI("qwebirc-qui",this.parentElement);this.qjsui.addEvent("reflow",function(){var A=this.getActiveWindow();if($defined(A)){A.onResize()}}.bind(this));this.qjsui.top.addClass("outertabbar");this.qjsui.bottom.addClass("input");this.qjsui.right.addClass("nicklist");this.qjsui.topic.addClass("topic");this.qjsui.middle.addClass("lines");this.outerTabs=this.qjsui.top;this.tabs=new Element("div");this.tabs.addClass("tabbar");this.__createDropdownMenu();this.outerTabs.appendChild(this.tabs);this.origtopic=this.topic=this.qjsui.topic;this.origlines=this.lines=this.qjsui.middle;this.orignicklist=this.nicklist=this.qjsui.right;this.input=this.qjsui.bottom;this.reflow=this.qjsui.reflow.bind(this.qjsui);this.tabs.addEvent("mousewheel",function(A){var B=new Event(A);if(B.wheel>0){this.nextWindow()}else{if(B.wheel<0){this.prevWindow()}}B.stop()}.bind(this));this.createInput();this.reflow();this.reflow.delay(100);this.__createDropdownHint.delay(100,this)},__createDropdownMenu:function(){var A=new Element("span");A.addClass("dropdownmenu");A.hide=function(){A.setStyle("display","none");A.visible=false;document.removeEvent("mousedown",B)}.bind(this);var B=function(){A.hide()};A.hide();this.parentElement.appendChild(A);this.UICommands.forEach(function(E){var H=E[0];var F=this[E[1]+"Window"].bind(this);var G=new Element("a");G.addEvent("mousedown",function(I){new Event(I).stop()});G.addEvent("click",function(){A.hide();F()});G.set("text",H);A.appendChild(G)}.bind(this));var D=new Element("div");D.addClass("dropdown-tab");D.appendChild(new Element("img",{src:"images/icon.png",title:"menu",alt:"menu"}));D.setStyle("opacity",1);var C=new Fx.Tween(D,{duration:"long",property:"opacity",link:"chain"});C.start(0.25);C.start(1);C.start(0.33);C.start(1);this.outerTabs.appendChild(D);A.show=function(E){new Event(E).stop();this.hideHint();if(A.visible){A.hide();return }var F=this.outerTabs.getSize().y;A.setStyle("left",0);A.setStyle("top",F-1);A.setStyle("display","inline-block");A.visible=true;document.addEvent("mousedown",B)}.bind(this);D.addEvent("mousedown",function(E){new Event(E).stop()});D.addEvent("click",A.show)},__createDropdownHint:function(){var B=new Element("div");B.addClass("dropdownhint");B.set("text","Click the icon for the main menu.");B.setStyle("top",this.outerTabs.getSize().y+5);this.parentElement.appendChild(B);new Fx.Morph(B,{duration:"normal",transition:Fx.Transitions.Sine.easeOut}).start({left:[900,5]});var C=function(){new Fx.Morph(B,{duration:"long"}).start({left:[5,-900]})}.delay(4000,this);var A=function(){if(B.hidden){return }this.parentElement.removeChild(B);B.hidden=1}.bind(this);A.delay(4000);this.hideHint=A;document.addEvent("mousedown",A);document.addEvent("keypress",A)},createInput:function(){var D=new Element("form");this.input.appendChild(D);D.addClass("input");var B=new Element("input");D.appendChild(B);this.inputbox=B;this.inputbox.maxLength=512;var C=function(){if(B.value==""){return }this.resetTabComplete();this.getActiveWindow().historyExec(B.value);B.value=""}.bind(this);if(!qwebirc.util.deviceHasKeyboard()){B.addClass("mobile-input");var E=new Element("input",{type:"button"});E.addClass("mobile-button");E.addEvent("click",function(){C();B.focus()});E.value=">";this.input.appendChild(E);var A=function(){var H=this.input.getSize();var F=E.getSize();var G=H.x-F.x-5;E.setStyle("left",G);B.setStyle("width",G-5);E.setStyle("height",H.y)}.bind(this);this.qjsui.addEvent("reflow",A)}else{B.addClass("keyboard-input")}D.addEvent("submit",function(F){new Event(F).stop();C()});B.addEvent("focus",this.resetTabComplete.bind(this));B.addEvent("mousedown",this.resetTabComplete.bind(this));B.addEvent("keydown",function(H){var G;var I=B.value;if(H.key=="up"){G=this.commandhistory.upLine}else{if(H.key=="down"){G=this.commandhistory.downLine}else{if(H.key=="tab"){new Event(H).stop();this.tabComplete(B);return }else{this.resetTabComplete();return }}}this.resetTabComplete();if((I!="")&&(this.lastcvalue!=I)){this.commandhistory.addLine(I,true)}var F=G.bind(this.commandhistory)();new Event(H).stop();if(!F){F=""}this.lastcvalue=F;B.value=F;qwebirc.util.setAtEnd(B)}.bind(this))},setLines:function(A){this.lines.parentNode.replaceChild(A,this.lines);this.qjsui.middle=this.lines=A},setChannelItems:function(B,A){if(!$defined(B)){B=this.orignicklist;A=this.origtopic}this.nicklist.parentNode.replaceChild(B,this.nicklist);this.qjsui.right=this.nicklist=B;this.topic.parentNode.replaceChild(A,this.topic);this.qjsui.topic=this.topic=A}});qwebirc.ui.QUI.JSUI=new Class({Implements:[Events],initialize:function(A,B,C){this.parent=B;this.sizer=$defined(C)?C:B;this.class_=A;this.create();this.reflowevent=null;window.addEvent("resize",function(){this.reflow(100)}.bind(this))},applyClasses:function(B,A){A.addClass("dynamicpanel");A.addClass(this.class_);if(B=="middle"){A.addClass("leftboundpanel")}else{if(B=="top"){A.addClass("topboundpanel");A.addClass("widepanel")}else{if(B=="topic"){A.addClass("widepanel")}else{if(B=="right"){A.addClass("rightboundpanel")}else{if(B=="bottom"){A.addClass("bottomboundpanel");A.addClass("widepanel")}}}}}},create:function(){var A=function(C){var B=new Element("div");this.applyClasses(C,B);this.parent.appendChild(B);return B}.bind(this);this.top=A("top");this.topic=A("topic");this.middle=A("middle");this.right=A("right");this.bottom=A("bottom")},reflow:function(A){if(!A){A=1}if(this.reflowevent){$clear(this.reflowevent)}this.__reflow();this.reflowevent=this.__reflow.delay(A,this)},__reflow:function(){var C=this.bottom;var L=this.middle;var K=this.right;var F=this.topic;var J=this.top;var I=F.getSize();var E=J.getSize();var D=K.getSize();var B=C.getSize();var H=this.sizer.getSize();var A=(H.y-E.y-B.y-I.y);var G=(H.x-D.x);F.setStyle("top",E.y);L.setStyle("top",(E.y+I.y));if(A>0){L.setStyle("height",A);K.setStyle("height",A)}if(G>0){L.setStyle("width",G)}K.setStyle("top",(E.y+I.y));K.setStyle("left",G);C.setStyle("top",(H.y-B.y));this.fireEvent("reflow")},showChannel:function(A){var B="none";if(A){B="block"}this.right.setStyle("display",B);this.topic.setStyle("display",B)},showInput:function(A){this.bottom.isVisible=A;this.bottom.setStyle("display",A?"block":"none")}});qwebirc.ui.QUI.Window=new Class({Extends:qwebirc.ui.Window,initialize:function(F,B,E,D,C){this.parent(F,B,E,D,C);this.tab=new Element("a",{href:"#"});this.tab.addClass("tab");this.tab.addEvent("focus",function(){this.blur()}.bind(this.tab));F.tabs.appendChild(this.tab);this.tab.appendText(D);this.tab.addEvent("click",function(H){new Event(H).stop();if(this.closed){return }F.selectWindow(this)}.bind(this));if(E!=qwebirc.ui.WINDOW_STATUS&&E!=qwebirc.ui.WINDOW_CONNECT){var A=new Element("span");A.set("text","X");A.addClass("tabclose");var G=function(H){new Event(H).stop();if(this.closed){return }if(E==qwebirc.ui.WINDOW_CHANNEL){this.client.exec("/PART "+D)}this.close()}.bind(this);A.addEvent("click",G);this.tab.addEvent("mouseup",function(I){var H=1;if(Browser.Engine.trident){H=4}if(I.event.button==H){G(I)}}.bind(this));this.tab.appendChild(A)}this.lines=new Element("div");this.parentObject.qjsui.applyClasses("middle",this.lines);this.lines.addClass("lines");if(E!=qwebirc.ui.WINDOW_CUSTOM&&E!=qwebirc.ui.WINDOW_CONNECT){this.lines.addClass("ircwindow")}this.lines.addEvent("scroll",function(){this.scrolleddown=this.scrolledDown();this.scrollpos=this.getScrollParent().getScroll()}.bind(this));if(E==qwebirc.ui.WINDOW_CHANNEL){this.topic=new Element("div");this.topic.addClass("topic");this.topic.addClass("tab-invisible");this.topic.set("html","&nbsp;");this.topic.addEvent("dblclick",this.editTopic.bind(this));this.parentObject.qjsui.applyClasses("topic",this.topic);this.prevNick=null;this.nicklist=new Element("div");this.nicklist.addClass("nicklist");this.nicklist.addClass("tab-invisible");this.nicklist.addEvent("click",this.removePrevMenu.bind(this));this.parentObject.qjsui.applyClasses("nicklist",this.nicklist)}if(E==qwebirc.ui.WINDOW_CHANNEL){this.updateTopic("")}else{this.reflow()}this.nicksColoured=this.parentObject.uiOptions.NICK_COLOURS},editTopic:function(){if(!this.client.nickOnChanHasPrefix(this.client.nickname,this.name,"@")){alert("Sorry, you need to be a channel operator to change the topic!");return }var A=prompt("Change topic of "+this.name+" to:",this.topic.topicText);if(A===null){return }this.client.exec("/TOPIC "+A)},reflow:function(){this.parentObject.reflow()},onResize:function(){if(this.scrolleddown){if(Browser.Engine.trident){this.scrollToBottom.delay(5,this)}else{this.scrollToBottom()}}else{if($defined(this.scrollpos)){if(Browser.Engine.trident){this.getScrollParent().scrollTo(this.scrollpos.x,this.scrollpos.y)}else{this.getScrollParent().scrollTo.delay(5,this,[this.scrollpos.x,this.scrollpos.y])}}}},createMenu:function(B,C){var D=new Element("div");C.appendChild(D);D.addClass("menu");var A=[B];qwebirc.ui.MENU_ITEMS.forEach(function(E){if(!E.predicate||E.predicate!==true&&!E.predicate.apply(this,A)){return }var F=new Element("a");D.appendChild(F);F.href="#";F.set("text","- "+E.text);F.addEvent("focus",function(){this.blur()}.bind(F));F.addEvent("click",function(G){new Event(G.stop());this.menuClick(E.fn)}.bind(this))}.bind(this));return D},menuClick:function(A){A.bind(this)(this.prevNick.realNick);this.removePrevMenu()},moveMenuClass:function(){if(!this.prevNick){return }if(this.nicklist.firstChild==this.prevNick){this.prevNick.removeClass("selected-middle")}else{this.prevNick.addClass("selected-middle")}},removePrevMenu:function(){if(!this.prevNick){return }this.prevNick.removeClass("selected");this.prevNick.removeClass("selected-middle");if(this.prevNick.menu){this.prevNick.removeChild(this.prevNick.menu)}this.prevNick=null},nickListAdd:function(C,B){var A=this.client.stripPrefix(C);var F=new Element("a");qwebirc.ui.insertAt(B,this.nicklist,F);F.href="#";var D=new Element("span");if(this.parentObject.uiOptions.NICK_COLOURS){var E=A.toHSBColour(this.client);if($defined(E)){D.setStyle("color",E.rgbToHex())}}D.set("text",C);F.appendChild(D);F.realNick=A;F.addEvent("click",function(G){if(this.prevNick==F){this.removePrevMenu();return }this.removePrevMenu();this.prevNick=F;F.addClass("selected");this.moveMenuClass();F.menu=this.createMenu(F.realNick,F);new Event(G).stop()}.bind(this));F.addEvent("focus",function(){this.blur()}.bind(F));this.moveMenuClass();return F},nickListRemove:function(A,B){this.nicklist.removeChild(B);this.moveMenuClass()},updateTopic:function(A){var B=this.topic;while(B.firstChild){B.removeChild(B.firstChild)}if(A){B.topicText=A;this.parent(A,B)}else{B.topicText=A;var C=new Element("div");C.set("text","(no topic set)");C.addClass("emptytopic");B.appendChild(C)}this.reflow()},select:function(){var B=this.type!=qwebirc.ui.WINDOW_CONNECT&&this.type!=qwebirc.ui.WINDOW_CUSTOM;this.tab.removeClass("tab-unselected");this.tab.addClass("tab-selected");this.parentObject.setLines(this.lines);this.parentObject.setChannelItems(this.nicklist,this.topic);this.parentObject.qjsui.showInput(B);this.parentObject.qjsui.showChannel($defined(this.nicklist));this.reflow();this.parent();if(B){this.parentObject.inputbox.focus()}if(this.type==qwebirc.ui.WINDOW_CHANNEL&&this.nicksColoured!=this.parentObject.uiOptions.NICK_COLOURS){this.nicksColoured=this.parentObject.uiOptions.NICK_COLOURS;var A=this.nicklist.childNodes;if(this.parentObject.uiOptions.NICK_COLOURS){for(var C=0;C<A.length;C++){var F=A[C],D=F.firstChild;var E=F.realNick.toHSBColour(this.client);if($defined(E)){D.setStyle("color",E.rgbToHex())}}}else{for(var C=0;C<A.length;C++){var D=A[C].firstChild;D.setStyle("color",null)}}}},deselect:function(){this.parent();this.tab.removeClass("tab-selected");this.tab.addClass("tab-unselected")},close:function(){this.parent();this.parentObject.tabs.removeChild(this.tab)},addLine:function(B,A,D){var C=new Element("div");if(D){C.addClass(D)}else{if(this.lastcolour){C.addClass("linestyle1")}else{C.addClass("linestyle2")}}this.lastcolour=!this.lastcolour;this.parent(B,A,D,C)},setHilighted:function(A){var B=this.hilighted;this.parent(A);if(A==B){return }this.tab.removeClass("tab-hilight-activity");this.tab.removeClass("tab-hilight-us");this.tab.removeClass("tab-hilight-speech");switch(this.hilighted){case qwebirc.ui.HILIGHT_US:this.tab.addClass("tab-hilight-us");break;case qwebirc.ui.HILIGHT_SPEECH:this.tab.addClass("tab-hilight-speech");break;case qwebirc.ui.HILIGHT_ACTIVITY:this.tab.addClass("tab-hilight-activity");break}}});
