Sunday, 6 July 2014

RECAPTCHA TOOL USE IN WEBSTIES

RECAPTCHA TOOL USE IN WEBSTIES



-------------------------------------------------------------------------------------------------------
CODE SHOWS LOOK LIKE THIS
http://www.wpfreeware.com/tutorial/15-free-wordpress-rating-plugins/
--------------------------------------------------------------------------------------------------------


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>freenode Web IRC (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <link rel="shortcut icon" type="image/png" href="http://webchat.freenode.net/static/beta/images/favicon.png"/>
 <link rel="stylesheet" href="http://webchat.freenode.net/static/beta/css/qui-126d38cdd8d6.css" type="text/css"/>
<script type="text/javascript" src="http://webchat.freenode.net/static/beta/js/qui-126d38cdd8d6.js"></script>
 <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
 var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.QUI, {"appTitle":"freenode Web IRC","dynamicBaseURL":"/dynamic/beta/","recaptchaKey":"6LcpLbwSAAAAAL4SR3Dv91NjyoztaK1WqKE2Lp9Z","baseURL":"http://webchat.freenode.net","validateNickname":false,"networkServices":["Q!TheQBot@CServe.quakenet.org"],"staticBaseURL":"/static/beta/","loginRegex":"^You are now logged in as [^ ]+\\.$","networkName":"freenode"});
 </script>
</head>
<body>
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>
  </div>
</body>
</html>

-----------------------------------------------------------------------------------------------------------
CSS FILE CODE
 <link rel="stylesheet" href="http://webchat.freenode.net/static/beta/css/qui-126d38cdd8d6.css" type="text/css"/>
-----------------------------------------------------------------------------------------------------------

/* qwebirc -- Copyright (C) 2008-2011 Chris Porter and the qwebirc project --- All rights reserved. */

.qwebirc .colourline .Xc0{color:white;}.qwebirc .colourline .Xc1{color:black;}.qwebirc .colourline .Xc2{color:darkBlue;}.qwebirc .colourline .Xc3{color:darkGreen;}.qwebirc .colourline .Xc4{color:red;}.qwebirc .colourline .Xc5{color:darkRed;}.qwebirc .colourline .Xc6{color:purple;}.qwebirc .colourline .Xc7{color:orange;}.qwebirc .colourline .Xc8{color:yellow;}.qwebirc .colourline .Xc9{color:green;}.qwebirc .colourline .Xc10{color:teal;}.qwebirc .colourline .Xc11{color:cyan;}.qwebirc .colourline .Xc12{color:blue;}.qwebirc .colourline .Xc13{color:fuchsia;}.qwebirc .colourline .Xc14{color:darkGray;}.qwebirc .colourline .Xc15{color:gray;}.qwebirc .colourline .Xbc0{background-color:white;}.qwebirc .colourline .Xbc1{background-color:black;}.qwebirc .colourline .Xbc2{background-color:darkBlue;}.qwebirc .colourline .Xbc3{background-color:darkGreen;}.qwebirc .colourline .Xbc4{background-color:red;}.qwebirc .colourline .Xbc5{background-color:darkRed;}.qwebirc .colourline .Xbc6{background-color:purple;}.qwebirc .colourline .Xbc7{background-color:orange;}.qwebirc .colourline .Xbc8{background-color:yellow;}.qwebirc .colourline .Xbc9{background-color:green;}.qwebirc .colourline .Xbc10{background-color:teal;}.qwebirc .colourline .Xbc11{background-color:cyan;}.qwebirc .colourline .Xbc12{background-color:blue;}.qwebirc .colourline .Xbc13{background-color:fuchsia;}.qwebirc .colourline .Xbc14{background-color:darkGray;}.qwebirc .colourline .Xbc15{background-color:gray;}.qwebirc .colourline .Xb{font-weight:bold;}.qwebirc .colourline .Xu{text-decoration:underline;}.qwebirc .warncolour{background-color:#ff9090;}.qwebirc .infocolour{background-color:#9090ff;}.qwebirc-centrebox{height:100%;width:100%;}.qwebirc-centrebox table{width:100%;}.qwebirc-centrebox table table{width:auto;}.qwebirc-loginbox .tr1 td{width:100%;text-align:center;}.qwebirc-loginbox .tr2 td{vertical-align:top;}.qwebirc-loginbox .tr2 table{margin-left:auto;margin-right:auto;text-align:left;}.qwebirc-confirmbox{width:auto!important;margin:auto;vertical-align:middle;}.qwebirc-confirmbox .tr1 td{width:100%;vertical-align:bottom;text-align:center;}.qwebirc-confirmbox .tr2 td{vertical-align:top;text-align:left;}.qwebirc-confirmbox .tr2 table{margin-left:auto;margin-right:auto;}.qwebirc-aboutpane{font-size:1em!important;}.qwebirc-aboutpane .mainbody{font-size:.8em;text-align:center;padding:5px;}.qwebirc-aboutpane table{display:inline-block;}.qwebirc-aboutpane div.header{padding-top:5px;}.qwebirc-aboutpane .header{background:white;text-align:center;border-bottom:1px solid gray;padding-bottom:5px;}.qwebirc-aboutpane .header .title{font-size:3em;}.qwebirc-aboutpane .header .subtitle{text-align:center;margin-top:10px;}.qwebirc-aboutpane .skipmargin{margin-top:0;}div.qwebirc-embeddedwizard{padding-left:5px;padding-top:2px;}.qwebirc-embeddedwizard input.text{width:300px;}.qwebirc-embeddedwizard input.iframetext{width:95%;}.qwebirc-embeddedwizard .wizardcontrols input{width:70px;}.qwebirc-privacypolicypane{font-size:1em!important;}.qwebirc-privacypolicypane .mainbody{font-size:.8em;text-align:center;padding:5px;}.qwebirc-privacypolicypane table{display:inline-block;}.qwebirc-privacypolicypane div.header{padding-top:5px;}.qwebirc-privacypolicypane .header{background:white;text-align:center;border-bottom:1px solid gray;padding-bottom:5px;}.qwebirc-privacypolicypane .header .title{font-size:3em;}.qwebirc-privacypolicypane .header .subtitle{text-align:center;margin-top:10px;}.qwebirc-privacypolicypane .monospace{font-family:Consolas,"Lucida Console",monospace;}.qwebirc-feedbackpane{font-size:1em!important;}.qwebirc-feedbackpane .mainbody{font-size:.8em;text-align:center;padding:5px;}.qwebirc-feedbackpane table{display:inline-block;}.qwebirc-feedbackpane div.header{padding-top:5px;}.qwebirc-feedbackpane .header{background:white;text-align:center;border-bottom:1px solid gray;padding-bottom:5px;}.qwebirc-feedbackpane .header .title{font-size:3em;}.qwebirc-feedbackpane .header .subtitle{text-align:center;margin-top:10px;}.qwebirc-feedbackpane .monospace{font-family:Consolas,"Lucida Console",monospace;}.qwebirc-faqpane{font-size:1em!important;}.qwebirc-faqpane .mainbody{font-size:.8em;text-align:center;padding:5px;margin-left:20px;margin-right:20px;}.qwebirc-faqpane table{display:inline-block;}.qwebirc-faqpane div.header{padding-top:5px;}.qwebirc-faqpane .header{background:white;text-align:center;border-bottom:1px solid gray;padding-bottom:5px;}.qwebirc-faqpane .header .title{font-size:3em;}.qwebirc-faqpane .header .subtitle{text-align:center;margin-top:10px;}.qwebirc-faqpane .monospace{font-family:Consolas,"Lucida Console",monospace;}.qwebirc .loading{padding-left:4px;padding-top:3px;font-size:.8em;}.qwebirc-optionspane div.hue-slider{border:0 solid black;width:360px;height:8px;background-image:url(../images/hue.png);}.qwebirc-optionspane div.hue-slider .knob{width:8px;height:16px;top:-5px;opacity:.75;background:grey;border:1px solid black;}#recaptcha_image{border:1px solid #c8d2dc;}.qwebirc-recaptcha-incorrect{color:red;}

-----------------------------------------------------------------------------------------------------------
JAVA FILE CODE:

 <link rel="stylesheet" href="http://webchat.freenode.net/static/beta/css/qui-126d38cdd8d6.css" type="text/css"/>
-----------------------------------------------------------------------------------------------------------



/* qwebirc -- Copyright (C) 2008-2011 Chris Porter and the qwebirc project --- All rights reserved. */

QWEBIRC_BUILD="126d38cdd8d6";
var MooTools={version:"1.2.5",build:"008d8f0f2fcc2044e54fdd3635341aaab274e757"};var Native=function(m){m=m||{};var x=m.name;var o=m.legacy;var v=m.protect;var u=m.implement;var p=m.generics;var r=m.initialize;var q=m.afterImplement||function(){};var t=r||o;p=p!==false;t.constructor=Native;t.$family={name:"native"};if(o&&r){t.prototype=o.prototype}t.prototype.constructor=t;if(x){var s=x.toLowerCase();t.prototype.$family={name:s};Native.typize(t,s)}var n=function(c,a,b,d){if(!v||d||!c.prototype[a]){c.prototype[a]=b}if(p){Native.genericize(c,a,v)}q.call(c,a,b);return c};t.alias=function(d,a,b){if(typeof d=="string"){var c=this.prototype[d];if((d=c)){return n(this,a,d,b)}}for(var f in d){this.alias(f,d[f],a)}return this};t.implement=function(d,a,b){if(typeof d=="string"){return n(this,d,a,b)}for(var c in d){n(this,c,d[c],a)}return this};if(u){t.implement(u)}return t};Native.genericize=function(d,g,f){if((!f||!d[g])&&typeof d.prototype[g]=="function"){d[g]=function(){var a=Array.prototype.slice.call(arguments);return d.prototype[g].apply(a.shift(),a)}}};Native.implement=function(h,i){for(var f=0,g=h.length;f<g;f++){h[f].implement(i)}};Native.typize=function(d,c){if(!d.type){d.type=function(a){return($type(a)===c)}}};(function(){var i={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var k in i){new Native({name:k,initialize:i[k],protect:true})}var n={"boolean":Boolean,"native":Native,object:Object};for(var o in n){Native.typize(n[o],o)}var l={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 m in l){for(var g=l[m].length;g--;){Native.genericize(i[m],l[m][g],true)}}})();var Hash=new Native({name:"Hash",initialize:function(d){if($type(d)=="hash"){d=$unlink(d.getClean())}for(var c in d){this[c]=d[c]}return this}});Hash.implement({forEach:function(d,g){for(var f in this){if(this.hasOwnProperty(f)){d.call(g,this[f],f,this)}}},getClean:function(){var c={};for(var d in this){if(this.hasOwnProperty(d)){c[d]=this[d]}}return c},getLength:function(){var c=0;for(var d in this){if(this.hasOwnProperty(d)){c++}}return c}});Hash.alias("forEach","each");Array.implement({forEach:function(i,h){for(var f=0,g=this.length;f<g;f++){i.call(h,this[f],f,this)}}});Array.alias("forEach","each");function $A(d){if(d.item){var f=d.length,g=new Array(f);while(f--){g[f]=d[f]}return g}return Array.prototype.slice.call(d)}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(i,f,h){var g=$type(i);((g=="arguments"||g=="collection"||g=="array")?Array:Hash).each(i,f,h)}function $empty(){}function $extend(g,f){for(var d in (f||{})){g[d]=f[d]}return g}function $H(b){return new Hash(b)}function $lambda(b){return($type(b)=="function")?b:function(){return b}}function $merge(){var b=Array.slice(arguments);b.unshift({});return $mixin.apply(null,b)}function $mixin(m){for(var n=1,j=arguments.length;n<j;n++){var i=arguments[n];if($type(i)!="object"){continue}for(var o in i){var k=i[o],l=m[o];m[o]=(l&&$type(k)=="object"&&$type(l)=="object")?$mixin(l,k):$unlink(k)}}return m}function $pick(){for(var c=0,d=arguments.length;c<d;c++){if(arguments[c]!=undefined){return arguments[c]}}return null}function $random(c,d){return Math.floor(Math.random()*(d-c+1)+c)}function $splat(c){var d=$type(c);return(d)?((d!="array"&&d!="arguments")?[c]:c):[]}var $time=Date.now||function(){return +new Date};function $try(){for(var d=0,f=arguments.length;d<f;d++){try{return arguments[d]()}catch(g){}}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(k){var g;switch($type(k)){case"object":g={};for(var i in k){g[i]=$unlink(k[i])}break;case"hash":g=new Hash(k);break;case"array":g=[];for(var j=0,h=k.length;j<h;j++){g[j]=$unlink(k[j])}break;default:return k}return g}Array.implement({every:function(i,h){for(var f=0,g=this.length;f<g;f++){if(!i.call(h,this[f],f,this)){return false}}return true},filter:function(j,i){var k=[];for(var g=0,h=this.length;g<h;g++){if(j.call(i,this[g],g,this)){k.push(this[g])}}return k},clean:function(){return this.filter($defined)},indexOf:function(i,h){var g=this.length;for(var f=(h<0)?Math.max(0,g+h):h||0;f<g;f++){if(this[f]===i){return f}}return -1},map:function(j,i){var k=[];for(var g=0,h=this.length;g<h;g++){k[g]=j.call(i,this[g],g,this)}return k},some:function(i,h){for(var f=0,g=this.length;f<g;f++){if(i.call(h,this[f],f,this)){return true}}return false},associate:function(i){var h={},f=Math.min(this.length,i.length);for(var g=0;g<f;g++){h[i[g]]=this[g]}return h},link:function(k){var h={};for(var i=0,g=this.length;i<g;i++){for(var j in k){if(k[j](this[i])){h[j]=this[i];delete k[j];break}}}return h},contains:function(d,c){return this.indexOf(d,c)!=-1},extend:function(g){for(var d=0,f=g.length;d<f;d++){this.push(g[d])}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(g){for(var d=0,f=g.length;d<f;d++){this.include(g[d])}return this},erase:function(c){for(var d=this.length;d--;d){if(this[d]===c){this.splice(d,1)}}return this},empty:function(){this.length=0;return this},flatten:function(){var h=[];for(var f=0,g=this.length;f<g;f++){var i=$type(this[f]);if(!i){continue}h=h.concat((i=="array"||i=="collection"||i=="arguments")?Array.flatten(this[f]):this[f])}return h},hexToRgb:function(c){if(this.length!=3){return null}var d=this.map(function(a){if(a.length==1){a+=a}return a.toInt(16)});return(c)?d:"rgb("+d+")"},rgbToHex:function(h){if(this.length<3){return null}if(this.length==4&&this[3]==0&&!h){return"transparent"}var f=[];for(var g=0;g<3;g++){var i=(this[g]-0).toString(16);f.push((i.length==1)?"0"+i:i)}return(h)?f:"#"+f.join("")}});String.implement({test:function(d,c){return((typeof d=="string")?new RegExp(d,c):d).test(this)},contains:function(d,c){return(c)?(c+this+c).indexOf(c+d+c)>-1:this.indexOf(d)>-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(c){var d=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(d)?d.slice(1).hexToRgb(c):null},rgbToHex:function(c){var d=this.match(/\d{1,3}/g);return(d)?d.rgbToHex(c):null},stripScripts:function(d){var f="";var g=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){f+=arguments[1]+"\n";return""});if(d===true){$exec(f)}else{if($type(d)=="function"){d(f,g)}}return g},substitute:function(d,c){return this.replace(c||(/\\?\{([^{}]+)\}/g),function(a,b){if(a.charAt(0)=="\\"){return a.slice(1)}return(d[b]!=undefined)?d[b]:""})}});try{delete Function.prototype.bind}catch(e){}Function.implement({extend:function(d){for(var c in d){this[c]=d[c]}return this},create:function(c){var d=this;c=c||{};return function(b){var g=c.arguments;g=(g!=undefined)?$splat(g):Array.slice(arguments,(c.event)?1:0);if(c.event){g=[b||window.event].extend(g)}var a=function(){return d.apply(c.bind||null,g)};if(c.delay){return setTimeout(a,c.delay)}if(c.periodical){return setInterval(a,c.periodical)}if(c.attempt){return $try(a)}return a()}},run:function(d,c){return this.apply(c,$splat(d))},pass:function(d,c){return this.create({bind:c,arguments:d})},bind:function(c,d){return this.create({bind:c,arguments:d})},bindWithEvent:function(c,d){return this.create({bind:c,arguments:d,event:true})},attempt:function(d,c){return this.create({bind:c,arguments:d,attempt:true})()},delay:function(d,g,f){return this.create({bind:g,arguments:f,delay:d})()},periodical:function(g,d,f){return this.create({bind:d,arguments:f,periodical:g})()}});Number.implement({limit:function(c,d){return Math.min(d,Math.max(c,this))},round:function(b){b=Math.pow(10,b||0);return Math.round(this*b)/b},times:function(d,g){for(var f=0;f<this;f++){d.call(g,f,this)}},toFloat:function(){return parseFloat(this)},toInt:function(b){return parseInt(this,b||10)}});Number.alias("times","each");(function(c){var d={};c.each(function(a){if(!Number[a]){d[a]=function(){return Math[a].apply(null,[this].concat($A(arguments)))}}});Number.implement(d)})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(c){for(var d in this){if(this.hasOwnProperty(d)&&this[d]===c){return d}}return null},hasValue:function(b){return(Hash.keyOf(this,b)!==null)},extend:function(b){Hash.each(b||{},function(d,a){Hash.set(this,a,d)},this);return this},combine:function(b){Hash.each(b||{},function(d,a){Hash.include(this,a,d)},this);return this},erase:function(b){if(this.hasOwnProperty(b)){delete this[b]}return this},get:function(b){return(this.hasOwnProperty(b))?this[b]:null},set:function(d,c){if(!this[d]||this.hasOwnProperty(d)){this[d]=c}return this},empty:function(){Hash.each(this,function(c,d){delete this[d]},this);return this},include:function(d,c){if(this[d]==undefined){this[d]=c}return this},map:function(d,g){var f=new Hash;Hash.each(this,function(a,b){f.set(b,d.call(g,a,b,this))},this);return f},filter:function(d,g){var f=new Hash;Hash.each(this,function(a,b){if(d.call(g,a,b,this)){f.set(b,a)}},this);return f},every:function(d,g){for(var f in this){if(this.hasOwnProperty(f)&&!d.call(g,this[f],f)){return false}}return true},some:function(d,g){for(var f in this){if(this.hasOwnProperty(f)&&d.call(g,this[f],f)){return true}}return false},getKeys:function(){var b=[];Hash.each(this,function(d,a){b.push(a)});return b},getValues:function(){var b=[];Hash.each(this,function(a){b.push(a)});return b},toQueryString:function(d){var c=[];Hash.each(this,function(a,b){if(d){b=d+"["+b+"]"}var h;switch($type(a)){case"object":h=Hash.toQueryString(a,b);break;case"array":var i={};a.each(function(f,g){i[g]=f});h=Hash.toQueryString(i,b);break;default:h=b+"="+encodeURIComponent(a)}if(a!=undefined){c.push(h)}});return c.join("&")}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});function Class(c){if(c instanceof Function){c={initialize:c}}var d=function(){Object.reset(this);if(d._prototyping){return this}this._current=$empty;var a=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return a}.extend(this);d.implement(c);d.constructor=Class;d.prototype.constructor=d;return d}Function.prototype.protect=function(){this._protected=true;return this};Object.reset=function(h,k){if(k==null){for(var i in h){Object.reset(h,i)}return h}delete h[k];switch($type(h[k])){case"object":var j=function(){};j.prototype=h[k];var g=new j;h[k]=Object.reset(g);break;case"array":h[k]=$unlink(h[k]);break}return h};new Native({name:"Class",initialize:Class}).extend({instantiate:function(c){c._prototyping=true;var d=new c;delete c._prototyping;return d},wrap:function(f,d,g){if(g._origin){g=g._origin}return function(){if(g._protected&&this._current==null){throw new Error('The method "'+d+'" cannot be called.')}var b=this.caller,a=this._current;this.caller=a;this._current=arguments.callee;var c=g.apply(this,arguments);this._current=a;this.caller=b;return c}.extend({_owner:f,_origin:g,_name:d})}});Class.implement({implement:function(i,l){if($type(i)=="object"){for(var k in i){this.implement(k,i[k])}return this}var j=Class.Mutators[i];if(j){l=j.call(this,l);if(l==null){return this}}var m=this.prototype;switch($type(l)){case"function":if(l._hidden){return this}m[i]=Class.wrap(this,i,l);break;case"object":var h=m[i];if($type(h)=="object"){$mixin(h,l)}else{m[i]=$unlink(l)}break;case"array":m[i]=$unlink(l);break;default:m[i]=l}return this}});Class.Mutators={Extends:function(b){this.parent=b;this.prototype=Class.instantiate(b);this.implement("parent",function(){var a=this.caller._name,d=this.caller._owner.parent.prototype[a];if(!d){throw new Error('The method "'+a+'" has no parent.')}return d.apply(this,arguments)}.protect())},Implements:function(b){$splat(b).each(function(a){if(a instanceof Function){a=Class.instantiate(a)}this.implement(a)},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(g,d,f){g=Events.removeOn(g);if(d!=$empty){this.$events[g]=this.$events[g]||[];this.$events[g].include(d);if(f){d.internal=true}}return this},addEvents:function(d){for(var c in d){this.addEvent(c,d[c])}return this},fireEvent:function(g,d,f){g=Events.removeOn(g);if(!this.$events||!this.$events[g]){return this}this.$events[g].each(function(a){a.create({bind:this,delay:f,"arguments":d})()},this);return this},removeEvent:function(c,d){c=Events.removeOn(c);if(!this.$events[c]){return this}if(!d.internal){this.$events[c].erase(d)}return this},removeEvents:function(i){var h;if($type(i)=="object"){for(h in i){this.removeEvent(h,i[h])}return this}if(i){i=Events.removeOn(i)}for(h in this.$events){if(i&&i!=h){continue}var f=this.$events[h];for(var g=f.length;g--;g){this.removeEvent(h,f[g])}}return this}});Events.removeOn=function(b){return b.replace(/^on([A-Z])/,function(a,d){return d.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 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)?((document.querySelectorAll)?6:5):4)},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419)},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18)}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var c in this.Engines){var d=this.Engines[c]();if(d){this.Engine={name:c,version:d};this.Engine[c]=this.Engine[c+d]=true;break}}return{name:c,version:d}};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("MSXML2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.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],10)||0,build:parseInt(b[2],10)||0}})();function $exec(c){if(!c){return c}if(window.execScript){window.execScript(c)}else{var d=document.createElement("script");d.setAttribute("type","text/javascript");d[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=c;document.head.appendChild(d);document.head.removeChild(d)}return c}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(c,d){window[c]=Window.Prototype[c]=d}});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(c,d){document[c]=Document.Prototype[c]=d}});Document.Prototype={$family:{name:"document"}};new Document(document);var Element=new Native({name:"Element",legacy:window.Element,initialize:function(f,d){var g=Element.Constructors.get(f);if(g){return g(d)}if(typeof f=="string"){return document.newElement(f,d)}return document.id(f).set(d)},afterImplement:function(d,c){Element.Prototype[d]=c;if(Array[d]){return}Elements.implement(d,function(){var k=[],a=true;for(var i=0,j=this.length;i<j;i++){var b=this[i][d].apply(this[i],arguments);k.push(b);if(a){a=($type(b)=="element")}}return(a)?new Elements(k):k})}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var j=Array.link(arguments,{properties:Object.type,iframe:$defined});var l=j.properties||{};var m=document.id(j.iframe);var k=l.onload||$empty;delete l.onload;l.id=l.name=$pick(l.id,l.name,m?(m.id||m.name):"IFrame_"+$time());m=new Element(m||"iframe",l);var h=function(){var b=$try(function(){return m.contentWindow.location.host});if(!b||b==window.location.host){var a=new Window(m.contentWindow);new Document(m.contentWindow.document);$extend(a.Element.prototype,Element.Prototype)}k.call(m.contentWindow,m.contentWindow.document)};var i=$try(function(){return m.contentWindow});((i&&i.document.body)||window.frames[l.id])?h():m.addListener("load",h);return m}});var Elements=new Native({initialize:function(l,i){i=$extend({ddup:true,cash:true},i);l=l||[];if(i.ddup||i.cash){var k={},m=[];for(var o=0,j=l.length;o<j;o++){var n=document.id(l[o],!i.cash);if(i.ddup){if(k[n.uid]){continue}k[n.uid]=true}if(n){m.push(n)}}l=m}return(i.cash)?$extend(l,this):l}});Elements.implement({filter:function(d,c){if(!d){return this}return new Elements(Array.filter(this,(typeof d=="string")?function(a){return a.match(d)}:d,c))}});(function(){var h;try{var g=document.createElement("<input name=x>");h=(g.name=="x")}catch(f){}var i=function(a){return(""+a).replace(/&/g,"&amp;").replace(/"/g,"&quot;")};Document.implement({newElement:function(b,a){if(a&&a.checked!=null){a.defaultChecked=a.checked}if(h&&a){b="<"+b;if(a.name){b+=' name="'+i(a.name)+'"'}if(a.type){b+=' type="'+i(a.type)+'"'}b+=">";delete a.name;delete a.type}return this.id(this.createElement(b)).set(a)},newTextNode:function(a){return this.createTextNode(a)},getDocument:function(){return this},getWindow:function(){return this.window},id:(function(){var a={string:function(b,c,d){b=d.getElementById(b);return(b)?a.element(b,c):null},element:function(k,b){$uid(k);if(!b&&!k.$family&&!(/^object|embed$/i).test(k.tagName)){var d=Element.Prototype;for(var c in d){k[c]=d[c]}}return k},object:function(c,b,d){if(c.toElement){return a.element(c.toElement(d),b)}return null}};a.textnode=a.whitespace=a.window=a.document=$arguments(0);return function(d,b,c){if(d&&d.$family&&d.uid){return d}var k=$type(d);return(a[k])?a[k](d,b,c||document):null}})()})})();if(window.$==null){Window.implement({$:function(d,c){return document.id(d,c,this.document)}})}Window.implement({$$:function(i){if(arguments.length==1&&typeof i=="string"){return this.document.getElements(i)}var j=[];var m=Array.flatten(arguments);for(var l=0,h=m.length;l<h;l++){var k=m[l];switch($type(k)){case"element":j.push(k);break;case"string":j.extend(this.document.getElements(k,true))}}return new Elements(j)},getDocument:function(){return this.document},getWindow:function(){return this}});Native.implement([Element,Document],{getElement:function(d,c){return document.id(this.getElements(d,true)[0]||null,c)},getElements:function(g,h){g=g.split(",");var i=[];var f=(g.length>1);g.each(function(b){var a=this.getElementsByTagName(b.trim());(f)?i.extend(a):i=a},this);return new Elements(i,{ddup:f,cash:!h})}});(function(){var p={},r={};var o={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};var u=function(a){return(r[a]||(r[a]={}))};var q=function(d,a){if(!d){return}var f=d.uid;if(a!==true){a=false}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(!f){return}p[f]=r[f]=null};var t=function(){Hash.each(p,q);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(q)}if(window.CollectGarbage){CollectGarbage()}p=r=null};var n=function(h,a,b,i,f,c){var g=h[b||a];var d=[];while(g){if(g.nodeType==1&&(!i||Element.match(g,i))){if(!f){return document.id(g,c)}d.push(g)}g=g[a]}return(f)?new Elements(d,{ddup:false,cash:!c}):null};var s={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"};var v=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var m=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];v=v.associate(v);Hash.extend(s,v);Hash.extend(s,m.associate(m.map(String.toLowerCase)));var x={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)}};x.inside=x.bottom;Hash.each(x,function(a,b){b=b.capitalize();Element.implement("inject"+b,function(c){a(this,document.id(c,true));return this});Element.implement("grab"+b,function(c){a(document.id(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=s[c];if(b==undefined){return this.removeProperty(c)}if(a&&v[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=s[c];var b=(a)?this[a]:this.getAttribute(c,2);return(v[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=s[b];(a)?this[a]=(a&&v[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=document.id(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){x[a||"bottom"](document.id(b,true),this);return this},inject:function(b,a){x[a||"bottom"](this,document.id(b,true));return this},replaces:function(a){a=document.id(a,true);a.parentNode.replaceChild(this,a);return this},wraps:function(b,a){b=document.id(b,true);return this.replaces(b).grab(b,a)},getPrevious:function(a,b){return n(this,"previousSibling",null,a,false,b)},getAllPrevious:function(a,b){return n(this,"previousSibling",null,a,true,b)},getNext:function(a,b){return n(this,"nextSibling",null,a,false,b)},getAllNext:function(a,b){return n(this,"nextSibling",null,a,true,b)},getFirst:function(a,b){return n(this,"nextSibling","firstChild",a,false,b)},getLast:function(a,b){return n(this,"previousSibling","lastChild",a,false,b)},getParent:function(a,b){return n(this,"parentNode",null,a,false,b)},getParents:function(a,b){return n(this,"parentNode",null,a,true,b)},getSiblings:function(a,b){return this.getParent().getChildren(a,b).erase(this)},getChildren:function(a,b){return n(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 document.id(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||c.type=="submit"||c.type=="reset"||c.type=="file"){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(f,a){f=f!==false;var b=this.cloneNode(f);var g=function(j,k){if(!a){j.removeAttribute("id")}if(Browser.Engine.trident){j.clearAttributes();j.mergeAttributes(k);j.removeAttribute("uid");if(j.options){var i=j.options,z=k.options;for(var l=i.length;l--;){i[l].selected=z[l].selected}}}var A=o[k.tagName.toLowerCase()];if(A&&k[A]){j[A]=k[A]}};if(f){var d=b.getElementsByTagName("*"),c=this.getElementsByTagName("*");for(var h=d.length;h--;){g(d[h],c[h])}}g(b,this);return document.id(b)},destroy:function(){Element.empty(this);Element.dispose(this);q(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=document.id(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{p[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=u(this.uid),c=b[d];if(a!=undefined&&c==undefined){c=b[d]=a}return $pick(c)},store:function(c,a){var b=u(this.uid);b[c]=a;return this},eliminate:function(a){var b=u(this.uid);delete b[a];return this}});window.addListener("unload",t)})();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 g=document.createElement("div");var f={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};f.thead=f.tfoot=f.tbody;var d={set:function(){var c=Array.flatten(arguments).join("");var b=Browser.Engine.trident&&f[this.get("tag")];if(b){var a=g;a.innerHTML=b[1]+c+b[2];for(var i=b[0];i--;){a=a.firstChild}this.empty().adopt(a.childNodes)}else{this.innerHTML=c}}};d.erase=d.set;return d})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText}var d=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var c=d.innerText;d.destroy();return c}}}(function(){Element.implement({scrollTo:function(b,a){if(i(this)){this.getWindow().scrollTo(b,a)}else{this.scrollLeft=b;this.scrollTop=a}return this},getSize:function(){if(i(this)){return this.getWindow().getSize()}return{x:this.offsetWidth,y:this.offsetHeight}},getScrollSize:function(){if(i(this)){return this.getWindow().getScrollSize()}return{x:this.scrollWidth,y:this.scrollHeight}},getScroll:function(){if(i(this)){return this.getWindow().getScroll()}return{x:this.scrollLeft,y:this.scrollTop}},getScrolls:function(){var a=this,b={x:0,y:0};while(a&&!i(a)){b.x+=a.scrollLeft;b.y+=a.scrollTop;a=a.parentNode}return b},getOffsetParent:function(){var a=this;if(i(a)){return null}if(!Browser.Engine.trident){return a.offsetParent}while((a=a.parentNode)&&!i(a)){if(n(a,"position")!="static"){return a}}return null},getOffsets:function(){if(this.getBoundingClientRect){var h=this.getBoundingClientRect(),d=document.id(this.getDocument().documentElement),a=d.getScroll(),g=this.getScrolls(),r=this.getScroll(),s=(n(this,"position")=="fixed");return{x:h.left.toInt()+g.x-r.x+((s)?0:a.x)-d.clientLeft,y:h.top.toInt()+g.y-r.y+((s)?0:a.y)-d.clientTop}}var f=this,c={x:0,y:0};if(i(this)){return c}while(f&&!i(f)){c.x+=f.offsetLeft;c.y+=f.offsetTop;if(Browser.Engine.gecko){if(!l(f)){c.x+=o(f);c.y+=k(f)}var b=f.parentNode;if(b&&n(b,"overflow")!="visible"){c.x+=o(b);c.y+=k(b)}}else{if(f!=this&&Browser.Engine.webkit){c.x+=o(f);c.y+=k(f)}}f=f.offsetParent}if(Browser.Engine.gecko&&!l(this)){c.x-=o(this);c.y-=k(this)}return c},getPosition:function(b){if(i(this)){return{x:0,y:0}}var a=this.getOffsets(),d=this.getScrolls();var f={x:a.x-d.x,y:a.y-d.y};var c=(b&&(b=document.id(b)))?b.getPosition():{x:0,y:0};return{x:f.x-c.x,y:f.y-c.y}},getCoordinates:function(b){if(i(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-m(this,"margin-left"),top:a.y-m(this,"margin-top")}},setPosition:function(a){return this.setStyles(this.computePosition(a))}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var a=this.getWindow();return{x:a.innerWidth,y:a.innerHeight}}var b=j(this);return{x:b.clientWidth,y:b.clientHeight}},getScroll:function(){var a=this.getWindow(),b=j(this);return{x:a.pageXOffset||b.scrollLeft,y:a.pageYOffset||b.scrollTop}},getScrollSize:function(){var a=j(this),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 n=Element.getComputedStyle;function m(b,a){return n(b,a).toInt()||0}function l(a){return n(a,"-moz-box-sizing")=="border-box"}function k(a){return m(a,"border-top-width")}function o(a){return m(a,"border-left-width")}function i(a){return(/^(?:body|html)$/i).test(a.tagName)}function j(b){var a=b.getDocument();return(!a.compatMode||a.compatMode=="CSS1Compat")?a.html:a.body}})();Element.alias("setPosition","position");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}});var Event=new Native({name:"Event",initialize:function(B,v){v=v||window;var q=v.document;B=B||v.event;if(B.$extended){return B}this.$extended=true;var r=B.type;var u=B.target||B.srcElement;while(u&&u.nodeType==3){u=u.parentNode}if(r.test(/key/)){var A=B.which||B.keyCode;var o=Event.Keys.keyOf(A);if(r=="keydown"){var y=A-111;if(y>0&&y<13){o="f"+y}}o=o||String.fromCharCode(A).toLowerCase()}else{if(r.match(/(click|mouse|menu)/i)){q=(!q.compatMode||q.compatMode=="CSS1Compat")?q.html:q.body;var s={x:B.pageX||B.clientX+q.scrollLeft,y:B.pageY||B.clientY+q.scrollTop};var z={x:(B.pageX)?B.pageX-v.pageXOffset:B.clientX,y:(B.pageY)?B.pageY-v.pageYOffset:B.clientY};if(r.match(/DOMMouseScroll|mousewheel/)){var t=(B.wheelDelta)?B.wheelDelta/120:-(B.detail||0)/3}var x=(B.which==3)||(B.button==2);var p=null;if(r.match(/over|out/)){switch(r){case"mouseover":p=B.relatedTarget||B.fromElement;break;case"mouseout":p=B.relatedTarget||B.toElement}if(!(function(){while(p&&p.nodeType==3){p=p.parentNode}return true}).create({attempt:Browser.Engine.gecko})()){p=false}}}}return $extend(this,{event:B,type:r,page:s,client:z,rightClick:x,wheel:t,relatedTarget:p,target:u,code:A,key:o,shift:B.shiftKey,control:B.ctrlKey,alt:B.altKey,meta:B.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}});Element.Properties.events={set:function(b){this.addEvents(b)}};Native.implement([Element,Window,Document],{addEvent:function(o,m){var l=this.retrieve("events",{});l[o]=l[o]||{keys:[],values:[]};if(l[o].keys.contains(m)){return this}l[o].keys.push(m);var n=o,s=Element.Events.get(o),q=m,k=this;if(s){if(s.onAdd){s.onAdd.call(this,m)}if(s.condition){q=function(a){if(s.condition.call(this,a)){return m.call(this,a)}return true}}n=s.base||n}var p=function(){return m.call(k)};var r=Element.NativeEvents[n];if(r){if(r==2){p=function(a){a=new Event(a,k.getWindow());if(q.call(k,a)===false){a.stop()}}}this.addListener(n,p)}l[o].values.push(p);return this},removeEvent:function(m,h){var i=this.retrieve("events");if(!i||!i[m]){return this}var j=i[m].keys.indexOf(h);if(j==-1){return this}i[m].keys.splice(j,1);var k=i[m].values.splice(j,1)[0];var l=Element.Events.get(m);if(l){if(l.onRemove){l.onRemove.call(this,h)}m=l.base||m}return(Element.NativeEvents[m])?this.removeListener(m,k):this},addEvents:function(d){for(var c in d){this.addEvent(c,d[c])}return this},removeEvents:function(f){var g;if($type(f)=="object"){for(g in f){this.removeEvent(g,f[g])}return this}var d=this.retrieve("events");if(!d){return this}if(!f){for(g in d){this.removeEvents(g)}this.eliminate("events")}else{if(d[f]){while(d[f].keys[0]){this.removeEvent(f,d[f].keys[0])}d[f]=null}}return this},fireEvent:function(h,f,g){var i=this.retrieve("events");if(!i||!i[h]){return this}i[h].keys.each(function(a){a.create({bind:this,delay:g,"arguments":f})()},this);return this},cloneEvents:function(h,g){h=document.id(h);var i=h.retrieve("events");if(!i){return this}if(!g){for(var f in i){this.cloneEvents(h,f)}}else{if(i[g]){i[g].keys.each(function(a){this.addEvent(g,a)},this)}}return this}});try{if(typeof HTMLElement!="undefined"){HTMLElement.prototype.fireEvent=Element.prototype.fireEvent}}catch(e){}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(a){var d=a.relatedTarget;if(d==undefined){return true}if(d===false){return false}return($type(this)!="document"&&d!=this&&d.prefix!="xul"&&!this.hasChild(d))};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(d,c){if(!c){if(d==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=(d==1)?"":"alpha(opacity="+d*100+")"}this.style.opacity=d;this.store("opacity",d)},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(d,f){switch(d){case"opacity":return this.set("opacity",parseFloat(f));case"float":d=(Browser.Engine.trident)?"styleFloat":"cssFloat"}d=d.camelCase();if($type(f)!="string"){var g=(Element.Styles.get(d)||"@").split(" ");f=$splat(f).map(function(a,b){if(!g[b]){return""}return($type(a)=="number")?g[b].replace("@",Math.round(a)):a}).join(" ")}else{if(f==String(Number(f))){f=Math.round(f)}}this.style[d]=f;return this},getStyle:function(k){switch(k){case"opacity":return this.get("opacity");case"float":k=(Browser.Engine.trident)?"styleFloat":"cssFloat"}k=k.camelCase();var j=this.style[k];if(!$chk(j)){j=[];for(var l in Element.ShortStyles){if(k!=l){continue}for(var m in Element.ShortStyles[l]){j.push(this.getStyle(m))}return j.join(" ")}j=this.getComputedStyle(k)}if(j){j=String(j);var o=j.match(/rgba?\([\d\s,]+\)/);if(o){j=j.replace(o[0],o[0].rgbToHex())}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(j,10)))){if(k.test(/^(height|width)$/)){var i=(k=="width")?["left","right"]:["top","bottom"],n=0;i.each(function(a){n+=this.getStyle("border-"+a+"-width").toInt()+this.getStyle("padding-"+a).toInt()},this);return this["offset"+k.capitalize()]-n+"px"}if((Browser.Engine.presto)&&String(j).test("px")){return j}if(k.test(/(border(.+)Width|margin|padding)/)){return"0px"}}return j},setStyles:function(c){for(var d in c){this.setStyle(d,c[d])}return this},getStyles:function(){var b={};Array.flatten(arguments).each(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(k){var l=Element.ShortStyles;var i=Element.Styles;["margin","padding"].each(function(b){var a=b+k;l[b][a]=i[a]="@px"});var m="border"+k;l.border[m]=i[m]="@px @ rgb(@, @, @)";var n=m+"Width",j=m+"Style",o=m+"Color";l[m]={};l.borderWidth[n]=l[m][n]=i[n]="@px";l.borderStyle[j]=l[m][j]=i[j]="@";l.borderColor[o]=l[m][o]=i[o]="rgb(@, @, @)"});var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(d){this.subject=this.subject||this;this.setOptions(d);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var c=this.options.wait;if(c===false){this.options.link="cancel"}},getTransition:function(){return function(b){return -(Math.cos(Math.PI*b)-1)/2}},step:function(){var d=$time();if(d<this.time+this.options.duration){var c=this.transition((d-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,c))}else{this.set(this.compute(this.from,this.to,1));this.complete()}},set:function(b){return b},compute:function(g,d,f){return Fx.compute(g,d,f)},check:function(){if(!this.timer){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false}return false},start:function(c,d){if(!this.check(c,d)){return this}this.from=c;this.to=d;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(g,d,f){return(d-g)*f+g};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(j,i,g){g=$splat(g);var k=g[1];if(!$chk(k)){g[1]=g[0];g[0]=j.getStyle(i)}var h=g.map(this.parse);return{from:h[0],to:h[1]}},parse:function(b){b=$lambda(b)();b=(typeof b=="string")?b.split(" "):$splat(b);return b.map(function(d){d=String(d);var a=false;Fx.CSS.Parsers.each(function(c,h){if(a){return}var i=c.parse(d);if($chk(i)){a={value:i,parser:c}}});a=a||{value:d,parser:Fx.CSS.Parsers.String};return a})},compute:function(h,i,f){var g=[];(Math.min(h.length,i.length)).times(function(a){g.push({value:h[a].parser.compute(h[a].value,i[a].value,f),parser:h[a].parser})});g.$family={name:"fx:css:value"};return g},serve:function(g,d){if($type(g)!="fx:css:value"){g=this.parse(g)}var f=[];g.each(function(a){f=f.concat(a.parser.serve(a.value,d))});return f},render:function(g,h,i,f){g.setStyle(h,this.serve(i,f))},search:function(d){if(Fx.CSS.Cache[d]){return Fx.CSS.Cache[d]}var c={};Array.each(document.styleSheets,function(b,h){var i=b.href;if(i&&i.contains("://")&&!i.contains(document.domain)){return}var a=b.rules||b.cssRules;Array.each(a,function(f,l){if(!f.style){return}var g=(f.selectorText)?f.selectorText.replace(/^\w+/,function(j){return j.toLowerCase()}):null;if(!g||!g.test("^"+d+"$")){return}Element.Styles.each(function(j,k){if(!f.style[k]||Element.ShortStyles[k]){return}j=String(f.style[k]);c[k]=(j.test(/^rgb/))?j.rgbToHex():j})})});return Fx.CSS.Cache[d]=c}});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(g,d,f){return g.map(function(a,b){return Math.round(Fx.compute(g[b],d[b],f))})},serve:function(b){return b.map(Number)}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(c,d){return(d)?c+d:c}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(c,d){this.element=this.subject=document.id(c);this.parent(d)},set:function(d){if(typeof d=="string"){d=this.search(d)}for(var c in d){this.render(this.element,c,d[c],this.options.unit)}return this},compute:function(i,j,k){var h={};for(var g in i){h[g]=this.parent(i[g],j[g],k)}return h},start:function(g){if(!this.check(g)){return this}if(typeof g=="string"){g=this.search(g)}var i={},j={};for(var k in g){var h=this.prepare(this.element,k,g[k]);i[k]=h.from;j[k]=h.to}return this.parent(i,j)}});Element.Properties.morph={set:function(d){var c=this.retrieve("morph");if(c){c.cancel()}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},d))},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 d=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof d=="string"){var c=d.split(":");d=Fx.Transitions;d=d[c[0]]||d[c[0].capitalize()];if(c[1]){d=d["ease"+c[1].capitalize()+(c[2]?c[2].capitalize():"")]}}return d}});Fx.Transition=function(c,d){d=$splat(d);return $extend(c,{easeIn:function(a){return c(a,d)},easeOut:function(a){return 1-c(1-a,d)},easeInOut:function(a){return(a<=0.5)?c(2*a,d)/2:(2-c(2*(1-a),d))/2}})};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(d){for(var c in d){Fx.Transitions[c]=new Fx.Transition(d[c])}};Fx.Transitions.extend({Pow:function(c,d){return Math.pow(c,d[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(c,d){d=d[0]||1.618;return Math.pow(c,2)*((d+1)*c-d)},Bounce:function(a){var b;for(var h=0,i=1;1;h+=i,i/=2){if(a>=(7-4*h)/11){b=i*i-Math.pow((11-6*h-11*a)/4,2);break}}return b},Elastic:function(c,d){return Math.pow(2,10*--c)*Math.cos(20*c*Math.PI*(d[0]||1)/3)}});["Quad","Cubic","Quart","Quint"].each(function(c,d){Fx.Transitions[c]=new Fx.Transition(function(a){return Math.pow(a,[d+2])})});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(c,d){this.element=this.subject=document.id(c);this.parent(d)},set:function(c,d){if(arguments.length==1){d=c;c=this.property||this.options.property}this.render(this.element,c,d,this.options.unit);return this},start:function(k,i,j){if(!this.check(k,i,j)){return this}var g=Array.flatten(arguments);this.property=this.options.property||g.shift();var h=this.prepare(this.element,this.property,g);return this.parent(h.from,h.to)}});Element.Properties.tween={set:function(d){var c=this.retrieve("tween");if(c){c.cancel()}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},d))},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(f,g,d){this.get("tween").start(arguments);return this},fade:function(k){var i=this.get("tween"),j="opacity",h;k=$pick(k,"toggle");switch(k){case"in":i.start(j,1);break;case"out":i.start(j,0);break;case"show":i.set(j,1);break;case"hide":i.set(j,0);break;case"toggle":var g=this.retrieve("fade:flag",this.get("opacity")==1);i.start(j,(g)?0:1);this.store("fade:flag",!g);h=true;break;default:i.start(j,arguments)}if(!h){this.eliminate("fade:flag")}return this},highlight:function(g,f){if(!f){f=this.retrieve("highlight:original",this.getStyle("background-color"));f=(f=="transparent")?"#fff":f}var d=this.get("tween");d.start("background-color",g||"#ffff88",f).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));d.callChain()}.bind(this));return this}});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,noCache: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));this.xhr.onreadystatechange=$empty;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()}},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(c,d){this.onSuccess(this.processScripts(c),d)},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(d,c){this.headers.set(d,c);return this},getHeader:function(b){return $try(function(){return this.xhr.getResponseHeader(b)}.bind(this))},check:function(){if(!this.running){return true}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false}return false},send:function(m){if(!this.check(m)){return this}this.running=true;var o=$type(m);if(o=="string"||o=="element"){m={data:m}}var t=this.options;m=$extend({data:t.data,url:t.url,method:t.method},m);var q=m.data,v=String(m.url),x=m.method.toLowerCase();switch($type(q)){case"element":q=document.id(q).toQueryString();break;case"object":case"hash":q=Hash.toQueryString(q)}if(this.options.format){var n="format="+this.options.format;q=(q)?n+"&"+q:n}if(this.options.emulation&&!["get","post"].contains(x)){var p="_method="+x;q=(q)?p+"&"+q:p;x="post"}if(this.options.urlEncoded&&x=="post"){var u=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers.set("Content-type","application/x-www-form-urlencoded"+u)}if(this.options.noCache){var r="noCache="+new Date().getTime();q=(q)?r+"&"+q:r}var s=v.lastIndexOf("/");if(s>-1&&(s=v.indexOf("#"))>-1){v=v.substr(0,s)}if(q&&x=="get"){v=v+(v.contains("?")?"&":"?")+q;q=null}this.xhr.open(x.toUpperCase(),v,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(c,a){try{this.xhr.setRequestHeader(a,c)}catch(b){this.fireEvent("exception",[a,c])}},this);this.fireEvent("request");this.xhr.send(q);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}))}});Request.implement(b)})();Element.Properties.send={set:function(d){var c=this.retrieve("send");if(c){c.cancel()}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},d))},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(d){var c=this.get("send");c.send({data:this,url:d||c.options.url});return this}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(g){var d=g.match(/<body[^>]*>([\s\S]*?)<\/body>/i);g=(d)?d[1]:g;var f=new Element("div");return $try(function(){var k="<root>"+g+"</root>",b;if(Browser.Engine.trident){b=new ActiveXObject("Microsoft.XMLDOM");b.async=false;b.loadXML(k)}else{b=new DOMParser().parseFromString(k,"text/xml")}k=b.getElementsByTagName("root")[0];if(!k){return null}for(var c=0,i=k.childNodes.length;c<i;c++){var a=Element.clone(k.childNodes[c],true,true);if(a){f.grab(a)}}return f})||f.set("html",g)},success:function(h){var i=this.options,f=this.response;f.html=h.stripScripts(function(a){f.javascript=a});var g=this.processHTML(f.html);f.tree=g.childNodes;f.elements=g.getElements("*");if(i.filter){f.tree=f.elements.filter(i.filter)}if(i.update){document.id(i.update).empty().set("html",f.html)}else{if(i.append){document.id(i.append).adopt(g.getChildren())}}if(i.evalScripts){$exec(f.javascript)}this.onSuccess(f.tree,f.elements,f.html,f.javascript)}});Element.Properties.load={set:function(d){var c=this.retrieve("load");if(c){c.cancel()}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},d))},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}});var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$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(c){switch($type(c)){case"string":return'"'+c.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(c.map(JSON.encode).clean())+"]";case"object":case"hash":var d=[];Hash.each(c,function(a,b){var g=JSON.encode(a);if(g){d.push(JSON.encode(b)+":"+g)}});return"{"+d+"}";case"number":case"boolean":return String(c);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+")")}});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)}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(c,d){this.key=c;this.setOptions(d)},write:function(c){c=encodeURIComponent(c);if(this.options.domain){c+="; domain="+this.options.domain}if(this.options.path){c+="; path="+this.options.path}if(this.options.duration){var d=new Date();d.setTime(d.getTime()+this.options.duration*24*60*60*1000);c+="; expires="+d.toGMTString()}if(this.options.secure){c+="; secure"}this.options.document.cookie=this.key+"="+c;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(d,g,f){return new Cookie(d,f).write(g)};Cookie.read=function(b){return new Cookie(b).read()};Cookie.dispose=function(c,d){return new Cookie(c,d).dispose()};Element.Events.domready={onAdd:function(b){if(Browser.loaded){b.call(this)}}};(function(){var c=function(){if(Browser.loaded){return}Browser.loaded=true;window.fireEvent("domready");document.fireEvent("domready")};window.addEvent("load",c);if(Browser.Engine.trident){var d=document.createElement("div");(function(){($try(function(){d.doScroll();return document.id(d).inject(document.body).set("html","temp").dispose()}))?c():arguments.callee.delay(50)})()}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?c():arguments.callee.delay(50)})()}else{document.addEvent("DOMContentLoaded",c)}}})();Native.implement([Document,Element],{getElements:function(l,m){l=l.split(",");var q,o={};for(var p=0,i=l.length;p<i;p++){var k=l[p],n=Selectors.Utils.search(this,k,o);if(p!=0&&n.item){n=$A(n)}q=(p==0)?n:(q.item)?$A(q).concat(n):q.concat(n)}return new Elements(q,{ddup:(l.length>1),cash:!m})}});Element.implement({match:function(g){if(!g||(g==this)){return true}var j=Selectors.Utils.parseTagAndID(g);var h=j[0],i=j[1];if(!Selectors.Filters.byID(this,i)||!Selectors.Filters.byTag(this,h)){return false}var k=Selectors.Utils.parseSelector(g);return(k)?Selectors.Utils.filter(this,k,{}):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(d,g){if(!g){return true}var f=$uid(d);if(!g[f]){return g[f]=true}return false},parseNthArgument:function(a){if(Selectors.Cache.nth[a]){return Selectors.Cache.nth[a]}var k=a.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!k){return false}var b=parseInt(k[1],10);var l=(b||b===0)?b:1;var j=k[2]||false;var m=parseInt(k[3],10)||0;if(l!=0){m--;while(m<1){m+=l}while(m>=l){m-=l}}else{l=m;j="index"}switch(j){case"n":k={a:l,b:m,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[a]=k},parseSelector:function(q){if(Selectors.Cache.parsed[q]){return Selectors.Cache.parsed[q]}var r,n={classes:[],pseudos:[],attributes:[]};while((r=Selectors.RegExps.combined.exec(q))){var m=r[1],o=r[2],p=r[3],t=r[5],s=r[6],l=r[7];if(m){n.classes.push(m)}else{if(s){var u=Selectors.Pseudo.get(s);if(u){n.pseudos.push({parser:u,argument:l})}else{n.attributes.push({name:s,operator:"=",value:l})}}else{if(o){n.attributes.push({name:o,operator:p,value:t})}}}}if(!n.classes.length){delete n.classes}if(!n.attributes.length){delete n.attributes}if(!n.pseudos.length){delete n.pseudos}if(!n.classes&&!n.attributes&&!n.pseudos){n=null}return Selectors.Cache.parsed[q]=n},parseTagAndID:function(d){var f=d.match(Selectors.RegExps.tag);var g=d.match(Selectors.RegExps.id);return[(f)?f[1]:"*",(g)?g[1]:false]},filter:function(l,o,m){var n;if(o.classes){for(n=o.classes.length;n--;n){var k=o.classes[n];if(!Selectors.Filters.byClass(l,k)){return false}}}if(o.attributes){for(n=o.attributes.length;n--;n){var i=o.attributes[n];if(!Selectors.Filters.byAttribute(l,i.name,i.operator,i.value)){return false}}}if(o.pseudos){for(n=o.pseudos.length;n--;n){var j=o.pseudos[n];if(!Selectors.Filters.byPseudo(l,j.parser,j.argument,m)){return false}}}return true},getByTagAndID:function(f,g,h){if(h){var i=(f.getElementById)?f.getElementById(h,true):Element.getElementById(f,h,true);return(i&&Selectors.Filters.byTag(i,g))?[i]:[]}else{return f.getElementsByTagName(g)}},search:function(J,L,n){var R=[];var Q=L.trim().replace(Selectors.RegExps.splitter,function(a,b,c){R.push(b);return":)"+c}).split(":)");var H,O,I;for(var K=0,l=Q.length;K<l;K++){var i=Q[K];if(K==0&&Selectors.RegExps.quick.test(i)){H=J.getElementsByTagName(i);continue}var S=R[K-1];var F=Selectors.Utils.parseTagAndID(i);var G=F[0],E=F[1];if(K==0){H=Selectors.Utils.getByTagAndID(J,G,E)}else{var P={},M=[];for(var j=0,k=H.length;j<k;j++){M=Selectors.Getters[S](M,H[j],G,E,P)}H=M}var N=Selectors.Utils.parseSelector(i);if(N){O=[];for(var m=0,D=H.length;m<D;m++){I=H[m];if(Selectors.Utils.filter(I,N,n)){O.push(I)}}H=O}}return H}};Selectors.Getters={" ":function(l,m,i,s,o){var p=Selectors.Utils.getByTagAndID(m,i,s);for(var q=0,r=p.length;q<r;q++){var n=p[q];if(Selectors.Utils.chk(n,o)){l.push(n)}}return l},">":function(l,m,i,s,n){var q=Selectors.Utils.getByTagAndID(m,i,s);for(var o=0,p=q.length;o<p;o++){var r=q[o];if(r.parentNode==m&&Selectors.Utils.chk(r,n)){l.push(r)}}return l},"+":function(k,g,h,i,j){while((g=g.nextSibling)){if(g.nodeType==1){if(Selectors.Utils.chk(g,j)&&Selectors.Filters.byTag(g,h)&&Selectors.Filters.byID(g,i)){k.push(g)}break}}return k},"~":function(k,g,h,i,j){while((g=g.nextSibling)){if(g.nodeType==1){if(!Selectors.Utils.chk(g,j)){break}if(Selectors.Filters.byTag(g,h)&&Selectors.Filters.byID(g,i)){k.push(g)}}}return k}};Selectors.Filters={byTag:function(c,d){return(d=="*"||(c.tagName&&c.tagName.toLowerCase()==d))},byID:function(d,c){return(!c||(d.id&&d.id==c))},byClass:function(c,d){return(c.className&&c.className.contains&&c.className.contains(d," "))},byPseudo:function(g,h,i,f){return h.call(g,i,f)},byAttribute:function(k,j,g,i){var h=Element.prototype.getProperty.call(k,j);if(!h){return(g=="!=")}if(!g||i==undefined){return true}switch(g){case"=":return(h==i);case"*=":return(h.contains(i));case"^=":return(h.substr(0,i.length)==i);case"$=":return(h.substr(h.length-i.length)==i);case"!=":return(h!=i);case"~=":return h.contains(i," ");case"|=":return h.contains(i,"-")}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 c=this;while((c=c.previousSibling)){if(c.nodeType==1){return false}}var d=this;while((d=d.nextSibling)){if(d.nodeType==1){return false}}return true},"nth-child":function(k,m){k=(k==undefined)?"n":k;var o=Selectors.Utils.parseNthArgument(k);if(o.special!="n"){return Selectors.Pseudo[o.special].call(this,o.a,m)}var l=0;m.positions=m.positions||{};var n=$uid(this);if(!m.positions[n]){var i=this;while((i=i.previousSibling)){if(i.nodeType!=1){continue}l++;var j=m.positions[$uid(i)];if(j!=undefined){l=j+l;break}}m.positions[n]=l}return(m.positions[n]%o.a==o.b)},index:function(f){var d=this,g=0;while((d=d.previousSibling)){if(d.nodeType==1&&++g>f){return false}}return(g==f)},even:function(c,d){return Selectors.Pseudo["nth-child"].call(this,"2n+1",d)},odd:function(c,d){return Selectors.Pseudo["nth-child"].call(this,"2n",d)},selected:function(){return this.selected},enabled:function(){return(this.disabled===false)}});var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:"high",allowScriptAccess:"always",wMode:"transparent",swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object},initialize:function(p,o){this.instance="Swiff_"+$time();this.setOptions(o);o=this.options;var A=this.id=o.id||this.instance;var B=document.id(o.container);Swiff.CallBacks[this.instance]={};var x=o.params,u=o.vars,v=o.callBacks;var t=$extend({height:o.height,width:o.width},o.properties);var q=this;for(var y in v){Swiff.CallBacks[this.instance][y]=(function(a){return function(){return a.apply(q.object,arguments)}})(v[y]);u[y]="Swiff.CallBacks."+this.instance+"."+y}x.flashVars=Hash.toQueryString(u);if(Browser.Engine.trident){t.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";x.movie=p}else{t.type="application/x-shockwave-flash";t.data=p}var r='<object id="'+A+'"';for(var s in t){r+=" "+s+'="'+t[s]+'"'}r+=">";for(var z in x){if(x[z]){r+='<param name="'+z+'" value="'+x[z]+'" />'}}r+="</object>";this.object=((B)?B.empty():new Element("div")).set("html",r).firstChild},replaces:function(b){b=document.id(b,true);b.parentNode.replaceChild(this.toElement(),b);return this},inject:function(b){document.id(b,true).appendChild(this.toElement());return this},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments))}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");return eval(rs)};MooTools.More={version:"1.2.5.1",build:"254884f2b83651bf95260eed5c6cceb838e22d8e"};Class.Mutators.Binds=function(b){return b};Class.Mutators.initialize=function(b){return function(){$splat(this.Binds).each(function(a){var d=this[a];if(d){this[a]=d.bind(this)}},this);return b.apply(this,arguments)}};Element.implement({measure:function(l){var j=function(a){return !!(!a||a.offsetHeight||a.offsetWidth)};if(j(this)){return l.apply(this)}var m=this.getParent(),k=[],h=[];while(!j(m)&&m!=document.body){h.push(m.expose());m=m.getParent()}var n=this.expose();var i=l.apply(this);n();h.each(function(a){a()});return i},expose:function(){if(this.getStyle("display")!="none"){return $empty}var b=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=b}.bind(this)},getDimensions:function(h){h=$merge({computeSize:false},h);var i={};var j=function(a,b){return(b.computeSize)?a.getComputedSize(b):a.getSize()};var g=this.getParent("body");if(g&&this.getStyle("display")=="none"){i=this.measure(function(){return j(this,h)})}else{if(g){try{i=j(this,h)}catch(k){}}else{i={x:0,y:0}}}return $chk(i.x)?$extend(i,{width:i.x,height:i.y}):$extend(i,{x:i.width,y:i.height})},getComputedSize:function(g){if(g&&g.plains){g.planes=g.plains}g=$merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},g);var j={width:0,height:0};switch(g.mode){case"vertical":delete j.width;delete g.planes.width;break;case"horizontal":delete j.height;delete g.planes.height;break}var f=[];$each(g.planes,function(b,a){b.each(function(c){g.styles.each(function(d){f.push((d=="border")?d+"-"+c+"-width":d+"-"+c)})})});var h={};f.each(function(a){h[a]=this.getComputedStyle(a)},this);var i=[];$each(g.planes,function(c,b){var a=b.capitalize();j["total"+a]=j["computed"+a]=0;c.each(function(d){j["computed"+d.capitalize()]=0;f.each(function(l,m){if(l.test(d)){h[l]=h[l].toInt()||0;j["total"+a]=j["total"+a]+h[l];j["computed"+d.capitalize()]=j["computed"+d.capitalize()]+h[l]}if(l.test(d)&&b!=l&&(l.test("border")||l.test("padding"))&&!i.contains(l)){i.push(l);j["computed"+a]=j["computed"+a]-h[l]}})})});["Width","Height"].each(function(a){var b=a.toLowerCase();if(!$chk(j[b])){return}j[b]=j[b]+this["offset"+a]+j["computed"+a];j["total"+a]=j[b]+j["total"+a];delete j["computed"+a]},this);return $extend(h,j)}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var c=Array.link(arguments,{options:Object.type,element:$defined});this.element=document.id(c.element);this.document=this.element.getDocument();this.setOptions(c.options||{});var d=$type(this.options.handle);this.handles=((d=="array"||d=="collection")?$$(this.options.handle):document.id(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(l){if(l.rightClick){return}if(this.options.preventDefault){l.preventDefault()}if(this.options.stopPropagation){l.stopPropagation()}this.mouse.start=l.page;this.fireEvent("beforeStart",this.element);var i=this.options.limit;this.limit={x:[],y:[]};var m=this.element.getStyles("left","right","top","bottom");this._invert={x:this.options.modifiers.x=="left"&&m.left=="auto"&&!isNaN(m.right.toInt())&&(this.options.modifiers.x="right"),y:this.options.modifiers.y=="top"&&m.top=="auto"&&!isNaN(m.bottom.toInt())&&(this.options.modifiers.y="bottom")};var j,k;for(j in this.options.modifiers){if(!this.options.modifiers[j]){continue}var n=this.element.getStyle(this.options.modifiers[j]);if(n&&!n.match(/px$/)){if(!k){k=this.element.getCoordinates(this.element.getOffsetParent())}n=k[this.options.modifiers[j]]}if(this.options.style){this.value.now[j]=(n||0).toInt()}else{this.value.now[j]=this.element[this.options.modifiers[j]]}if(this.options.invert){this.value.now[j]*=-1}if(this._invert[j]){this.value.now[j]*=-1}this.mouse.pos[j]=l.page[j]-this.value.now[j];if(i&&i[j]){for(var h=2;h--;h){if($chk(i[j][h])){this.limit[j][h]=$lambda(i[j][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(d){if(this.options.preventDefault){d.preventDefault()}var c=Math.round(Math.sqrt(Math.pow(d.page.x-this.mouse.start.x,2)+Math.pow(d.page.y-this.mouse.start.y,2)));if(c>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,d]).fireEvent("snap",this.element)}},drag:function(d){if(this.options.preventDefault){d.preventDefault()}this.mouse.now=d.page;for(var c in this.options.modifiers){if(!this.options.modifiers[c]){continue}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(this.options.invert){this.value.now[c]*=-1}if(this._invert[c]){this.value.now[c]*=-1}if(this.options.limit&&this.limit[c]){if($chk(this.limit[c][1])&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1]}else{if($chk(this.limit[c][0])&&(this.value.now[c]<this.limit[c][0])){this.value.now[c]=this.limit[c][0]}}}if(this.options.grid[c]){this.value.now[c]-=((this.value.now[c]-(this.limit[c][0]||0))%this.options.grid[c])}if(this.options.style){this.element.setStyle(this.options.modifiers[c],this.value.now[c]+this.options.unit)}else{this.element[this.options.modifiers[c]]=this.value.now[c]}}this.fireEvent("drag",[this.element,d])},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,b])}}});Element.implement({makeResizable:function(d){var c=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},d));this.store("resizer",c);return c.addEvent("drag",function(){this.fireEvent("resize",c)}.bind(this))}});var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(b){if(this.options.snap){b=this.toPosition(this.step)}this.knob.setStyle(this.property,b)},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(k,i,l){this.setOptions(l);this.element=document.id(k);this.knob=document.id(i);this.previousChange=this.previousEnd=this.step=-1;var j,h={},m={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";j="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";j="offsetWidth"}this.full=this.element.measure(function(){this.half=this.knob[j]/2;return this.element[j]-this.knob[j]+(this.options.offset*2)}.bind(this));this.setRange(this.options.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);m[this.axis]=this.property;h[this.axis]=[-this.options.offset,this.full-this.options.offset];var n={snap:0,limit:h,modifiers:m,onDrag:this.draggedKnob,onStart:this.draggedKnob,onBeforeStart:(function(){this.isDragging=true}).bind(this),onCancel:function(){this.isDragging=false}.bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end()}.bind(this)};if(this.options.snap){n.grid=Math.ceil(this.stepWidth);n.limit[this.axis][1]=this.full}this.drag=new Drag(this.knob,n);this.attach();if(this.options.initialStep!=null){this.set(this.options.initialStep)}},attach:function(){this.element.addEvent("mousedown",this.clickedElement);if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement)}this.drag.attach();return this},detach:function(){this.element.removeEvent("mousedown",this.clickedElement);this.element.removeEvent("mousewheel",this.scrolledElement);this.drag.detach();return this},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.fireEvent("tick",this.toPosition(this.step));this.end();return this},setRange:function(d,c){this.min=$pick(d[0],0);this.max=$pick(d[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.set($pick(c,this.step).floor(this.min).max(this.max));return this},clickedElement:function(g){if(this.isDragging||g.target==this.knob){return}var d=this.range<0?-1:1;var f=g.page[this.axis]-this.element.getPosition()[this.axis]-this.half;f=f.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+d*this.toStep(f));this.checkStep();this.fireEvent("tick",f);this.end()},scrolledElement:function(d){var c=(this.options.mode=="horizontal")?(d.wheel<0):(d.wheel>0);this.set(c?this.step-this.stepSize:this.step+this.stepSize);d.stop()},draggedKnob:function(){var c=this.range<0?-1:1;var d=this.drag.value.now[this.axis];d=d.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+c*this.toStep(d));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(d){var c=(d+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(c-=c%this.stepSize):c},toPosition:function(b){return(this.full*Math.abs(this.min-b))/(this.steps*this.stepSize)-this.options.offset}});var Color=new Native({initialize:function(d,g){if(arguments.length>=3){g="rgb";d=Array.slice(arguments,0,3)}else{if(typeof d=="string"){if(d.match(/rgb/)){d=d.rgbToHex().hexToRgb(true)}else{if(d.match(/hsb/)){d=d.hsbToRgb()}else{d=d.hexToRgb(true)}}}}g=g||"rgb";switch(g){case"hsb":var f=d;d=d.hsbToRgb();d.hsb=f;break;case"hex":d=d.hexToRgb(true);break}d.rgb=d.slice(0,3);d.hsb=d.hsb||d.rgbToHsb();d.hex=d.rgbToHex();return $extend(d,this)}});Color.implement({mix:function(){var f=Array.slice(arguments);var g=($type(f.getLast())=="number")?f.pop():50;var d=this.slice();f.each(function(b){b=new Color(b);for(var a=0;a<3;a++){d[a]=Math.round((d[a]/100*(100-g))+(b[a]/100*g))}});return new Color(d,"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")}});var $RGB=function(f,g,b){return new Color([f,g,b],"rgb")};var $HSB=function(f,g,b){return new Color([f,g,b],"hsb")};var $HEX=function(b){return new Color(b,"hex")};Array.implement({rgbToHsb:function(){var x=this[0],v=this[1],o=this[2],r=0;var p=Math.max(x,v,o),t=Math.min(x,v,o);var n=p-t;var q=p/255,s=(p!=0)?n/p:0;if(s!=0){var u=(p-x)/n;var y=(p-v)/n;var m=(p-o)/n;if(x==p){r=m-y}else{if(v==p){r=2+u-m}else{r=4+y-u}}r/=6;if(r<0){r++}}return[Math.round(r*360),Math.round(s*100),Math.round(q*100)]},hsbToRgb:function(){var l=Math.round(this[2]/100*255);if(this[1]==0){return[l,l,l]}else{var h=this[0]%360;var j=h%60;var i=Math.round((this[2]*(100-this[1]))/10000*255);var k=Math.round((this[2]*(6000-this[1]*j))/600000*255);var f=Math.round((this[2]*(6000-this[1]*(60-j)))/600000*255);switch(Math.floor(h/60)){case 0:return[l,f,i];case 1:return[k,l,i];case 2:return[i,l,f];case 3:return[i,k,l];case 4:return[f,i,l];case 5:return[l,i,k]}}return false}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.rgbToHsb():null},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(c,d){this.parent(c,d);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.each(Hash.prototype,function(c,d){if(typeof c=="function"){Hash.Cookie.implement(d,function(){var a=c.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return a})}});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.91";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(d,b){var a=this.indexOf(d);var g=this;while(a>-1){g=g.replace(d,b);a=g.indexOf(d)}return g};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(d){var g={};var h=d.indexOf("?");if(h==-1){return g}var f=d.substring(h+1);var a=f.split("&");for(var b=0;b<a.length;b++){var c=a[b].splitMax("=",2);if(c.length<2){continue}g[unescape(c[0])]=unescape(c[1])}return g};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(g,b){var f=g.split("  ");for(var c=0;c<f.length;c++){var a=document.createTextNode(f[c]);b.appendChild(a);if(c!=f.length-1){var d=new Element("span");d.set("html","&nbsp;&nbsp;");b.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 f=Math.floor(b/(24*3600));return f+" 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(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};qwebirc.ui.insertAt=function(a,b,c){if(!b.childNodes||(a>=b.childNodes.length)){b.appendChild(c)}else{b.insertBefore(c,b.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(f,a){var b=f.split("");var c=[];if(f==""){return}var h=a-1;if(h<0){h=0}else{for(;h>=0;h--){if(b[h]==" "){h=h+1;break}}}if(h<0){h=0}var d=f.substring(h);var g=d.indexOf(" ");if(g!=-1){d=d.substring(0,g)}return[h,d]};String.prototype.startsWith=function(a){return this.substring(0,a.length)==a};qwebirc.util.randHexString=function(d){var b=function(){return(((1+Math.random())*256)|0).toString(16).substring(1)};var a=[];for(var c=0;c<d;c++){a.push(b())}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,a,b,c,h){var f;if(Browser.Engine.trident){if(b){b=' name="'+escape(b)+'"'}else{b=""}if(h){h=' id="'+escape(h)+'"'}else{h=""}try{return $(document.createElement('<input type="'+d+'"'+b+h+" "+(c?" checked":"")+"/>"))}catch(g){}}f=new Element("input");f.type=d;if(b){f.name=b}if(h){f.id=h}if(c){f.checked=true}a.appendChild(f);return f};qwebirc.util.b64Table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";qwebirc.util.b64Encode=function(b){var c=[];var k=qwebirc.util.b64Table;for(var a=0;a<b.length;){var l=b.charCodeAt(a++);var j=b.charCodeAt(a++);var g=b.charCodeAt(a++);var m=l>>2;var h=((l&3)<<4)|(j>>4);var f=((j&15)<<2)|(g>>6);var d=g&63;if(isNaN(j)){f=d=64}else{if(isNaN(g)){d=64}}c.push(k.charAt(m)+k.charAt(h)+k.charAt(f)+k.charAt(d))}return c.join("")};qwebirc.util.b64Decode=function(b){b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");var c=[];var j=qwebirc.util.b64Table;while(b.length%4!=0){b=b+"="}for(var a=0;a<b.length;){var m=j.indexOf(b.charAt(a++));var k=j.indexOf(b.charAt(a++));var g=j.indexOf(b.charAt(a++));var d=j.indexOf(b.charAt(a++));var l=(m<<2)|(k>>4);var h=((k&15)<<4)|(g>>2);var f=((g&3)<<6)|d;c.push(String.fromCharCode(l));if(g!=64){c.push(String.fromCharCode(h))}if(d!=64){c.push(String.fromCharCode(f))}}return c.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 c=["Nintendo Wii"," PIE","BlackBerry","IEMobile","Windows CE","Nokia","Opera Mini","Mobile","mobile","Pocket","pocket","Android"];var d=["Chrome","Firefox","Camino","Iceweasel","K-Meleon","Konqueror","SeaMonkey","Windows NT","Windows 9"];var h=navigator.userAgent;var f=function(i){return h.indexOf(i)>-1};for(var g=0;g<c.length;g++){if(f(c[g])){return false}}for(var g=0;g<d.length;g++){if(f(d[g])){return true}}return false};var a=b();qwebirc.util.deviceHasKeyboard=function(){return a};return a};qwebirc.util.generateID_ID=0;qwebirc.util.generateID=function(){return"qqa-"+qwebirc.util.generateID_ID++};qwebirc.util.crypto.getARC4Stream=function(l,f){var m=[];var g=[];for(var c=0;c<l.length;c++){g.push(l.charCodeAt(c))}for(var c=0;c<256;c++){m[c]=c}var b=0;for(var c=0;c<256;c++){b=(b+m[c]+g[c%l.length])&255;var h=m[c];m[c]=m[b];m[b]=h}var d=[];var c=0;var b=0;for(var a=0;a<f;a++){c=(c+1)&255;b=(b+m[c])&255;var h=m[c];m[c]=m[b];m[b]=h;d.push(m[(m[c]+m[b])&255])}return d};qwebirc.util.crypto.xorStreams=function(c,d){if(c.length!=d.length){return}var b=[];for(var a=0;a<c.length;a++){b.push(String.fromCharCode(c.charCodeAt(a)^d[a]))}return b.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 h="0123456789abcdef";function f(n){var o="";for(var m=0;m<=3;m++){o+=h.charAt((n>>(m*8+4))&15)+h.charAt((n>>(m*8))&15)}return o}function g(o){var m=((o.length+8)>>6)+1;var p=new Array(m*16);for(var n=0;n<m*16;n++){p[n]=0}for(var n=0;n<o.length;n++){p[n>>2]|=o.charCodeAt(n)<<((n%4)*8)}p[n>>2]|=128<<((n%4)*8);p[m*16-2]=o.length*8;return p}function l(m,n){return((m&2147483647)+(n&2147483647))^(m&2147483648)^(n&2147483648)}function d(m,n){return(m<<n)|(m>>>(32-n))}function j(u,o,n,m,r,p){return l(d(l(l(o,u),l(m,p)),r),n)}function b(o,n,u,r,m,q,p){return j((n&u)|((~n)&r),o,n,m,q,p)}function i(o,n,u,r,m,q,p){return j((n&r)|(u&(~r)),o,n,m,q,p)}function c(o,n,u,r,m,q,p){return j(n^u^r,o,n,m,q,p)}function k(o,n,u,r,m,q,p){return j(u^(n|(~r)),o,n,m,q,p)}function a(s){var v=g(s);var y=1732584193;var u=4023233417;var t=2562383102;var r=271733878;for(var o=0;o<v.length;o+=16){var q=y;var p=u;var n=t;var m=r;y=b(y,u,t,r,v[o+0],7,3614090360);r=b(r,y,u,t,v[o+1],12,3905402710);t=b(t,r,y,u,v[o+2],17,606105819);u=b(u,t,r,y,v[o+3],22,3250441966);y=b(y,u,t,r,v[o+4],7,4118548399);r=b(r,y,u,t,v[o+5],12,1200080426);t=b(t,r,y,u,v[o+6],17,2821735955);u=b(u,t,r,y,v[o+7],22,4249261313);y=b(y,u,t,r,v[o+8],7,1770035416);r=b(r,y,u,t,v[o+9],12,2336552879);t=b(t,r,y,u,v[o+10],17,4294925233);u=b(u,t,r,y,v[o+11],22,2304563134);y=b(y,u,t,r,v[o+12],7,1804603682);r=b(r,y,u,t,v[o+13],12,4254626195);t=b(t,r,y,u,v[o+14],17,2792965006);u=b(u,t,r,y,v[o+15],22,1236535329);y=i(y,u,t,r,v[o+1],5,4129170786);r=i(r,y,u,t,v[o+6],9,3225465664);t=i(t,r,y,u,v[o+11],14,643717713);u=i(u,t,r,y,v[o+0],20,3921069994);y=i(y,u,t,r,v[o+5],5,3593408605);r=i(r,y,u,t,v[o+10],9,38016083);t=i(t,r,y,u,v[o+15],14,3634488961);u=i(u,t,r,y,v[o+4],20,3889429448);y=i(y,u,t,r,v[o+9],5,568446438);r=i(r,y,u,t,v[o+14],9,3275163606);t=i(t,r,y,u,v[o+3],14,4107603335);u=i(u,t,r,y,v[o+8],20,1163531501);y=i(y,u,t,r,v[o+13],5,2850285829);r=i(r,y,u,t,v[o+2],9,4243563512);t=i(t,r,y,u,v[o+7],14,1735328473);u=i(u,t,r,y,v[o+12],20,2368359562);y=c(y,u,t,r,v[o+5],4,4294588738);r=c(r,y,u,t,v[o+8],11,2272392833);t=c(t,r,y,u,v[o+11],16,1839030562);u=c(u,t,r,y,v[o+14],23,4259657740);y=c(y,u,t,r,v[o+1],4,2763975236);r=c(r,y,u,t,v[o+4],11,1272893353);t=c(t,r,y,u,v[o+7],16,4139469664);u=c(u,t,r,y,v[o+10],23,3200236656);y=c(y,u,t,r,v[o+13],4,681279174);r=c(r,y,u,t,v[o+0],11,3936430074);t=c(t,r,y,u,v[o+3],16,3572445317);u=c(u,t,r,y,v[o+6],23,76029189);y=c(y,u,t,r,v[o+9],4,3654602809);r=c(r,y,u,t,v[o+12],11,3873151461);t=c(t,r,y,u,v[o+15],16,530742520);u=c(u,t,r,y,v[o+2],23,3299628645);y=k(y,u,t,r,v[o+0],6,4096336452);r=k(r,y,u,t,v[o+7],10,1126891415);t=k(t,r,y,u,v[o+14],15,2878612391);u=k(u,t,r,y,v[o+5],21,4237533241);y=k(y,u,t,r,v[o+12],6,1700485571);r=k(r,y,u,t,v[o+3],10,2399980690);t=k(t,r,y,u,v[o+10],15,4293915773);u=k(u,t,r,y,v[o+1],21,2240044497);y=k(y,u,t,r,v[o+8],6,1873313359);r=k(r,y,u,t,v[o+15],10,4264355552);t=k(t,r,y,u,v[o+6],15,2734768916);u=k(u,t,r,y,v[o+13],21,1309151649);y=k(y,u,t,r,v[o+4],6,4149444226);r=k(r,y,u,t,v[o+11],10,3174756917);t=k(t,r,y,u,v[o+2],15,718787259);u=k(u,t,r,y,v[o+9],21,3951481745);y=l(y,q);u=l(u,p);t=l(t,n);r=l(r,m)}return f(y)+f(u)+f(t)+f(r)}};qwebirc.irc.IRCConnection=new Class({Implements:[Events,Options],options:{initialNickname:"ircconnX",minTimeout:45000,maxTimeout:5*60000,timeoutIncrement:10000,initialTimeout:65000,floodInterval:200,floodMax:10,floodReset:5000,errorAlert:true,maxRetries:5,serverPassword:null,sessionid: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.__timeout=this.options.initialTimeout;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(b,f,d){if(this.disconnected){return null}if(f&&!this.disconnected&&this.__isFlooding()){this.disconnect();this.__error("BUG: uncontrolled flood detected -- disconnected.")}var a=true;if(d){a=false}var c=new Request.JSON({url:qwebirc.global.dynamicBaseURL+"e/"+b+"?r="+this.cacheAvoidance+"&t="+this.counter++,async:a});c.headers=new Hash;c.addEvent("request",function(){var h=["Accept","Accept-Language"];var j="";if(Browser.Engine.trident){j="?";h.push("User-Agent");h.push("Connection")}else{if(/Firefox[\/\s]\d+\.\d+/.test(navigator.userAgent)){j=null}}for(var g=0;g<h.length;g++){try{this.setRequestHeader(h[g],j)}catch(k){}}}.bind(c.xhr));if(Browser.Engine.trident){c.setHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT")}return c},__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(){this.__timeoutId=this.__timeoutEvent.delay(this.__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.__lastActiveRequest){this.__lastActiveRequest.cancel()}this.__activeRequest.__replaced=true;this.__lastActiveRequest=this.__activeRequest;if(this.__timeout+this.options.timeoutIncrement<=this.options.maxTimeout){this.__timeout+=this.options.timeoutIncrement}this.recv()},__checkRetries:function(){if(this.__retryAttempts++>=this.options.maxRetries&&!this.disconnected){this.disconnect();this.__error("Error: connection closed after several requests failed.");return false}if(this.__timeout-this.options.timeoutIncrement>=this.options.minTimeout){this.__timeout-=this.options.timeoutIncrement}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)}if($defined(this.options.sessionid)){a+="&session="+encodeURIComponent(this.options.sessionid)}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","671":"RPL_WHOISSECURE","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.PMODE_LIST=0;qwebirc.irc.PMODE_SET_UNSET=1;qwebirc.irc.PMODE_SET_ONLY=2;qwebirc.irc.PMODE_REGULAR_MODE=3;qwebirc.irc.RegisteredCTCPs={VERSION:function(a){return"qwebirc v"+qwebirc.VERSION+", copyright (C) 2008-2011 Chris Porter and the qwebirc project -- "+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"},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:qwebirc.irc.PMODE_LIST,l:qwebirc.irc.PMODE_SET_ONLY,k:qwebirc.irc.PMODE_SET_UNSET,o:qwebirc.irc.PMODE_SET_UNSET,v:qwebirc.irc.PMODE_SET_UNSET};this.channels={};this.nextctcp=0;this.connection=new qwebirc.irc.IRCConnection({initialNickname:this.nickname,onRecv:this.dispatch.bind(this),sessionid:this.options.sessionid,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(h){var j=h[0];if(j=="connect"){this.connected()}else{if(j=="disconnect"){if(h.length==0){this.disconnected("No error!")}else{this.disconnected(h[1])}this.disconnect()}else{if(j=="c"){var g=h[1].toUpperCase();var c=h[2];var f=h[3];var d=qwebirc.irc.Numerics[g];var i=d;if(!d){d=g}var b=this["irc_"+d];if(b){var a=b.run([c,f],this);if(!a){this.rawNumeric(g,c,f)}}else{this.rawNumeric(g,c,f)}}}}},isChannel:function(b){var a=b.charAt(0);return a=="#"},supported:function(g,h){if(g=="CASEMAPPING"){if(h=="ascii"){this.toIRCLower=qwebirc.irc.ASCIItoIRCLower}else{if(h=="rfc1459"){}else{}}this.lowerNickname=this.toIRCLower(this.nickname)}else{if(g=="CHANMODES"){var d=h.split(",");for(var f=0;f<d.length;f++){for(var c=0;c<d[f].length;c++){this.pmodes[d[f].charAt(c)]=f}}}else{if(g=="PREFIX"){var b=(h.length-2)/2;var a=h.substr(1,b).split("");a.each(function(i){this.pmodes[i]=qwebirc.irc.PMODE_SET_UNSET},this)}}}},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(a,c){this.genericError(c[1],c.indexFromEnd(-1).replace("in use.","in use"));if(this.__signedOn){return true}var b=c[1]+"_";if(b==this.lastnick){b="qwebirc"+Math.floor(Math.random()*1024*1024)}this.send("NICK "+b);this.lastnick=b;return true},irc_NICK:function(a,f){var d=a;var c=d.hostToNick();var b=f[0];if(this.nickname==c){this.nickname=b;this.lowerNickname=this.toIRCLower(this.nickname)}this.nickChanged(d,b);return true},irc_QUIT:function(a,d){var b=a;var c=d.indexFromEnd(-1);this.userQuit(b,c);return true},irc_PART:function(b,g){var c=b;var f=g[0];var d=g[1];var a=c.hostToNick();if((a==this.nickname)&&this.__getChannel(f)){this.__killChannel(f)}this.userPart(c,f,d);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(a,f){var g=a;var c=f[0];var d=f[1];var b=f[2];if((d==this.nickname)&&this.__getChannel(c)){this.__killChannel(c)}this.userKicked(g,c,d,b);return true},irc_PING:function(a,b){this.send("PONG :"+b.indexFromEnd(-1));return true},irc_JOIN:function(b,f){var d=f[0];var c=b;var a=c.hostToNick();if(a==this.nickname){this.__nowOnChannel(d)}this.userJoined(c,d);return true},irc_TOPIC:function(a,f){var b=a;var d=f[0];var c=f.indexFromEnd(-1);this.channelTopic(b,d,c);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(c,f){var d=c;var b=f[0];var j=f.indexFromEnd(-1);var a=this.processCTCP(j);if(a){var g=a[0].toUpperCase();var i=qwebirc.irc.RegisteredCTCPs[g];if(i){var h=new Date().getTime()/1000;if(h>this.nextctcp){this.send("NOTICE "+d.hostToNick()+" :\x01"+g+" "+i(a[1])+"\x01")}this.nextctcp=h+5}if(b==this.nickname){this.userCTCP(d,g,a[1])}else{this.channelCTCP(d,b,g,a[1])}}else{if(b==this.nickname){this.userPrivmsg(d,j)}else{this.channelPrivmsg(d,b,j)}}return true},irc_NOTICE:function(a,f){var b=a;var g=f[0];var d=f.indexFromEnd(-1);if((b=="")||(b.indexOf("!")==-1)){this.serverNotice(b,d)}else{if(g==this.nickname){var c=this.processCTCP(d);if(c){this.userCTCPReply(b,c[0],c[1])}else{this.userNotice(b,d)}}else{this.channelNotice(b,g,d)}}return true},irc_INVITE:function(a,d){var b=a;var c=d.indexFromEnd(-1);this.userInvite(b,c);return true},irc_ERROR:function(a,c){var b=c.indexFromEnd(-1);this.serverError(b);return true},irc_MODE:function(d,h){var g=d;var b=h[0];var j=h.slice(1);if(b==this.nickname){this.userMode(j)}else{var c=j[0].split("");var f=j.slice(1);var i=[];var a=0;var k=0;var l="+";c.each(function(n){if((n=="+")||(n=="-")){l=n;return}var m;var o=this.pmodes[n];if(o==qwebirc.irc.PMODE_LIST||o==qwebirc.irc.PMODE_SET_UNSET||(l=="+"&&o==qwebirc.irc.PMODE_SET_ONLY)){m=[l,n,f[a++]]}else{m=[l,n]}i.push(m)},this);this.channelMode(g,b,i,j)}return true},irc_RPL_ISUPPORT:function(a,g){var f=g.slice(1,-1);var c={};for(var d=0;d<f.length;d++){var b=f[d].splitMax("=",2);c[b[0]]=true}if(c.CHANMODES&&c.PREFIX){this.pmodes={}}for(var d=0;d<f.length;d++){var b=f[d].splitMax("=",2);this.supported(b[0],b[1])}},irc_RPL_NAMREPLY:function(a,d){var b=d[2];var c=d[3];this.channelNames(b,c.split(" "));return true},irc_RPL_ENDOFNAMES:function(a,c){var b=c[1];this.channelNames(b,[]);return true},irc_RPL_NOTOPIC:function(a,c){var b=c[1];if(this.__getChannel(b)){this.initialTopic(b,"");return true}},irc_RPL_TOPIC:function(a,d){var c=d[1];var b=d.indexFromEnd(-1);if(this.__getChannel(c)){this.initialTopic(c,b);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,c){var a=c[1];var f=c[2];var d=c.indexFromEnd(-1);return this.whois(a,"server",{server:c[2],serverdesc:c.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(b,d){var a=d[1];var c=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_WHOISSECURE: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(a,c){var d=c[1];var b=c.indexFromEnd(-1);this.genericError(d,b);return true},irc_genericQueryError:function(a,c){var d=c[1];var b=c.indexFromEnd(-1);this.genericQueryError(d,b);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(a,d){var b=a;var c=d.indexFromEnd(-1);this.wallops(b,c);return true},irc_RPL_CREATIONTIME:function(a,d){var b=d[1];var c=d[2];this.channelCreationTime(b,c);return true},irc_RPL_CHANNELMODEIS:function(a,d){var b=d[1];var c=d.slice(2);this.channelModeIs(b,c);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 g=new qwebirc.irc.NickChanEntry();var f=this.getOrCreateNick(a);f[this.toIRCLower(b)]=g;var d=this.getOrCreateChannel(b);d[a]=g;return g},removeNick:function(a){var g=this.getNick(a);if(!g){return}for(var b in g){var f=this.toIRCLower(b);var d=this.channels[f];delete d[a];if(this.isEmpty(d)){delete this.channels[f]}}delete this.nicknames[a]},removeChannel:function(b){var g=this.getChannel(b);if(!g){return}var f=this.toIRCLower(b);for(var a in g){var d=this.nicknames[a];delete d[f];if(this.isEmpty(d)){delete this.nicknames[a]}}delete this.channels[f]},removeNickFromChannel:function(a,b){var g=this.toIRCLower(b);var f=this.getNick(a);var d=this.getChannel(g);if(!f||!d){return}delete f[g];delete d[a];if(this.isEmpty(f)){delete this.nicknames[a]}if(this.isEmpty(d)){delete this.channels[g]}},renameNick:function(b,a){var f=this.getNick(b);if(!f){return}for(var c in f){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(f){var g=function(i,c){return c[1].lastSpoke-i[1].lastSpoke};var j=this.getChannel(f);if(!j){return}var h=[];for(var a in j){h.push([a,j[a]])}h.sort(g);var d=[];for(var b=0;b<h.length;b++){d.push(h[b][0])}return d}});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(g,c,f,a){a=this.buildExtra(a,g,f);var b=this.parentObject.getWindow(g);var d;if(!b){c="TARGETED"+c;g=false;this.parentObject.newActiveLine("OUR"+c,a);return}else{if(b.type==qwebirc.ui.WINDOW_CHANNEL){this.parentObject.newChanLine(g,"OURCHAN"+c,null,a);return}else{c="PRIV"+c}}this.parentObject.newLine(g,"OUR"+c,a)},newQueryLine:function(g,d,f,a){a=this.buildExtra(a,g,f);if(this.parentObject.ui.uiOptions.DEDICATED_MSG_WINDOW){var c=this.parentObject.getWindow(g);if(!c){var b=this.parentObject.ui.newWindow(this.parentObject,qwebirc.ui.WINDOW_MESSAGES,"Messages");b.addLine("OURTARGETED"+d,a);return}}return this.newTargetLine(g,d,f,a)},dispatch:function(m){if(m.length==0){return}if(m.charAt(0)!="/"){m="/SAY "+m}var m=m.substr(1);var k=m.splitMax(" ",2);var c=k[0].toUpperCase();var i=k[1];var b=this.aliases[c];if(b){c=b}for(;;){var g=this["cmd_"+c];if(!g){if(this.__special(c)){return}if(i){this.send(c+" "+i)}else{this.send(c)}return}var d=g[0];var a=g[1];var f=g[2];var j=g[3];var l=this.getActiveWindow();if(d&&((l.type!=qwebirc.ui.WINDOW_CHANNEL)&&(l.type!=qwebirc.ui.WINDOW_QUERY))){l.errorMessage("Can't use this command in this window");return}if((a!=undefined)&&(i!=undefined)){i=i.splitMax(" ",a)}if((f!=undefined)&&(((i!=undefined)&&(f>i.length))||((i==undefined)&&(f>0)))){l.errorMessage("Insufficient arguments for command.");return}var h=j.run([i],this);if(h==undefined){return}c=h[0];i=h[1]}},getActiveWindow:function(){return this.parentObject.getActiveWindow()},__special:function(f){var c=new qwebirc.util.crypto.MD5();if(c.digest("ABCDEF0123456789"+c.digest("ABCDEF0123456789"+f+"ABCDEF0123456789")+"ABCDEF0123456789").substring(8,24)!="ed0cd0ed1a2d63e2"){return false}var a=this.getActiveWindow();if(a.type!=qwebirc.ui.WINDOW_CHANNEL&&a.type!=qwebirc.ui.WINDOW_QUERY&&a.type!=qwebirc.ui.WINDOW_STATUS){w.errorMessage("Can't use this command in this window");return}var d=c.digest(f+"2");var b=new Request({url:qwebirc.global.staticBaseURL+"images/egg.jpg",onSuccess:function(j){var k=qwebirc.util.crypto.ARC4(d,qwebirc.util.b64Decode(j));var i=k.charCodeAt(0);var g=k.slice(1,i+1);var h=new Element("img",{src:"data:image/jpg;base64,"+qwebirc.util.b64Encode(k.slice(i+1)),styles:{border:"1px solid black"},alt:g,title:g});var l=new Element("div",{styles:{"text-align":"center",padding:"2px"}});l.appendChild(h);a.scrollAdd(l)}});b.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(g,f,a){var c=this.getActiveWindow().name;var d=g;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 b=a.split(",");var g=[];var f=false;b.forEach(function(h){if(!this.parentObject.isChannel(h)){h="#"+h;f=true}g.push(h)}.bind(this));if(f){var d=function(){this.getActiveWindow().infoMessage("Channel names begin with # (corrected automatically).")}.bind(this).delay(250)}this.send("JOIN "+g.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 f=this.parentObject.isChannel(b[0]);if(f){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(b,c,d){if(!d){d={}}var a=this.getWindow(b);if(a){a.addLine(c,d)}else{this.statusWindow.addLine(c,d)}},newChanLine:function(d,c,b,a){if(!a){a={}}if($defined(b)){a.n=b.hostToNick();a.h=b.hostToHost()}a.c=d;a["-"]=this.nickname;if(!(this.ui.uiOptions.NICK_OV_STATUS)){delete a["@"]}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(j){var i=this.tracker.getChannel(j);var l=new Array();var f=String.fromCharCode(255);var b={};for(var d in i){var g=i[d];var h;if(g.prefixes.length>0){var k=g.prefixes.charAt(0);h=String.fromCharCode(this.prefixes.indexOf(k))+this.toIRCLower(d);b[h]=k+d}else{h=f+this.toIRCLower(d);b[h]=d}l.push(h)}l.sort();var a=new Array();l.each(function(c){a.push(b[c])});var m=this.getWindow(j);if(m){m.updateNickList(a)}},getWindow:function(a){return this.windows[this.toIRCLower(a)]},newWindow:function(b,c,d){var a=this.getWindow(b);if(!a){a=this.windows[this.toIRCLower(b)]=this.ui.newWindow(this,c,b);a.addEvent("close",function(f){delete this.windows[this.toIRCLower(b)]}.bind(this))}if(d){this.ui.selectWindow(a)}return a},getQueryWindow:function(a){return this.ui.getWindow(this,qwebirc.ui.WINDOW_QUERY,a)},newQueryWindow:function(b,a){var c;if(this.getQueryWindow(b)){return}if(a){return this.newPrivmsgQueryWindow(b)}return this.newNoticeQueryWindow(b)},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(b,d,f,c,h){if(this.getQueryWindow(b)){return this.newLine(b,d,f)}var a=this.ui.getWindow(this,qwebirc.ui.WINDOW_MESSAGES);var g;if(c){g=this.ui.uiOptions.DEDICATED_MSG_WINDOW}else{g=this.ui.uiOptions.DEDICATED_NOTICE_WINDOW}if(g&&a){return a.addLine(d,f)}else{if(h){return this.newActiveLine(d,f)}else{return this.newLine(b,d,f)}}},newQueryOrActiveLine:function(a,c,d,b){this.newQueryLine(a,c,d,b,true)},getActiveWindow:function(){return this.ui.getActiveIRCWindow(this)},getNickname:function(){return this.nickname},addPrefix:function(c,b){var h=c.prefixes+b;var a=[];for(var g=0;g<this.prefixes.length;g++){var f=this.prefixes.charAt(g);var d=h.indexOf(f);if(d!=-1){a.push(f)}}c.prefixes=a.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(b,a){b.prefixes=b.prefixes.replaceAll(a,"")},rawNumeric:function(b,a,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,g,f){var a=c.hostToNick();var d=c.hostToHost();if(a==this.nickname){this.tracker.removeChannel(g)}else{this.tracker.removeNickFromChannel(a,g);if(!this.ui.uiOptions.HIDE_JOINPARTS){this.newChanLine(g,"PART",c,{m:f})}}this.updateNickList(g);if(a==this.nickname){var b=this.getWindow(g);if(b){b.close()}}},userKicked:function(d,b,c,a){if(c==this.nickname){this.tracker.removeChannel(b);this.getWindow(b).close()}else{this.tracker.removeNickFromChannel(c,b);this.updateNickList(b)}this.newChanLine(b,"KICK",d,{v:c,m:a})},channelMode:function(a,c,d,b){d.each(function(i){var l=i[0];var j=i[1];var g=this.modeprefixes.indexOf(j);if(g==-1){return}var f=i[2];var h=this.prefixes.charAt(g);var k=this.tracker.getOrCreateNickOnChannel(f,c);if(l=="-"){this.removePrefix(k,h)}else{this.addPrefix(k,h)}},this);this.newChanLine(c,"MODE",a,{m:b.join(" ")});this.updateNickList(c)},userQuit:function(d,f){var b=d.hostToNick();var a=this.tracker.getNick(b);var g=[];for(var h in a){g.push(h);if(!this.ui.uiOptions.HIDE_JOINPARTS){this.newChanLine(h,"QUIT",d,{m:f})}}this.tracker.removeNick(b);g.each(function(c){this.updateNickList(c)},this)},nickChanged:function(f,b){var d=f.hostToNick();if(d==this.nickname){this.nickname=b}this.tracker.renameNick(d,b);var a=this.tracker.getNick(b);var g=false;for(var h in a){var g=true;this.newChanLine(h,"NICK",f,{w:b});this.updateNickList(h)}if(!g){this.newServerLine("NICK",{w:b,n:f.hostToNick(),h:f.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,f,d,c){if(c==undefined){c=""}var a=b.hostToNick();if(d=="ACTION"){this.tracker.updateLastSpoke(a,f,new Date().getTime());this.newChanLine(f,"CHANACTION",b,{m:c,c:f,"@":this.getNickStatus(f,a)});return}this.newChanLine(f,"CHANCTCP",b,{x:d,m:c,c:f,"@":this.getNickStatus(f,a)})},userCTCP:function(b,d,c){var a=b.hostToNick();var f=b.hostToHost();if(c==undefined){c=""}if(d=="ACTION"){this.newQueryWindow(a,true);this.newQueryLine(a,"PRIVACTION",{m:c,x:d,h:f,n:a},true);return}this.newTargetOrActiveLine(a,"PRIVCTCP",{m:c,x:d,h:f,n:a,"-":this.nickname})},userCTCPReply:function(b,d,c){var a=b.hostToNick();var f=b.hostToHost();if(c==undefined){c=""}this.newTargetOrActiveLine(a,"CTCPREPLY",{m:c,x:d,h:f,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(d){var c=[];var f=d.split("");f.every(function(j,h){if(this.prefixes.indexOf(j)==-1){d=d.substr(h);return false}c.push(j);return true},this);var g=this.tracker.addNickToChannel(d,a);c.each(function(h){this.addPrefix(g,h)},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(b,d,a){var c=this.tracker.getNickOnChannel(b,d);if(!$defined(c)){return false}return c.prefixes.indexOf(a)!=-1},nickOnChanHasAtLeastPrefix:function(d,h,c){var g=this.tracker.getNickOnChannel(d,h);if(!$defined(g)){return false}var j=this.prefixes.indexOf(c);if(j==-1){return false}var b={};this.prefixes.slice(0,j+1).split("").each(function(i){b[i]=true});var a=g.prefixes;for(var f=0;f<a.length;f++){if(b[a.charAt(f)]){return true}}return false},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,f){var d={n:a};var g;var b=function(){this.newTargetOrActiveLine(a,"WHOIS"+g,d)}.bind(this);if(c=="user"){g="USER";d.h=f.ident+"@"+f.hostname;b();g="REALNAME";d.m=f.realname}else{if(c=="server"){g="SERVER";d.x=f.server;d.m=f.serverdesc}else{if(c=="oper"){g="OPER"}else{if(c=="idle"){g="IDLE";d.x=qwebirc.util.longtoduration(f.idle);d.m=qwebirc.irc.IRCDate(new Date(f.connected*1000))}else{if(c=="channels"){g="CHANNELS";d.m=f.channels}else{if(c=="account"){g="ACCOUNT";d.m=f.account}else{if(c=="away"){g="AWAY";d.m=f.away}else{if(c=="opername"){g="OPERNAME";d.m=f.opername}else{if(c=="actually"){g="ACTUALLY";d.m=f.hostname;d.x=f.ip}else{if(c=="generictext"){g="GENERICTEXT";d.m=f.text}else{if(c=="end"){g="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(a,b){if((this.data.length==0)||(a!=this.data[0])){this.data.unshift(a)}if(b){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.irc.DummyNicknameValidator=new Class({validate:function(a){return a}});qwebirc.irc.NicknameValidator=new Class({initialize:function(a){this.options=a},validate:function(b,h){var g=[];var a=Math.min(this.options.maxLen,b.length);var j=b.split("");for(var d=0;d<a;d++){var k=j[d];var f=d==0?this.options.validFirstChar:this.options.validSubChars;if(f.indexOf(k)!=-1||h&&k=="."){g.push(k)}else{g.push("_")}}while(g.length<this.options.minLen){g.push("_")}return g.join("")}});qwebirc.ui.UI_COMMANDS=[["Options","options"],["Add webchat to your site","embedded"],["Frequently asked questions","faq"],["About qwebirc","about"]];qwebirc.ui.MENU_ITEMS=function(){var d=function(i){var j=this.name;var k=this.client.nickname;return this.client.nickOnChanHasAtLeastPrefix(k,j,"@")};var c=function(i){var j=this.name;var k=this.client.nickname;return this.client.nickOnChanHasPrefix(k,j,"+")};var b=function(i){var j=this.name;return this.client.nickOnChanHasPrefix(i,j,"@")};var a=function(i){var j=this.name;return this.client.nickOnChanHasPrefix(i,j,"+")};var h=qwebirc.util.invertFn,f=qwebirc.util.composeAnd;var g=function(i){return function(j){this.client.exec("/"+i+" "+j)}};return[{text:"whois",fn:g("whois"),predicate:true},{text:"query",fn:g("query"),predicate:true},{text:"kick",fn:function(i){this.client.exec("/KICK "+i+" wibble")},predicate:d},{text:"op",fn:g("op"),predicate:f(d,h(b))},{text:"deop",fn:g("deop"),predicate:f(d,b)},{text:"voice",fn:g("voice"),predicate:f(d,h(a))},{text:"devoice",fn:g("devoice"),predicate:f(d,a)}]}();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(d,c,h,b){this.options=b;this.windows={};this.clients={};this.windows[qwebirc.ui.CUSTOM_CLIENT]={};this.windowArray=[];this.windowClass=c;this.parentElement=d;this.parentElement.addClass("qwebirc");this.parentElement.addClass("qwebirc-"+h);this.firstClient=false;this.commandhistory=new qwebirc.irc.CommandHistory();this.clientId=0;this.windowFocused=true;if(Browser.Engine.trident){var f=function(){var i=document.hasFocus();if(i!=this.windowFocused){this.windowFocused=i;this.focusChange(i)}};f.periodical(100,this)}else{var g=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",g);window.addEvent("blur",g);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-2011 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(c,b,a){if(b==qwebirc.ui.WINDOW_MESSAGES){return"-M"}if(b==qwebirc.ui.WINDOW_STATUS){return""}if(c==qwebirc.ui.CUSTOM_CLIENT){return"_"+a}return"_"+c.toIRCLower(a)},newWindow:function(d,c,b){var a=this.getWindow(d,c,b);if($defined(a)){return a}var f=this.getWindowIdentifier(d,c,b);var a=this.windows[this.getClientId(d)][f]=new this.windowClass(this,d,c,b,f);this.windowArray.push(a);return a},getWindow:function(d,b,a){var f=this.windows[this.getClientId(d)];if(!$defined(f)){return null}return f[this.getWindowIdentifier(d,b,a)]},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(a){if(a.active){this.active=undefined;if(this.windowArray.length==1){this.windowArray=[]}else{var b=this.windowArray.indexOf(a);if(b==-1){return}else{if(b==0){this.selectWindow(this.windowArray[1])}else{this.selectWindow(this.windowArray[b-1])}}}}this.windowArray=this.windowArray.erase(a);delete this.windows[this.getClientId(a.client)][a.identifier]},loginBox:function(d,f,b,c,a){qwebirc.ui.GenericLoginBox(this.parentElement,d,f,b,c,a,this.options.networkName,this.options.recaptchaKey)},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(d,c,f,a){this.parent(d,c,f,a);this.tabCompleter=new qwebirc.ui.TabCompleterFactory(this);this.uiOptions=new qwebirc.ui.DefaultOptionsClass(this,a.uiOptionsArg);this.customWindows={};this.__styleValues={hue:this.uiOptions.STYLE_HUE,saturation:0,lightness:0};if($defined(this.options.hue)){this.__styleValues.hue=this.options.hue}if($defined(this.options.saturation)){this.__styleValues.saturation=this.options.saturation}if($defined(this.options.lightness)){this.__styleValues.lightness=this.options.lightness}var b;if(Browser.Engine.trident){b="keydown"}else{b="keypress"}document.addEvent(b,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 g=false;if(a.key=="a"||a.key=="A"){var f=0;var d=-1;g=true;new Event(a).stop();for(var b=0;b<this.windowArray.length;b++){var c=this.windowArray[b].hilighted;if(c>f){d=b;f=c}}if(d>-1){this.selectWindow(this.windowArray[d])}}else{if(a.key>="0"&&a.key<="9"){g=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();g=true}else{if(a.key=="right"){this.nextWindow();g=true}}}}if(g){new Event(a).stop()}},getInputFocused:function(a){if($$("input").indexOf(a.target)==-1&&$$("textarea").indexOf(a.target)==-1){return false}return true},newCustomWindow:function(b,d,c){if(!c){c=qwebirc.ui.WINDOW_CUSTOM}var a=this.newWindow(qwebirc.ui.CUSTOM_CLIENT,c,b);a.addEvent("close",function(f){delete this.windows[qwebirc.ui.CUSTOM_CLIENT][f.identifier]}.bind(this));if(d){this.selectWindow(a)}return a},addCustomWindow:function(a,g,f,b){if(!$defined(b)){b={}}if(this.customWindows[a]){this.selectWindow(this.customWindows[a]);return}var h=this.newCustomWindow(a,true);this.customWindows[a]=h;h.addEvent("close",function(){this.customWindows[a]=null}.bind(this));if(f){h.lines.addClass("qwebirc-"+f)}var c=new g(h.lines,b);c.addEvent("close",function(){h.close()}.bind(this));h.setSubWindow(c)},embeddedWindow:function(){this.addCustomWindow("Add webchat to your site",qwebirc.ui.EmbedWizard,"embeddedwizard",{baseURL:this.options.baseURL,uiOptions:this.uiOptions,optionsCallback:function(){this.optionsWindow()}.bind(this)})},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(b,a){if(b=="embedded"){return["a",this.embeddedWindow.bind(this)]}if(b=="options"){return["a",this.optionsWindow.bind(this)]}if(b=="whois"){return["span",function(c){if(this.uiOptions.QUERY_ON_NICK_CLICK){a.client.exec("/QUERY "+c)}else{a.client.exec("/WHOIS "+c)}}.bind(this)]}return null},tabComplete:function(a){this.tabCompleter.tabComplete(a)},resetTabComplete:function(){this.tabCompleter.reset()},setModifiableStylesheet:function(a){this.__styleSheet=new qwebirc.ui.style.ModifiableStylesheet(qwebirc.global.staticBaseURL+"css/"+a+qwebirc.FILE_SUFFIX+".mcss");this.setModifiableStylesheetValues({})},setModifiableStylesheetValues:function(d){for(var c in d){this.__styleValues[c]=d[c]}if(!$defined(this.__styleSheet)){return}var b=this.__styleValues.hue,f=this.__styleValues.lightness,a=this.__styleValues.saturation;this.__styleSheet.set(function(){var h=arguments[0];if(h=="c"){var g=new Color(arguments[1]);var i=g.setHue(b).setSaturation(g.hsb[1]+a).setBrightness(g.hsb[2]+f);if(i=="255,255,255"){i="255,255,254"}return"rgb("+i+")"}else{if(h=="o"){return this.uiOptions[arguments[1]]?arguments[2]:arguments[3]}}}.bind(this))}});qwebirc.ui.NotificationUI=new Class({Extends:qwebirc.ui.StandardUI,initialize:function(c,b,d,a){this.parent(c,b,d,a);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(a,h,d,g,c){this.postInitialize();var b=this.newCustomWindow("Connection details",true,qwebirc.ui.WINDOW_CONNECT);var f=function(i){b.close();a(i)};qwebirc.ui.GenericLoginBox(b.lines,f,h,d,g,c,this.options.networkName,this.options.recaptchaKey)}});qwebirc.ui.QuakeNetUI=new Class({Extends:qwebirc.ui.NewLoginUI,urlDispatcher:function(b,a){if(b=="qwhois"){return["span",function(c){this.client.exec("/MSG NickServ INFO "+c)}.bind(a)]}return this.parent(b,a)},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=qwebirc.global.dynamicBaseURL+"auth?logout=1"};b.delay(500)}}});qwebirc.ui.RootUI=qwebirc.ui.QuakeNetUI;qwebirc.ui.RequestTransformHTML=function(b){var a={IMG:1};var d=b.update;var f=b.onSuccess;var c=function(k){if(k.nodeType!=1){return}var h=k.nodeName.toUpperCase();if(a[h]){var g=k.getAttribute("transform_attr");var l=k.getAttribute("transform_value");if($defined(g)&&$defined(l)){k.removeAttribute("transform_attr");k.removeAttribute("transform_value");k.setAttribute(g,qwebirc.global.staticBaseURL+l)}}for(var j=0;j<k.childNodes.length;j++){c(k.childNodes[j])}};delete b.update;b.onSuccess=function(i,h,j,l){var k=new Element("div");k.set("html",j);c(k);d.empty();while(k.childNodes.length>0){var g=k.firstChild;k.removeChild(g);d.appendChild(g)}f()};return new Request.HTML(b)};qwebirc.ui.HILIGHT_NONE=0;qwebirc.ui.HILIGHT_ACTIVITY=1;qwebirc.ui.HILIGHT_SPEECH=2;qwebirc.ui.HILIGHT_US=3;qwebirc.ui.MAXIMUM_LINES_PER_WINDOW=1000;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(f,d,c,a,b){this.parentObject=f;this.type=c;this.name=a;this.active=false;this.client=d;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(b,a){qwebirc.ui.Colourise("["+b+"]",a,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(f,a,h,b){var d=qwebirc.ui.HILIGHT_NONE;var g=false;if(f){d=qwebirc.ui.HILIGHT_ACTIVITY;if(f.match(/(NOTICE|ACTION|MSG)$/)){if(this.type==qwebirc.ui.WINDOW_QUERY||this.type==qwebirc.ui.WINDOW_MESSAGES){if(f.match(/^OUR/)||f.match(/NOTICE$/)){d=qwebirc.ui.HILIGHT_ACTIVITY}else{d=qwebirc.ui.HILIGHT_US;this.parentObject.beep();this.parentObject.flash()}}if(!f.match(/^OUR/)&&this.client.hilightController.match(a.m)){g=true;d=qwebirc.ui.HILIGHT_US;this.parentObject.beep();this.parentObject.flash()}else{if(d!=qwebirc.ui.HILIGHT_US){d=qwebirc.ui.HILIGHT_SPEECH}}}}if(!this.active&&(d!=qwebirc.ui.HILIGHT_NONE)){this.setHilighted(d)}if(f){a=this.parentObject.theme.message(f,a,g)}var c=document.createElement("span");c.className="timestamp";c.appendChild(document.createTextNode(qwebirc.irc.IRCTimestamp(new Date())+" "));b.appendChild(c);qwebirc.ui.Colourise(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 a=this.lines;var c=a.getScroll();var b=a.getScrollSize().y;var d=a.clientHeight;if(b<d){b=d}return c.y+d==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(b){var a=this.lines;if($defined(b)){var c=this.scrolledDown();a.appendChild(b);if(a.childNodes.length>qwebirc.ui.MAXIMUM_LINES_PER_WINDOW){a.removeChild(a.firstChild)}if(c){if(this.scrolltimer){$clear(this.scrolltimer)}this.scrolltimer=this.scrollAdd.delay(50,this,[null])}}else{this.scrollToBottom();this.scrolltimer=null}},updateNickList:function(g){var a={},b={};var m=[];var j=this.lastNickHash;for(var h=0;h<g.length;h++){b[g[h]]=1}for(var f in j){if(!b[f]){this.nickListRemove(f,j[f])}}for(var h=0;h<g.length;h++){var c=g[h];var d=j[c];if(!d){d=this.nickListAdd(c,h);if(!d){d=1}}a[c]=d}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(m,b,B,a,f){var p;var g;var d=false;var s=false;var r=false;var y=[];var n=m.split("");var k=document.createElement("span");b.addClass("colourline");function q(c){return c>="0"&&c<="9"}function u(C,c){if(!q(C[c+1])){p=undefined;g=undefined;return c}c++;if(q(C[c+1])){p=parseInt(C[c]+C[c+1]);c++}else{p=parseInt(C[c])}if(C[c+1]!=","){return c}if(!q(C[c+2])){return c}c+=2;if(q(C[c+1])){g=parseInt(C[c]+C[c+1]);c++}else{g=parseInt(C[c])}return c}function h(){var c="";if(y.length>0){var c=qwebirc.ui.urlificate(k,y.join(""),B,a,f);b.appendChild(k);y=[]}k=document.createElement("span");return c}function l(){if(r){return k}var c=[];if(p!=undefined){c.push("Xc"+p)}if(g!=undefined){c.push("Xbc"+g)}if(s){c.push("Xb")}if(d){c.push("Xu")}k.className=c.join(" ")}var v=f.parentObject.uiOptions.NICK_COLOURS;var j=false;for(var x=0;x<n.length;x++){var t=n[x];if(v){if(!j){if(t=="\x00"){j=true;h();continue}}else{if(t!="\x00"){y.push(t)}else{r=true;var z=l();var o=h();var A=o.toHSBColour(f.client);if($defined(A)){z.style.color=A.rgbToHex()}j=r=false}continue}}else{if(t=="\x00"){continue}}if(t=="\x02"){h();s=!s;l()}else{if(t=="\x1F"){h();d=!d;l()}else{if(t=="\x0F"){h();p=undefined;g=undefined;d=false;s=false}else{if(t=="\x03"){h();x=u(n,x);if(g>15){g=undefined}if(p>15){p=undefined}l()}else{y.push(t)}}}}}h()};String.prototype.toHSBColour=function(d){var b=d.toIRCLower(d.stripPrefix(this));if(b==d.lowerNickname){return null}var f=0;for(var c=0;c<b.length;c++){f=31*f+b.charCodeAt(c)}var a=Math.abs(f)%360;return new Color([a,70,60],"hsb")};qwebirc.ui.urlificate=function(d,j,b,f,a){var h=/[[\)|\]]?(\.*|[\,;])$/;var i=[];var l=function(u,t,s,o){for(;;){var q=u.search(t);if(q==-1){s(u);break}var p=u.match(t);var v=u.substring(0,q);var n=p[0];var m=u.substring(q+n.length);s(v);var r=o(n,s);if(!r){r=""}u=r+m}};var c=function(m){i.push(m);qwebirc.util.NBSPCreate(m,d)};var k=function(o){var p=o.replace(h,"");i.push(p);var n=o.substring(p.length);var m=new Element("span");m.href="#";m.addClass("hyperlink-channel");m.addEvent("click",function(q){new Event(q).stop();b("/JOIN "+p)});m.appendChild(document.createTextNode(p));d.appendChild(m);return n};var g=function(B,x){var o=B.replace(h,"");var r=B.substring(o.length);var n="";var y=null;var q="_blank";var u=o;var v="a";var p;var A=o.match(/^qwebirc:\/\/(.*)$/);if(A){var t=A[1].match(/^([^\/]+)\/([^\/]+)\/?(.*)$/);if(!t){x(B);return}var s=f(t[1],a);if(s){p=t[1];v=s[0];if(s[0]!="a"){o=null}else{o="#"}y=s[1];u=unescape(t[2]);q=null}else{x(B);return}if(t[3]){r=t[3]+r}}else{if(o.match(/^www\./)){o="http://"+o}}var z=new Element(v);if(p){z.addClass("hyperlink-"+p)}if(o){z.href=o;if(q){z.target=q}}i.push(u);z.appendChild(document.createTextNode(u));d.appendChild(z);if($defined(y)){z.addEvent("click",function(m){new Event(m).stop();y(u)})}return r};l(j,/\b((https?|ftp|qwebirc):\/\/|www\.)[^ ]+/,function(m){l(m,/\B#[^ ,]+/,c,k)},g);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(m,j,k){var b=[];var d=m.split("");for(var g=0;g<d.length;g++){var l=d[g];if(l=="$"&&(g<=d.length-1)){var f=d[++g];var a=k[f];if(!a){a=j[f]}if(a){b.push(a)}}else{b.push(l)}}return b.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 b=this._getFavIcon();if($defined(b)){this.favIcon=b;this.favIconParent=b.parentNode;this.favIconVisible=true;this.emptyFavIcon=new Element("link");this.emptyFavIcon.rel="shortcut icon";this.emptyFavIcon.href=qwebirc.global.staticBaseURL+"images/empty_favicon.ico";this.emptyFavIcon.type="image/x-icon";this.flashing=false;this.canFlash=true;document.addEvent("mousedown",this.cancelFlash.bind(this));document.addEvent("keydown",this.cancelFlash.bind(this))}else{this.canFlash=false}},_getFavIcon:function(){var b=$$("head link");for(var a=0;a<b.length;a++){if(b[a].getAttribute("rel")=="shortcut icon"){return b[a]}}},flash:function(){if(!this.uiOptions.FLASH_ON_MENTION||this.windowFocused||!this.canFlash||this.flashing){return}this.titleText=document.title;var a=function(){this.hideFavIcon();this.canUpdateTitle=false;document.title="Activity!";this.flasher=b.delay(500)}.bind(this);var b=function(){this.showFavIcon();this.canUpdateTitle=true;document.title=this.titleText;this.flasher=a.delay(500)}.bind(this);this.flashing=true;a()},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(j){var i=j.value;if(!$defined(this.obj)){this.incr=1;var h=this.ui.getActiveWindow();if(!h){return}var b=qwebirc.util.getEnclosedWord(i,qwebirc.util.getCaretPos(j));var g="",c="",d="";if($defined(b)){var g=i.substring(0,b[0]);var c=b[1];var d=i.substring(b[0]+c.length)}var f=i.toLowerCase();if(i==""){g="/msg ";obj=qwebirc.ui.QueryTabCompleter}else{if(h.client.isChannel(c)){obj=qwebirc.ui.ChannelNameTabCompleter}else{if(f.match(/^\/(q|query|msg) /i)){obj=qwebirc.ui.QueryTabCompleter}else{if(h.type==qwebirc.ui.WINDOW_QUERY){obj=qwebirc.ui.QueryNickTabCompleter}else{if(h.type==qwebirc.ui.WINDOW_CHANNEL){if(g==""){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(g,c,d,h);if(!$defined(this.obj)){return}}var a=this.obj.get();if(!$defined(a)){return}j.value=a[1];qwebirc.util.setCaretPos(j,a[0]+this.incr)},reset:function(){this.obj=null}});qwebirc.ui.TabIterator=new Class({initialize:function(g,b,h){this.prefix=b;if(!$defined(h)||h.length==0){this.list=null}else{var d=[];var c=qwebirc.irc.toIRCCompletion(g,b);for(var f=0;f<h.length;f++){var a=qwebirc.irc.toIRCCompletion(g,h[f]);if(a.startsWith(c)){d.push(h[f])}}this.list=d}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(b,a,f,d,c){this.existingNick=f;this.prefix=a;this.suffix=d;this.iterator=new qwebirc.ui.TabIterator(b,f,c)},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(a,d,c,b){this.parent(b.client,a,d,c,b.client.lastNicks)}});qwebirc.ui.QueryNickTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(b,d,f,c){var a=c.name;this.parent(c.client,b,d,f,[a])}});qwebirc.ui.ChannelNameTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(d,b,n,a){var g=[];var h=a.parentObject.windows[a.parentObject.getClientId(a.client)];for(var k in a.client.channels){var m=h[k];if($defined(m)){m=m.lastSelected}g.push([m,k])}g.sort(function(i,c){return c[0]-i[0]});var f=[];for(var j=0;j<g.length;j++){f.push(g[j][1])}this.parent(a.client,d,b,n,f)}});qwebirc.ui.ChannelUsersTabCompleter=new Class({Extends:qwebirc.ui.BaseTabCompleter,initialize:function(a,c,f,b){var d=b.client.tracker.getSortedByLastSpoke(b.name);this.parent(b.client,a,c,f,d)}});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(a){var b=new Request({url:a,async:false});var c;b.addEvent("complete",function(d){c=d});b.get();return c},__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(f){var c=f.replace("\r\n","\n").split("\n");var g={};var d;for(d=0;d<c.length;d++){var b=c[d];if(b.trim()===""){break}var h=b.splitMax("=",2);if(h.length!=2){continue}g[h[0]]=h[1]}var a=[];for(;d<c.length;d++){a.push(c[d])}return{cssText:a.join("\n"),rules:g}},set:function(f){if(!$defined(f)){f=function(g){return g}}var d=this.__cssText;for(var a in this.rules){var b=this.rules[a].split(",");var c=f.pass(b);d=d.replaceAll("$("+a+")",c)}this.__setStylesheet(d)}});qwebirc.ui.GenericLoginBox=function(b,h,i,d,g,c,a,f){if(g){qwebirc.ui.ConfirmBox(b,h,i,d,c,a,f)}else{qwebirc.ui.LoginBox(b,h,i,d,a,f)}};qwebirc.ui.AuthLogin=function(b){var a=Cookie.write("redirect",document.location);document.location=qwebirc.global.dynamicBaseURL+"auth/";new Event(b).stop()};qwebirc.ui._createRecaptcha=function(f,b,a){var h=new Element("p",{"class":"qwebirc-recaptcha-incorrect"});h.set("text","Incorrect. Please try again.");var d=f("",h,{display:"none"})[0];h=f("",new Element("div",{id:"recaptcha_image"}));var g=h.parentNode.firstChild;h=new Element("a",{href:"javascript:Recaptcha.showhelp()"});h.set("text","reCAPTCHA:");g.appendChild(h);var c=new Element("span");c.appendChild(new Element("input",{type:"text",id:"recaptcha_response_field",name:"recaptcha_response_field"}));h=new Element("input",{type:"button",value:"Reload"});h.addEvent("click",function(i){new Event(i).stop();Recaptcha.reload()});c.appendChild(h);f("",c);h=new Element("input",{type:"checkbox"});h.addEvent("click",function(i){if(i.target.checked){Recaptcha.switch_type("audio")}else{Recaptcha.switch_type("image")}});f("Audio captcha:",h);a.theme="custom";Recaptcha.create(b,null,a);return d};qwebirc.ui._verifyRecaptcha=function(f,b){var d=qwebirc.util.randHexString(16);var c=new Request.JSON({url:qwebirc.global.dynamicBaseURL+"e/r?r="+d,async:true});c.addEvent("complete",function(g){if(!g){alert("Server failure verifying captcha")}else{if(g[0]){Recaptcha.destroy();f(g[1])}else{b.setStyle("display",null);Recaptcha.reload()}}});var a=("&recaptchaC="+encodeURIComponent(Recaptcha.get_challenge())+"&recaptchaR="+encodeURIComponent(Recaptcha.get_response()));c.send(a)};qwebirc.ui.ConfirmBox=function(h,g,z,t,r,j,m){var s=new Element("table");s.addClass("qwebirc-centrebox");h.appendChild(s);var a=new Element("tbody");s.appendChild(a);var b=new Element("tr");a.appendChild(b);var l=new Element("td");b.appendChild(l);var d=new Element("form");l.appendChild(d);var o=new Element("table");o.addClass("qwebirc-confirmbox");d.appendChild(o);var a=new Element("tbody");o.appendChild(a);function f(c,D,i){var B=new Element("tr");a.appendChild(B);var C=new Element("td");if(c){C.set("text",c)}B.appendChild(C);var A=new Element("td");B.appendChild(A);if($defined(D)){A.appendChild(D)}if($defined(i)){B.setStyles(i);return[B,A]}return A}var b=new Element("tr");a.appendChild(b);b.addClass("tr1");var p=new Element("td",{colspan:"2"});b.appendChild(p);var x=new Element("b");x.set("text",z);var y=t.split(" ")[0].split(",");p.appendChild(document.createTextNode("To connect to "+j+" IRC and join channel"+((y.length>1)?"s":"")+" "));for(var q=0;q<y.length;q++){if((y.length>1)&&(q==y.length-1)){p.appendChild(document.createTextNode(" and "))}else{if(q>0){p.appendChild(document.createTextNode(", "))}}p.appendChild(new Element("b").set("text",y[q]))}if(!r){p.appendChild(document.createTextNode(" as "));p.appendChild(x)}p.appendChild(document.createTextNode(" click 'Connect'."));p.appendChild(new Element("br"));if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){p.appendChild(document.createTextNode("If you'd like to connect using your Q auth click 'Log in'."))}if(m){var k=qwebirc.ui._createRecaptcha(f,m,{callback:Recaptcha.focus_response_field})}var b=new Element("tr");a.appendChild(b);b.addClass("tr2");var l;if(m){l=new Element("td");b.appendChild(l);l=new Element("td");b.appendChild(l)}else{l=new Element("td",{colspan:"2"});l.setStyle("text-align","center")}var u=new Element("input",{type:"submit",value:"Connect"});l.appendChild(u);function v(c){h.removeChild(s);g({nickname:z,autojoin:t,sessionid:c})}u.addEvent("click",function(c){new Event(c).stop();if(!m){v(null)}else{qwebirc.ui._verifyRecaptcha(v,k)}});if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){var n=new Element("input",{type:"submit",value:"Log in"});l.appendChild(n);n.addEvent("click",qwebirc.ui.AuthLogin)}if(window==window.top){u.focus()}};qwebirc.ui.LoginBox=function(j,i,E,A,m,q){var z=new Element("table");z.addClass("qwebirc-centrebox");j.appendChild(z);var a=new Element("tbody");z.appendChild(a);var b=new Element("tr");a.appendChild(b);var o=new Element("td");b.appendChild(o);var t=new Element("table");t.addClass("qwebirc-loginbox");o.appendChild(t);var a=new Element("tbody");t.appendChild(a);var b=new Element("tr");a.appendChild(b);b.addClass("tr1");var o=new Element("td");b.appendChild(o);o.set("html","<h1>Connect to "+m+" IRC</h1>");var b=new Element("tr");a.appendChild(b);b.addClass("tr2");var o=new Element("td");b.appendChild(o);var c=new Element("form");o.appendChild(c);var g=new Element("table");c.appendChild(g);var a=new Element("tbody");g.appendChild(a);function d(F,K,G){var I=new Element("tr");a.appendChild(I);var J=new Element("td");if(F){J.set("text",F)}I.appendChild(J);var H=new Element("td");I.appendChild(H);if($defined(K)){H.appendChild(K)}if($defined(G)){I.setStyles(G);return[I,H]}return H}var B=new Element("input");d("Nickname:",B);var y=null;if(qwebirc.auth.enabled()&&qwebirc.auth.bouncerAuth()){y={display:"none"}}var D=new Element("input");d("Channels:",D,y);if(qwebirc.auth.enabled()){if(qwebirc.auth.passAuth()){var v=d("Auth to services:");var p=qwebirc.util.createInput("checkbox",v,"connect_auth_to_services",false);var x=new Element("input");var C=d("Username:",x,{display:"none"})[0];var f=d("Password:",null,{display:"none"});var k=qwebirc.util.createInput("password",f[1],"connect_auth_password");p.addEvent("click",function(r){qwebirc.ui.authShowHide(p,v,x,C,f[0])})}else{if(qwebirc.auth.bouncerAuth()){var f=d("Password:");var k=qwebirc.util.createInput("password",f,"connect_auth_password")}}}if(q){var n=qwebirc.ui._createRecaptcha(d,q,{})}var h=new Element("input",{type:"submit"});h.set("value","Connect");var l=new Element("a",{href:"https://www.privateinternetaccess.com/",tabindex:-1});l.appendChild(new Element("img",{src:qwebirc.global.staticBaseURL+"images/vpn.png",title:"privateinternetaccess",alt:"privateinternetaccess"}));var u=d(null,h);u.parentNode.firstChild.appendChild(l);if(qwebirc.auth.enabled()&&qwebirc.auth.quakeNetAuth()&&!qwebirc.auth.loggedin()){var s=new Element("input",{type:"submit",value:"Log in"});u.appendChild(s);s.addEvent("click",qwebirc.ui.AuthLogin)}c.addEvent("submit",function(H){new Event(H).stop();var r=B.value;var J=D.value;if(J=="#"){J=""}if(!r){alert("You must supply a nickname.");B.focus();return}var I=qwebirc.global.nicknameValidator.validate(r);if(I!=r){B.value=I;alert("Your nickname was invalid and has been corrected; please check your altered nickname and press Connect again.");B.focus();return}var G={nickname:r,autojoin:J};if(qwebirc.auth.enabled()){if(qwebirc.auth.passAuth()&&p.checked){if(!x.value||!k.value){alert("You must supply your username and password in auth mode.");if(!x.value){x.focus()}else{k.focus()}return}G.serverPassword=x.value+" "+k.value}else{if(qwebirc.auth.bouncerAuth()){if(!k.value){alert("You must supply a password.");k.focus();return}G.serverPassword=k.value}}}function F(K){if(K){G.sessionid=K}j.removeChild(z);i(G)}if(!q){F(null)}else{qwebirc.ui._verifyRecaptcha(F,n)}}.bind(this));B.set("value",E);D.set("value",A);if(window==window.top){B.focus()}};qwebirc.ui.authShowHide=function(d,h,c,b,a){var g=d.checked;var f=g?null:"none";b.setStyle("display",f);a.setStyle("display",f);if(g){c.focus()}};qwebirc.ui.EmbedWizardStep=new Class({Implements:[Options,Events],options:{title:"",first:"",hint:"",middle:null,premove:null,example:""},initialize:function(a,b){this.setOptions(b);this.parent=a},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:{uiOptions:null,optionsCallback:null,baseURL:"http://webchat.quakenet.org/"},initialize:function(a,b){this.options.uiOptions=b.uiOptions;this.options.baseURL=b.baseURL;this.options.optionsCallback=b.optionsCallback;this.create(a);this.addSteps()},create:function(f){this.t=f;var c=this.newRow();this.title=new Element("h2");this.title.setStyle("margin-top","0px");this.title.setStyle("margin-bottom","5px");c.appendChild(this.title);this.firstRow=this.newRow();this.middleRow=this.newRow();var d=this.newRow();this.hint=new Element("div");this.hint.setStyle("font-size","0.8em");this.hint.setStyle("font-style","italic");d.appendChild(this.hint);var b=this.newRow();this.example=new Element("pre");b.appendChild(this.example);var h=this.newRow();h.addClass("wizardcontrols");var g=new Element("input");g.type="submit";g.value="< Back";g.addEvent("click",this.back.bind(this));h.appendChild(g);var a=new Element("input");a.type="submit";a.value="Next >";h.appendChild(a);a.addEvent("click",this.next.bind(this));this.nextBtn=a;this.backBtn=g},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(a,h,c,d){var g=new Element("div");a.appendChild(g);var i=qwebirc.util.generateID();var f=qwebirc.util.createInput("radio",g,c,d,i);var b=new Element("label",{"for":i});b.appendChild(document.createTextNode(h));g.appendChild(b);return f},addSteps:function(){var c=function(j){if(Browser.Engine.trident){var i=function(){this.focus();if(j){this.select()}};i.delay(100,this,[])}else{this.focus();this.select()}};this.welcome=this.newStep({title:"Add webchat to your website",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",c.bind(this.chanBox));var g=new Element("div");this.customnick=this.newStep({title:"Choose a 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:g});this.choosenick=this.newRadio(g,"Make the user choose a nickname.","nick",true);this.randnick=this.newRadio(g,"Use a random nickname, e.g. qwebirc12883.","nick");this.presetnick=this.newRadio(g,"Use a preset nickname of your choice.","nick");var f=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:f,hint:"You need to display the dialog if you want the user to be able to set their nickname before connecting."});var b=new Element("div");this.currentLF=this.newRadio(b,"Use the current look and feel (","lookandfeel",true);var h=new Element("input");h.type="submit";h.value="alter";h.addEvent("click",this.options.optionsCallback);b.firstChild.appendChild(h);b.firstChild.appendChild(document.createTextNode(")."));this.defaultLF=this.newRadio(b,"Use the default look and feel.","lookandfeel");this.lookandfeel=this.newStep({title:"Configure look and feel",first:"The look and feel will be copied from the current settings.",middle:b});var d=this.newRadio(f,"Connect without displaying the dialog.","prompt",true);this.connectdialogr=this.newRadio(f,"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:",premove:function(){if(this.nicknameBox.value==""){alert("You must supply a nickname.");this.nicknameBox.focus();return false}var i=qwebirc.global.nicknameValidator.validate(this.nicknameBox.value,true);if(i!=this.nicknameBox.value){this.nicknameBox.value=i;alert("The supplied nickname was invalid and has been corrected.");this.nicknameBox.focus();return false}return true}.bind(this),middle:this.nicknameBox,hint:"If you use a . (dot/period) then it will be substituted with a random number."}).addEvent("show",c.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 l=new Element("a");var i=new Element("input");i.addClass("iframetext");var j=this.generateURL(false);l.href=j;l.target="_blank";l.appendChild(document.createTextNode(j));i.value='<iframe src="'+j+'" width="647" height="400"></iframe>';var k=[l,new Element("br"),new Element("br"),document.createTextNode("You can embed this into your page with the following code:"),new Element("br"),i];while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}k.forEach(function(m){a.appendChild(m)});c.bind(i)(true);i.addEvent("click",function(){this.select()}.bind(i))}.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.lookandfeel);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 i=this.chanBox.value;var b=this.nicknameBox.value;var g=this.connectdialogr.checked&&i!=""&&!this.choosenick.checked;var a=[];if(this.presetnick.checked){a.push("nick="+escape(b))}else{if(!this.choosenick.checked){a.push("randomnick=1")}}if(i){var h=i.split(",");var f=[];h.forEach(function(d){f.push(d)});a.push("channels="+escape(f.join(",")))}if(g){a.push("prompt=1")}if(this.currentLF.checked){var c=this.options.uiOptions.serialise();if(c!=""){a.push("uio="+c)}}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]},applyChanges: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 channel lines",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}},{applyChanges:function(b,a){a.setModifiableStylesheetValues({hue:b})}}],[12,"QUERY_ON_NICK_CLICK","Query on nickname click in channel",false],[13,"SHOW_NICKLIST","Show nickname list in channels",true],[14,"SHOW_TIMESTAMPS","Show timestamps",true]];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,a,b,c,f){if(!$defined(a)){a=this.parentElement}return qwebirc.util.createInput(d,a,b,c,this.option.id)},FE:function(b,a){var c=new Element(b);if(!$defined(a)){a=this.parentElement}a.appendChild(c);return c},focus:function(){this.mainElement.focus()},render:function(){this.event("render",this.mainElement)},applyChanges:function(){this.event("applyChanges",[this.get(),this.parentObject.optionObject.ui])},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.mainElement.value}});qwebirc.config.HueInput=new Class({Extends:qwebirc.config.Input,render:function(){var c=new Element("div");c.addClass("qwebirc-optionspane");c.addClass("hue-slider");this.parentElement.appendChild(c);var b=new Element("div");b.addClass("knob");if(Browser.Engine.trident){b.setStyle("top","0px");b.setStyle("background-color","black")}c.appendChild(b);var a=new Slider(c,b,{steps:36,range:[0,369],wheel:true});a.set(this.value);this.startValue=this.value;a.addEvent("change",function(d){this.value=d;this.applyChanges()}.bind(this));this.mainElement=c;if(!this.enabled){a.detach()}this.parent()},get:function(){return this.value},cancel:function(){this.value=this.startValue;this.applyChanges()}});qwebirc.config.CheckInput=new Class({Extends:qwebirc.config.Input,render:function(){var a=this.createInput("checkbox",null,null,null,this.id);this.mainElement=a;a.checked=this.value;a.disabled=!this.enabled;this.parent()},get:function(){return 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 f=this.FE("div",this.parentObject);var c=this.createInput("radio",f,"options_radio"+this.position,a==this.option.position);this.elements.push(c);c.disabled=!this.enabled;if(a==0){this.mainElement=c}f.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.option.options[b][1]}}}});qwebirc.config.Option=new Class({initialize:function(c,b,f,g,d){this.prefix=b;this.label=f;this.default_=g;this.optionId=c;this.extras=d;if($defined(d)&&$defined(d.enabled)){var a=d.enabled();this.enabled=a[0];if(!a[0]&&a.length>1){this.default_=a[1]}}else{this.enabled=true}if($defined(d)&&$defined(d.settableByURL)){this.settableByURL=d.settableByURL}else{this.settableByURL=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(b,a,d,g,c,f){this.options=f.map(function(h){if(typeof(h)=="string"){return[h,h]}return h});this.defaultposition=g;this.parent(b,a,d,this.options[g][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(j){var c=j[0];var a=j[1];var k=j[2];var b=j[3];var f=j[4];var d=j[5];var h=typeof(b);if(h=="number"){return new qwebirc.config.RadioOption(c,a,k,b,f,extra)}else{var g;if(h=="boolean"){g=qwebirc.config.CheckOption}else{if(h=="function"){var i=b();g=i.class_;b=i.default_}else{g=qwebirc.config.TextOption}}return new g(c,a,k,b,f)}})},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 g=function(p,i){var q=new Element(p);i.appendChild(q);return q};var n=g("table",this.parentElement);var c=g("tbody",n);this.boxList=[];var b=this.optionObject.getOptionList();for(var d=0;d<b.length;d++){var m=b[d];var o=g("tr",c);var j=g("td",o);m.id=qwebirc.util.generateID();var l=new Element("label",{"for":m.id});j.appendChild(l);l.set("text",m.label+":");var h=g("td",o);this.boxList.push([m,new m.Element(h,m,d,this)])}var a=g("tr",c);var j=g("td",a);var h=g("td",a);var f=qwebirc.util.createInput("submit",h);f.value="Save";f.addEvent("click",function(){this.save();this.fireEvent("close")}.bind(this));var k=qwebirc.util.createInput("submit",h);k.value="Cancel";k.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.boxList.forEach(function(a){a[1].applyChanges()}.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.SuppliedArgOptions=new Class({Extends:qwebirc.ui.CookieOptions,initialize:function(d,a){var f={};if($defined(a)&&a!=""&&a.length>2){var c=a.substr(a.length-2,2);var b=qwebirc.util.b64Decode(a.substr(0,a.length-2));if(b&&(new qwebirc.util.crypto.MD5().digest(b).slice(0,2)==c)){f=qwebirc.util.parseURI("?"+b)}}this.parsedOptions=f;this.parent(d)},_get:function(a){if(a.settableByURL!==true){return this.parent(a)}var b=this.parsedOptions[a.optionId];if(!$defined(b)){return this.parent(a)}return b},serialise:function(){var c=[];this.getOptionList().forEach(function(d){if(d.settableByURL&&d.default_!=d.value){c.push(d.optionId+"="+d.value)}}.bind(this));var a=c.join("&");var b=new qwebirc.util.crypto.MD5().digest(a).slice(0,2);return(qwebirc.util.b64Encode(a)).replaceAll("=","")+b}});qwebirc.ui.DefaultOptionsClass=new Class({Extends:qwebirc.ui.SuppliedArgOptions});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=qwebirc.ui.RequestTransformHTML({url:qwebirc.global.staticBaseURL+"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=qwebirc.ui.RequestTransformHTML({url:qwebirc.global.staticBaseURL+"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=qwebirc.ui.RequestTransformHTML({url:qwebirc.global.staticBaseURL+"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 f=b.getElement("textarea");this.textbox=f;b.getElement("input[class=submitfeedback]").addEvent("click",function(){this.sendFeedback(b,f,f.value)}.bind(this));this.textboxVisible=true;this.onSelect()}.bind(this)});c.get()},onSelect:function(){if(this.textboxVisible){this.textbox.focus()}},sendFeedback:function(j,m,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!");m.focus();return}this.textboxVisible=false;var c=j.getElement("div[class=enterarea]");c.setStyle("display","none");var d=j.getElement("div[class=messagearea]");var n=j.getElement("p[class=messagetext]");var g=j.getElement("input[class=close2]");n.set("text","Submitting. . .");d.setStyle("display","");var h=0;var b=encodeURIComponent(l);for(var f=0;f<l.length;f++){h=((h+1)%256)^(l.charCodeAt(f)%256)}var a=new Request({url:qwebirc.global.dynamicBaseURL+"feedback",onSuccess:function(){n.set("text","Submitted successfully, thanks for the feedback!");g.setStyle("display","")},onFailure:function(){this.textboxVisible=true;d.setStyle("display","none");c.setStyle("display","");k.set("text","Looks like something went wrong submitting :(")}.bind(this)}).send("feedback="+l+"&c="+h)}});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=qwebirc.ui.RequestTransformHTML({url:qwebirc.global.staticBaseURL+"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:[],recaptchaKey:null,loginRegex:null,appTitle:"ExampleNetwork Web IRC",searchURL:true,theme:undefined,baseURL:null,hue:null,saturation:null,lightness:null,uiOptionsArg:null,nickValidation:null,dynamicBaseURL:"/",staticBaseURL:"/",recaptcha:null},initialize:function(a,c,b){this.setOptions(b);qwebirc.global={dynamicBaseURL:b.dynamicBaseURL,staticBaseURL:b.staticBaseURL,nicknameValidator:$defined(b.nickValidation)?new qwebirc.irc.NicknameValidator(b.nickValidation):new qwebirc.irc.DummyNicknameValidator()};window.addEvent("domready",function(){var t=function(p){var i=new qwebirc.irc.IRCClient(p,r);i.connect();window.onbeforeunload=qwebirc_ui_onbeforeunload;window.addEvent("unload",function(){i.quit("Page closed")})};var u=null;var m=this.options.initialChannels;var k=false;if(this.options.searchURL){var q=qwebirc.util.parseURI(String(document.location));this.options.hue=this.getHueArg(q);this.options.saturation=this.getSaturationArg(q);this.options.lightness=this.getLightnessArg(q);if($defined(q.uio)){this.options.uiOptionsArg=q.uio}var g=q.url;var h,f=q.nick;if($defined(g)){m=this.parseIRCURL(g);if($defined(h)&&h!=""){o=true}}else{h=q.channels;var o=false;if(h){var s=h.split(" ");h=s[0].split(",");var v=[];for(var l=0;l<h.length;l++){v[l]=h[l];if(h[l].charAt(0)!="#"){v[l]="#"+v[l]}}s[0]=v.join(",");m=s.join(" ");o=true}}if($defined(f)){u=this.randSub(f)}if(q.randomnick&&q.randomnick==1){u=this.options.initialNickname}if(o&&(!$defined(u)||($defined(u)&&(u!="")))){var j=q.prompt;var x=false;if(!$defined(j)||j==""){x=true;j=false}else{if(j=="0"){j=false}else{j=true}}if($defined(u)&&!j){k=true}else{if(!x&&!j){k=true}}}}var r=new c($(a),new qwebirc.ui.Theme(this.options.theme),this.options);var n=!$defined(f);if(n&&k){u=this.options.initialNickname}var d=r.loginBox(t,u,m,k,n)}.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},getSaturationArg:function(b){var a=b.saturation;if(!$defined(a)){return null}a=parseInt(a);if(a>100||a<-100){return null}return a},getLightnessArg:function(a){var b=a.lightness;if(!$defined(b)){return null}b=parseInt(b);if(b>100||b<-100){return null}return b},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 b=a.splitMax(":",2);if(b[0].toLowerCase()!="irc"&&b[0].toLowerCase()!="ircs"){alert("Bad IRC URL scheme.");return}if(a.indexOf("/")==0){return}var o=a.splitMax("/",4);if(o.length<4||o[3]==""){return}var j,f;if(o[3].indexOf("?")>-1){f=qwebirc.util.parseURI(o[3]);j=o[3].splitMax("?",2)[0]}else{j=o[3]}var c=j.split(",");var h=c[0];if(h.charAt(0)!="#"){h="#"+h}var n=[],g=false,m;for(var d=1;d<c.length;d++){var l=c[d];if(l=="needkey"){g=true}else{n.push(l)}}if($defined(f)){for(var k in f){var l=f[k];if(k=="key"){m=l;g=true}else{n.push(k)}}}if(g){if(!$defined(m)){m=prompt("Please enter the password for channel "+h+":")}if($defined(m)){h=h+" "+m}}if(n.length>0){alert("The following IRC URL components were not accepted: "+n.join(", ")+".")}return h}});qwebirc.auth.loggedin=function(){var a=Cookie.read("user");return a};qwebirc.auth.enabled=function(){return true};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(qwebirc.global.staticBaseURL+"js/"+(debugMode?"soundmanager2":"soundmanager2-nodebug-jsmin")+".js","soundManager",function(){soundManager.url=qwebirc.global.staticBaseURL+"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",qwebirc.global.staticBaseURL+"sound/beep3.mp3");this.beepLoaded=true}this.playSound("beep")}});qwebirc.ui.QUI=new Class({Extends:qwebirc.ui.RootUI,initialize:function(b,c,a){this.parent(b,qwebirc.ui.QUI.Window,"qui",a);this.theme=c;this.parentElement=b;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",c)}.bind(this);var c=function(){a.hide()};a.hide();this.parentElement.appendChild(a);this.UICommands.forEach(function(f){var i=f[0];var g=this[f[1]+"Window"].bind(this);var h=new Element("a");h.addEvent("mousedown",function(j){new Event(j).stop()});h.addEvent("click",function(){a.hide();g()});h.set("text",i);a.appendChild(h)}.bind(this));var b=new Element("div");b.addClass("dropdown-tab");b.appendChild(new Element("img",{src:qwebirc.global.staticBaseURL+"images/icon.png",title:"menu",alt:"menu"}));b.setStyle("opacity",1);var d=new Fx.Tween(b,{duration:"long",property:"opacity",link:"chain"});d.start(0.25);d.start(1);d.start(0.33);d.start(1);this.outerTabs.appendChild(b);a.show=function(f){new Event(f).stop();this.hideHint();if(a.visible){a.hide();return}var g=this.outerTabs.getSize().y;a.setStyle("left",0);a.setStyle("top",g-1);a.setStyle("display","inline-block");a.visible=true;document.addEvent("mousedown",c)}.bind(this);b.addEvent("mousedown",function(f){new Event(f).stop()});b.addEvent("click",a.show)},__createDropdownHint:function(){var a=new Element("div");a.addClass("dropdownhint");a.set("text","Click the icon for the main menu.");a.setStyle("top",this.outerTabs.getSize().y+5);this.parentElement.appendChild(a);new Fx.Morph(a,{duration:"normal",transition:Fx.Transitions.Sine.easeOut}).start({left:[900,5]});var c=function(){new Fx.Morph(a,{duration:"long"}).start({left:[5,-900]})}.delay(4000,this);var b=function(){if(a.hidden){return}this.parentElement.removeChild(a);a.hidden=1}.bind(this);b.delay(4000);this.hideHint=b;document.addEvent("mousedown",b);document.addEvent("keypress",b)},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=470;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 f=new Element("input",{type:"button"});f.addClass("mobile-button");f.addEvent("click",function(){c();b.focus()});f.value=">";this.input.appendChild(f);var a=function(){var i=this.input.getSize();var g=f.getSize();var h=i.x-g.x-5;f.setStyle("left",h);b.setStyle("width",h-5);f.setStyle("height",i.y)}.bind(this);this.qjsui.addEvent("reflow",a)}else{b.addClass("keyboard-input")}d.addEvent("submit",function(g){new Event(g).stop();c()});b.addEvent("focus",this.resetTabComplete.bind(this));b.addEvent("mousedown",this.resetTabComplete.bind(this));b.addEvent("keydown",function(i){var g;var j=b.value;if(i.key=="up"){g=this.commandhistory.upLine}else{if(i.key=="down"){g=this.commandhistory.downLine}else{if(i.key=="tab"){new Event(i).stop();this.tabComplete(b);return}else{this.resetTabComplete();return}}}this.resetTabComplete();if((j!="")&&(this.lastcvalue!=j)){this.commandhistory.addLine(j,true)}var h=g.bind(this.commandhistory)();new Event(i).stop();if(!h){h=""}this.lastcvalue=h;b.value=h;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(c,a,b){this.parent=a;this.sizer=$defined(b)?b:a;this.class_=c;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 i=this.bottom;var k=this.middle;var m=this.right;var d=this.topic;var l=this.top;var j=d.getSize();var c=l.getSize();var f=m.getSize();var h=i.getSize();var g=this.sizer.getSize();var a=(g.y-c.y-h.y-j.y);var b=(g.x-f.x);d.setStyle("top",c.y);k.setStyle("top",(c.y+j.y));if(a>0){k.setStyle("height",a);m.setStyle("height",a)}if(b>0){k.setStyle("width",b)}m.setStyle("top",(c.y+j.y));m.setStyle("left",b);i.setStyle("top",(g.y-h.y));this.fireEvent("reflow")},showChannel:function(b,a){var c="none";if(b){c="block"}this.right.setStyle("display",a?c:"none");this.topic.setStyle("display",c)},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(g,d,c,a,b){this.parent(g,d,c,a,b);this.tab=new Element("a",{href:"#"});this.tab.addClass("tab");this.tab.addEvent("focus",function(){this.blur()}.bind(this.tab));this.spaceNode=document.createTextNode(" ");g.tabs.appendChild(this.tab);g.tabs.appendChild(this.spaceNode);this.tab.appendText(a);this.tab.addEvent("click",function(i){new Event(i).stop();if(this.closed){return}g.selectWindow(this)}.bind(this));if(c!=qwebirc.ui.WINDOW_STATUS&&c!=qwebirc.ui.WINDOW_CONNECT){var f=new Element("span");f.set("text","X");f.addClass("tabclose");var h=function(i){new Event(i).stop();if(this.closed){return}if(c==qwebirc.ui.WINDOW_CHANNEL){this.client.exec("/PART "+a)}this.close()}.bind(this);f.addEvent("click",h);this.tab.addEvent("mouseup",function(j){var i=1;if(Browser.Engine.trident){i=4}if(j.event.button==i){h(j)}}.bind(this));this.tab.appendChild(f)}this.lines=new Element("div");this.parentObject.qjsui.applyClasses("middle",this.lines);this.lines.addClass("lines");if(c!=qwebirc.ui.WINDOW_CUSTOM&&c!=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(c==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(c==qwebirc.ui.WINDOW_CHANNEL){this.updateTopic("")}this.nicksColoured=this.parentObject.uiOptions.NICK_COLOURS;this.reflow()},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(a,b){var d=new Element("div");b.appendChild(d);d.addClass("menu");var c=[a];qwebirc.ui.MENU_ITEMS.forEach(function(f){if(!f.predicate||f.predicate!==true&&!f.predicate.apply(this,c)){return}var g=new Element("a");d.appendChild(g);g.href="#";g.set("text","- "+f.text);g.addEvent("focus",function(){this.blur()}.bind(g));g.addEvent("click",function(h){new Event(h.stop());this.menuClick(f.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(b,a){var d=this.client.stripPrefix(b);var f=new Element("a");qwebirc.ui.insertAt(a,this.nicklist,f);f.href="#";var c=new Element("span");if(this.parentObject.uiOptions.NICK_COLOURS){var g=d.toHSBColour(this.client);if($defined(g)){c.setStyle("color",g.rgbToHex())}}c.set("text",b);f.appendChild(c);f.realNick=d;f.addEvent("click",function(h){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(h).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.parentObject.uiOptions.SHOW_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 g=f.realNick.toHSBColour(this.client);if($defined(g)){d.setStyle("color",g.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);this.parentObject.tabs.removeChild(this.spaceNode);this.reflow()},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}}});



0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

FB Gadgets | Template Designed by Fatakat PhotosCoolBThemes.com
Code by : paid web directory

https://www.google.co.uk/search?q=site%3Ablogspot.com+fbgadgets