var MooTools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};
var Native=function(K){K=K||{};
var A=K.name;
var I=K.legacy;
var B=K.protect;
var C=K.implement;
var H=K.generics;
var F=K.initialize;
var G=K.afterImplement||function(){};
var D=F||I;
H=H!==false;
D.constructor=Native;
D.$family={name:"native"};
if(I&&F){D.prototype=I.prototype
}D.prototype.constructor=D;
if(A){var E=A.toLowerCase();
D.prototype.$family={name:E};
Native.typize(D,E)
}var J=function(N,L,O,M){if(!B||M||!N.prototype[L]){N.prototype[L]=O
}if(H){Native.genericize(N,L,B)
}G.call(N,L,O);
return N
};
D.alias=function(N,L,P){if(typeof N=="string"){var O=this.prototype[N];
if((N=O)){return J(this,L,N,P)
}}for(var M in N){this.alias(M,N[M],L)
}return this
};
D.implement=function(M,L,O){if(typeof M=="string"){return J(this,M,L,O)
}for(var N in M){J(this,N,M[N],L)
}return this
};
if(C){D.implement(C)
}return D
};
Native.genericize=function(B,C,A){if((!A||!B[C])&&typeof B.prototype[C]=="function"){B[C]=function(){var D=Array.prototype.slice.call(arguments);
return B.prototype[C].apply(D.shift(),D)
}
}};
Native.implement=function(D,C){for(var B=0,A=D.length;
B<A;
B++){D[B].implement(C)
}};
Native.typize=function(A,B){if(!A.type){A.type=function(C){return($type(C)===B)
}
}};
(function(){var A={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};
for(var G in A){new Native({name:G,initialize:A[G],protect:true})
}var D={"boolean":Boolean,"native":Native,object:Object};
for(var C in D){Native.typize(D[C],C)
}var F={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 E in F){for(var B=F[E].length;
B--;
){Native.genericize(A[E],F[E][B],true)
}}})();
var Hash=new Native({name:"Hash",initialize:function(A){if($type(A)=="hash"){A=$unlink(A.getClean())
}for(var B in A){this[B]=A[B]
}return this
}});
Hash.implement({forEach:function(B,C){for(var A in this){if(this.hasOwnProperty(A)){B.call(C,this[A],A,this)
}}},getClean:function(){var B={};
for(var A in this){if(this.hasOwnProperty(A)){B[A]=this[A]
}}return B
},getLength:function(){var B=0;
for(var A in this){if(this.hasOwnProperty(A)){B++
}}return B
}});
Hash.alias("forEach","each");
Array.implement({forEach:function(C,D){for(var B=0,A=this.length;
B<A;
B++){C.call(D,this[B],B,this)
}}});
Array.alias("forEach","each");
function $A(B){if(B.item){var A=B.length,C=new Array(A);
while(A--){C[A]=B[A]
}return C
}return Array.prototype.slice.call(B)
}function $arguments(A){return function(){return arguments[A]
}
}function $chk(A){return !!(A||A===0)
}function $clear(A){clearTimeout(A);
clearInterval(A);
return null
}function $defined(A){return(A!=undefined)
}function $each(C,B,D){var A=$type(C);
((A=="arguments"||A=="collection"||A=="array")?Array:Hash).each(C,B,D)
}function $empty(){}function $extend(C,A){for(var B in (A||{})){C[B]=A[B]
}return C
}function $H(A){return new Hash(A)
}function $lambda(A){return($type(A)=="function")?A:function(){return A
}
}function $merge(){var A=Array.slice(arguments);
A.unshift({});
return $mixin.apply(null,A)
}function $mixin(E){for(var D=1,A=arguments.length;
D<A;
D++){var B=arguments[D];
if($type(B)!="object"){continue
}for(var C in B){var G=B[C],F=E[C];
E[C]=(F&&$type(G)=="object"&&$type(F)=="object")?$mixin(F,G):$unlink(G)
}}return E
}function $pick(){for(var B=0,A=arguments.length;
B<A;
B++){if(arguments[B]!=undefined){return arguments[B]
}}return null
}function $random(B,A){return Math.floor(Math.random()*(A-B+1)+B)
}function $splat(B){var A=$type(B);
return(A)?((A!="array"&&A!="arguments")?[B]:B):[]
}var $time=Date.now||function(){return +new Date
};
function $try(){for(var B=0,A=arguments.length;
B<A;
B++){try{return arguments[B]()
}catch(C){}}return null
}function $type(A){if(A==undefined){return false
}if(A.$family){return(A.$family.name=="number"&&!isFinite(A))?false:A.$family.name
}if(A.nodeName){switch(A.nodeType){case 1:return"element";
case 3:return(/\S/).test(A.nodeValue)?"textnode":"whitespace"
}}else{if(typeof A.length=="number"){if(A.callee){return"arguments"
}else{if(A.item){return"collection"
}}}}return typeof A
}function $unlink(C){var B;
switch($type(C)){case"object":B={};
for(var E in C){B[E]=$unlink(C[E])
}break;
case"hash":B=new Hash(C);
break;
case"array":B=[];
for(var D=0,A=C.length;
D<A;
D++){B[D]=$unlink(C[D])
}break;
default:return C
}return B
}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 B in this.Engines){var A=this.Engines[B]();
if(A){this.Engine={name:B,version:A};
this.Engine[B]=this.Engine[B+A]=true;
break
}}return{name:B,version:A}
};
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 A=($try(function(){return navigator.plugins["Shockwave Flash"].description
},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")
})||"0 r0").match(/\d+/g);
return{version:parseInt(A[0]||0+"."+A[1],10)||0,build:parseInt(A[2],10)||0}
})();
function $exec(B){if(!B){return B
}if(window.execScript){window.execScript(B)
}else{var A=document.createElement("script");
A.setAttribute("type","text/javascript");
A[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=B;
document.head.appendChild(A);
document.head.removeChild(A)
}return B
}Native.UID=1;
var $uid=(Browser.Engine.trident)?function(A){return(A.uid||(A.uid=[Native.UID++]))[0]
}:function(A){return A.uid||(A.uid=Native.UID++)
};
var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(A){$uid(A);
if(!A.Element){A.Element=$empty;
if(Browser.Engine.webkit){A.document.createElement("iframe")
}A.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{}
}A.document.window=A;
return $extend(A,Window.Prototype)
},afterImplement:function(B,A){window[B]=Window.Prototype[B]=A
}});
Window.Prototype={$family:{name:"window"}};
new Window(window);
var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(A){$uid(A);
A.head=A.getElementsByTagName("head")[0];
A.html=A.getElementsByTagName("html")[0];
if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){A.execCommand("BackgroundImageCache",false,true)
})
}if(Browser.Engine.trident){A.window.attachEvent("onunload",function(){A.window.detachEvent("onunload",arguments.callee);
A.head=A.html=A.window=null
})
}return $extend(A,Document.Prototype)
},afterImplement:function(B,A){document[B]=Document.Prototype[B]=A
}});
Document.Prototype={$family:{name:"document"}};
new Document(document);
Array.implement({every:function(C,D){for(var B=0,A=this.length;
B<A;
B++){if(!C.call(D,this[B],B,this)){return false
}}return true
},filter:function(D,E){var C=[];
for(var B=0,A=this.length;
B<A;
B++){if(D.call(E,this[B],B,this)){C.push(this[B])
}}return C
},clean:function(){return this.filter($defined)
},indexOf:function(C,D){var A=this.length;
for(var B=(D<0)?Math.max(0,A+D):D||0;
B<A;
B++){if(this[B]===C){return B
}}return -1
},map:function(D,E){var C=[];
for(var B=0,A=this.length;
B<A;
B++){C[B]=D.call(E,this[B],B,this)
}return C
},some:function(C,D){for(var B=0,A=this.length;
B<A;
B++){if(C.call(D,this[B],B,this)){return true
}}return false
},associate:function(C){var D={},B=Math.min(this.length,C.length);
for(var A=0;
A<B;
A++){D[C[A]]=this[A]
}return D
},link:function(C){var A={};
for(var E=0,B=this.length;
E<B;
E++){for(var D in C){if(C[D](this[E])){A[D]=this[E];
delete C[D];
break
}}}return A
},contains:function(A,B){return this.indexOf(A,B)!=-1
},extend:function(C){for(var B=0,A=C.length;
B<A;
B++){this.push(C[B])
}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(A){if(!this.contains(A)){this.push(A)
}return this
},combine:function(C){for(var B=0,A=C.length;
B<A;
B++){this.include(C[B])
}return this
},erase:function(B){for(var A=this.length;
A--;
A){if(this[A]===B){this.splice(A,1)
}}return this
},empty:function(){this.length=0;
return this
},flatten:function(){var D=[];
for(var B=0,A=this.length;
B<A;
B++){var C=$type(this[B]);
if(!C){continue
}D=D.concat((C=="array"||C=="collection"||C=="arguments")?Array.flatten(this[B]):this[B])
}return D
},hexToRgb:function(B){if(this.length!=3){return null
}var A=this.map(function(C){if(C.length==1){C+=C
}return C.toInt(16)
});
return(B)?A:"rgb("+A+")"
},rgbToHex:function(D){if(this.length<3){return null
}if(this.length==4&&this[3]==0&&!D){return"transparent"
}var B=[];
for(var A=0;
A<3;
A++){var C=(this[A]-0).toString(16);
B.push((C.length==1)?"0"+C:C)
}return(D)?B:"#"+B.join("")
}});
Function.implement({extend:function(A){for(var B in A){this[B]=A[B]
}return this
},create:function(B){var A=this;
B=B||{};
return function(D){var C=B.arguments;
C=(C!=undefined)?$splat(C):Array.slice(arguments,(B.event)?1:0);
if(B.event){C=[D||window.event].extend(C)
}var E=function(){return A.apply(B.bind||null,C)
};
if(B.delay){return setTimeout(E,B.delay)
}if(B.periodical){return setInterval(E,B.periodical)
}if(B.attempt){return $try(E)
}return E()
}
},run:function(A,B){return this.apply(B,$splat(A))
},pass:function(A,B){return this.create({bind:B,arguments:A})
},bind:function(B,A){return this.create({bind:B,arguments:A})
},bindWithEvent:function(B,A){return this.create({bind:B,arguments:A,event:true})
},attempt:function(A,B){return this.create({bind:B,arguments:A,attempt:true})()
},delay:function(B,C,A){return this.create({bind:C,arguments:A,delay:B})()
},periodical:function(C,B,A){return this.create({bind:B,arguments:A,periodical:C})()
}});
Number.implement({limit:function(B,A){return Math.min(A,Math.max(B,this))
},round:function(A){A=Math.pow(10,A||0);
return Math.round(this*A)/A
},times:function(B,C){for(var A=0;
A<this;
A++){B.call(C,A,this)
}},toFloat:function(){return parseFloat(this)
},toInt:function(A){return parseInt(this,A||10)
}});
Number.alias("times","each");
(function(B){var A={};
B.each(function(C){if(!Number[C]){A[C]=function(){return Math[C].apply(null,[this].concat($A(arguments)))
}
}});
Number.implement(A)
})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);
String.implement({test:function(A,B){return((typeof A=="string")?new RegExp(A,B):A).test(this)
},contains:function(A,B){return(B)?(B+this+B).indexOf(B+A+B)>-1:this.indexOf(A)>-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(A){return A.charAt(1).toUpperCase()
})
},hyphenate:function(){return this.replace(/[A-Z]/g,function(A){return("-"+A.charAt(0).toLowerCase())
})
},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase()
})
},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")
},toInt:function(A){return parseInt(this,A||10)
},toFloat:function(){return parseFloat(this)
},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return(A)?A.slice(1).hexToRgb(B):null
},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);
return(A)?A.rgbToHex(B):null
},stripScripts:function(B){var A="";
var C=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){A+=arguments[1]+"\n";
return""
});
if(B===true){$exec(A)
}else{if($type(B)=="function"){B(A,C)
}}return C
},substitute:function(A,B){return this.replace(B||(/\\?\{([^{}]+)\}/g),function(D,C){if(D.charAt(0)=="\\"){return D.slice(1)
}return(A[C]!=undefined)?A[C]:""
})
}});
Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(B){for(var A in this){if(this.hasOwnProperty(A)&&this[A]===B){return A
}}return null
},hasValue:function(A){return(Hash.keyOf(this,A)!==null)
},extend:function(A){Hash.each(A||{},function(C,B){Hash.set(this,B,C)
},this);
return this
},combine:function(A){Hash.each(A||{},function(C,B){Hash.include(this,B,C)
},this);
return this
},erase:function(A){if(this.hasOwnProperty(A)){delete this[A]
}return this
},get:function(A){return(this.hasOwnProperty(A))?this[A]:null
},set:function(A,B){if(!this[A]||this.hasOwnProperty(A)){this[A]=B
}return this
},empty:function(){Hash.each(this,function(B,A){delete this[A]
},this);
return this
},include:function(A,B){if(this[A]==undefined){this[A]=B
}return this
},map:function(B,C){var A=new Hash;
Hash.each(this,function(E,D){A.set(D,B.call(C,E,D,this))
},this);
return A
},filter:function(B,C){var A=new Hash;
Hash.each(this,function(E,D){if(B.call(C,E,D,this)){A.set(D,E)
}},this);
return A
},every:function(B,C){for(var A in this){if(this.hasOwnProperty(A)&&!B.call(C,this[A],A)){return false
}}return true
},some:function(B,C){for(var A in this){if(this.hasOwnProperty(A)&&B.call(C,this[A],A)){return true
}}return false
},getKeys:function(){var A=[];
Hash.each(this,function(C,B){A.push(B)
});
return A
},getValues:function(){var A=[];
Hash.each(this,function(B){A.push(B)
});
return A
},toQueryString:function(A){var B=[];
Hash.each(this,function(F,E){if(A){E=A+"["+E+"]"
}var D;
switch($type(F)){case"object":D=Hash.toQueryString(F,E);
break;
case"array":var C={};
F.each(function(H,G){C[G]=H
});
D=Hash.toQueryString(C,E);
break;
default:D=E+"="+encodeURIComponent(F)
}if(F!=undefined){B.push(D)
}});
return B.join("&")
}});
Hash.alias({keyOf:"indexOf",hasValue:"contains"});
var Event=new Native({name:"Event",initialize:function(A,F){F=F||window;
var K=F.document;
A=A||F.event;
if(A.$extended){return A
}this.$extended=true;
var J=A.type;
var G=A.target||A.srcElement;
while(G&&G.nodeType==3){G=G.parentNode
}if(J.test(/key/)){var B=A.which||A.keyCode;
var M=Event.Keys.keyOf(B);
if(J=="keydown"){var D=B-111;
if(D>0&&D<13){M="f"+D
}}M=M||String.fromCharCode(B).toLowerCase()
}else{if(J.match(/(click|mouse|menu)/i)){K=(!K.compatMode||K.compatMode=="CSS1Compat")?K.html:K.body;
var I={x:A.pageX||A.clientX+K.scrollLeft,y:A.pageY||A.clientY+K.scrollTop};
var C={x:(A.pageX)?A.pageX-F.pageXOffset:A.clientX,y:(A.pageY)?A.pageY-F.pageYOffset:A.clientY};
if(J.match(/DOMMouseScroll|mousewheel/)){var H=(A.wheelDelta)?A.wheelDelta/120:-(A.detail||0)/3
}var E=(A.which==3)||(A.button==2);
var L=null;
if(J.match(/over|out/)){switch(J){case"mouseover":L=A.relatedTarget||A.fromElement;
break;
case"mouseout":L=A.relatedTarget||A.toElement
}if(!(function(){while(L&&L.nodeType==3){L=L.parentNode
}return true
}).create({attempt:Browser.Engine.gecko})()){L=false
}}}}return $extend(this,{event:A,type:J,page:I,client:C,rightClick:E,wheel:H,relatedTarget:L,target:G,code:B,key:M,shift:A.shiftKey,control:A.ctrlKey,alt:A.altKey,meta:A.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
}});
function Class(B){if(B instanceof Function){B={initialize:B}
}var A=function(){Object.reset(this);
if(A._prototyping){return this
}this._current=$empty;
var C=(this.initialize)?this.initialize.apply(this,arguments):this;
delete this._current;
delete this.caller;
return C
}.extend(this);
A.implement(B);
A.constructor=Class;
A.prototype.constructor=A;
return A
}Function.prototype.protect=function(){this._protected=true;
return this
};
Object.reset=function(A,C){if(C==null){for(var E in A){Object.reset(A,E)
}return A
}delete A[C];
switch($type(A[C])){case"object":var D=function(){};
D.prototype=A[C];
var B=new D;
A[C]=Object.reset(B);
break;
case"array":A[C]=$unlink(A[C]);
break
}return A
};
new Native({name:"Class",initialize:Class}).extend({instantiate:function(B){B._prototyping=true;
var A=new B;
delete B._prototyping;
return A
},wrap:function(A,B,C){if(C._origin){C=C._origin
}return function(){if(C._protected&&this._current==null){throw new Error('The method "'+B+'" cannot be called.')
}var E=this.caller,F=this._current;
this.caller=F;
this._current=arguments.callee;
var D=C.apply(this,arguments);
this._current=F;
this.caller=E;
return D
}.extend({_owner:A,_origin:C,_name:B})
}});
Class.implement({implement:function(A,D){if($type(A)=="object"){for(var E in A){this.implement(E,A[E])
}return this
}var F=Class.Mutators[A];
if(F){D=F.call(this,D);
if(D==null){return this
}}var C=this.prototype;
switch($type(D)){case"function":if(D._hidden){return this
}C[A]=Class.wrap(this,A,D);
break;
case"object":var B=C[A];
if($type(B)=="object"){$mixin(B,D)
}else{C[A]=$unlink(D)
}break;
case"array":C[A]=$unlink(D);
break;
default:C[A]=D
}return this
}});
Class.Mutators={Extends:function(A){this.parent=A;
this.prototype=Class.instantiate(A);
this.implement("parent",function(){var B=this.caller._name,C=this.caller._owner.parent.prototype[B];
if(!C){throw new Error('The method "'+B+'" has no parent.')
}return C.apply(this,arguments)
}.protect())
},Implements:function(A){$splat(A).each(function(B){if(B instanceof Function){B=Class.instantiate(B)
}this.implement(B)
},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(C,B,A){C=Events.removeOn(C);
if(B!=$empty){this.$events[C]=this.$events[C]||[];
this.$events[C].include(B);
if(A){B.internal=true
}}return this
},addEvents:function(A){for(var B in A){this.addEvent(B,A[B])
}return this
},fireEvent:function(C,B,A){C=Events.removeOn(C);
if(!this.$events||!this.$events[C]){return this
}this.$events[C].each(function(D){D.create({bind:this,delay:A,"arguments":B})()
},this);
return this
},removeEvent:function(B,A){B=Events.removeOn(B);
if(!this.$events[B]){return this
}if(!A.internal){this.$events[B].erase(A)
}return this
},removeEvents:function(C){var D;
if($type(C)=="object"){for(D in C){this.removeEvent(D,C[D])
}return this
}if(C){C=Events.removeOn(C)
}for(D in this.$events){if(C&&C!=D){continue
}var B=this.$events[D];
for(var A=B.length;
A--;
A){this.removeEvent(D,B[A])
}}return this
}});
Events.removeOn=function(A){return A.replace(/^on([A-Z])/,function(B,C){return C.toLowerCase()
})
};
var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));
if(!this.addEvent){return this
}for(var A in this.options){if($type(this.options[A])!="function"||!(/^on[A-Z]/).test(A)){continue
}this.addEvent(A,this.options[A]);
delete this.options[A]
}return this
}});
var Element=new Native({name:"Element",legacy:window.Element,initialize:function(A,B){var C=Element.Constructors.get(A);
if(C){return C(B)
}if(typeof A=="string"){return document.newElement(A,B)
}return document.id(A).set(B)
},afterImplement:function(A,B){Element.Prototype[A]=B;
if(Array[A]){return 
}Elements.implement(A,function(){var C=[],G=true;
for(var E=0,D=this.length;
E<D;
E++){var F=this[E][A].apply(this[E],arguments);
C.push(F);
if(G){G=($type(F)=="element")
}}return(G)?new Elements(C):C
})
}});
Element.Prototype={$family:{name:"element"}};
Element.Constructors=new Hash;
var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var F=Array.link(arguments,{properties:Object.type,iframe:$defined});
var D=F.properties||{};
var C=document.id(F.iframe);
var E=D.onload||$empty;
delete D.onload;
D.id=D.name=$pick(D.id,D.name,C?(C.id||C.name):"IFrame_"+$time());
C=new Element(C||"iframe",D);
var B=function(){var G=$try(function(){return C.contentWindow.location.host
});
if(!G||G==window.location.host){var H=new Window(C.contentWindow);
new Document(C.contentWindow.document);
$extend(H.Element.prototype,Element.Prototype)
}E.call(C.contentWindow,C.contentWindow.document)
};
var A=$try(function(){return C.contentWindow
});
((A&&A.document.body)||window.frames[D.id])?B():C.addListener("load",B);
return C
}});
var Elements=new Native({initialize:function(F,B){B=$extend({ddup:true,cash:true},B);
F=F||[];
if(B.ddup||B.cash){var G={},E=[];
for(var C=0,A=F.length;
C<A;
C++){var D=document.id(F[C],!B.cash);
if(B.ddup){if(G[D.uid]){continue
}G[D.uid]=true
}if(D){E.push(D)
}}F=E
}return(B.cash)?$extend(F,this):F
}});
Elements.implement({filter:function(A,B){if(!A){return this
}return new Elements(Array.filter(this,(typeof A=="string")?function(C){return C.match(A)
}:A,B))
}});
Document.implement({newElement:function(A,B){if(Browser.Engine.trident&&B){["name","type","checked"].each(function(C){if(!B[C]){return 
}A+=" "+C+'="'+B[C]+'"';
if(C!="checked"){delete B[C]
}});
A="<"+A+">"
}return document.id(this.createElement(A)).set(B)
},newTextNode:function(A){return this.createTextNode(A)
},getDocument:function(){return this
},getWindow:function(){return this.window
},id:(function(){var A={string:function(D,C,B){D=B.getElementById(D);
return(D)?A.element(D,C):null
},element:function(B,E){$uid(B);
if(!E&&!B.$family&&!(/^object|embed$/i).test(B.tagName)){var C=Element.Prototype;
for(var D in C){B[D]=C[D]
}}return B
},object:function(C,D,B){if(C.toElement){return A.element(C.toElement(B),D)
}return null
}};
A.textnode=A.whitespace=A.window=A.document=$arguments(0);
return function(C,E,D){if(C&&C.$family&&C.uid){return C
}var B=$type(C);
return(A[B])?A[B](C,E,D||document):null
}
})()});
if(window.$==null){Window.implement({$:function(A,B){return document.id(A,B,this.document)
}})
}Window.implement({$$:function(A){if(arguments.length==1&&typeof A=="string"){return this.document.getElements(A)
}var F=[];
var C=Array.flatten(arguments);
for(var D=0,B=C.length;
D<B;
D++){var E=C[D];
switch($type(E)){case"element":F.push(E);
break;
case"string":F.extend(this.document.getElements(E,true))
}}return new Elements(F)
},getDocument:function(){return this.document
},getWindow:function(){return this
}});
Native.implement([Element,Document],{getElement:function(A,B){return document.id(this.getElements(A,true)[0]||null,B)
},getElements:function(A,D){A=A.split(",");
var C=[];
var B=(A.length>1);
A.each(function(E){var F=this.getElementsByTagName(E.trim());
(B)?C.extend(F):C=F
},this);
return new Elements(C,{ddup:B,cash:!D})
}});
(function(){var H={},F={};
var I={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};
var C=function(L){return(F[L]||(F[L]={}))
};
var G=function(N,L){if(!N){return 
}var M=N.uid;
if(Browser.Engine.trident){if(N.clearAttributes){var P=L&&N.cloneNode(false);
N.clearAttributes();
if(P){N.mergeAttributes(P)
}}else{if(N.removeEvents){N.removeEvents()
}}if((/object/i).test(N.tagName)){for(var O in N){if(typeof N[O]=="function"){N[O]=$empty
}}Element.dispose(N)
}}if(!M){return 
}H[M]=F[M]=null
};
var D=function(){Hash.each(H,G);
if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(G)
}if(window.CollectGarbage){CollectGarbage()
}H=F=null
};
var J=function(N,L,S,M,P,R){var O=N[S||L];
var Q=[];
while(O){if(O.nodeType==1&&(!M||Element.match(O,M))){if(!P){return document.id(O,R)
}Q.push(O)
}O=O[L]
}return(P)?new Elements(Q,{ddup:false,cash:!R}):null
};
var E={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"};
var B=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];
var K=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];
B=B.associate(B);
Hash.extend(E,B);
Hash.extend(E,K.associate(K.map(String.toLowerCase)));
var A={before:function(M,L){if(L.parentNode){L.parentNode.insertBefore(M,L)
}},after:function(M,L){if(!L.parentNode){return 
}var N=L.nextSibling;
(N)?L.parentNode.insertBefore(M,N):L.parentNode.appendChild(M)
},bottom:function(M,L){L.appendChild(M)
},top:function(M,L){var N=L.firstChild;
(N)?L.insertBefore(M,N):L.appendChild(M)
}};
A.inside=A.bottom;
Hash.each(A,function(L,M){M=M.capitalize();
Element.implement("inject"+M,function(N){L(this,document.id(N,true));
return this
});
Element.implement("grab"+M,function(N){L(document.id(N,true),this);
return this
})
});
Element.implement({set:function(O,M){switch($type(O)){case"object":for(var N in O){this.set(N,O[N])
}break;
case"string":var L=Element.Properties.get(O);
(L&&L.set)?L.set.apply(this,Array.slice(arguments,1)):this.setProperty(O,M)
}return this
},get:function(M){var L=Element.Properties.get(M);
return(L&&L.get)?L.get.apply(this,Array.slice(arguments,1)):this.getProperty(M)
},erase:function(M){var L=Element.Properties.get(M);
(L&&L.erase)?L.erase.apply(this):this.removeProperty(M);
return this
},setProperty:function(M,N){var L=E[M];
if(N==undefined){return this.removeProperty(M)
}if(L&&B[M]){N=!!N
}(L)?this[L]=N:this.setAttribute(M,""+N);
return this
},setProperties:function(L){for(var M in L){this.setProperty(M,L[M])
}return this
},getProperty:function(M){var L=E[M];
var N=(L)?this[L]:this.getAttribute(M,2);
return(B[M])?!!N:(L)?N:N||null
},getProperties:function(){var L=$A(arguments);
return L.map(this.getProperty,this).associate(L)
},removeProperty:function(M){var L=E[M];
(L)?this[L]=(L&&B[M])?false:"":this.removeAttribute(M);
return this
},removeProperties:function(){Array.each(arguments,this.removeProperty,this);
return this
},hasClass:function(L){return this.className.contains(L," ")
},addClass:function(L){if(!this.hasClass(L)){this.className=(this.className+" "+L).clean()
}return this
},removeClass:function(L){this.className=this.className.replace(new RegExp("(^|\\s)"+L+"(?:\\s|$)"),"$1");
return this
},toggleClass:function(L){return this.hasClass(L)?this.removeClass(L):this.addClass(L)
},adopt:function(){Array.flatten(arguments).each(function(L){L=document.id(L,true);
if(L){this.appendChild(L)
}},this);
return this
},appendText:function(M,L){return this.grab(this.getDocument().newTextNode(M),L)
},grab:function(M,L){A[L||"bottom"](document.id(M,true),this);
return this
},inject:function(M,L){A[L||"bottom"](this,document.id(M,true));
return this
},replaces:function(L){L=document.id(L,true);
L.parentNode.replaceChild(this,L);
return this
},wraps:function(M,L){M=document.id(M,true);
return this.replaces(M).grab(M,L)
},getPrevious:function(L,M){return J(this,"previousSibling",null,L,false,M)
},getAllPrevious:function(L,M){return J(this,"previousSibling",null,L,true,M)
},getNext:function(L,M){return J(this,"nextSibling",null,L,false,M)
},getAllNext:function(L,M){return J(this,"nextSibling",null,L,true,M)
},getFirst:function(L,M){return J(this,"nextSibling","firstChild",L,false,M)
},getLast:function(L,M){return J(this,"previousSibling","lastChild",L,false,M)
},getParent:function(L,M){return J(this,"parentNode",null,L,false,M)
},getParents:function(L,M){return J(this,"parentNode",null,L,true,M)
},getSiblings:function(L,M){return this.getParent().getChildren(L,M).erase(this)
},getChildren:function(L,M){return J(this,"nextSibling","firstChild",L,true,M)
},getWindow:function(){return this.ownerDocument.window
},getDocument:function(){return this.ownerDocument
},getElementById:function(O,N){var M=this.ownerDocument.getElementById(O);
if(!M){return null
}for(var L=M.parentNode;
L!=this;
L=L.parentNode){if(!L){return null
}}return document.id(M,N)
},getSelected:function(){return new Elements($A(this.options).filter(function(L){return L.selected
}))
},getComputedStyle:function(M){if(this.currentStyle){return this.currentStyle[M.camelCase()]
}var L=this.getDocument().defaultView.getComputedStyle(this,null);
return(L)?L.getPropertyValue([M.hyphenate()]):null
},toQueryString:function(){var L=[];
this.getElements("input, select, textarea",true).each(function(M){if(!M.name||M.disabled||M.type=="submit"||M.type=="reset"||M.type=="file"){return 
}var N=(M.tagName.toLowerCase()=="select")?Element.getSelected(M).map(function(O){return O.value
}):((M.type=="radio"||M.type=="checkbox")&&!M.checked)?null:M.value;
$splat(N).each(function(O){if(typeof O!="undefined"){L.push(M.name+"="+encodeURIComponent(O))
}})
});
return L.join("&")
},clone:function(O,L){O=O!==false;
var R=this.cloneNode(O);
var N=function(V,U){if(!L){V.removeAttribute("id")
}if(Browser.Engine.trident){V.clearAttributes();
V.mergeAttributes(U);
V.removeAttribute("uid");
if(V.options){var W=V.options,S=U.options;
for(var T=W.length;
T--;
){W[T].selected=S[T].selected
}}}var X=I[U.tagName.toLowerCase()];
if(X&&U[X]){V[X]=U[X]
}};
if(O){var P=R.getElementsByTagName("*"),Q=this.getElementsByTagName("*");
for(var M=P.length;
M--;
){N(P[M],Q[M])
}}N(R,this);
return document.id(R)
},destroy:function(){Element.empty(this);
Element.dispose(this);
G(this,true);
return null
},empty:function(){$A(this.childNodes).each(function(L){Element.destroy(L)
});
return this
},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this
},hasChild:function(L){L=document.id(L,true);
if(!L){return false
}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(L.tagName)).contains(L)
}return(this.contains)?(this!=L&&this.contains(L)):!!(this.compareDocumentPosition(L)&16)
},match:function(L){return(!L||(L==this)||(Element.get(this,"tag")==L))
}});
Native.implement([Element,Window,Document],{addListener:function(O,N){if(O=="unload"){var L=N,M=this;
N=function(){M.removeListener("unload",N);
L()
}
}else{H[this.uid]=this
}if(this.addEventListener){this.addEventListener(O,N,false)
}else{this.attachEvent("on"+O,N)
}return this
},removeListener:function(M,L){if(this.removeEventListener){this.removeEventListener(M,L,false)
}else{this.detachEvent("on"+M,L)
}return this
},retrieve:function(M,L){var O=C(this.uid),N=O[M];
if(L!=undefined&&N==undefined){N=O[M]=L
}return $pick(N)
},store:function(M,L){var N=C(this.uid);
N[M]=L;
return this
},eliminate:function(L){var M=C(this.uid);
delete M[L];
return this
}});
window.addListener("unload",D)
})();
Element.Properties=new Hash;
Element.Properties.style={set:function(A){this.style.cssText=A
},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 C=document.createElement("div");
var A={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};
A.thead=A.tfoot=A.tbody;
var B={set:function(){var E=Array.flatten(arguments).join("");
var F=Browser.Engine.trident&&A[this.get("tag")];
if(F){var G=C;
G.innerHTML=F[1]+E+F[2];
for(var D=F[0];
D--;
){G=G.firstChild
}this.empty().adopt(G.childNodes)
}else{this.innerHTML=E
}}};
B.erase=B.set;
return B
})();
if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText
}var A=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);
var B=A.innerText;
A.destroy();
return B
}}
}Element.Properties.events={set:function(A){this.addEvents(A)
}};
Native.implement([Element,Window,Document],{addEvent:function(E,G){var H=this.retrieve("events",{});
H[E]=H[E]||{keys:[],values:[]};
if(H[E].keys.contains(G)){return this
}H[E].keys.push(G);
var F=E,A=Element.Events.get(E),C=G,I=this;
if(A){if(A.onAdd){A.onAdd.call(this,G)
}if(A.condition){C=function(J){if(A.condition.call(this,J)){return G.call(this,J)
}return true
}
}F=A.base||F
}var D=function(){return G.call(I)
};
var B=Element.NativeEvents[F];
if(B){if(B==2){D=function(J){J=new Event(J,I.getWindow());
if(C.call(I,J)===false){J.stop()
}}
}this.addListener(F,D)
}H[E].values.push(D);
return this
},removeEvent:function(C,B){var A=this.retrieve("events");
if(!A||!A[C]){return this
}var F=A[C].keys.indexOf(B);
if(F==-1){return this
}A[C].keys.splice(F,1);
var E=A[C].values.splice(F,1)[0];
var D=Element.Events.get(C);
if(D){if(D.onRemove){D.onRemove.call(this,B)
}C=D.base||C
}return(Element.NativeEvents[C])?this.removeListener(C,E):this
},addEvents:function(A){for(var B in A){this.addEvent(B,A[B])
}return this
},removeEvents:function(A){var C;
if($type(A)=="object"){for(C in A){this.removeEvent(C,A[C])
}return this
}var B=this.retrieve("events");
if(!B){return this
}if(!A){for(C in B){this.removeEvents(C)
}this.eliminate("events")
}else{if(B[A]){while(B[A].keys[0]){this.removeEvent(A,B[A].keys[0])
}B[A]=null
}}return this
},fireEvent:function(D,B,A){var C=this.retrieve("events");
if(!C||!C[D]){return this
}C[D].keys.each(function(E){E.create({bind:this,delay:A,"arguments":B})()
},this);
return this
},cloneEvents:function(D,A){D=document.id(D);
var C=D.retrieve("events");
if(!C){return this
}if(!A){for(var B in C){this.cloneEvents(D,B)
}}else{if(C[A]){C[A].keys.each(function(E){this.addEvent(A,E)
},this)
}}return this
}});
Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};
(function(){var A=function(B){var C=B.relatedTarget;
if(C==undefined){return true
}if(C===false){return false
}return($type(this)!="document"&&C!=this&&C.prefix!="xul"&&!this.hasChild(C))
};
Element.Events=new Hash({mouseenter:{base:"mouseover",condition:A},mouseleave:{base:"mouseout",condition:A},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}})
})();
Element.Properties.styles={set:function(A){this.setStyles(A)
}};
Element.Properties.opacity={set:function(A,B){if(!B){if(A==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=(A==1)?"":"alpha(opacity="+A*100+")"
}this.style.opacity=A;
this.store("opacity",A)
},get:function(){return this.retrieve("opacity",1)
}};
Element.implement({setOpacity:function(A){return this.set("opacity",A,true)
},getOpacity:function(){return this.get("opacity")
},setStyle:function(B,A){switch(B){case"opacity":return this.set("opacity",parseFloat(A));
case"float":B=(Browser.Engine.trident)?"styleFloat":"cssFloat"
}B=B.camelCase();
if($type(A)!="string"){var C=(Element.Styles.get(B)||"@").split(" ");
A=$splat(A).map(function(E,D){if(!C[D]){return""
}return($type(E)=="number")?C[D].replace("@",Math.round(E)):E
}).join(" ")
}else{if(A==String(Number(A))){A=Math.round(A)
}}this.style[B]=A;
return this
},getStyle:function(G){switch(G){case"opacity":return this.get("opacity");
case"float":G=(Browser.Engine.trident)?"styleFloat":"cssFloat"
}G=G.camelCase();
var A=this.style[G];
if(!$chk(A)){A=[];
for(var F in Element.ShortStyles){if(G!=F){continue
}for(var E in Element.ShortStyles[F]){A.push(this.getStyle(E))
}return A.join(" ")
}A=this.getComputedStyle(G)
}if(A){A=String(A);
var C=A.match(/rgba?\([\d\s,]+\)/);
if(C){A=A.replace(C[0],C[0].rgbToHex())
}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(A,10)))){if(G.test(/^(height|width)$/)){var B=(G=="width")?["left","right"]:["top","bottom"],D=0;
B.each(function(H){D+=this.getStyle("border-"+H+"-width").toInt()+this.getStyle("padding-"+H).toInt()
},this);
return this["offset"+G.capitalize()]-D+"px"
}if((Browser.Engine.presto)&&String(A).test("px")){return A
}if(G.test(/(border(.+)Width|margin|padding)/)){return"0px"
}}return A
},setStyles:function(B){for(var A in B){this.setStyle(A,B[A])
}return this
},getStyles:function(){var A={};
Array.flatten(arguments).each(function(B){A[B]=this.getStyle(B)
},this);
return A
}});
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(G){var F=Element.ShortStyles;
var B=Element.Styles;
["margin","padding"].each(function(H){var I=H+G;
F[H][I]=B[I]="@px"
});
var E="border"+G;
F.border[E]=B[E]="@px @ rgb(@, @, @)";
var D=E+"Width",A=E+"Style",C=E+"Color";
F[E]={};
F.borderWidth[D]=F[E][D]=B[D]="@px";
F.borderStyle[A]=F[E][A]=B[A]="@";
F.borderColor[C]=F[E][C]=B[C]="rgb(@, @, @)"
});
(function(){Element.implement({scrollTo:function(H,I){if(B(this)){this.getWindow().scrollTo(H,I)
}else{this.scrollLeft=H;
this.scrollTop=I
}return this
},getSize:function(){if(B(this)){return this.getWindow().getSize()
}return{x:this.offsetWidth,y:this.offsetHeight}
},getScrollSize:function(){if(B(this)){return this.getWindow().getScrollSize()
}return{x:this.scrollWidth,y:this.scrollHeight}
},getScroll:function(){if(B(this)){return this.getWindow().getScroll()
}return{x:this.scrollLeft,y:this.scrollTop}
},getScrolls:function(){var I=this,H={x:0,y:0};
while(I&&!B(I)){H.x+=I.scrollLeft;
H.y+=I.scrollTop;
I=I.parentNode
}return H
},getOffsetParent:function(){var H=this;
if(B(H)){return null
}if(!Browser.Engine.trident){return H.offsetParent
}while((H=H.parentNode)&&!B(H)){if(D(H,"position")!="static"){return H
}}return null
},getOffsets:function(){if(this.getBoundingClientRect){var J=this.getBoundingClientRect(),M=document.id(this.getDocument().documentElement),P=M.getScroll(),K=this.getScrolls(),I=this.getScroll(),H=(D(this,"position")=="fixed");
return{x:J.left.toInt()+K.x-I.x+((H)?0:P.x)-M.clientLeft,y:J.top.toInt()+K.y-I.y+((H)?0:P.y)-M.clientTop}
}var L=this,N={x:0,y:0};
if(B(this)){return N
}while(L&&!B(L)){N.x+=L.offsetLeft;
N.y+=L.offsetTop;
if(Browser.Engine.gecko){if(!F(L)){N.x+=C(L);
N.y+=G(L)
}var O=L.parentNode;
if(O&&D(O,"overflow")!="visible"){N.x+=C(O);
N.y+=G(O)
}}else{if(L!=this&&Browser.Engine.webkit){N.x+=C(L);
N.y+=G(L)
}}L=L.offsetParent
}if(Browser.Engine.gecko&&!F(this)){N.x-=C(this);
N.y-=G(this)
}return N
},getPosition:function(K){if(B(this)){return{x:0,y:0}
}var L=this.getOffsets(),I=this.getScrolls();
var H={x:L.x-I.x,y:L.y-I.y};
var J=(K&&(K=document.id(K)))?K.getPosition():{x:0,y:0};
return{x:H.x-J.x,y:H.y-J.y}
},getCoordinates:function(J){if(B(this)){return this.getWindow().getCoordinates()
}var H=this.getPosition(J),I=this.getSize();
var K={left:H.x,top:H.y,width:I.x,height:I.y};
K.right=K.left+K.width;
K.bottom=K.top+K.height;
return K
},computePosition:function(H){return{left:H.x-E(this,"margin-left"),top:H.y-E(this,"margin-top")}
},setPosition:function(H){return this.setStyles(this.computePosition(H))
}});
Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var I=this.getWindow();
return{x:I.innerWidth,y:I.innerHeight}
}var H=A(this);
return{x:H.clientWidth,y:H.clientHeight}
},getScroll:function(){var I=this.getWindow(),H=A(this);
return{x:I.pageXOffset||H.scrollLeft,y:I.pageYOffset||H.scrollTop}
},getScrollSize:function(){var I=A(this),H=this.getSize();
return{x:Math.max(I.scrollWidth,H.x),y:Math.max(I.scrollHeight,H.y)}
},getPosition:function(){return{x:0,y:0}
},getCoordinates:function(){var H=this.getSize();
return{top:0,left:0,bottom:H.y,right:H.x,height:H.y,width:H.x}
}});
var D=Element.getComputedStyle;
function E(H,I){return D(H,I).toInt()||0
}function F(H){return D(H,"-moz-box-sizing")=="border-box"
}function G(H){return E(H,"border-top-width")
}function C(H){return E(H,"border-left-width")
}function B(H){return(/^(?:body|html)$/i).test(H.tagName)
}function A(H){var I=H.getDocument();
return(!I.compatMode||I.compatMode=="CSS1Compat")?I.html:I.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
}});
Native.implement([Document,Element],{getElements:function(H,G){H=H.split(",");
var C,E={};
for(var D=0,B=H.length;
D<B;
D++){var A=H[D],F=Selectors.Utils.search(this,A,E);
if(D!=0&&F.item){F=$A(F)
}C=(D==0)?F:(C.item)?$A(C).concat(F):C.concat(F)
}return new Elements(C,{ddup:(H.length>1),cash:!G})
}});
Element.implement({match:function(B){if(!B||(B==this)){return true
}var D=Selectors.Utils.parseTagAndID(B);
var A=D[0],E=D[1];
if(!Selectors.Filters.byID(this,E)||!Selectors.Filters.byTag(this,A)){return false
}var C=Selectors.Utils.parseSelector(B);
return(C)?Selectors.Utils.filter(this,C,{}):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(B,C){if(!C){return true
}var A=$uid(B);
if(!C[A]){return C[A]=true
}return false
},parseNthArgument:function(F){if(Selectors.Cache.nth[F]){return Selectors.Cache.nth[F]
}var C=F.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);
if(!C){return false
}var E=parseInt(C[1],10);
var B=(E||E===0)?E:1;
var D=C[2]||false;
var A=parseInt(C[3],10)||0;
if(B!=0){A--;
while(A<1){A+=B
}while(A>=B){A-=B
}}else{B=A;
D="index"
}switch(D){case"n":C={a:B,b:A,special:"n"};
break;
case"odd":C={a:2,b:0,special:"n"};
break;
case"even":C={a:2,b:1,special:"n"};
break;
case"first":C={a:0,special:"index"};
break;
case"last":C={special:"last-child"};
break;
case"only":C={special:"only-child"};
break;
default:C={a:(B-1),special:"index"}
}return Selectors.Cache.nth[F]=C
},parseSelector:function(E){if(Selectors.Cache.parsed[E]){return Selectors.Cache.parsed[E]
}var D,H={classes:[],pseudos:[],attributes:[]};
while((D=Selectors.RegExps.combined.exec(E))){var I=D[1],G=D[2],F=D[3],B=D[5],C=D[6],J=D[7];
if(I){H.classes.push(I)
}else{if(C){var A=Selectors.Pseudo.get(C);
if(A){H.pseudos.push({parser:A,argument:J})
}else{H.attributes.push({name:C,operator:"=",value:J})
}}else{if(G){H.attributes.push({name:G,operator:F,value:B})
}}}}if(!H.classes.length){delete H.classes
}if(!H.attributes.length){delete H.attributes
}if(!H.pseudos.length){delete H.pseudos
}if(!H.classes&&!H.attributes&&!H.pseudos){H=null
}return Selectors.Cache.parsed[E]=H
},parseTagAndID:function(B){var A=B.match(Selectors.RegExps.tag);
var C=B.match(Selectors.RegExps.id);
return[(A)?A[1]:"*",(C)?C[1]:false]
},filter:function(F,C,E){var D;
if(C.classes){for(D=C.classes.length;
D--;
D){var G=C.classes[D];
if(!Selectors.Filters.byClass(F,G)){return false
}}}if(C.attributes){for(D=C.attributes.length;
D--;
D){var B=C.attributes[D];
if(!Selectors.Filters.byAttribute(F,B.name,B.operator,B.value)){return false
}}}if(C.pseudos){for(D=C.pseudos.length;
D--;
D){var A=C.pseudos[D];
if(!Selectors.Filters.byPseudo(F,A.parser,A.argument,E)){return false
}}}return true
},getByTagAndID:function(B,A,D){if(D){var C=(B.getElementById)?B.getElementById(D,true):Element.getElementById(B,D,true);
return(C&&Selectors.Filters.byTag(C,A))?[C]:[]
}else{return B.getElementsByTagName(A)
}},search:function(I,H,N){var B=[];
var C=H.trim().replace(Selectors.RegExps.splitter,function(Y,X,W){B.push(X);
return":)"+W
}).split(":)");
var J,E,U;
for(var T=0,P=C.length;
T<P;
T++){var S=C[T];
if(T==0&&Selectors.RegExps.quick.test(S)){J=I.getElementsByTagName(S);
continue
}var A=B[T-1];
var K=Selectors.Utils.parseTagAndID(S);
var V=K[0],L=K[1];
if(T==0){J=Selectors.Utils.getByTagAndID(I,V,L)
}else{var D={},G=[];
for(var R=0,Q=J.length;
R<Q;
R++){G=Selectors.Getters[A](G,J[R],V,L,D)
}J=G
}var F=Selectors.Utils.parseSelector(S);
if(F){E=[];
for(var O=0,M=J.length;
O<M;
O++){U=J[O];
if(Selectors.Utils.filter(U,F,N)){E.push(U)
}}J=E
}}return J
}};
Selectors.Getters={" ":function(H,G,I,A,E){var D=Selectors.Utils.getByTagAndID(G,I,A);
for(var C=0,B=D.length;
C<B;
C++){var F=D[C];
if(Selectors.Utils.chk(F,E)){H.push(F)
}}return H
},">":function(H,G,I,A,F){var C=Selectors.Utils.getByTagAndID(G,I,A);
for(var E=0,D=C.length;
E<D;
E++){var B=C[E];
if(B.parentNode==G&&Selectors.Utils.chk(B,F)){H.push(B)
}}return H
},"+":function(C,B,A,E,D){while((B=B.nextSibling)){if(B.nodeType==1){if(Selectors.Utils.chk(B,D)&&Selectors.Filters.byTag(B,A)&&Selectors.Filters.byID(B,E)){C.push(B)
}break
}}return C
},"~":function(C,B,A,E,D){while((B=B.nextSibling)){if(B.nodeType==1){if(!Selectors.Utils.chk(B,D)){break
}if(Selectors.Filters.byTag(B,A)&&Selectors.Filters.byID(B,E)){C.push(B)
}}}return C
}};
Selectors.Filters={byTag:function(B,A){return(A=="*"||(B.tagName&&B.tagName.toLowerCase()==A))
},byID:function(A,B){return(!B||(A.id&&A.id==B))
},byClass:function(B,A){return(B.className&&B.className.contains&&B.className.contains(A," "))
},byPseudo:function(A,D,C,B){return D.call(A,C,B)
},byAttribute:function(C,D,B,E){var A=Element.prototype.getProperty.call(C,D);
if(!A){return(B=="!=")
}if(!B||E==undefined){return true
}switch(B){case"=":return(A==E);
case"*=":return(A.contains(E));
case"^=":return(A.substr(0,E.length)==E);
case"$=":return(A.substr(A.length-E.length)==E);
case"!=":return(A!=E);
case"~=":return A.contains(E," ");
case"|=":return A.contains(E,"-")
}return false
}};
Selectors.Pseudo=new Hash({checked:function(){return this.checked
},empty:function(){return !(this.innerText||this.textContent||"").length
},not:function(A){return !Element.match(this,A)
},contains:function(A){return(this.innerText||this.textContent||"").contains(A)
},"first-child":function(){return Selectors.Pseudo.index.call(this,0)
},"last-child":function(){var A=this;
while((A=A.nextSibling)){if(A.nodeType==1){return false
}}return true
},"only-child":function(){var B=this;
while((B=B.previousSibling)){if(B.nodeType==1){return false
}}var A=this;
while((A=A.nextSibling)){if(A.nodeType==1){return false
}}return true
},"nth-child":function(G,E){G=(G==undefined)?"n":G;
var C=Selectors.Utils.parseNthArgument(G);
if(C.special!="n"){return Selectors.Pseudo[C.special].call(this,C.a,E)
}var F=0;
E.positions=E.positions||{};
var D=$uid(this);
if(!E.positions[D]){var B=this;
while((B=B.previousSibling)){if(B.nodeType!=1){continue
}F++;
var A=E.positions[$uid(B)];
if(A!=undefined){F=A+F;
break
}}E.positions[D]=F
}return(E.positions[D]%C.a==C.b)
},index:function(A){var B=this,C=0;
while((B=B.previousSibling)){if(B.nodeType==1&&++C>A){return false
}}return(C==A)
},even:function(B,A){return Selectors.Pseudo["nth-child"].call(this,"2n+1",A)
},odd:function(B,A){return Selectors.Pseudo["nth-child"].call(this,"2n",A)
},selected:function(){return this.selected
},enabled:function(){return(this.disabled===false)
}});
Element.Events.domready={onAdd:function(A){if(Browser.loaded){A.call(this)
}}};
(function(){var B=function(){if(Browser.loaded){return 
}Browser.loaded=true;
window.fireEvent("domready");
document.fireEvent("domready")
};
window.addEvent("load",B);
if(Browser.Engine.trident){var A=document.createElement("div");
(function(){($try(function(){A.doScroll();
return document.id(A).inject(document.body).set("html","temp").dispose()
}))?B():arguments.callee.delay(50)
})()
}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?B():arguments.callee.delay(50)
})()
}else{document.addEvent("DOMContentLoaded",B)
}}})();
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(A){return JSON.$specialChars[A]||"\\u00"+Math.floor(A.charCodeAt()/16).toString(16)+(A.charCodeAt()%16).toString(16)
},encode:function(B){switch($type(B)){case"string":return'"'+B.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';
case"array":return"["+String(B.map(JSON.encode).clean())+"]";
case"object":case"hash":var A=[];
Hash.each(B,function(E,D){var C=JSON.encode(E);
if(C){A.push(JSON.encode(D)+":"+C)
}});
return"{"+A+"}";
case"number":case"boolean":return String(B);
case false:return"null"
}return null
},decode:function(string,secure){if($type(string)!="string"||!string.length){return null
}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null
}return eval("("+string+")")
}});
Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this)
}});
var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(B,A){this.key=B;
this.setOptions(A)
},write:function(B){B=encodeURIComponent(B);
if(this.options.domain){B+="; domain="+this.options.domain
}if(this.options.path){B+="; path="+this.options.path
}if(this.options.duration){var A=new Date();
A.setTime(A.getTime()+this.options.duration*24*60*60*1000);
B+="; expires="+A.toGMTString()
}if(this.options.secure){B+="; secure"
}this.options.document.cookie=this.key+"="+B;
return this
},read:function(){var A=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");
return(A)?decodeURIComponent(A[1]):null
},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");
return this
}});
Cookie.write=function(B,C,A){return new Cookie(B,A).write(C)
};
Cookie.read=function(A){return new Cookie(A).read()
};
Cookie.dispose=function(B,A){return new Cookie(B,A).dispose()
};
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(L,M){this.instance="Swiff_"+$time();
this.setOptions(M);
M=this.options;
var B=this.id=M.id||this.instance;
var A=document.id(M.container);
Swiff.CallBacks[this.instance]={};
var E=M.params,G=M.vars,F=M.callBacks;
var H=$extend({height:M.height,width:M.width},M.properties);
var K=this;
for(var D in F){Swiff.CallBacks[this.instance][D]=(function(N){return function(){return N.apply(K.object,arguments)
}
})(F[D]);
G[D]="Swiff.CallBacks."+this.instance+"."+D
}E.flashVars=Hash.toQueryString(G);
if(Browser.Engine.trident){H.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
E.movie=L
}else{H.type="application/x-shockwave-flash";
H.data=L
}var J='<object id="'+B+'"';
for(var I in H){J+=" "+I+'="'+H[I]+'"'
}J+=">";
for(var C in E){if(E[C]){J+='<param name="'+C+'" value="'+E[C]+'" />'
}}J+="</object>";
this.object=((A)?A.empty():new Element("div")).set("html",J).firstChild
},replaces:function(A){A=document.id(A,true);
A.parentNode.replaceChild(this.toElement(),A);
return this
},inject:function(A){document.id(A,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)
};
var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(A){this.subject=this.subject||this;
this.setOptions(A);
this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();
var B=this.options.wait;
if(B===false){this.options.link="cancel"
}},getTransition:function(){return function(A){return -(Math.cos(Math.PI*A)-1)/2
}
},step:function(){var A=$time();
if(A<this.time+this.options.duration){var B=this.transition((A-this.time)/this.options.duration);
this.set(this.compute(this.from,this.to,B))
}else{this.set(this.compute(this.from,this.to,1));
this.complete()
}},set:function(A){return A
},compute:function(C,B,A){return Fx.compute(C,B,A)
},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(B,A){if(!this.check(B,A)){return this
}this.from=B;
this.to=A;
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(C,B,A){return(B-C)*A+C
};
Fx.Durations={"short":250,normal:500,"long":1000};
Fx.CSS=new Class({Extends:Fx,prepare:function(D,E,B){B=$splat(B);
var C=B[1];
if(!$chk(C)){B[1]=B[0];
B[0]=D.getStyle(E)
}var A=B.map(this.parse);
return{from:A[0],to:A[1]}
},parse:function(A){A=$lambda(A)();
A=(typeof A=="string")?A.split(" "):$splat(A);
return A.map(function(C){C=String(C);
var B=false;
Fx.CSS.Parsers.each(function(F,E){if(B){return 
}var D=F.parse(C);
if($chk(D)){B={value:D,parser:F}
}});
B=B||{value:C,parser:Fx.CSS.Parsers.String};
return B
})
},compute:function(D,C,B){var A=[];
(Math.min(D.length,C.length)).times(function(E){A.push({value:D[E].parser.compute(D[E].value,C[E].value,B),parser:D[E].parser})
});
A.$family={name:"fx:css:value"};
return A
},serve:function(C,B){if($type(C)!="fx:css:value"){C=this.parse(C)
}var A=[];
C.each(function(D){A=A.concat(D.parser.serve(D.value,B))
});
return A
},render:function(A,D,C,B){A.setStyle(D,this.serve(C,B))
},search:function(A){if(Fx.CSS.Cache[A]){return Fx.CSS.Cache[A]
}var B={};
Array.each(document.styleSheets,function(E,D){var C=E.href;
if(C&&C.contains("://")&&!C.contains(document.domain)){return 
}var F=E.rules||E.cssRules;
Array.each(F,function(I,G){if(!I.style){return 
}var H=(I.selectorText)?I.selectorText.replace(/^\w+/,function(J){return J.toLowerCase()
}):null;
if(!H||!H.test("^"+A+"$")){return 
}Element.Styles.each(function(K,J){if(!I.style[J]||Element.ShortStyles[J]){return 
}K=String(I.style[J]);
B[J]=(K.test(/^rgb/))?K.rgbToHex():K
})
})
});
return Fx.CSS.Cache[A]=B
}});
Fx.CSS.Cache={};
Fx.CSS.Parsers=new Hash({Color:{parse:function(A){if(A.match(/^#[0-9a-f]{3,6}$/i)){return A.hexToRgb(true)
}return((A=A.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[A[1],A[2],A[3]]:false
},compute:function(C,B,A){return C.map(function(E,D){return Math.round(Fx.compute(C[D],B[D],A))
})
},serve:function(A){return A.map(Number)
}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(B,A){return(A)?B+A:B
}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});
Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(B,A){this.element=this.subject=document.id(B);
this.parent(A)
},set:function(B,A){if(arguments.length==1){A=B;
B=this.property||this.options.property
}this.render(this.element,B,A,this.options.unit);
return this
},start:function(C,E,D){if(!this.check(C,E,D)){return this
}var B=Array.flatten(arguments);
this.property=this.options.property||B.shift();
var A=this.prepare(this.element,this.property,B);
return this.parent(A.from,A.to)
}});
Element.Properties.tween={set:function(A){var B=this.retrieve("tween");
if(B){B.cancel()
}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},A))
},get:function(A){if(A||!this.retrieve("tween")){if(A||!this.retrieve("tween:options")){this.set("tween",A)
}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options")))
}return this.retrieve("tween")
}};
Element.implement({tween:function(A,C,B){this.get("tween").start(arguments);
return this
},fade:function(C){var E=this.get("tween"),D="opacity",A;
C=$pick(C,"toggle");
switch(C){case"in":E.start(D,1);
break;
case"out":E.start(D,0);
break;
case"show":E.set(D,1);
break;
case"hide":E.set(D,0);
break;
case"toggle":var B=this.retrieve("fade:flag",this.get("opacity")==1);
E.start(D,(B)?0:1);
this.store("fade:flag",!B);
A=true;
break;
default:E.start(D,arguments)
}if(!A){this.eliminate("fade:flag")
}return this
},highlight:function(C,A){if(!A){A=this.retrieve("highlight:original",this.getStyle("background-color"));
A=(A=="transparent")?"#fff":A
}var B=this.get("tween");
B.start("background-color",C||"#ffff88",A).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));
B.callChain()
}.bind(this));
return this
}});
Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(B,A){this.element=this.subject=document.id(B);
this.parent(A)
},set:function(A){if(typeof A=="string"){A=this.search(A)
}for(var B in A){this.render(this.element,B,A[B],this.options.unit)
}return this
},compute:function(E,D,C){var A={};
for(var B in E){A[B]=this.parent(E[B],D[B],C)
}return A
},start:function(B){if(!this.check(B)){return this
}if(typeof B=="string"){B=this.search(B)
}var E={},D={};
for(var C in B){var A=this.prepare(this.element,C,B[C]);
E[C]=A.from;
D[C]=A.to
}return this.parent(E,D)
}});
Element.Properties.morph={set:function(A){var B=this.retrieve("morph");
if(B){B.cancel()
}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},A))
},get:function(A){if(A||!this.retrieve("morph")){if(A||!this.retrieve("morph:options")){this.set("morph",A)
}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")))
}return this.retrieve("morph")
}};
Element.implement({morph:function(A){this.get("morph").start(A);
return this
}});
Fx.implement({getTransition:function(){var A=this.options.transition||Fx.Transitions.Sine.easeInOut;
if(typeof A=="string"){var B=A.split(":");
A=Fx.Transitions;
A=A[B[0]]||A[B[0].capitalize()];
if(B[1]){A=A["ease"+B[1].capitalize()+(B[2]?B[2].capitalize():"")]
}}return A
}});
Fx.Transition=function(B,A){A=$splat(A);
return $extend(B,{easeIn:function(C){return B(C,A)
},easeOut:function(C){return 1-B(1-C,A)
},easeInOut:function(C){return(C<=0.5)?B(2*C,A)/2:(2-B(2*(1-C),A))/2
}})
};
Fx.Transitions=new Hash({linear:$arguments(0)});
Fx.Transitions.extend=function(A){for(var B in A){Fx.Transitions[B]=new Fx.Transition(A[B])
}};
Fx.Transitions.extend({Pow:function(B,A){return Math.pow(B,A[0]||6)
},Expo:function(A){return Math.pow(2,8*(A-1))
},Circ:function(A){return 1-Math.sin(Math.acos(A))
},Sine:function(A){return 1-Math.sin((1-A)*Math.PI/2)
},Back:function(B,A){A=A[0]||1.618;
return Math.pow(B,2)*((A+1)*B-A)
},Bounce:function(D){var C;
for(var B=0,A=1;
1;
B+=A,A/=2){if(D>=(7-4*B)/11){C=A*A-Math.pow((11-6*B-11*D)/4,2);
break
}}return C
},Elastic:function(B,A){return Math.pow(2,10*--B)*Math.cos(20*B*Math.PI*(A[0]||1)/3)
}});
["Quad","Cubic","Quart","Quint"].each(function(B,A){Fx.Transitions[B]=new Fx.Transition(function(C){return Math.pow(C,[A+2])
})
});
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(A){this.xhr=new Browser.Request();
this.setOptions(A);
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(A){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(A)
}return A.stripScripts(this.options.evalScripts)
},success:function(B,A){this.onSuccess(this.processScripts(B),A)
},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(A,B){this.headers.set(A,B);
return this
},getHeader:function(A){return $try(function(){return this.xhr.getResponseHeader(A)
}.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(K){if(!this.check(K)){return this
}this.running=true;
var I=$type(K);
if(I=="string"||I=="element"){K={data:K}
}var D=this.options;
K=$extend({data:D.data,url:D.url,method:D.method},K);
var G=K.data,B=String(K.url),A=K.method.toLowerCase();
switch($type(G)){case"element":G=document.id(G).toQueryString();
break;
case"object":case"hash":G=Hash.toQueryString(G)
}if(this.options.format){var J="format="+this.options.format;
G=(G)?J+"&"+G:J
}if(this.options.emulation&&!["get","post"].contains(A)){var H="_method="+A;
G=(G)?H+"&"+G:H;
A="post"
}if(this.options.urlEncoded&&A=="post"){var C=(this.options.encoding)?"; charset="+this.options.encoding:"";
this.headers.set("Content-type","application/x-www-form-urlencoded"+C)
}if(this.options.noCache){var F="noCache="+new Date().getTime();
G=(G)?F+"&"+G:F
}var E=B.lastIndexOf("/");
if(E>-1&&(E=B.indexOf("#"))>-1){B=B.substr(0,E)
}if(G&&A=="get"){B=B+(B.contains("?")?"&":"?")+G;
G=null
}this.xhr.open(A.toUpperCase(),B,this.options.async);
this.xhr.onreadystatechange=this.onStateChange.bind(this);
this.headers.each(function(M,L){try{this.xhr.setRequestHeader(L,M)
}catch(N){this.fireEvent("exception",[L,M])
}},this);
this.fireEvent("request");
this.xhr.send(G);
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 A={};
["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(B){A[B]=function(){var C=Array.link(arguments,{url:String.type,data:$defined});
return this.send($extend(C,{method:B}))
}
});
Request.implement(A)
})();
Element.Properties.send={set:function(A){var B=this.retrieve("send");
if(B){B.cancel()
}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},A))
},get:function(A){if(A||!this.retrieve("send")){if(A||!this.retrieve("send:options")){this.set("send",A)
}this.store("send",new Request(this.retrieve("send:options")))
}return this.retrieve("send")
}};
Element.implement({send:function(A){var B=this.get("send");
B.send({data:this,url:A||B.options.url});
return this
}});
Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(C){var B=C.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
C=(B)?B[1]:C;
var A=new Element("div");
return $try(function(){var D="<root>"+C+"</root>",G;
if(Browser.Engine.trident){G=new ActiveXObject("Microsoft.XMLDOM");
G.async=false;
G.loadXML(D)
}else{G=new DOMParser().parseFromString(D,"text/xml")
}D=G.getElementsByTagName("root")[0];
if(!D){return null
}for(var F=0,E=D.childNodes.length;
F<E;
F++){var H=Element.clone(D.childNodes[F],true,true);
if(H){A.grab(H)
}}return A
})||A.set("html",C)
},success:function(D){var C=this.options,B=this.response;
B.html=D.stripScripts(function(E){B.javascript=E
});
var A=this.processHTML(B.html);
B.tree=A.childNodes;
B.elements=A.getElements("*");
if(C.filter){B.tree=B.elements.filter(C.filter)
}if(C.update){document.id(C.update).empty().set("html",B.html)
}else{if(C.append){document.id(C.append).adopt(A.getChildren())
}}if(C.evalScripts){$exec(B.javascript)
}this.onSuccess(B.tree,B.elements,B.html,B.javascript)
}});
Element.Properties.load={set:function(A){var B=this.retrieve("load");
if(B){B.cancel()
}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},A))
},get:function(A){if(A||!this.retrieve("load")){if(A||!this.retrieve("load:options")){this.set("load",A)
}this.store("load",new Request.HTML(this.retrieve("load:options")))
}return this.retrieve("load")
}};
Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Object.type,url:String.type}));
return this
}});
Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(A){this.parent(A);
this.headers.extend({Accept:"application/json","X-Request":"JSON"})
},success:function(A){this.response.json=JSON.decode(A,this.options.secure);
this.onSuccess(this.response.json,A)
}});
MooTools.More={version:"1.2.4.2",build:"bd5a93c0913cce25917c48cbdacde568e15e02ef"};
(function(){var A={language:"en-US",languages:{"en-US":{}},cascades:["en-US"]};
var B;
MooTools.lang=new Events();
$extend(MooTools.lang,{setLanguage:function(C){if(!A.languages[C]){return this
}A.language=C;
this.load();
this.fireEvent("langChange",C);
return this
},load:function(){var C=this.cascade(this.getCurrentLanguage());
B={};
$each(C,function(E,D){B[D]=this.lambda(E)
},this)
},getCurrentLanguage:function(){return A.language
},addLanguage:function(C){A.languages[C]=A.languages[C]||{};
return this
},cascade:function(E){var C=(A.languages[E]||{}).cascades||[];
C.combine(A.cascades);
C.erase(E).push(E);
var D=C.map(function(F){return A.languages[F]
},this);
return $merge.apply(this,D)
},lambda:function(C){(C||{}).get=function(E,D){return $lambda(C[E]).apply(this,$splat(D))
};
return C
},get:function(E,D,C){if(B&&B[E]){return(D?B[E].get(D,C):B[E])
}},set:function(D,E,C){this.addLanguage(D);
langData=A.languages[D];
if(!langData[E]){langData[E]={}
}$extend(langData[E],C);
if(D==this.getCurrentLanguage()){this.load();
this.fireEvent("langChange",D)
}return this
},list:function(){return Hash.getKeys(A.languages)
}})
})();
(function(){var C=this;
var B=function(){if(C.console&&console.log){try{console.log.apply(console,arguments)
}catch(D){console.log(Array.slice(arguments))
}}else{Log.logged.push(arguments)
}return this
};
var A=function(){this.logged.push(arguments);
return this
};
this.Log=new Class({logged:[],log:A,resetLog:function(){this.logged.empty();
return this
},enableLog:function(){this.log=B;
this.logged.each(function(D){this.log.apply(this,D)
},this);
return this.resetLog()
},disableLog:function(){this.log=A;
return this
}});
Log.extend(new Log).enableLog();
Log.logger=function(){return this.log.apply(this,arguments)
}
})();
Class.refactor=function(B,A){$each(A,function(E,D){var C=B.prototype[D];
if(C&&(C=C._origin)&&typeof E=="function"){B.implement(D,function(){var F=this.previous;
this.previous=C;
var G=E.apply(this,arguments);
this.previous=F;
return G
})
}else{B.implement(D,E)
}});
return B
};
Class.Mutators.Binds=function(A){return A
};
Class.Mutators.initialize=function(A){return function(){$splat(this.Binds).each(function(B){var C=this[B];
if(C){this[B]=C.bind(this)
}},this);
return A.apply(this,arguments)
}
};
Class.Occlude=new Class({occlude:function(C,B){B=document.id(B||this.element);
var A=B.retrieve(C||this.property);
if(A&&!$defined(this.occluded)){return this.occluded=A
}this.occluded=false;
B.store(C||this.property,this);
return this.occluded
}});
(function(){var A={wait:function(B){return this.chain(function(){this.callChain.delay($pick(B,500),this)
}.bind(this))
}};
Chain.implement(A);
if(window.Fx){Fx.implement(A);
["Css","Tween","Elements"].each(function(B){if(Fx[B]){Fx[B].implement(A)
}})
}Element.implement({chains:function(B){$splat($pick(B,["tween","morph","reveal"])).each(function(C){C=this.get(C);
if(!C){return 
}C.setOptions({link:"chain"})
},this);
return this
},pauseFx:function(C,B){this.chains(B).get($pick(B,"tween")).wait(C);
return this
}})
})();
Array.implement({min:function(){return Math.min.apply(null,this)
},max:function(){return Math.max.apply(null,this)
},average:function(){return this.length?this.sum()/this.length:0
},sum:function(){var A=0,B=this.length;
if(B){do{A+=this[--B]
}while(B)
}return A
},unique:function(){return[].combine(this)
}});
(function(){var I=this.Date;
if(!I.now){I.now=$time
}I.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};
["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds"].each(function(P){I.Methods[P.toLowerCase()]=P
});
var D=function(Q,P){return new Array(P-String(Q).length+1).join("0")+Q
};
I.implement({set:function(S,Q){switch($type(S)){case"object":for(var R in S){this.set(R,S[R])
}break;
case"string":S=S.toLowerCase();
var P=I.Methods;
if(P[S]){this["set"+P[S]](Q)
}}return this
},get:function(Q){Q=Q.toLowerCase();
var P=I.Methods;
if(P[Q]){return this["get"+P[Q]]()
}return null
},clone:function(){return new I(this.get("time"))
},increment:function(P,R){P=P||"day";
R=$pick(R,1);
switch(P){case"year":return this.increment("month",R*12);
case"month":var Q=this.get("date");
this.set("date",1).set("mo",this.get("mo")+R);
return this.set("date",Q.min(this.get("lastdayofmonth")));
case"week":return this.increment("day",R*7);
case"day":return this.set("date",this.get("date")+R)
}if(!I.units[P]){throw new Error(P+" is not a supported interval")
}return this.set("time",this.get("time")+R*I.units[P]())
},decrement:function(P,Q){return this.increment(P,-1*$pick(Q,1))
},isLeapYear:function(){return I.isLeapYear(this.get("year"))
},clearTime:function(){return this.set({hr:0,min:0,sec:0,ms:0})
},diff:function(Q,P){if($type(Q)=="string"){Q=I.parse(Q)
}return((Q-this)/I.units[P||"day"](3,3)).toInt()
},getLastDayOfMonth:function(){return I.daysInMonth(this.get("mo"),this.get("year"))
},getDayOfYear:function(){return(I.UTC(this.get("year"),this.get("mo"),this.get("date")+1)-I.UTC(this.get("year"),0,1))/I.units.day()
},getWeek:function(){return(this.get("dayofyear")/7).ceil()
},getOrdinal:function(P){return I.getMsg("ordinal",P||this.get("date"))
},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")
},getGMTOffset:function(){var P=this.get("timezoneOffset");
return((P>0)?"-":"+")+D((P.abs()/60).floor(),2)+D(P%60,2)
},setAMPM:function(P){P=P.toUpperCase();
var Q=this.get("hr");
if(Q>11&&P=="AM"){return this.decrement("hour",12)
}else{if(Q<12&&P=="PM"){return this.increment("hour",12)
}}return this
},getAMPM:function(){return(this.get("hr")<12)?"AM":"PM"
},parse:function(P){this.set("time",I.parse(P));
return this
},isValid:function(P){return !!(P||this).valueOf()
},format:function(P){if(!this.isValid()){return"invalid date"
}P=P||"%x %X";
P=K[P.toLowerCase()]||P;
var Q=this;
return P.replace(/%([a-z%])/gi,function(S,R){switch(R){case"a":return I.getMsg("days")[Q.get("day")].substr(0,3);
case"A":return I.getMsg("days")[Q.get("day")];
case"b":return I.getMsg("months")[Q.get("month")].substr(0,3);
case"B":return I.getMsg("months")[Q.get("month")];
case"c":return Q.toString();
case"d":return D(Q.get("date"),2);
case"H":return D(Q.get("hr"),2);
case"I":return((Q.get("hr")%12)||12);
case"j":return D(Q.get("dayofyear"),3);
case"m":return D((Q.get("mo")+1),2);
case"M":return D(Q.get("min"),2);
case"o":return Q.get("ordinal");
case"p":return I.getMsg(Q.get("ampm"));
case"S":return D(Q.get("seconds"),2);
case"U":return D(Q.get("week"),2);
case"w":return Q.get("day");
case"x":return Q.format(I.getMsg("shortDate"));
case"X":return Q.format(I.getMsg("shortTime"));
case"y":return Q.get("year").toString().substr(2);
case"Y":return Q.get("year");
case"T":return Q.get("GMTOffset");
case"Z":return Q.get("Timezone")
}return R
})
},toISOString:function(){return this.format("iso8601")
}});
I.alias("toISOString","toJSON");
I.alias("diff","compare");
I.alias("format","strftime");
var K={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S",iso8601:"%Y-%m-%dT%H:%M:%S%T",rfc822:"%a, %d %b %Y %H:%M:%S %Z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"};
var G=[];
var E=I.parse;
var N=function(S,U,R){var Q=-1;
var T=I.getMsg(S+"s");
switch($type(U)){case"object":Q=T[U.get(S)];
break;
case"number":Q=T[month-1];
if(!Q){throw new Error("Invalid "+S+" index: "+index)
}break;
case"string":var P=T.filter(function(V){return this.test(V)
},new RegExp("^"+U,"i"));
if(!P.length){throw new Error("Invalid "+S+" string")
}if(P.length>1){throw new Error("Ambiguous "+S)
}Q=P[0]
}return(R)?T.indexOf(Q):Q
};
I.extend({getMsg:function(Q,P){return MooTools.lang.get("Date",Q,P)
},units:{ms:$lambda(1),second:$lambda(1000),minute:$lambda(60000),hour:$lambda(3600000),day:$lambda(86400000),week:$lambda(608400000),month:function(Q,P){var R=new I;
return I.daysInMonth($pick(Q,R.get("mo")),$pick(P,R.get("year")))*86400000
},year:function(P){P=P||new I().get("year");
return I.isLeapYear(P)?31622400000:31536000000
}},daysInMonth:function(Q,P){return[31,I.isLeapYear(P)?29:28,31,30,31,30,31,31,30,31,30,31][Q]
},isLeapYear:function(P){return((P%4===0)&&(P%100!==0))||(P%400===0)
},parse:function(R){var Q=$type(R);
if(Q=="number"){return new I(R)
}if(Q!="string"){return R
}R=R.clean();
if(!R.length){return null
}var P;
G.some(function(T){var S=T.re.exec(R);
return(S)?(P=T.handler(S)):false
});
return P||new I(E(R))
},parseDay:function(P,Q){return N("day",P,Q)
},parseMonth:function(Q,P){return N("month",Q,P)
},parseUTC:function(Q){var P=new I(Q);
var R=I.UTC(P.get("year"),P.get("mo"),P.get("date"),P.get("hr"),P.get("min"),P.get("sec"));
return new I(R)
},orderIndex:function(P){return I.getMsg("dateOrder").indexOf(P)+1
},defineFormat:function(P,Q){K[P]=Q
},defineFormats:function(P){for(var Q in P){I.defineFormat(Q,P[Q])
}},parsePatterns:G,defineParser:function(P){G.push((P.re&&P.handler)?P:L(P))
},defineParsers:function(){Array.flatten(arguments).each(I.defineParser)
},define2DigitYearStart:function(P){H=P%100;
M=P-H
}});
var M=1900;
var H=70;
var J=function(P){return new RegExp("(?:"+I.getMsg(P).map(function(Q){return Q.substr(0,3)
}).join("|")+")[a-z]*")
};
var A=function(P){switch(P){case"x":return((I.orderIndex("month")==1)?"%m[.-/]%d":"%d[.-/]%m")+"([.-/]%y)?";
case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%T?"
}return null
};
var O={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,T:/Z|[+-]\d{2}(?::?\d{2})?/};
O.m=O.I;
O.S=O.M;
var C;
var B=function(P){C=P;
O.a=O.A=J("days");
O.b=O.B=J("months");
G.each(function(R,Q){if(R.format){G[Q]=L(R.format)
}})
};
var L=function(R){if(!C){return{format:R}
}var P=[];
var Q=(R.source||R).replace(/%([a-z])/gi,function(T,S){return A(S)||T
}).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(T,S){var U=O[S];
if(!U){return S
}P.push(S);
return"("+U.source+")"
}).replace(/\[a-z\]/gi,"[a-z\\u00c0-\\uffff]");
return{format:R,re:new RegExp("^"+Q+"$","i"),handler:function(U){U=U.slice(1).associate(P);
var S=new I().clearTime();
if("d" in U){F.call(S,"d",1)
}if("m" in U){F.call(S,"m",1)
}for(var T in U){F.call(S,T,U[T])
}return S
}}
};
var F=function(P,Q){if(!Q){return this
}switch(P){case"a":case"A":return this.set("day",I.parseDay(Q,true));
case"b":case"B":return this.set("mo",I.parseMonth(Q,true));
case"d":return this.set("date",Q);
case"H":case"I":return this.set("hr",Q);
case"m":return this.set("mo",Q-1);
case"M":return this.set("min",Q);
case"p":return this.set("ampm",Q.replace(/\./g,""));
case"S":return this.set("sec",Q);
case"s":return this.set("ms",("0."+Q)*1000);
case"w":return this.set("day",Q);
case"Y":return this.set("year",Q);
case"y":Q=+Q;
if(Q<100){Q+=M+(Q<H?100:0)
}return this.set("year",Q);
case"T":if(Q=="Z"){Q="+00"
}var R=Q.match(/([+-])(\d{2}):?(\d{2})?/);
R=(R[1]+"1")*(R[2]*60+(+R[3]||0))+this.getTimezoneOffset();
return this.set("time",this-R*60000)
}return this
};
I.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b( %d%o)?( %Y)?( %X)?","%Y %b( %d%o( %X)?)?","%o %b %d %X %T %Y");
MooTools.lang.addEvent("langChange",function(P){if(MooTools.lang.get("Date")){B(P)
}}).fireEvent("langChange",MooTools.lang.getCurrentLanguage())
})();
Date.implement({timeDiffInWords:function(A){return Date.distanceOfTimeInWords(this,A||new Date)
},timeDiff:function(G,B){if(G==null){G=new Date
}var F=((G-this)/1000).toInt();
if(!F){return"0s"
}var A={s:60,m:60,h:24,d:365,y:0};
var E,D=[];
for(var C in A){if(!F){break
}if((E=A[C])){D.unshift((F%E)+C);
F=(F/E).toInt()
}else{D.unshift(F+C)
}}return D.join(B||":")
}});
Date.alias("timeDiffInWords","timeAgoInWords");
Date.extend({distanceOfTimeInWords:function(B,A){return Date.getTimePhrase(((A-B)/1000).toInt())
},getTimePhrase:function(F){var D=(F<0)?"Until":"Ago";
if(F<0){F*=-1
}var B={minute:60,hour:60,day:24,week:7,month:52/12,year:12,eon:Infinity};
var E="lessThanMinute";
for(var C in B){var A=B[C];
if(F<1.5*A){if(F>0.75*A){E=C
}break
}F/=A;
E=C+"s"
}return Date.getMsg(E+D).substitute({delta:F.round()})
}});
Date.defineParsers({re:/^(?:tod|tom|yes)/i,handler:function(A){var B=new Date().clearTime();
switch(A[0]){case"tom":return B.increment();
case"yes":return B.decrement();
default:return B
}}},{re:/^(next|last) ([a-z]+)$/i,handler:function(D){var E=new Date().clearTime();
var B=E.getDay();
var C=Date.parseDay(D[2],true);
var A=C-B;
if(C<=B){A+=7
}if(D[1]=="last"){A-=7
}return E.set("date",E.getDate()+A)
}});
Hash.implement({getFromPath:function(A){var B=this.getClean();
A.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(C){if(!B){return null
}var D=arguments[2]||arguments[1]||arguments[0];
B=(D in B)?B[D]:null;
return C
});
return B
},cleanValues:function(A){A=A||$defined;
this.each(function(C,B){if(!A(C)){this.erase(B)
}},this);
return this
},run:function(){var A=arguments;
this.each(function(C,B){if($type(C)=="function"){C.run(A)
}})
}});
(function(){var B=["??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??","??"];
var A=["A","a","A","a","A","a","A","a","Ae","ae","A","a","A","a","A","a","C","c","C","c","C","c","D","d","D","d","E","e","E","e","E","e","E","e","E","e","E","e","G","g","I","i","I","i","I","i","I","i","L","l","L","l","L","l","N","n","N","n","N","n","O","o","O","o","O","o","O","o","Oe","oe","O","o","o","R","r","R","r","S","s","S","s","S","s","T","t","T","t","T","t","U","u","U","u","U","u","Ue","ue","U","u","Y","y","Y","y","Z","z","Z","z","Z","z","TH","th","DH","dh","ss","OE","oe","AE","ae","u"];
var D={"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"};
var C=function(E,F){E=E||"";
var G=F?"<"+E+"[^>]*>([\\s\\S]*?)</"+E+">":"</?"+E+"([^>]+)?>";
reg=new RegExp(G,"gi");
return reg
};
String.implement({standardize:function(){var E=this;
B.each(function(G,F){E=E.replace(new RegExp(G,"g"),A[F])
});
return E
},repeat:function(E){return new Array(E+1).join(this)
},pad:function(F,H,E){if(this.length>=F){return this
}var G=(H==null?" ":""+H).repeat(F-this.length).substr(0,F-this.length);
if(!E||E=="right"){return this+G
}if(E=="left"){return G+this
}return G.substr(0,(G.length/2).floor())+this+G.substr(0,(G.length/2).ceil())
},getTags:function(E,F){return this.match(C(E,F))||[]
},stripTags:function(E,F){return this.replace(C(E,F),"")
},tidy:function(){var E=this.toString();
$each(D,function(G,F){E=E.replace(new RegExp(F,"g"),G)
});
return E
}})
})();
String.implement({parseQueryString:function(){var B=this.split(/[&;]/),A={};
if(B.length){B.each(function(G){var C=G.indexOf("="),D=C<0?[""]:G.substr(0,C).match(/[^\]\[]+/g),E=decodeURIComponent(G.substr(C+1)),F=A;
D.each(function(I,H){var J=F[I];
if(H<D.length-1){F=F[I]=J||{}
}else{if($type(J)=="array"){J.push(E)
}else{F[I]=$defined(J)?[J,E]:E
}}})
})
}return A
},cleanQueryString:function(A){return this.split("&").filter(function(E){var B=E.indexOf("="),C=B<0?"":E.substr(0,B),D=E.substr(B+1);
return A?A.run([C,D]):$chk(D)
}).join("&")
}});
var URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(B,A){this.setOptions(A);
var C=this.options.base||URI.base;
if(!B){B=C
}if(B&&B.parsed){this.parsed=$unlink(B.parsed)
}else{this.set("value",B.href||B.toString(),C?new URI(C):false)
}},parse:function(C,B){var A=C.match(this.regex);
if(!A){return false
}A.shift();
return this.merge(A.associate(this.parts),B)
},merge:function(B,A){if((!B||!B.scheme)&&(!A||!A.scheme)){return false
}if(A){this.parts.every(function(C){if(B[C]){return false
}B[C]=A[C]||"";
return true
})
}B.port=B.port||this.schemes[B.scheme.toLowerCase()];
B.directory=B.directory?this.parseDirectory(B.directory,A?A.directory:""):"/";
return B
},parseDirectory:function(B,C){B=(B.substr(0,1)=="/"?"":(C||"/"))+B;
if(!B.test(URI.regs.directoryDot)){return B
}var A=[];
B.replace(URI.regs.endSlash,"").split("/").each(function(D){if(D==".."&&A.length>0){A.pop()
}else{if(D!="."){A.push(D)
}}});
return A.join("/")+"/"
},combine:function(A){return A.value||A.scheme+"://"+(A.user?A.user+(A.password?":"+A.password:"")+"@":"")+(A.host||"")+(A.port&&A.port!=this.schemes[A.scheme]?":"+A.port:"")+(A.directory||"/")+(A.file||"")+(A.query?"?"+A.query:"")+(A.fragment?"#"+A.fragment:"")
},set:function(B,D,C){if(B=="value"){var A=D.match(URI.regs.scheme);
if(A){A=A[1]
}if(A&&!$defined(this.schemes[A.toLowerCase()])){this.parsed={scheme:A,value:D}
}else{this.parsed=this.parse(D,(C||this).parsed)||(A?{scheme:A,value:D}:{value:D})
}}else{if(B=="data"){this.setData(D)
}else{this.parsed[B]=D
}}return this
},get:function(A,B){switch(A){case"value":return this.combine(this.parsed,B?B.parsed:false);
case"data":return this.getData()
}return this.parsed[A]||""
},go:function(){document.location.href=this.toString()
},toURI:function(){return this
},getData:function(C,B){var A=this.get(B||"query");
if(!$chk(A)){return C?null:{}
}var D=A.parseQueryString();
return C?D[C]:D
},setData:function(A,C,B){if(typeof A=="string"){A=this.getData();
A[arguments[0]]=arguments[1]
}else{if(C){A=$merge(this.getData(),A)
}}return this.set(B||"query",Hash.toQueryString(A))
},clearData:function(A){return this.set(A||"query","")
}});
URI.prototype.toString=URI.prototype.valueOf=function(){return this.get("value")
};
URI.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};
URI.base=new URI(document.getElements("base[href]",true).getLast(),{base:document.location});
String.implement({toURI:function(A){return new URI(this,A)
}});
URI=Class.refactor(URI,{combine:function(F,E){if(!E||F.scheme!=E.scheme||F.host!=E.host||F.port!=E.port){return this.previous.apply(this,arguments)
}var A=F.file+(F.query?"?"+F.query:"")+(F.fragment?"#"+F.fragment:"");
if(!E.directory){return(F.directory||(F.file?"":"./"))+A
}var D=E.directory.split("/"),C=F.directory.split("/"),G="",H;
var B=0;
for(H=0;
H<D.length&&H<C.length&&D[H]==C[H];
H++){}for(B=0;
B<D.length-H-1;
B++){G+="../"
}for(B=H;
B<C.length-1;
B++){G+=C[B]+"/"
}return(G||(F.file?"":"./"))+A
},toAbsolute:function(A){A=new URI(A);
if(A){A.set("directory","").set("file","")
}return this.toRelative(A)
},toRelative:function(A){return this.get("value",new URI(A))
}});
Element.implement({tidy:function(){this.set("value",this.get("value").tidy())
},getTextInRange:function(B,A){return this.get("value").substring(B,A)
},getSelectedText:function(){if(this.setSelectionRange){return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd())
}return document.selection.createRange().text
},getSelectedRange:function(){if($defined(this.selectionStart)){return{start:this.selectionStart,end:this.selectionEnd}
}var E={start:0,end:0};
var A=this.getDocument().selection.createRange();
if(!A||A.parentElement()!=this){return E
}var C=A.duplicate();
if(this.type=="text"){E.start=0-C.moveStart("character",-100000);
E.end=E.start+A.text.length
}else{var B=this.get("value");
var D=B.length;
C.moveToElementText(this);
C.setEndPoint("StartToEnd",A);
if(C.text.length){D-=B.match(/[\n\r]*$/)[0].length
}E.end=D-C.text.length;
C.setEndPoint("StartToStart",A);
E.start=D-C.text.length
}return E
},getSelectionStart:function(){return this.getSelectedRange().start
},getSelectionEnd:function(){return this.getSelectedRange().end
},setCaretPosition:function(A){if(A=="end"){A=this.get("value").length
}this.selectRange(A,A);
return this
},getCaretPosition:function(){return this.getSelectedRange().start
},selectRange:function(E,A){if(this.setSelectionRange){this.focus();
this.setSelectionRange(E,A)
}else{var C=this.get("value");
var D=C.substr(E,A-E).replace(/\r/g,"").length;
E=C.substr(0,E).replace(/\r/g,"").length;
var B=this.createTextRange();
B.collapse(true);
B.moveEnd("character",E+D);
B.moveStart("character",E);
B.select()
}return this
},insertAtCursor:function(B,A){var D=this.getSelectedRange();
var C=this.get("value");
this.set("value",C.substring(0,D.start)+B+C.substring(D.end,C.length));
if($pick(A,true)){this.selectRange(D.start,D.start+B.length)
}else{this.setCaretPosition(D.start+B.length)
}return this
},insertAroundCursor:function(B,A){B=$extend({before:"",defaultMiddle:"",after:""},B);
var C=this.getSelectedText()||B.defaultMiddle;
var G=this.getSelectedRange();
var F=this.get("value");
if(G.start==G.end){this.set("value",F.substring(0,G.start)+B.before+C+B.after+F.substring(G.end,F.length));
this.selectRange(G.start+B.before.length,G.end+B.before.length+C.length)
}else{var D=F.substring(G.start,G.end);
this.set("value",F.substring(0,G.start)+B.before+D+B.after+F.substring(G.end,F.length));
var E=G.start+B.before.length;
if($pick(A,true)){this.selectRange(E,E+D.length)
}else{this.setCaretPosition(E+F.length)
}}return this
}});
Element.implement({measure:function(E){var G=function(H){return !!(!H||H.offsetHeight||H.offsetWidth)
};
if(G(this)){return E.apply(this)
}var D=this.getParent(),F=[],B=[];
while(!G(D)&&D!=document.body){B.push(D.expose());
D=D.getParent()
}var C=this.expose();
var A=E.apply(this);
C();
B.each(function(H){H()
});
return A
},expose:function(){if(this.getStyle("display")!="none"){return $empty
}var A=this.style.cssText;
this.setStyles({display:"block",position:"absolute",visibility:"hidden"});
return function(){this.style.cssText=A
}.bind(this)
},getDimensions:function(A){A=$merge({computeSize:false},A);
var E={};
var D=function(G,F){return(F.computeSize)?G.getComputedSize(F):G.getSize()
};
var B=this.getParent("body");
if(B&&this.getStyle("display")=="none"){E=this.measure(function(){return D(this,A)
})
}else{if(B){try{E=D(this,A)
}catch(C){}}else{E={x:0,y:0}
}}return $chk(E.x)?$extend(E,{width:E.x,height:E.y}):$extend(E,{x:E.width,y:E.height})
},getComputedSize:function(A){A=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},A);
var C={width:0,height:0};
switch(A.mode){case"vertical":delete C.width;
delete A.plains.width;
break;
case"horizontal":delete C.height;
delete A.plains.height;
break
}var B=[];
$each(A.plains,function(G,F){G.each(function(H){A.styles.each(function(I){B.push((I=="border")?I+"-"+H+"-width":I+"-"+H)
})
})
});
var E={};
B.each(function(F){E[F]=this.getComputedStyle(F)
},this);
var D=[];
$each(A.plains,function(G,F){var H=F.capitalize();
C["total"+H]=C["computed"+H]=0;
G.each(function(I){C["computed"+I.capitalize()]=0;
B.each(function(K,J){if(K.test(I)){E[K]=E[K].toInt()||0;
C["total"+H]=C["total"+H]+E[K];
C["computed"+I.capitalize()]=C["computed"+I.capitalize()]+E[K]
}if(K.test(I)&&F!=K&&(K.test("border")||K.test("padding"))&&!D.contains(K)){D.push(K);
C["computed"+H]=C["computed"+H]-E[K]
}})
})
});
["Width","Height"].each(function(G){var F=G.toLowerCase();
if(!$chk(C[F])){return 
}C[F]=C[F]+this["offset"+G]+C["computed"+G];
C["total"+G]=C[F]+C["total"+G];
delete C["computed"+G]
},this);
return $extend(E,C)
}});
(function(){var A=false;
window.addEvent("domready",function(){var B=new Element("div").setStyles({position:"fixed",top:0,right:0}).inject(document.body);
A=(B.offsetTop===0);
B.dispose()
});
Element.implement({pin:function(D){if(this.getStyle("display")=="none"){return null
}var F,B=window.getScroll();
if(D!==false){F=this.getPosition();
if(!this.retrieve("pinned")){var H={top:F.y-B.y,left:F.x-B.x};
if(A){this.setStyle("position","fixed").setStyles(H)
}else{this.store("pinnedByJS",true);
this.setStyles({position:"absolute",top:F.y,left:F.x}).addClass("isPinned");
this.store("scrollFixer",(function(){if(this.retrieve("pinned")){var I=window.getScroll()
}this.setStyles({top:H.top.toInt()+I.y,left:H.left.toInt()+I.x})
}).bind(this));
window.addEvent("scroll",this.retrieve("scrollFixer"))
}this.store("pinned",true)
}}else{var G;
if(!Browser.Engine.trident){var E=this.getParent();
G=(E.getComputedStyle("position")!="static"?E:E.getOffsetParent())
}F=this.getPosition(G);
this.store("pinned",false);
var C;
if(A&&!this.retrieve("pinnedByJS")){C={top:F.y+B.y,left:F.x+B.x}
}else{this.store("pinnedByJS",false);
window.removeEvent("scroll",this.retrieve("scrollFixer"));
C={top:F.y,left:F.x}
}this.setStyles($merge(C,{position:"absolute"})).removeClass("isPinned")
}return this
},unpin:function(){return this.pin(false)
},togglepin:function(){this.pin(!this.retrieve("pinned"))
}})
})();
(function(){var A=Element.prototype.position;
Element.implement({position:function(H){if(H&&($defined(H.x)||$defined(H.y))){return A?A.apply(this,arguments):this
}$each(H||{},function(V,U){if(!$defined(V)){delete H[U]
}});
H=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,ignoreScroll:false,allowNegative:false},H);
var S={x:0,y:0},F=false;
var C=this.measure(function(){return document.id(this.getOffsetParent())
});
if(C&&C!=this.getDocument().body){S=C.measure(function(){return this.getPosition()
});
F=C!=document.id(H.relativeTo);
H.offset.x=H.offset.x-S.x;
H.offset.y=H.offset.y-S.y
}var T=function(U){if($type(U)!="string"){return U
}U=U.toLowerCase();
var V={};
if(U.test("left")){V.x="left"
}else{if(U.test("right")){V.x="right"
}else{V.x="center"
}}if(U.test("upper")||U.test("top")){V.y="top"
}else{if(U.test("bottom")){V.y="bottom"
}else{V.y="center"
}}return V
};
H.edge=T(H.edge);
H.position=T(H.position);
if(!H.edge){if(H.position.x=="center"&&H.position.y=="center"){H.edge={x:"center",y:"center"}
}else{H.edge={x:"left",y:"top"}
}}this.setStyle("position","absolute");
var G=document.id(H.relativeTo)||document.body,D=G==document.body?window.getScroll():G.getPosition(),N=D.y,I=D.x;
var E=G.getScrolls();
N+=E.y;
I+=E.x;
var O=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});
var K={},P=H.offset.y,R=H.offset.x,L=window.getSize();
switch(H.position.x){case"left":K.x=I+R;
break;
case"right":K.x=I+R+G.offsetWidth;
break;
default:K.x=I+((G==document.body?L.x:G.offsetWidth)/2)+R;
break
}switch(H.position.y){case"top":K.y=N+P;
break;
case"bottom":K.y=N+P+G.offsetHeight;
break;
default:K.y=N+((G==document.body?L.y:G.offsetHeight)/2)+P;
break
}if(H.edge){var B={};
switch(H.edge.x){case"left":B.x=0;
break;
case"right":B.x=-O.x-O.computedRight-O.computedLeft;
break;
default:B.x=-(O.totalWidth/2);
break
}switch(H.edge.y){case"top":B.y=0;
break;
case"bottom":B.y=-O.y-O.computedTop-O.computedBottom;
break;
default:B.y=-(O.totalHeight/2);
break
}K.x+=B.x;
K.y+=B.y
}K={left:((K.x>=0||F||H.allowNegative)?K.x:0).toInt(),top:((K.y>=0||F||H.allowNegative)?K.y:0).toInt()};
var J={left:"x",top:"y"};
["minimum","maximum"].each(function(U){["left","top"].each(function(V){var W=H[U]?H[U][J[V]]:null;
if(W!=null&&K[V]<W){K[V]=W
}})
});
if(G.getStyle("position")=="fixed"||H.relFixedPosition){var M=window.getScroll();
K.top+=M.y;
K.left+=M.x
}if(H.ignoreScroll){var Q=G.getScroll();
K.top-=Q.y;
K.left-=Q.x
}if(H.ignoreMargins){K.left+=(H.edge.x=="right"?O["margin-right"]:H.edge.x=="center"?-O["margin-left"]+((O["margin-right"]+O["margin-left"])/2):-O["margin-left"]);
K.top+=(H.edge.y=="bottom"?O["margin-bottom"]:H.edge.y=="center"?-O["margin-top"]+((O["margin-bottom"]+O["margin-top"])/2):-O["margin-top"])
}K.left=Math.ceil(K.left);
K.top=Math.ceil(K.top);
if(H.returnPos){return K
}else{this.setStyles(K)
}return this
}})
})();
Element.implement({isDisplayed:function(){return this.getStyle("display")!="none"
},isVisible:function(){var A=this.offsetWidth,B=this.offsetHeight;
return(A==0&&B==0)?false:(A>0&&B>0)?true:this.isDisplayed()
},toggle:function(){return this[this.isDisplayed()?"hide":"show"]()
},hide:function(){var B;
try{if((B=this.getStyle("display"))=="none"){B=null
}}catch(A){}return this.store("originalDisplay",B||"block").setStyle("display","none")
},show:function(A){return this.setStyle("display",A||this.retrieve("originalDisplay")||"block")
},swapClass:function(A,B){return this.removeClass(A).addClass(B)
}});
var OverText=new Class({Implements:[Options,Events,Class.Occlude],Binds:["reposition","assert","focus","hide"],options:{element:"label",positionOptions:{position:"upperLeft",edge:"upperLeft",offset:{x:4,y:2}},poll:false,pollInterval:250,wrap:false},property:"OverText",initialize:function(B,A){this.element=document.id(B);
if(this.occlude()){return this.occluded
}this.setOptions(A);
this.attach(this.element);
OverText.instances.push(this);
if(this.options.poll){this.poll()
}return this
},toElement:function(){return this.element
},attach:function(){var A=this.options.textOverride||this.element.get("alt")||this.element.get("title");
if(!A){return 
}this.text=new Element(this.options.element,{"class":"overTxtLabel",styles:{lineHeight:"normal",position:"absolute",cursor:"text"},html:A,events:{click:this.hide.pass(this.options.element=="label",this)}}).inject(this.element,"after");
if(this.options.element=="label"){if(!this.element.get("id")){this.element.set("id","input_"+new Date().getTime())
}this.text.set("for",this.element.get("id"))
}if(this.options.wrap){this.textHolder=new Element("div",{styles:{lineHeight:"normal",position:"relative"},"class":"overTxtWrapper"}).adopt(this.text).inject(this.element,"before")
}this.element.addEvents({focus:this.focus,blur:this.assert,change:this.assert}).store("OverTextDiv",this.text);
window.addEvent("resize",this.reposition.bind(this));
this.assert(true);
this.reposition()
},wrap:function(){if(this.options.element=="label"){if(!this.element.get("id")){this.element.set("id","input_"+new Date().getTime())
}this.text.set("for",this.element.get("id"))
}},startPolling:function(){this.pollingPaused=false;
return this.poll()
},poll:function(A){if(this.poller&&!A){return this
}var B=function(){if(!this.pollingPaused){this.assert(true)
}}.bind(this);
if(A){$clear(this.poller)
}else{this.poller=B.periodical(this.options.pollInterval,this)
}return this
},stopPolling:function(){this.pollingPaused=true;
return this.poll(true)
},focus:function(){if(this.text&&(!this.text.isDisplayed()||this.element.get("disabled"))){return 
}this.hide()
},hide:function(C,A){if(this.text&&(this.text.isDisplayed()&&(!this.element.get("disabled")||A))){this.text.hide();
this.fireEvent("textHide",[this.text,this.element]);
this.pollingPaused=true;
try{if(!C){this.element.fireEvent("focus")
}this.element.focus()
}catch(B){}}return this
},show:function(){if(this.text&&!this.text.isDisplayed()){this.text.show();
this.reposition();
this.fireEvent("textShow",[this.text,this.element]);
this.pollingPaused=false
}return this
},assert:function(A){this[this.test()?"show":"hide"](A)
},test:function(){var A=this.element.get("value");
return !A
},reposition:function(){this.assert(true);
if(!this.element.isVisible()){return this.stopPolling().hide()
}if(this.text&&this.test()){this.text.position($merge(this.options.positionOptions,{relativeTo:this.element}))
}return this
}});
OverText.instances=[];
$extend(OverText,{each:function(A){return OverText.instances.map(function(C,B){if(C.element&&C.text){return A.apply(OverText,[C,B])
}return null
})
},update:function(){return OverText.each(function(A){return A.reposition()
})
},hideAll:function(){return OverText.each(function(A){return A.hide(true,true)
})
},showAll:function(){return OverText.each(function(A){return A.show()
})
}});
if(window.Fx&&Fx.Reveal){Fx.Reveal.implement({hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed, .overTxtLabel":false})
}Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(B,A){this.elements=this.subject=$$(B);
this.parent(A)
},compute:function(G,H,I){var C={};
for(var D in G){var A=G[D],E=H[D],F=C[D]={};
for(var B in A){F[B]=this.parent(A[B],E[B],I)
}}return C
},set:function(B){for(var C in B){var A=B[C];
for(var D in A){this.render(this.elements[C],D,A[D],this.options.unit)
}}return this
},start:function(C){if(!this.check(C)){return this
}var H={},I={};
for(var D in C){var F=C[D],A=H[D]={},G=I[D]={};
for(var B in F){var E=this.prepare(this.elements[D],B,F[B]);
A[B]=E.from;
G[B]=E.to
}}return this.parent(H,I)
}});
var Accordion=Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,returnHeightToAuto:true},initialize:function(){var C=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});
this.parent(C.elements,C.options);
this.togglers=$$(C.togglers);
this.container=document.id(C.container);
this.previous=-1;
this.internalChain=new Chain();
if(this.options.alwaysHide){this.options.wait=true
}if($chk(this.options.show)){this.options.display=false;
this.previous=this.options.show
}if(this.options.start){this.options.display=false;
this.options.show=false
}this.effects={};
if(this.options.opacity){this.effects.opacity="fullOpacity"
}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth"
}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight"
}for(var B=0,A=this.togglers.length;
B<A;
B++){this.addSection(this.togglers[B],this.elements[B])
}this.elements.each(function(E,D){if(this.options.show===D){this.fireEvent("active",[this.togglers[D],E])
}else{for(var F in this.effects){E.setStyle(F,0)
}}},this);
if($chk(this.options.display)){this.display(this.options.display,this.options.initialDisplayFx)
}this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain))
},addSection:function(E,C){E=document.id(E);
C=document.id(C);
var F=this.togglers.contains(E);
this.togglers.include(E);
this.elements.include(C);
var A=this.togglers.indexOf(E);
var B=this.display.bind(this,A);
E.store("accordion:display",B);
E.addEvent(this.options.trigger,B);
if(this.options.height){C.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})
}if(this.options.width){C.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})
}C.fullOpacity=1;
if(this.options.fixedWidth){C.fullWidth=this.options.fixedWidth
}if(this.options.fixedHeight){C.fullHeight=this.options.fixedHeight
}C.setStyle("overflow","hidden");
if(!F){for(var D in this.effects){C.setStyle(D,0)
}}return this
},detach:function(){this.togglers.each(function(A){A.removeEvent(this.options.trigger,A.retrieve("accordion:display"))
},this)
},display:function(A,B){if(!this.check(A,B)){return this
}B=$pick(B,true);
if(this.options.returnHeightToAuto){var D=this.elements[this.previous];
if(D&&!this.selfHidden){for(var C in this.effects){D.setStyle(C,D[this.effects[C]])
}}}A=($type(A)=="element")?this.elements.indexOf(A):A;
if((this.timer&&this.options.wait)||(A===this.previous&&!this.options.alwaysHide)){return this
}this.previous=A;
var E={};
this.elements.each(function(H,G){E[G]={};
var F;
if(G!=A){F=true
}else{if(this.options.alwaysHide&&((H.offsetHeight>0&&this.options.height)||H.offsetWidth>0&&this.options.width)){F=true;
this.selfHidden=true
}}this.fireEvent(F?"background":"active",[this.togglers[G],H]);
for(var I in this.effects){E[G][I]=F?0:H[this.effects[I]]
}},this);
this.internalChain.chain(function(){if(this.options.returnHeightToAuto&&!this.selfHidden){var F=this.elements[A];
if(F){F.setStyle("height","auto")
}}}.bind(this));
return B?this.start(E):this.set(E)
}});
Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(A){return this.parent(this.element.position($merge(this.options,A,{returnPos:true})))
}});
Element.Properties.move={set:function(A){var B=this.retrieve("move");
if(B){B.cancel()
}return this.eliminate("move").store("move:options",$extend({link:"cancel"},A))
},get:function(A){if(A||!this.retrieve("move")){if(A||!this.retrieve("move:options")){this.set("move",A)
}this.store("move",new Fx.Move(this,this.retrieve("move:options")))
}return this.retrieve("move")
}};
Element.implement({move:function(A){this.get("move").start(A);
return this
}});
Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.Engine.trident4,mode:"vertical",display:"block",hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed":false},dissolve:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;
this.showing=false;
this.hidden=true;
this.cssText=this.element.style.cssText;
var D=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});
this.element.setStyle("display","block");
if(this.options.transitionOpacity){D.opacity=1
}var B={};
$each(D,function(F,E){B[E]=[F,0]
},this);
this.element.setStyle("overflow","hidden");
var A=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;
this.$chain.unshift(function(){if(this.hidden){this.hiding=false;
$each(D,function(F,E){D[E]=F
},this);
this.element.style.cssText=this.cssText;
this.element.setStyle("display","none");
if(A){A.setStyle("visibility","visible")
}}this.fireEvent("hide",this.element);
this.callChain()
}.bind(this));
if(A){A.setStyle("visibility","hidden")
}this.start(B)
}else{this.callChain.delay(10,this);
this.fireEvent("complete",this.element);
this.fireEvent("hide",this.element)
}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this))
}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();
this.dissolve()
}}}}catch(C){this.hiding=false;
this.element.setStyle("display","none");
this.callChain.delay(10,this);
this.fireEvent("complete",this.element);
this.fireEvent("hide",this.element)
}return this
},reveal:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.showing=true;
this.hiding=this.hidden=false;
var D;
this.cssText=this.element.style.cssText;
this.element.measure(function(){D=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode})
}.bind(this));
$each(D,function(F,E){D[E]=F
});
if($chk(this.options.heightOverride)){D.height=this.options.heightOverride.toInt()
}if($chk(this.options.widthOverride)){D.width=this.options.widthOverride.toInt()
}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);
D.opacity=1
}var B={height:0,display:this.options.display};
$each(D,function(F,E){B[E]=0
});
this.element.setStyles($merge(B,{overflow:"hidden"}));
var A=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;
if(A){A.setStyle("visibility","hidden")
}this.start(D);
this.$chain.unshift(function(){this.element.style.cssText=this.cssText;
this.element.setStyle("display",this.options.display);
if(!this.hidden){this.showing=false
}if(A){A.setStyle("visibility","visible")
}this.callChain();
this.fireEvent("show",this.element)
}.bind(this))
}else{this.callChain();
this.fireEvent("complete",this.element);
this.fireEvent("show",this.element)
}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this))
}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();
this.reveal()
}}}}catch(C){this.element.setStyles({display:this.options.display,visiblity:"visible",opacity:1});
this.showing=false;
this.callChain.delay(10,this);
this.fireEvent("complete",this.element);
this.fireEvent("show",this.element)
}return this
},toggle:function(){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.reveal()
}else{this.dissolve()
}return this
},cancel:function(){this.parent.apply(this,arguments);
this.element.style.cssText=this.cssText;
this.hidding=false;
this.showing=false
}});
Element.Properties.reveal={set:function(A){var B=this.retrieve("reveal");
if(B){B.cancel()
}return this.eliminate("reveal").store("reveal:options",A)
},get:function(A){if(A||!this.retrieve("reveal")){if(A||!this.retrieve("reveal:options")){this.set("reveal",A)
}this.store("reveal",new Fx.Reveal(this,this.retrieve("reveal:options")))
}return this.retrieve("reveal")
}};
Element.Properties.dissolve=Element.Properties.reveal;
Element.implement({reveal:function(A){this.get("reveal",A).reveal();
return this
},dissolve:function(A){this.get("reveal",A).dissolve();
return this
},nix:function(){var A=Array.link(arguments,{destroy:Boolean.type,options:Object.type});
this.get("reveal",A.options).dissolve().chain(function(){this[A.destroy?"destroy":"dispose"]()
}.bind(this));
return this
},wink:function(){var B=Array.link(arguments,{duration:Number.type,options:Object.type});
var A=this.get("reveal",B.options);
A.reveal().chain(function(){(function(){A.dissolve()
}).delay(B.duration||2000)
})
}});
Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.element=this.subject=document.id(B);
this.parent(A);
var D=this.cancel.bind(this,false);
if($type(this.element)!="element"){this.element=document.id(this.element.getDocument().body)
}var C=this.element;
if(this.options.wheelStops){this.addEvent("start",function(){C.addEvent("mousewheel",D)
},true);
this.addEvent("complete",function(){C.removeEvent("mousewheel",D)
},true)
}},set:function(){var A=Array.flatten(arguments);
if(Browser.Engine.gecko){A=[Math.round(A[0]),Math.round(A[1])]
}this.element.scrollTo(A[0],A[1])
},compute:function(C,B,A){return[0,1].map(function(D){return Fx.compute(C[D],B[D],A)
})
},start:function(C,G){if(!this.check(C,G)){return this
}var E=this.element.getScrollSize(),B=this.element.getScroll(),D={x:C,y:G};
for(var F in D){var A=E[F];
if($chk(D[F])){D[F]=($type(D[F])=="number")?D[F]:A
}else{D[F]=B[F]
}D[F]+=this.options.offset[F]
}return this.parent([B.x,B.y],[D.x,D.y])
},toTop:function(){return this.start(false,0)
},toLeft:function(){return this.start(0,false)
},toRight:function(){return this.start("right",false)
},toBottom:function(){return this.start(false,"bottom")
},toElement:function(B){var A=document.id(B).getPosition(this.element);
return this.start(A.x,A.y)
},scrollIntoView:function(C,E,D){E=E?$splat(E):["x","y"];
var H={};
C=document.id(C);
var F=C.getPosition(this.element);
var I=C.getSize();
var G=this.element.getScroll();
var A=this.element.getSize();
var B={x:F.x+I.x,y:F.y+I.y};
["x","y"].each(function(J){if(E.contains(J)){if(B[J]>G[J]+A[J]){H[J]=B[J]-A[J]
}if(F[J]<G[J]){H[J]=F[J]
}}if(H[J]==null){H[J]=G[J]
}if(D&&D[J]){H[J]=H[J]+D[J]
}},this);
if(H.x!=G.x||H.y!=G.y){this.start(H.x,H.y)
}return this
},scrollToCenter:function(C,E,D){E=E?$splat(E):["x","y"];
C=$(C);
var H={},F=C.getPosition(this.element),I=C.getSize(),G=this.element.getScroll(),A=this.element.getSize(),B={x:F.x+I.x,y:F.y+I.y};
["x","y"].each(function(J){if(E.contains(J)){H[J]=F[J]-(A[J]-I[J])/2
}if(H[J]==null){H[J]=G[J]
}if(D&&D[J]){H[J]=H[J]+D[J]
}},this);
if(H.x!=G.x||H.y!=G.y){this.start(H.x,H.y)
}return this
}});
Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",hideOverflow:true},initialize:function(B,A){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);
if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper)
}},true);
this.element=this.subject=document.id(B);
this.parent(A);
var D=this.element.retrieve("wrapper");
var C=this.element.getStyles("margin","position","overflow");
if(this.options.hideOverflow){C=$extend(C,{overflow:"hidden"})
}this.wrapper=D||new Element("div",{styles:C}).wraps(this.element);
this.element.store("wrapper",this.wrapper).setStyle("margin",0);
this.now=[];
this.open=true
},vertical:function(){this.margin="margin-top";
this.layout="height";
this.offset=this.element.offsetHeight
},horizontal:function(){this.margin="margin-left";
this.layout="width";
this.offset=this.element.offsetWidth
},set:function(A){this.element.setStyle(this.margin,A[0]);
this.wrapper.setStyle(this.layout,A[1]);
return this
},compute:function(C,B,A){return[0,1].map(function(D){return Fx.compute(C[D],B[D],A)
})
},start:function(B,E){if(!this.check(B,E)){return this
}this[E||this.options.mode]();
var D=this.element.getStyle(this.margin).toInt();
var C=this.wrapper.getStyle(this.layout).toInt();
var A=[[D,C],[0,this.offset]];
var G=[[D,C],[-this.offset,0]];
var F;
switch(B){case"in":F=A;
break;
case"out":F=G;
break;
case"toggle":F=(C==0)?A:G
}return this.parent(F[0],F[1])
},slideIn:function(A){return this.start("in",A)
},slideOut:function(A){return this.start("out",A)
},hide:function(A){this[A||this.options.mode]();
this.open=false;
return this.set([-this.offset,0])
},show:function(A){this[A||this.options.mode]();
this.open=true;
return this.set([0,this.offset])
},toggle:function(A){return this.start("toggle",A)
}});
Element.Properties.slide={set:function(B){var A=this.retrieve("slide");
if(A){A.cancel()
}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},B))
},get:function(A){if(A||!this.retrieve("slide")){if(A||!this.retrieve("slide:options")){this.set("slide",A)
}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")))
}return this.retrieve("slide")
}};
Element.implement({slide:function(D,E){D=D||"toggle";
var B=this.get("slide"),A;
switch(D){case"hide":B.hide(E);
break;
case"show":B.show(E);
break;
case"toggle":var C=this.retrieve("slide:flag",B.open);
B[C?"slideOut":"slideIn"](E);
this.store("slide:flag",!C);
A=true;
break;
default:B.start(D,E)
}if(!A){this.eliminate("slide:flag")
}return this
}});
var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(B,C){C=C||document;
this.doc=C.getDocument();
var D=C.getWindow();
this.parent(this.doc,B);
this.links=$$(this.options.links||this.doc.links);
var A=D.location.href.match(/^[^#]*/)[0]+"#";
this.links.each(function(F){if(F.href.indexOf(A)!=0){return 
}var E=F.href.substr(A.length);
if(E){this.useLink(F,E)
}},this);
if(!Browser.Engine.webkit419){this.addEvent("complete",function(){D.location.hash=this.anchor
},true)
}},useLink:function(C,A){var B;
C.addEvent("click",function(D){if(B!==false&&!B){B=document.id(A)||this.doc.getElement("a[name="+A+"]")
}if(B){D.preventDefault();
this.anchor=A;
this.toElement(B).chain(function(){this.fireEvent("scrolledTo",[C,B])
}.bind(this));
C.blur()
}}.bind(this))
}});
Fx.Sort=new Class({Extends:Fx.Elements,options:{mode:"vertical"},initialize:function(B,A){this.parent(B,A);
this.elements.each(function(C){if(C.getStyle("position")=="static"){C.setStyle("position","relative")
}});
this.setDefaultOrder()
},setDefaultOrder:function(){this.currentOrder=this.elements.map(function(B,A){return A
})
},sort:function(E){if($type(E)!="array"){return false
}var I=0,A=0,C={},H={},D=this.options.mode=="vertical";
var F=this.elements.map(function(M,J){var L=M.getComputedSize({styles:["border","padding","margin"]});
var N;
if(D){N={top:I,margin:L["margin-top"],height:L.totalHeight};
I+=N.height-L["margin-top"]
}else{N={left:A,margin:L["margin-left"],width:L.totalWidth};
A+=N.width
}var K=D?"top":"left";
H[J]={};
var O=M.getStyle(K).toInt();
H[J][K]=O||0;
return N
},this);
this.set(H);
E=E.map(function(J){return J.toInt()
});
if(E.length!=this.elements.length){this.currentOrder.each(function(J){if(!E.contains(J)){E.push(J)
}});
if(E.length>this.elements.length){E.splice(this.elements.length-1,E.length-this.elements.length)
}}var B=I=A=0;
E.each(function(L,J){var K={};
if(D){K.top=I-F[L].top-B;
I+=F[L].height
}else{K.left=A-F[L].left;
A+=F[L].width
}B=B+F[L].margin;
C[L]=K
},this);
var G={};
$A(E).sort().each(function(J){G[J]=C[J]
});
this.start(G);
this.currentOrder=E;
return this
},rearrangeDOM:function(A){A=A||this.currentOrder;
var B=this.elements[0].getParent();
var C=[];
this.elements.setStyle("opacity",0);
A.each(function(D){C.push(this.elements[D].inject(B).setStyles({top:0,left:0}))
},this);
this.elements.setStyle("opacity",1);
this.elements=$$(C);
this.setDefaultOrder();
return this
},getDefaultOrder:function(){return this.elements.map(function(B,A){return A
})
},forward:function(){return this.sort(this.getDefaultOrder())
},backward:function(){return this.sort(this.getDefaultOrder().reverse())
},reverse:function(){return this.sort(this.currentOrder.reverse())
},sortByElements:function(A){return this.sort(A.map(function(B){return this.elements.indexOf(B)
},this))
},swap:function(C,B){if($type(C)=="element"){C=this.elements.indexOf(C)
}if($type(B)=="element"){B=this.elements.indexOf(B)
}var A=$A(this.currentOrder);
A[this.currentOrder.indexOf(C)]=B;
A[this.currentOrder.indexOf(B)]=C;
return this.sort(A)
}});
var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var B=Array.link(arguments,{options:Object.type,element:$defined});
this.element=document.id(B.element);
this.document=this.element.getDocument();
this.setOptions(B.options||{});
var A=$type(this.options.handle);
this.handles=((A=="array"||A=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
this.mouse={now:{},pos:{}};
this.value={start:{},now:{}};
this.selection=(Browser.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(C){if(C.rightClick){return 
}if(this.options.preventDefault){C.preventDefault()
}if(this.options.stopPropagation){C.stopPropagation()
}this.mouse.start=C.page;
this.fireEvent("beforeStart",this.element);
var A=this.options.limit;
this.limit={x:[],y:[]};
for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue
}if(this.options.style){this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt()
}else{this.value.now[D]=this.element[this.options.modifiers[D]]
}if(this.options.invert){this.value.now[D]*=-1
}this.mouse.pos[D]=C.page[D]-this.value.now[D];
if(A&&A[D]){for(var B=2;
B--;
B){if($chk(A[D][B])){this.limit[D][B]=$lambda(A[D][B])()
}}}}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(A){if(this.options.preventDefault){A.preventDefault()
}var B=Math.round(Math.sqrt(Math.pow(A.page.x-this.mouse.start.x,2)+Math.pow(A.page.y-this.mouse.start.y,2)));
if(B>this.options.snap){this.cancel();
this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});
this.fireEvent("start",[this.element,A]).fireEvent("snap",this.element)
}},drag:function(A){if(this.options.preventDefault){A.preventDefault()
}this.mouse.now=A.page;
for(var B in this.options.modifiers){if(!this.options.modifiers[B]){continue
}this.value.now[B]=this.mouse.now[B]-this.mouse.pos[B];
if(this.options.invert){this.value.now[B]*=-1
}if(this.options.limit&&this.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1]
}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0]
}}}if(this.options.grid[B]){this.value.now[B]-=((this.value.now[B]-(this.limit[B][0]||0))%this.options.grid[B])
}if(this.options.style){this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit)
}else{this.element[this.options.modifiers[B]]=this.value.now[B]
}}this.fireEvent("drag",[this.element,A])
},cancel:function(A){this.document.removeEvent("mousemove",this.bound.check);
this.document.removeEvent("mouseup",this.bound.cancel);
if(A){this.document.removeEvent(this.selection,this.bound.eventStop);
this.fireEvent("cancel",this.element)
}},stop:function(A){this.document.removeEvent(this.selection,this.bound.eventStop);
this.document.removeEvent("mousemove",this.bound.drag);
this.document.removeEvent("mouseup",this.bound.stop);
if(A){this.fireEvent("complete",[this.element,A])
}}});
Element.implement({makeResizable:function(A){var B=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},A));
this.store("resizer",B);
return B.addEvent("drag",function(){this.fireEvent("resize",B)
}.bind(this))
}});
Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(B,A){this.parent(B,A);
B=this.element;
this.droppables=$$(this.options.droppables);
this.container=document.id(this.options.container);
if(this.container&&$type(this.container)!="element"){this.container=document.id(this.container.getDocument().body)
}var C=B.getStyles("left","right","position");
if(C.left=="auto"||C.top=="auto"){B.setPosition(B.getPosition(B.getOffsetParent()))
}if(C.position=="static"){B.setStyle("position","absolute")
}this.addEvent("start",this.checkDroppables,true);
this.overed=null
},start:function(A){if(this.container){this.options.limit=this.calculateLimit()
}if(this.options.precalculate){this.positions=this.droppables.map(function(B){return B.getCoordinates()
})
}this.parent(A)
},calculateLimit:function(){var D=this.element.getOffsetParent(),G=this.container.getCoordinates(D),F={},C={},B={},I={},K={};
["top","right","bottom","left"].each(function(O){F[O]=this.container.getStyle("border-"+O).toInt();
B[O]=this.element.getStyle("border-"+O).toInt();
C[O]=this.element.getStyle("margin-"+O).toInt();
I[O]=this.container.getStyle("margin-"+O).toInt();
K[O]=D.getStyle("padding-"+O).toInt()
},this);
var E=this.element.offsetWidth+C.left+C.right,N=this.element.offsetHeight+C.top+C.bottom,H=0,J=0,M=G.right-F.right-E,A=G.bottom-F.bottom-N;
if(this.options.includeMargins){H+=C.left;
J+=C.top
}else{M+=C.right;
A+=C.bottom
}if(this.element.getStyle("position")=="relative"){var L=this.element.getCoordinates(D);
L.left-=this.element.getStyle("left").toInt();
L.top-=this.element.getStyle("top").toInt();
H+=F.left-L.left;
J+=F.top-L.top;
M+=C.left-L.left;
A+=C.top-L.top;
if(this.container!=D){H+=I.left+K.left;
J+=(Browser.Engine.trident4?0:I.top)+K.top
}}else{H-=C.left;
J-=C.top;
if(this.container==D){M-=F.left;
A-=F.top
}else{H+=G.left+F.left;
J+=G.top+F.top
}}return{x:[H,M],y:[J,A]}
},checkAgainst:function(C,B){C=(this.positions)?this.positions[B]:C.getCoordinates();
var A=this.mouse.now;
return(A.x>C.left&&A.x<C.right&&A.y<C.bottom&&A.y>C.top)
},checkDroppables:function(){var A=this.droppables.filter(this.checkAgainst,this).getLast();
if(this.overed!=A){if(this.overed){this.fireEvent("leave",[this.element,this.overed])
}if(A){this.fireEvent("enter",[this.element,A])
}this.overed=A
}},drag:function(A){this.parent(A);
if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables()
}},stop:function(A){this.checkDroppables();
this.fireEvent("drop",[this.element,this.overed,A]);
this.overed=null;
return this.parent(A)
}});
Element.implement({makeDraggable:function(A){var B=new Drag.Move(this,A);
this.store("dragger",B);
return B
}});
var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(A){if(this.options.snap){A=this.toPosition(this.step)
}this.knob.setStyle(this.property,A)
},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(F,A,E){this.setOptions(E);
this.element=document.id(F);
this.knob=document.id(A);
this.previousChange=this.previousEnd=this.step=-1;
var G,B={},D={x:false,y:false};
switch(this.options.mode){case"vertical":this.axis="y";
this.property="top";
G="offsetHeight";
break;
case"horizontal":this.axis="x";
this.property="left";
G="offsetWidth"
}this.full=this.element.measure(function(){this.half=this.knob[G]/2;
return this.element[G]-this.knob[G]+(this.options.offset*2)
}.bind(this));
this.min=$chk(this.options.range[0])?this.options.range[0]:0;
this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;
this.range=this.max-this.min;
this.steps=this.options.steps||this.full;
this.stepSize=Math.abs(this.range)/this.steps;
this.stepWidth=this.stepSize*this.full/Math.abs(this.range);
this.knob.setStyle("position","relative").setStyle(this.property,this.options.initialStep?this.toPosition(this.options.initialStep):-this.options.offset);
D[this.axis]=this.property;
B[this.axis]=[-this.options.offset,this.full-this.options.offset];
var C={snap:0,limit:B,modifiers:D,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){C.grid=Math.ceil(this.stepWidth);
C.limit[this.axis][1]=this.full
}this.drag=new Drag(this.knob,C);
this.attach()
},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(A){if(!((this.range>0)^(A<this.min))){A=this.min
}if(!((this.range>0)^(A>this.max))){A=this.max
}this.step=Math.round(A);
this.checkStep();
this.fireEvent("tick",this.toPosition(this.step));
this.end();
return this
},clickedElement:function(C){if(this.isDragging||C.target==this.knob){return 
}var B=this.range<0?-1:1;
var A=C.page[this.axis]-this.element.getPosition()[this.axis]-this.half;
A=A.limit(-this.options.offset,this.full-this.options.offset);
this.step=Math.round(this.min+B*this.toStep(A));
this.checkStep();
this.fireEvent("tick",A);
this.end()
},scrolledElement:function(A){var B=(this.options.mode=="horizontal")?(A.wheel<0):(A.wheel>0);
this.set(B?this.step-this.stepSize:this.step+this.stepSize);
A.stop()
},draggedKnob:function(){var B=this.range<0?-1:1;
var A=this.drag.value.now[this.axis];
A=A.limit(-this.options.offset,this.full-this.options.offset);
this.step=Math.round(this.min+B*this.toStep(A));
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(A){var B=(A+this.options.offset)*this.stepSize/this.full*this.steps;
return this.options.steps?Math.round(B-=B%this.stepSize):B
},toPosition:function(A){return(this.full*Math.abs(this.min-A))/(this.steps*this.stepSize)-this.options.offset
}});
var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(A,B){this.setOptions(B);
this.elements=[];
this.lists=[];
this.idle=true;
this.addLists($$(document.id(A)||A));
if(!this.options.clone){this.options.revert=false
}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert))
}},attach:function(){this.addLists(this.lists);
return this
},detach:function(){this.lists=this.removeLists(this.lists);
return this
},addItems:function(){Array.flatten(arguments).each(function(A){this.elements.push(A);
var B=A.retrieve("sortables:start",this.start.bindWithEvent(this,A));
(this.options.handle?A.getElement(this.options.handle)||A:A).addEvent("mousedown",B)
},this);
return this
},addLists:function(){Array.flatten(arguments).each(function(A){this.lists.push(A);
this.addItems(A.getChildren())
},this);
return this
},removeItems:function(){return $$(Array.flatten(arguments).map(function(A){this.elements.erase(A);
var B=A.retrieve("sortables:start");
(this.options.handle?A.getElement(this.options.handle)||A:A).removeEvent("mousedown",B);
return A
},this))
},removeLists:function(){return $$(Array.flatten(arguments).map(function(A){this.lists.erase(A);
this.removeItems(A.getChildren());
return A
},this))
},getClone:function(B,A){if(!this.options.clone){return new Element("div").inject(document.body)
}if($type(this.options.clone)=="function"){return this.options.clone.call(this,B,A,this.list)
}return A.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:A.getStyle("width")}).inject(this.list).setPosition(A.getPosition(A.getOffsetParent()))
},getDroppables:function(){var A=this.list.getChildren();
if(!this.options.constrain){A=this.lists.concat(A).erase(this.list)
}return A.erase(this.clone).erase(this.element)
},insert:function(C,B){var A="inside";
if(this.lists.contains(B)){this.list=B;
this.drag.droppables=this.getDroppables()
}else{A=this.element.getAllPrevious().contains(B)?"before":"after"
}this.element.inject(B,A);
this.fireEvent("sort",[this.element,this.clone])
},start:function(B,A){if(!this.idle){return 
}this.idle=false;
this.element=A;
this.opacity=A.get("opacity");
this.list=A.getParent();
this.clone=this.getClone(B,A);
this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){B.stop();
this.clone.setStyle("visibility","visible");
this.element.set("opacity",this.options.opacity||0);
this.fireEvent("start",[this.element,this.clone])
}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});
this.clone.inject(this.element,"before");
this.drag.start(B)
},end:function(){this.drag.detach();
this.element.set("opacity",this.opacity);
if(this.effect){var A=this.element.getStyles("width","height");
var B=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));
this.effect.element=this.clone;
this.effect.start({top:B.top,left:B.left,width:A.width,height:A.height,opacity:0.25}).chain(this.reset.bind(this))
}else{this.reset()
}},reset:function(){this.idle=true;
this.clone.destroy();
this.fireEvent("complete",this.element)
},serialize:function(){var C=Array.link(arguments,{modifier:Function.type,index:$defined});
var B=this.lists.map(function(D){return D.getChildren().map(C.modifier||function(E){return E.get("id")
},this)
},this);
var A=C.index;
if(this.lists.length==1){A=0
}return $chk(A)&&A>=0&&A<this.lists.length?B[A]:B
}});
Request.JSONP=new Class({Implements:[Chain,Events,Options,Log],options:{url:"",data:{},retries:0,timeout:0,link:"ignore",callbackKey:"callback",injectScript:document.head},initialize:function(A){this.setOptions(A);
if(this.options.log){this.enableLog()
}this.running=false;
this.requests=0;
this.triesRemaining=[]
},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(C){if(!$chk(arguments[1])&&!this.check(C)){return this
}var E=$type(C),A=this.options,B=$chk(arguments[1])?arguments[1]:this.requests++;
if(E=="string"||E=="element"){C={data:C}
}C=$extend({data:A.data,url:A.url},C);
if(!$chk(this.triesRemaining[B])){this.triesRemaining[B]=this.options.retries
}var D=this.triesRemaining[B];
(function(){var F=this.getScript(C);
this.log("JSONP retrieving script with url: "+F.get("src"));
this.fireEvent("request",F);
this.running=true;
(function(){if(D){this.triesRemaining[B]=D-1;
if(F){F.destroy();
this.send(C,B).fireEvent("retry",this.triesRemaining[B])
}}else{if(F&&this.options.timeout){F.destroy();
this.cancel().fireEvent("failure")
}}}).delay(this.options.timeout,this)
}).delay(Browser.Engine.trident?50:0,this);
return this
},cancel:function(){if(!this.running){return this
}this.running=false;
this.fireEvent("cancel");
return this
},getScript:function(C){var B=Request.JSONP.counter,D;
Request.JSONP.counter++;
switch($type(C.data)){case"element":D=document.id(C.data).toQueryString();
break;
case"object":case"hash":D=Hash.toQueryString(C.data)
}var E=C.url+(C.url.test("\\?")?"&":"?")+(C.callbackKey||this.options.callbackKey)+"=Request.JSONP.request_map.request_"+B+(D?"&"+D:"");
if(E.length>2083){this.log("JSONP "+E+" will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs")
}var A=new Element("script",{type:"text/javascript",src:E});
Request.JSONP.request_map["request_"+B]=function(F){this.success(F,A)
}.bind(this);
return A.inject(this.options.injectScript)
},success:function(B,A){if(A){A.destroy()
}this.running=false;
this.log("JSONP successfully retrieved: ",B);
this.fireEvent("complete",[B]).fireEvent("success",[B]).callChain()
}});
Request.JSONP.counter=0;
Request.JSONP.request_map={};
Request.Queue=new Class({Implements:[Options,Events],Binds:["attach","request","complete","cancel","success","failure","exception"],options:{stopOnFailure:true,autoAdvance:true,concurrent:1,requests:{}},initialize:function(A){if(A){var B=A.requests;
delete A.requests
}this.setOptions(A);
this.requests=new Hash;
this.queue=[];
this.reqBinders={};
if(B){this.addRequests(B)
}},addRequest:function(A,B){this.requests.set(A,B);
this.attach(A,B);
return this
},addRequests:function(A){$each(A,function(C,B){this.addRequest(B,C)
},this);
return this
},getName:function(A){return this.requests.keyOf(A)
},attach:function(A,B){if(B._groupSend){return this
}["request","complete","cancel","success","failure","exception"].each(function(C){if(!this.reqBinders[A]){this.reqBinders[A]={}
}this.reqBinders[A][C]=function(){this["on"+C.capitalize()].apply(this,[A,B].extend(arguments))
}.bind(this);
B.addEvent(C,this.reqBinders[A][C])
},this);
B._groupSend=B.send;
B.send=function(C){this.send(A,C);
return B
}.bind(this);
return this
},removeRequest:function(B){var A=$type(B)=="object"?this.getName(B):B;
if(!A&&$type(A)!="string"){return this
}B=this.requests.get(A);
if(!B){return this
}["request","complete","cancel","success","failure","exception"].each(function(C){B.removeEvent(C,this.reqBinders[A][C])
},this);
B.send=B._groupSend;
delete B._groupSend;
return this
},getRunning:function(){return this.requests.filter(function(A){return A.running
})
},isRunning:function(){return !!(this.getRunning().getKeys().length)
},send:function(B,A){var C=function(){this.requests.get(B)._groupSend(A);
this.queue.erase(C)
}.bind(this);
C.name=B;
if(this.getRunning().getKeys().length>=this.options.concurrent||(this.error&&this.options.stopOnFailure)){this.queue.push(C)
}else{C()
}return this
},hasNext:function(A){return(!A)?!!this.queue.length:!!this.queue.filter(function(B){return B.name==A
}).length
},resume:function(){this.error=false;
(this.options.concurrent-this.getRunning().getKeys().length).times(this.runNext,this);
return this
},runNext:function(A){if(!this.queue.length){return this
}if(!A){this.queue[0]()
}else{var B;
this.queue.each(function(C){if(!B&&C.name==A){B=true;
C()
}})
}return this
},runAll:function(){this.queue.each(function(A){A()
});
return this
},clear:function(A){if(!A){this.queue.empty()
}else{this.queue=this.queue.map(function(B){if(B.name!=A){return B
}else{return false
}}).filter(function(B){return B
})
}return this
},cancel:function(A){this.requests.get(A).cancel();
return this
},onRequest:function(){this.fireEvent("request",arguments)
},onComplete:function(){this.fireEvent("complete",arguments);
if(!this.queue.length){this.fireEvent("end")
}},onCancel:function(){if(this.options.autoAdvance&&!this.error){this.runNext()
}this.fireEvent("cancel",arguments)
},onSuccess:function(){if(this.options.autoAdvance&&!this.error){this.runNext()
}this.fireEvent("success",arguments)
},onFailure:function(){this.error=true;
if(!this.options.stopOnFailure&&this.options.autoAdvance){this.runNext()
}this.fireEvent("failure",arguments)
},onException:function(){this.error=true;
if(!this.options.stopOnFailure&&this.options.autoAdvance){this.runNext()
}this.fireEvent("exception",arguments)
}});
Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(B){var A=function(){if(!this.running){this.send({data:B})
}};
this.timer=A.delay(this.options.initialDelay,this);
this.lastDelay=this.options.initialDelay;
this.completeCheck=function(C){$clear(this.timer);
this.lastDelay=(C)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit);
this.timer=A.delay(this.lastDelay,this)
};
return this.addEvent("complete",this.completeCheck)
},stopTimer:function(){$clear(this.timer);
return this.removeEvent("complete",this.completeCheck)
}});
var Asset={javascript:function(F,D){D=$extend({onload:$empty,document:document,check:$lambda(true)},D);
var B=new Element("script",{src:F,type:"text/javascript"});
var E=D.onload.bind(B),A=D.check,G=D.document;
delete D.onload;
delete D.check;
delete D.document;
B.addEvents({load:E,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){E()
}}}).set(D);
if(Browser.Engine.webkit419){var C=(function(){if(!$try(A)){return 
}$clear(C);
E()
}).periodical(50)
}return B.inject(G.head)
},css:function(B,A){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:B},A)).inject(document.head)
},image:function(C,B){B=$merge({onload:$empty,onabort:$empty,onerror:$empty},B);
var D=new Image();
var A=document.id(D)||new Element("img");
["load","abort","error"].each(function(E){var F="on"+E;
var G=B[F];
delete B[F];
D[F]=function(){if(!D){return 
}if(!A.parentNode){A.width=D.width;
A.height=D.height
}D=D.onload=D.onabort=D.onerror=null;
G.delay(1,A,A);
A.fireEvent(E,A,1)
}
});
D.src=A.src=C;
if(D&&D.complete){D.onload.delay(1)
}return A.set(B)
},images:function(D,C){C=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},C);
D=$splat(D);
var A=[];
var B=0;
return new Elements(D.map(function(E){return Asset.image(E,$extend(C.properties,{onload:function(){C.onProgress.call(this,B,D.indexOf(E));
B++;
if(B==D.length){C.onComplete()
}},onerror:function(){C.onError.call(this,B,D.indexOf(E));
B++;
if(B==D.length){C.onComplete()
}}}))
}))
}};
var Color=new Native({initialize:function(B,C){if(arguments.length>=3){C="rgb";
B=Array.slice(arguments,0,3)
}else{if(typeof B=="string"){if(B.match(/rgb/)){B=B.rgbToHex().hexToRgb(true)
}else{if(B.match(/hsb/)){B=B.hsbToRgb()
}else{B=B.hexToRgb(true)
}}}}C=C||"rgb";
switch(C){case"hsb":var A=B;
B=B.hsbToRgb();
B.hsb=A;
break;
case"hex":B=B.hexToRgb(true);
break
}B.rgb=B.slice(0,3);
B.hsb=B.hsb||B.rgbToHsb();
B.hex=B.rgbToHex();
return $extend(B,this)
}});
Color.implement({mix:function(){var A=Array.slice(arguments);
var C=($type(A.getLast())=="number")?A.pop():50;
var B=this.slice();
A.each(function(D){D=new Color(D);
for(var E=0;
E<3;
E++){B[E]=Math.round((B[E]/100*(100-C))+(D[E]/100*C))
}});
return new Color(B,"rgb")
},invert:function(){return new Color(this.map(function(A){return 255-A
}))
},setHue:function(A){return new Color([A,this.hsb[1],this.hsb[2]],"hsb")
},setSaturation:function(A){return new Color([this.hsb[0],A,this.hsb[2]],"hsb")
},setBrightness:function(A){return new Color([this.hsb[0],this.hsb[1],A],"hsb")
}});
var $RGB=function(C,B,A){return new Color([C,B,A],"rgb")
};
var $HSB=function(C,B,A){return new Color([C,B,A],"hsb")
};
var $HEX=function(A){return new Color(A,"hex")
};
Array.implement({rgbToHsb:function(){var B=this[0],C=this[1],J=this[2],G=0;
var I=Math.max(B,C,J),E=Math.min(B,C,J);
var K=I-E;
var H=I/255,F=(I!=0)?K/I:0;
if(F!=0){var D=(I-B)/K;
var A=(I-C)/K;
var L=(I-J)/K;
if(B==I){G=L-A
}else{if(C==I){G=2+D-L
}else{G=4+A-D
}}G/=6;
if(G<0){G++
}}return[Math.round(G*360),Math.round(F*100),Math.round(H*100)]
},hsbToRgb:function(){var C=Math.round(this[2]/100*255);
if(this[1]==0){return[C,C,C]
}else{var A=this[0]%360;
var E=A%60;
var F=Math.round((this[2]*(100-this[1]))/10000*255);
var D=Math.round((this[2]*(6000-this[1]*E))/600000*255);
var B=Math.round((this[2]*(6000-this[1]*(60-E)))/600000*255);
switch(Math.floor(A/60)){case 0:return[C,B,F];
case 1:return[D,C,F];
case 2:return[F,C,B];
case 3:return[F,D,C];
case 4:return[B,F,C];
case 5:return[C,F,D]
}}return false
}});
String.implement({rgbToHsb:function(){var A=this.match(/\d{1,3}/g);
return(A)?A.rgbToHsb():null
},hsbToRgb:function(){var A=this.match(/\d{1,3}/g);
return(A)?A.hsbToRgb():null
}});
var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);
this.events={};
this.checker={}
},addEvent:function(B,A){this.checker[B]=this.checker[B]||{};
this.events[B]=this.events[B]||[];
if(this.events[B].contains(A)){return false
}else{this.events[B].push(A)
}this.instances.each(function(C,D){C.addEvent(B,this.check.bind(this,[B,C,D]))
},this);
return this
},check:function(C,A,B){this.checker[C][B]=true;
var D=this.instances.every(function(F,E){return this.checker[C][E]||false
},this);
if(!D){return 
}this.checker[C]={};
this.events[C].each(function(E){E.call(this,this.instances,A)
},this)
}});
Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(B,A){this.parent(B,A);
this.load()
},save:function(){var A=JSON.encode(this.hash);
if(!A||A.length>4096){return false
}if(A=="{}"){this.dispose()
}else{this.write(A)
}return true
},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));
return this
}});
Hash.each(Hash.prototype,function(B,A){if(typeof B=="function"){Hash.Cookie.implement(A,function(){var C=B.apply(this.hash,arguments);
if(this.options.autoSave){this.save()
}return C
})
}});
var IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},property:"IframeShim",initialize:function(B,A){this.element=document.id(B);
if(this.occlude()){return this.occluded
}this.setOptions(A);
this.makeShim();
return this
},makeShim:function(){if(this.options.browsers){var C=this.element.getStyle("zIndex").toInt();
if(!C){C=1;
var B=this.element.getStyle("position");
if(B=="static"||!B){this.element.setStyle("position","relative")
}this.element.setStyle("zIndex",C)
}C=($chk(this.options.zIndex)&&C>this.options.zIndex)?this.options.zIndex:C-1;
if(C<0){C=1
}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:C,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this);
var A=(function(){this.shim.inject(this.element,"after");
this[this.options.display?"show":"hide"]();
this.fireEvent("inject")
}).bind(this);
if(IframeShim.ready){window.addEvent("load",A)
}else{A()
}}else{this.position=this.hide=this.show=this.dispose=$lambda(this)
}},position:function(){if(!IframeShim.ready||!this.shim){return this
}var A=this.element.measure(function(){return this.getSize()
});
if(this.options.margin!=undefined){A.x=A.x-(this.options.margin*2);
A.y=A.y-(this.options.margin*2);
this.options.offset.x+=this.options.margin;
this.options.offset.y+=this.options.margin
}this.shim.set({width:A.x,height:A.y}).position({relativeTo:this.element,offset:this.options.offset});
return this
},hide:function(){if(this.shim){this.shim.setStyle("display","none")
}return this
},show:function(){if(this.shim){this.shim.setStyle("display","block")
}return this.position()
},dispose:function(){if(this.shim){this.shim.dispose()
}return this
},destroy:function(){if(this.shim){this.shim.destroy()
}return this
}});
window.addEvent("load",function(){IframeShim.ready=true
});
var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(A,B){this.element.scrollTo(A,B)
},fps:50},initialize:function(B,A){this.setOptions(A);
this.element=document.id(B);
this.listener=($type(this.element)!="element")?document.id(this.element.getDocument().body):this.element;
this.timer=null;
this.bound={attach:this.attach.bind(this),detach:this.detach.bind(this),getCoords:this.getCoords.bind(this)}
},start:function(){this.listener.addEvents({mouseover:this.bound.attach,mouseout:this.bound.detach})
},stop:function(){this.listener.removeEvents({mouseover:this.bound.attach,mouseout:this.bound.detach});
this.detach();
this.timer=$clear(this.timer)
},attach:function(){this.listener.addEvent("mousemove",this.bound.getCoords)
},detach:function(){this.listener.removeEvent("mousemove",this.bound.getCoords);
this.timer=$clear(this.timer)
},getCoords:function(A){this.page=(this.listener.get("tag")=="body")?A.client:A.page;
if(!this.timer){this.timer=this.scroll.periodical(Math.round(1000/this.options.fps),this)
}},scroll:function(){var B=this.element.getSize(),A=this.element.getScroll(),F=this.element.getOffsets(),C=this.element.getScrollSize(),E={x:0,y:0};
for(var D in this.page){if(this.page[D]<(this.options.area+F[D])&&A[D]!=0){E[D]=(this.page[D]-this.options.area-F[D])*this.options.velocity
}else{if(this.page[D]+this.options.area>(B[D]+F[D])&&A[D]+B[D]!=C[D]){E[D]=(this.page[D]-B[D]+this.options.area-F[D])*this.options.velocity
}}}if(E.y||E.x){this.fireEvent("change",[A.x+E.x,A.y+E.y])
}}});
(function(){var A=function(C,B){return(C)?($type(C)=="function"?C(B):B.get(C)):""
};
this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block")
},onHide:function(){this.tip.setStyle("display","none")
},title:"title",text:function(B){return B.get("rel")||B.get("href")
},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},fixed:false},initialize:function(){var B=Array.link(arguments,{options:Object.type,elements:$defined});
this.setOptions(B.options);
document.id(this);
if(B.elements){this.attach(B.elements)
}},toElement:function(){if(this.tip){return this.tip
}this.container=new Element("div",{"class":"tip"});
return this.tip=new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}}).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"})).inject(document.body)
},attach:function(B){$$(B).each(function(D){var F=A(this.options.title,D),E=A(this.options.text,D);
D.erase("title").store("tip:native",F).retrieve("tip:title",F);
D.retrieve("tip:text",E);
this.fireEvent("attach",[D]);
var C=["enter","leave"];
if(!this.options.fixed){C.push("move")
}C.each(function(H){var G=D.retrieve("tip:"+H);
if(!G){G=this["element"+H.capitalize()].bindWithEvent(this,D)
}D.store("tip:"+H,G).addEvent("mouse"+H,G)
},this)
},this);
return this
},detach:function(B){$$(B).each(function(D){["enter","leave","move"].each(function(E){D.removeEvent("mouse"+E,D.retrieve("tip:"+E)).eliminate("tip:"+E)
});
this.fireEvent("detach",[D]);
if(this.options.title=="title"){var C=D.retrieve("tip:native");
if(C){D.set("title",C)
}}},this);
return this
},elementEnter:function(C,B){this.container.empty();
["title","text"].each(function(E){var D=B.retrieve("tip:"+E);
if(D){this.fill(new Element("div",{"class":"tip-"+E}).inject(this.container),D)
}},this);
$clear(this.timer);
this.timer=this.show.delay(this.options.showDelay,this,B);
this.position((this.options.fixed)?{page:B.getPosition()}:C)
},elementLeave:function(C,B){$clear(this.timer);
this.timer=this.hide.delay(this.options.hideDelay,this,B);
this.fireForParent(C,B)
},fireForParent:function(C,B){if(!B){return 
}parentNode=B.getParent();
if(parentNode==document.body){return 
}if(parentNode.retrieve("tip:enter")){parentNode.fireEvent("mouseenter",C)
}else{this.fireForParent(parentNode,C)
}},elementMove:function(C,B){this.position(C)
},position:function(E){var C=window.getSize(),B=window.getScroll(),F={x:this.tip.offsetWidth,y:this.tip.offsetHeight},D={x:"left",y:"top"},G={};
for(var H in D){G[D[H]]=E.page[H]+this.options.offset[H];
if((G[D[H]]+F[H]-B[H])>C[H]){G[D[H]]=E.page[H]-this.options.offset[H]-F[H]
}}this.tip.setStyles(G)
},fill:function(B,C){if(typeof C=="string"){B.set("html",C)
}else{B.adopt(C)
}},show:function(B){this.fireEvent("show",[this.tip,B])
},hide:function(B){this.fireEvent("hide",[this.tip,B])
}})
})();
MooTools.lang.set("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",ordinal:function(A){return(A>3&&A<21)?"th":["th","st","nd","rd","th"][Math.min(A%10,4)]
},lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"});
if(!Array.prototype.push){Array.prototype.push=function(){for(var B=0,A=arguments.length;
B<A;
B++){this[this.length]=arguments[B]
}return this.length
}
}if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var C=this[0];
for(var B=0,A=this.length-1;
B<A;
B++){this[B]=this[B+1]
}this.length=this.length-1;
return C
}}
}if(!Array.prototype.splice){Array.prototype.splice=function(H,E){var B=this.slice(H+E);
var C=this.slice(H,H+E);
this.length=H;
var F=[];
for(var D=0,A=arguments.length;
D<A;
D++){F[D]=arguments[D]
}var G=(F.length>2)?B=F.slice(2).concat(B):B;
for(D=0,A=G.length;
D<A;
D++){this.push(G[D])
}return C
}
}var log4javascript;
(function(){function isUndefined(obj){return typeof obj=="undefined"
}function EventSupport(){}EventSupport.prototype={eventTypes:[],eventListeners:{},setEventTypes:function(eventTypesParam){if(eventTypesParam instanceof Array){this.eventTypes=eventTypesParam;
this.eventListeners={};
for(var i=0,len=this.eventTypes.length;
i<len;
i++){this.eventListeners[this.eventTypes[i]]=[]
}}else{handleError("log4javascript.EventSupport ["+this+"]: setEventTypes: eventTypes parameter must be an Array")
}},addEventListener:function(eventType,listener){if(typeof listener=="function"){if(!array_contains(this.eventTypes,eventType)){handleError("log4javascript.EventSupport ["+this+"]: addEventListener: no event called '"+eventType+"'")
}this.eventListeners[eventType].push(listener)
}else{handleError("log4javascript.EventSupport ["+this+"]: addEventListener: listener must be a function")
}},removeEventListener:function(eventType,listener){if(typeof listener=="function"){if(!array_contains(this.eventTypes,eventType)){handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: no event called '"+eventType+"'")
}array_remove(this.eventListeners[eventType],listener)
}else{handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: listener must be a function")
}},dispatchEvent:function(eventType,eventArgs){if(array_contains(this.eventTypes,eventType)){var listeners=this.eventListeners[eventType];
for(var i=0,len=listeners.length;
i<len;
i++){listeners[i](this,eventType,eventArgs)
}}else{handleError("log4javascript.EventSupport ["+this+"]: dispatchEvent: no event called '"+eventType+"'")
}}};
var applicationStartDate=new Date();
var uniqueId="log4javascript_"+applicationStartDate.getTime()+"_"+Math.floor(Math.random()*100000000);
var emptyFunction=function(){};
var newLine="\r\n";
var pageLoaded=false;
function Log4JavaScript(){}Log4JavaScript.prototype=new EventSupport();
log4javascript=new Log4JavaScript();
log4javascript.version="1.4.1";
log4javascript.edition="log4javascript";
function toStr(obj){if(obj&&obj.toString){return obj.toString()
}else{return String(obj)
}}function getExceptionMessage(ex){if(ex.message){return ex.message
}else{if(ex.description){return ex.description
}else{return toStr(ex)
}}}function getUrlFileName(url){var lastSlashIndex=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));
return url.substr(lastSlashIndex+1)
}function getExceptionStringRep(ex){if(ex){var exStr="Exception: "+getExceptionMessage(ex);
try{if(ex.lineNumber){exStr+=" on line number "+ex.lineNumber
}if(ex.fileName){exStr+=" in file "+getUrlFileName(ex.fileName)
}}catch(localEx){logLog.warn("Unable to obtain file and line information for error")
}if(showStackTraces&&ex.stack){exStr+=newLine+"Stack trace:"+newLine+ex.stack
}return exStr
}return null
}function bool(obj){return Boolean(obj)
}function trim(str){return str.replace(/^\s+/,"").replace(/\s+$/,"")
}function splitIntoLines(text){var text2=text.replace(/\r\n/g,"\n").replace(/\r/g,"\n");
return text2.split("\n")
}function urlEncode(str){return escape(str).replace(/\+/g,"%2B").replace(/"/g,"%22").replace(/'/g,"%27").replace(/\//g,"%2F").replace(/=/g,"%3D")
}function urlDecode(str){return unescape(str).replace(/%2B/g,"+").replace(/%22/g,'"').replace(/%27/g,"'").replace(/%2F/g,"/").replace(/%3D/g,"=")
}function array_remove(arr,val){var index=-1;
for(var i=0,len=arr.length;
i<len;
i++){if(arr[i]===val){index=i;
break
}}if(index>=0){arr.splice(index,1);
return true
}else{return false
}}function array_contains(arr,val){for(var i=0,len=arr.length;
i<len;
i++){if(arr[i]==val){return true
}}return false
}function extractBooleanFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue
}else{return bool(param)
}}function extractStringFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue
}else{return String(param)
}}function extractIntFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue
}else{try{var value=parseInt(param,10);
return isNaN(value)?defaultValue:value
}catch(ex){logLog.warn("Invalid int param "+param,ex);
return defaultValue
}}}function extractFunctionFromParam(param,defaultValue){if(typeof param=="function"){return param
}else{return defaultValue
}}function isError(err){return(err instanceof Error)
}if(!Function.prototype.apply){Function.prototype.apply=function(obj,args){var methodName="__apply__";
if(typeof obj[methodName]!="undefined"){methodName+=String(Math.random()).substr(2)
}obj[methodName]=this;
var argsStrings=[];
for(var i=0,len=args.length;
i<len;
i++){argsStrings[i]="args["+i+"]"
}var script="obj."+methodName+"("+argsStrings.join(",")+")";
var returnValue=eval(script);
delete obj[methodName];
return returnValue
}
}if(!Function.prototype.call){Function.prototype.call=function(obj){var args=[];
for(var i=1,len=arguments.length;
i<len;
i++){args[i-1]=arguments[i]
}return this.apply(obj,args)
}
}function getListenersPropertyName(eventName){return"__log4javascript_listeners__"+eventName
}function addEvent(node,eventName,listener,useCapture,win){win=win?win:window;
if(node.addEventListener){node.addEventListener(eventName,listener,useCapture)
}else{if(node.attachEvent){node.attachEvent("on"+eventName,listener)
}else{var propertyName=getListenersPropertyName(eventName);
if(!node[propertyName]){node[propertyName]=[];
node["on"+eventName]=function(evt){evt=getEvent(evt,win);
var listenersPropertyName=getListenersPropertyName(eventName);
var listeners=this[listenersPropertyName].concat([]);
var currentListener;
while((currentListener=listeners.shift())){currentListener.call(this,evt)
}}
}node[propertyName].push(listener)
}}}function removeEvent(node,eventName,listener,useCapture){if(node.removeEventListener){node.removeEventListener(eventName,listener,useCapture)
}else{if(node.detachEvent){node.detachEvent("on"+eventName,listener)
}else{var propertyName=getListenersPropertyName(eventName);
if(node[propertyName]){array_remove(node[propertyName],listener)
}}}}function getEvent(evt,win){win=win?win:window;
return evt?evt:win.event
}function stopEventPropagation(evt){if(evt.stopPropagation){evt.stopPropagation()
}else{if(typeof evt.cancelBubble!="undefined"){evt.cancelBubble=true
}}evt.returnValue=false
}var logLog={quietMode:false,debugMessages:[],setQuietMode:function(quietMode){this.quietMode=bool(quietMode)
},numberOfErrors:0,alertAllErrors:false,setAlertAllErrors:function(alertAllErrors){this.alertAllErrors=alertAllErrors
},debug:function(message){this.debugMessages.push(message)
},displayDebug:function(){alert(this.debugMessages.join(newLine))
},warn:function(message,exception){},error:function(message,exception){if(++this.numberOfErrors==1||this.alertAllErrors){if(!this.quietMode){var alertMessage="log4javascript error: "+message;
if(exception){alertMessage+=newLine+newLine+"Original error: "+getExceptionStringRep(exception)
}alert(alertMessage)
}}}};
log4javascript.logLog=logLog;
log4javascript.setEventTypes(["load","error"]);
function handleError(message,exception){logLog.error(message,exception);
log4javascript.dispatchEvent("error",{message:message,exception:exception})
}log4javascript.handleError=handleError;
var enabled=!((typeof log4javascript_disabled!="undefined")&&log4javascript_disabled);
log4javascript.setEnabled=function(enable){enabled=bool(enable)
};
log4javascript.isEnabled=function(){return enabled
};
var useTimeStampsInMilliseconds=true;
log4javascript.setTimeStampsInMilliseconds=function(timeStampsInMilliseconds){useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds)
};
log4javascript.isTimeStampsInMilliseconds=function(){return useTimeStampsInMilliseconds
};
log4javascript.evalInScope=function(expr){return eval(expr)
};
var showStackTraces=false;
log4javascript.setShowStackTraces=function(show){showStackTraces=bool(show)
};
var Level=function(level,name){this.level=level;
this.name=name
};
Level.prototype={toString:function(){return this.name
},equals:function(level){return this.level==level.level
},isGreaterOrEqual:function(level){return this.level>=level.level
}};
Level.ALL=new Level(Number.MIN_VALUE,"ALL");
Level.TRACE=new Level(10000,"TRACE");
Level.DEBUG=new Level(20000,"DEBUG");
Level.INFO=new Level(30000,"INFO");
Level.WARN=new Level(40000,"WARN");
Level.ERROR=new Level(50000,"ERROR");
Level.FATAL=new Level(60000,"FATAL");
Level.OFF=new Level(Number.MAX_VALUE,"OFF");
log4javascript.Level=Level;
function Timer(name,level){this.name=name;
this.level=isUndefined(level)?Level.INFO:level;
this.start=new Date()
}Timer.prototype.getElapsedTime=function(){return new Date().getTime()-this.start.getTime()
};
var anonymousLoggerName="[anonymous]";
var defaultLoggerName="[default]";
var nullLoggerName="[null]";
var rootLoggerName="root";
function Logger(name){this.name=name;
this.parent=null;
this.children=[];
var appenders=[];
var loggerLevel=null;
var isRoot=(this.name===rootLoggerName);
var isNull=(this.name===nullLoggerName);
var appenderCache=null;
var appenderCacheInvalidated=false;
this.addChild=function(childLogger){this.children.push(childLogger);
childLogger.parent=this;
childLogger.invalidateAppenderCache()
};
var additive=true;
this.getAdditivity=function(){return additive
};
this.setAdditivity=function(additivity){var valueChanged=(additive!=additivity);
additive=additivity;
if(valueChanged){this.invalidateAppenderCache()
}};
this.addAppender=function(appender){if(isNull){handleError("Logger.addAppender: you may not add an appender to the null logger")
}else{if(appender instanceof log4javascript.Appender){if(!array_contains(appenders,appender)){appenders.push(appender);
appender.setAddedToLogger(this);
this.invalidateAppenderCache()
}}else{handleError("Logger.addAppender: appender supplied ('"+toStr(appender)+"') is not a subclass of Appender")
}}};
this.removeAppender=function(appender){array_remove(appenders,appender);
appender.setRemovedFromLogger(this);
this.invalidateAppenderCache()
};
this.removeAllAppenders=function(){var appenderCount=appenders.length;
if(appenderCount>0){for(var i=0;
i<appenderCount;
i++){appenders[i].setRemovedFromLogger(this)
}appenders.length=0;
this.invalidateAppenderCache()
}};
this.getEffectiveAppenders=function(){if(appenderCache===null||appenderCacheInvalidated){var parentEffectiveAppenders=(isRoot||!this.getAdditivity())?[]:this.parent.getEffectiveAppenders();
appenderCache=parentEffectiveAppenders.concat(appenders);
appenderCacheInvalidated=false
}return appenderCache
};
this.invalidateAppenderCache=function(){appenderCacheInvalidated=true;
for(var i=0,len=this.children.length;
i<len;
i++){this.children[i].invalidateAppenderCache()
}};
this.log=function(level,params){if(level.isGreaterOrEqual(this.getEffectiveLevel())){var exception;
var finalParamIndex=params.length-1;
var lastParam=params[params.length-1];
if(params.length>1&&isError(lastParam)){exception=lastParam;
finalParamIndex--
}var messages=[];
for(var i=0;
i<=finalParamIndex;
i++){messages[i]=params[i]
}var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);
this.callAppenders(loggingEvent)
}};
this.callAppenders=function(loggingEvent){var effectiveAppenders=this.getEffectiveAppenders();
for(var i=0,len=effectiveAppenders.length;
i<len;
i++){effectiveAppenders[i].doAppend(loggingEvent)
}};
this.setLevel=function(level){if(isRoot&&level===null){handleError("Logger.setLevel: you cannot set the level of the root logger to null")
}else{if(level instanceof Level){loggerLevel=level
}else{handleError("Logger.setLevel: level supplied to logger "+this.name+" is not an instance of log4javascript.Level")
}}};
this.getLevel=function(){return loggerLevel
};
this.getEffectiveLevel=function(){for(var logger=this;
logger!==null;
logger=logger.parent){var level=logger.getLevel();
if(level!==null){return level
}}};
this.group=function(name,initiallyExpanded){var effectiveAppenders=this.getEffectiveAppenders();
for(var i=0,len=effectiveAppenders.length;
i<len;
i++){effectiveAppenders[i].group(name,initiallyExpanded)
}};
this.groupEnd=function(name){var effectiveAppenders=this.getEffectiveAppenders();
for(var i=0,len=effectiveAppenders.length;
i<len;
i++){effectiveAppenders[i].groupEnd()
}};
var timers={};
this.time=function(name,level){if(isUndefined(name)){handleError("Logger.time: a name for the timer must be supplied")
}else{if(level&&!(level instanceof Level)){handleError("Logger.time: level supplied to timer "+name+" is not an instance of log4javascript.Level")
}else{timers[name]=new Timer(name,level)
}}};
this.timeEnd=function(name){if(isUndefined(name)){handleError("Logger.timeEnd: a name for the timer must be supplied")
}else{if(timers[name]){var timer=timers[name];
var milliseconds=timer.getElapsedTime();
this.log(timer.level,["Timer "+toStr(name)+" completed in "+milliseconds+"ms"]);
delete timers[name]
}else{logLog.warn("Logger.timeEnd: no timer found with name "+name)
}}};
this.assert=function(expr){if(!expr){var args=[];
for(var i=1,len=arguments.length;
i<len;
i++){args.push(arguments[i])
}args=(args.length>0)?args:["Assertion Failure"];
args.push(newLine);
args.push(expr);
this.log(Level.ERROR,args)
}};
this.toString=function(){return"Logger["+this.name+"]"
}
}Logger.prototype={trace:function(){this.log(Level.TRACE,arguments)
},debug:function(){this.log(Level.DEBUG,arguments)
},info:function(){this.log(Level.INFO,arguments)
},warn:function(){this.log(Level.WARN,arguments)
},error:function(){this.log(Level.ERROR,arguments)
},fatal:function(){this.log(Level.FATAL,arguments)
},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getEffectiveLevel())
},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE)
},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG)
},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO)
},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN)
},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR)
},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL)
}};
Logger.prototype.trace.isEntryPoint=true;
Logger.prototype.debug.isEntryPoint=true;
Logger.prototype.info.isEntryPoint=true;
Logger.prototype.warn.isEntryPoint=true;
Logger.prototype.error.isEntryPoint=true;
Logger.prototype.fatal.isEntryPoint=true;
var loggers={};
var loggerNames=[];
var ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG;
var rootLogger=new Logger(rootLoggerName);
rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);
log4javascript.getRootLogger=function(){return rootLogger
};
log4javascript.getLogger=function(loggerName){if(!(typeof loggerName=="string")){loggerName=anonymousLoggerName;
logLog.warn("log4javascript.getLogger: non-string logger name "+toStr(loggerName)+" supplied, returning anonymous logger")
}if(loggerName==rootLoggerName){handleError("log4javascript.getLogger: root logger may not be obtained by name")
}if(!loggers[loggerName]){var logger=new Logger(loggerName);
loggers[loggerName]=logger;
loggerNames.push(loggerName);
var lastDotIndex=loggerName.lastIndexOf(".");
var parentLogger;
if(lastDotIndex>-1){var parentLoggerName=loggerName.substring(0,lastDotIndex);
parentLogger=log4javascript.getLogger(parentLoggerName)
}else{parentLogger=rootLogger
}parentLogger.addChild(logger)
}return loggers[loggerName]
};
var defaultLogger=null;
log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=log4javascript.getLogger(defaultLoggerName);
var a=new log4javascript.PopUpAppender();
defaultLogger.addAppender(a)
}return defaultLogger
};
var nullLogger=null;
log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger(nullLoggerName);
nullLogger.setLevel(Level.OFF)
}return nullLogger
};
log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);
loggers={}
};
var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;
this.timeStamp=timeStamp;
this.timeStampInMilliseconds=timeStamp.getTime();
this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1000);
this.milliseconds=this.timeStamp.getMilliseconds();
this.level=level;
this.messages=messages;
this.exception=exception
};
LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):""
},getCombinedMessages:function(){return(this.messages.length==1)?this.messages[0]:this.messages.join(newLine)
},toString:function(){return"LoggingEvent["+this.level+"]"
}};
log4javascript.LoggingEvent=LoggingEvent;
var Layout=function(){};
Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:false,overrideTimeStampsSetting:false,useTimeStampsInMilliseconds:null,format:function(loggingEvent){handleError("Layout.format: layout supplied has no format() method")
},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method")
},getContentType:function(){return"text/plain"
},allowBatching:function(){return true
},setTimeStampsInMilliseconds:function(timeStampsInMilliseconds){this.overrideTimeStampsSetting=true;
this.useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds)
},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds
},getTimeStampValue:function(loggingEvent){return this.isTimeStampsInMilliseconds()?loggingEvent.timeStampInMilliseconds:loggingEvent.timeStampInSeconds
},getDataValues:function(loggingEvent,combineMessages){var dataValues=[[this.loggerKey,loggingEvent.logger.name],[this.timeStampKey,this.getTimeStampValue(loggingEvent)],[this.levelKey,loggingEvent.level.name],[this.urlKey,window.location.href],[this.messageKey,combineMessages?loggingEvent.getCombinedMessages():loggingEvent.messages]];
if(!this.isTimeStampsInMilliseconds()){dataValues.push([this.millisecondsKey,loggingEvent.milliseconds])
}if(loggingEvent.exception){dataValues.push([this.exceptionKey,getExceptionStringRep(loggingEvent.exception)])
}if(this.hasCustomFields()){for(var i=0,len=this.customFields.length;
i<len;
i++){var val=this.customFields[i].value;
if(typeof val==="function"){val=val(this,loggingEvent)
}dataValues.push([this.customFields[i].name,val])
}}return dataValues
},setKeys:function(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey,millisecondsKey){this.loggerKey=extractStringFromParam(loggerKey,this.defaults.loggerKey);
this.timeStampKey=extractStringFromParam(timeStampKey,this.defaults.timeStampKey);
this.levelKey=extractStringFromParam(levelKey,this.defaults.levelKey);
this.messageKey=extractStringFromParam(messageKey,this.defaults.messageKey);
this.exceptionKey=extractStringFromParam(exceptionKey,this.defaults.exceptionKey);
this.urlKey=extractStringFromParam(urlKey,this.defaults.urlKey);
this.millisecondsKey=extractStringFromParam(millisecondsKey,this.defaults.millisecondsKey)
},setCustomField:function(name,value){var fieldUpdated=false;
for(var i=0,len=this.customFields.length;
i<len;
i++){if(this.customFields[i].name===name){this.customFields[i].value=value;
fieldUpdated=true
}}if(!fieldUpdated){this.customFields.push({name:name,value:value})
}},hasCustomFields:function(){return(this.customFields.length>0)
},toString:function(){handleError("Layout.toString: all layouts must override this method")
}};
log4javascript.Layout=Layout;
var Appender=function(){};
Appender.prototype=new EventSupport();
Appender.prototype.layout=new PatternLayout();
Appender.prototype.threshold=Level.ALL;
Appender.prototype.loggers=[];
Appender.prototype.doAppend=function(loggingEvent){if(enabled&&loggingEvent.level.level>=this.threshold.level){this.append(loggingEvent)
}};
Appender.prototype.append=function(loggingEvent){};
Appender.prototype.setLayout=function(layout){if(layout instanceof Layout){this.layout=layout
}else{handleError("Appender.setLayout: layout supplied to "+this.toString()+" is not a subclass of Layout")
}};
Appender.prototype.getLayout=function(){return this.layout
};
Appender.prototype.setThreshold=function(threshold){if(threshold instanceof Level){this.threshold=threshold
}else{handleError("Appender.setThreshold: threshold supplied to "+this.toString()+" is not a subclass of Level")
}};
Appender.prototype.getThreshold=function(){return this.threshold
};
Appender.prototype.setAddedToLogger=function(logger){this.loggers.push(logger)
};
Appender.prototype.setRemovedFromLogger=function(logger){array_remove(this.loggers,logger)
};
Appender.prototype.group=emptyFunction;
Appender.prototype.groupEnd=emptyFunction;
Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method")
};
log4javascript.Appender=Appender;
function SimpleLayout(){this.customFields=[]
}SimpleLayout.prototype=new Layout();
SimpleLayout.prototype.format=function(loggingEvent){return loggingEvent.level.name+" - "+loggingEvent.getCombinedMessages()
};
SimpleLayout.prototype.ignoresThrowable=function(){return true
};
SimpleLayout.prototype.toString=function(){return"SimpleLayout"
};
log4javascript.SimpleLayout=SimpleLayout;
function NullLayout(){this.customFields=[]
}NullLayout.prototype=new Layout();
NullLayout.prototype.format=function(loggingEvent){return loggingEvent.messages
};
NullLayout.prototype.ignoresThrowable=function(){return true
};
NullLayout.prototype.toString=function(){return"NullLayout"
};
log4javascript.NullLayout=NullLayout;
function XmlLayout(combineMessages){this.combineMessages=extractBooleanFromParam(combineMessages,true);
this.customFields=[]
}XmlLayout.prototype=new Layout();
XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages
};
XmlLayout.prototype.getContentType=function(){return"text/xml"
};
XmlLayout.prototype.escapeCdata=function(str){return str.replace(/\]\]>/,"]]>]]&gt;<![CDATA[")
};
XmlLayout.prototype.format=function(loggingEvent){var layout=this;
var i,len;
function formatMessage(message){message=(typeof message==="string")?message:toStr(message);
return"<log4javascript:message><![CDATA["+layout.escapeCdata(message)+"]]></log4javascript:message>"
}var str='<log4javascript:event logger="'+loggingEvent.logger.name+'" timestamp="'+this.getTimeStampValue(loggingEvent)+'"';
if(!this.isTimeStampsInMilliseconds()){str+=' milliseconds="'+loggingEvent.milliseconds+'"'
}str+=' level="'+loggingEvent.level.name+'">'+newLine;
if(this.combineMessages){str+=formatMessage(loggingEvent.getCombinedMessages())
}else{str+="<log4javascript:messages>"+newLine;
for(i=0,len=loggingEvent.messages.length;
i<len;
i++){str+=formatMessage(loggingEvent.messages[i])+newLine
}str+="</log4javascript:messages>"+newLine
}if(this.hasCustomFields()){for(i=0,len=this.customFields.length;
i<len;
i++){str+='<log4javascript:customfield name="'+this.customFields[i].name+'"><![CDATA['+this.customFields[i].value.toString()+"]]></log4javascript:customfield>"+newLine
}}if(loggingEvent.exception){str+="<log4javascript:exception><![CDATA["+getExceptionStringRep(loggingEvent.exception)+"]]></log4javascript:exception>"+newLine
}str+="</log4javascript:event>"+newLine+newLine;
return str
};
XmlLayout.prototype.ignoresThrowable=function(){return false
};
XmlLayout.prototype.toString=function(){return"XmlLayout"
};
log4javascript.XmlLayout=XmlLayout;
function escapeNewLines(str){return str.replace(/\r\n|\r|\n/g,"\\r\\n")
}function JsonLayout(readable,combineMessages){this.readable=extractBooleanFromParam(readable,false);
this.combineMessages=extractBooleanFromParam(combineMessages,true);
this.batchHeader=this.readable?"["+newLine:"[";
this.batchFooter=this.readable?"]"+newLine:"]";
this.batchSeparator=this.readable?","+newLine:",";
this.setKeys();
this.colon=this.readable?": ":":";
this.tab=this.readable?"\t":"";
this.lineBreak=this.readable?newLine:"";
this.customFields=[]
}JsonLayout.prototype=new Layout();
JsonLayout.prototype.isReadable=function(){return this.readable
};
JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages
};
JsonLayout.prototype.format=function(loggingEvent){var layout=this;
var dataValues=this.getDataValues(loggingEvent,this.combineMessages);
var str="{"+this.lineBreak;
var i;
function formatValue(val,prefix,expand){var formattedValue;
var valType=typeof val;
if(val instanceof Date){formattedValue=String(val.getTime())
}else{if(expand&&(val instanceof Array)){formattedValue="["+layout.lineBreak;
for(i=0,len=val.length;
i<len;
i++){var childPrefix=prefix+layout.tab;
formattedValue+=childPrefix+formatValue(val[i],childPrefix,false);
if(i<val.length-1){formattedValue+=","
}formattedValue+=layout.lineBreak
}formattedValue+=prefix+"]"
}else{if(valType!=="number"&&valType!=="boolean"){formattedValue='"'+escapeNewLines(toStr(val).replace(/\"/g,'\\"'))+'"'
}else{formattedValue=val
}}}return formattedValue
}for(i=0,len=dataValues.length;
i<len;
i++){str+=this.tab+'"'+dataValues[i][0]+'"'+this.colon+formatValue(dataValues[i][1],this.tab,true);
if(i<dataValues.length-1){str+=","
}str+=this.lineBreak
}str+="}"+this.lineBreak;
return str
};
JsonLayout.prototype.ignoresThrowable=function(){return false
};
JsonLayout.prototype.toString=function(){return"JsonLayout"
};
JsonLayout.prototype.getContentType=function(){return"application/json"
};
log4javascript.JsonLayout=JsonLayout;
function HttpPostDataLayout(){this.setKeys();
this.customFields=[];
this.returnsPostData=true
}HttpPostDataLayout.prototype=new Layout();
HttpPostDataLayout.prototype.allowBatching=function(){return false
};
HttpPostDataLayout.prototype.format=function(loggingEvent){var dataValues=this.getDataValues(loggingEvent);
var queryBits=[];
for(var i=0,len=dataValues.length;
i<len;
i++){var val=(dataValues[i][1] instanceof Date)?String(dataValues[i][1].getTime()):dataValues[i][1];
queryBits.push(urlEncode(dataValues[i][0])+"="+urlEncode(val))
}return queryBits.join("&")
};
HttpPostDataLayout.prototype.ignoresThrowable=function(loggingEvent){return false
};
HttpPostDataLayout.prototype.toString=function(){return"HttpPostDataLayout"
};
log4javascript.HttpPostDataLayout=HttpPostDataLayout;
function formatObjectExpansion(obj,depth,indentation){var objectsExpanded=[];
function doFormat(obj,depth,indentation){var i,j,len,childDepth,childIndentation,childLines,expansion,childExpansion;
if(!indentation){indentation=""
}function formatString(text){var lines=splitIntoLines(text);
for(var j=1,jLen=lines.length;
j<jLen;
j++){lines[j]=indentation+lines[j]
}return lines.join(newLine)
}if(obj===null){return"null"
}else{if(typeof obj=="undefined"){return"undefined"
}else{if(typeof obj=="string"){return formatString(obj)
}else{if(typeof obj=="object"&&array_contains(objectsExpanded,obj)){try{expansion=toStr(obj)
}catch(ex){expansion="Error formatting property. Details: "+getExceptionStringRep(ex)
}return expansion+" [already expanded]"
}else{if((obj instanceof Array)&&depth>0){objectsExpanded.push(obj);
expansion="["+newLine;
childDepth=depth-1;
childIndentation=indentation+"  ";
childLines=[];
for(i=0,len=obj.length;
i<len;
i++){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);
childLines.push(childIndentation+childExpansion)
}catch(ex){childLines.push(childIndentation+"Error formatting array member. Details: "+getExceptionStringRep(ex)+"")
}}expansion+=childLines.join(","+newLine)+newLine+indentation+"]";
return expansion
}else{if(typeof obj=="object"&&depth>0){objectsExpanded.push(obj);
expansion="{"+newLine;
childDepth=depth-1;
childIndentation=indentation+"  ";
childLines=[];
for(i in obj){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);
childLines.push(childIndentation+i+": "+childExpansion)
}catch(ex){childLines.push(childIndentation+i+": Error formatting property. Details: "+getExceptionStringRep(ex))
}}expansion+=childLines.join(","+newLine)+newLine+indentation+"}";
return expansion
}else{return formatString(toStr(obj))
}}}}}}}return doFormat(obj,depth,indentation)
}var SimpleDateFormat;
(function(){var regex=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/;
var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var TEXT2=0,TEXT3=1,NUMBER=2,YEAR=3,MONTH=4,TIMEZONE=5;
var types={G:TEXT2,y:YEAR,M:MONTH,w:NUMBER,W:NUMBER,D:NUMBER,d:NUMBER,F:NUMBER,E:TEXT3,a:TEXT2,H:NUMBER,k:NUMBER,K:NUMBER,h:NUMBER,m:NUMBER,s:NUMBER,S:NUMBER,Z:TIMEZONE};
var ONE_DAY=24*60*60*1000;
var ONE_WEEK=7*ONE_DAY;
var DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK=1;
var newDateAtMidnight=function(year,month,day){var d=new Date(year,month,day,0,0,0);
d.setMilliseconds(0);
return d
};
Date.prototype.getDifference=function(date){return this.getTime()-date.getTime()
};
Date.prototype.isBefore=function(d){return this.getTime()<d.getTime()
};
Date.prototype.getUTCTime=function(){return Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds())
};
Date.prototype.getTimeSince=function(d){return this.getUTCTime()-d.getUTCTime()
};
Date.prototype.getPreviousSunday=function(){var midday=new Date(this.getFullYear(),this.getMonth(),this.getDate(),12,0,0);
var previousSunday=new Date(midday.getTime()-this.getDay()*ONE_DAY);
return newDateAtMidnight(previousSunday.getFullYear(),previousSunday.getMonth(),previousSunday.getDate())
};
Date.prototype.getWeekInYear=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK
}var previousSunday=this.getPreviousSunday();
var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);
var numberOfSundays=previousSunday.isBefore(startOfYear)?0:1+Math.floor(previousSunday.getTimeSince(startOfYear)/ONE_WEEK);
var numberOfDaysInFirstWeek=7-startOfYear.getDay();
var weekInYear=numberOfSundays;
if(numberOfDaysInFirstWeek<minimalDaysInFirstWeek){weekInYear--
}return weekInYear
};
Date.prototype.getWeekInMonth=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK
}var previousSunday=this.getPreviousSunday();
var startOfMonth=newDateAtMidnight(this.getFullYear(),this.getMonth(),1);
var numberOfSundays=previousSunday.isBefore(startOfMonth)?0:1+Math.floor(previousSunday.getTimeSince(startOfMonth)/ONE_WEEK);
var numberOfDaysInFirstWeek=7-startOfMonth.getDay();
var weekInMonth=numberOfSundays;
if(numberOfDaysInFirstWeek>=minimalDaysInFirstWeek){weekInMonth++
}return weekInMonth
};
Date.prototype.getDayInYear=function(){var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);
return 1+Math.floor(this.getTimeSince(startOfYear)/ONE_DAY)
};
SimpleDateFormat=function(formatString){this.formatString=formatString
};
SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(days){this.minimalDaysInFirstWeek=days
};
SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK:this.minimalDaysInFirstWeek
};
var padWithZeroes=function(str,len){while(str.length<len){str="0"+str
}return str
};
var formatText=function(data,numberOfLetters,minLength){return(numberOfLetters>=4)?data:data.substr(0,Math.max(minLength,numberOfLetters))
};
var formatNumber=function(data,numberOfLetters){var dataString=""+data;
return padWithZeroes(dataString,numberOfLetters)
};
SimpleDateFormat.prototype.format=function(date){var formattedString="";
var result;
var searchString=this.formatString;
while((result=regex.exec(searchString))){var quotedString=result[1];
var patternLetters=result[2];
var otherLetters=result[3];
var otherCharacters=result[4];
if(quotedString){if(quotedString=="''"){formattedString+="'"
}else{formattedString+=quotedString.substring(1,quotedString.length-1)
}}else{if(otherLetters){}else{if(otherCharacters){formattedString+=otherCharacters
}else{if(patternLetters){var patternLetter=patternLetters.charAt(0);
var numberOfLetters=patternLetters.length;
var rawData="";
switch(patternLetter){case"G":rawData="AD";
break;
case"y":rawData=date.getFullYear();
break;
case"M":rawData=date.getMonth();
break;
case"w":rawData=date.getWeekInYear(this.getMinimalDaysInFirstWeek());
break;
case"W":rawData=date.getWeekInMonth(this.getMinimalDaysInFirstWeek());
break;
case"D":rawData=date.getDayInYear();
break;
case"d":rawData=date.getDate();
break;
case"F":rawData=1+Math.floor((date.getDate()-1)/7);
break;
case"E":rawData=dayNames[date.getDay()];
break;
case"a":rawData=(date.getHours()>=12)?"PM":"AM";
break;
case"H":rawData=date.getHours();
break;
case"k":rawData=date.getHours()||24;
break;
case"K":rawData=date.getHours()%12;
break;
case"h":rawData=(date.getHours()%12)||12;
break;
case"m":rawData=date.getMinutes();
break;
case"s":rawData=date.getSeconds();
break;
case"S":rawData=date.getMilliseconds();
break;
case"Z":rawData=date.getTimezoneOffset();
break
}switch(types[patternLetter]){case TEXT2:formattedString+=formatText(rawData,numberOfLetters,2);
break;
case TEXT3:formattedString+=formatText(rawData,numberOfLetters,3);
break;
case NUMBER:formattedString+=formatNumber(rawData,numberOfLetters);
break;
case YEAR:if(numberOfLetters<=3){var dataString=""+rawData;
formattedString+=dataString.substr(2,2)
}else{formattedString+=formatNumber(rawData,numberOfLetters)
}break;
case MONTH:if(numberOfLetters>=3){formattedString+=formatText(monthNames[rawData],numberOfLetters,numberOfLetters)
}else{formattedString+=formatNumber(rawData+1,numberOfLetters)
}break;
case TIMEZONE:var isPositive=(rawData>0);
var prefix=isPositive?"-":"+";
var absData=Math.abs(rawData);
var hours=""+Math.floor(absData/60);
hours=padWithZeroes(hours,2);
var minutes=""+(absData%60);
minutes=padWithZeroes(minutes,2);
formattedString+=prefix+hours+minutes;
break
}}}}}searchString=searchString.substr(result.index+result[0].length)
}return formattedString
}
})();
log4javascript.SimpleDateFormat=SimpleDateFormat;
function PatternLayout(pattern){if(pattern){this.pattern=pattern
}else{this.pattern=PatternLayout.DEFAULT_CONVERSION_PATTERN
}this.customFields=[]
}PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";
PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";
PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";
PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS";
PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";
PatternLayout.prototype=new Layout();
PatternLayout.prototype.format=function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/;
var formattedString="";
var result;
var searchString=this.pattern;
while((result=regex.exec(searchString))){var matchedString=result[0];
var padding=result[1];
var truncation=result[2];
var conversionCharacter=result[3];
var specifier=result[5];
var text=result[6];
if(text){formattedString+=""+text
}else{var replacement="";
switch(conversionCharacter){case"a":case"m":var depth=0;
if(specifier){depth=parseInt(specifier,10);
if(isNaN(depth)){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character '"+conversionCharacter+"' - should be a number");
depth=0
}}var messages=(conversionCharacter==="a")?loggingEvent.messages[0]:loggingEvent.messages;
for(var i=0,len=messages.length;
i<len;
i++){if(i>0&&(replacement.charAt(replacement.length-1)!==" ")){replacement+=" "
}if(depth===0){replacement+=messages[i]
}else{replacement+=formatObjectExpansion(messages[i],depth)
}}break;
case"c":var loggerName=loggingEvent.logger.name;
if(specifier){var precision=parseInt(specifier,10);
var loggerNameBits=loggingEvent.logger.name.split(".");
if(precision>=loggerNameBits.length){replacement=loggerName
}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".")
}}else{replacement=loggerName
}break;
case"d":var dateFormat=PatternLayout.ISO8601_DATEFORMAT;
if(specifier){dateFormat=specifier;
if(dateFormat=="ISO8601"){dateFormat=PatternLayout.ISO8601_DATEFORMAT
}else{if(dateFormat=="ABSOLUTE"){dateFormat=PatternLayout.ABSOLUTETIME_DATEFORMAT
}else{if(dateFormat=="DATE"){dateFormat=PatternLayout.DATETIME_DATEFORMAT
}}}}replacement=(new SimpleDateFormat(dateFormat)).format(loggingEvent.timeStamp);
break;
case"f":if(this.hasCustomFields()){var fieldIndex=0;
if(specifier){fieldIndex=parseInt(specifier,10);
if(isNaN(fieldIndex)){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - should be a number")
}else{if(fieldIndex===0){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - must be greater than zero")
}else{if(fieldIndex>this.customFields.length){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - there aren't that many custom fields")
}else{fieldIndex=fieldIndex-1
}}}}replacement=this.customFields[fieldIndex].value
}break;
case"n":replacement=newLine;
break;
case"p":replacement=loggingEvent.level.name;
break;
case"r":replacement=""+loggingEvent.timeStamp.getDifference(applicationStartDate);
break;
case"%":replacement="%";
break;
default:replacement=matchedString;
break
}var l;
if(truncation){l=parseInt(truncation.substr(1),10);
var strLen=replacement.length;
if(l<strLen){replacement=replacement.substring(strLen-l,strLen)
}}if(padding){if(padding.charAt(0)=="-"){l=parseInt(padding.substr(1),10);
while(replacement.length<l){replacement+=" "
}}else{l=parseInt(padding,10);
while(replacement.length<l){replacement=" "+replacement
}}}formattedString+=replacement
}searchString=searchString.substr(result.index+result[0].length)
}return formattedString
};
PatternLayout.prototype.ignoresThrowable=function(){return true
};
PatternLayout.prototype.toString=function(){return"PatternLayout"
};
log4javascript.PatternLayout=PatternLayout;
function AlertAppender(){}AlertAppender.prototype=new Appender();
AlertAppender.prototype.layout=new SimpleLayout();
AlertAppender.prototype.append=function(loggingEvent){var formattedMessage=this.getLayout().format(loggingEvent);
if(this.getLayout().ignoresThrowable()){formattedMessage+=loggingEvent.getThrowableStrRep()
}alert(formattedMessage)
};
AlertAppender.prototype.toString=function(){return"AlertAppender"
};
log4javascript.AlertAppender=AlertAppender;
function BrowserConsoleAppender(){}BrowserConsoleAppender.prototype=new log4javascript.Appender();
BrowserConsoleAppender.prototype.layout=new NullLayout();
BrowserConsoleAppender.prototype.threshold=Level.DEBUG;
BrowserConsoleAppender.prototype.append=function(loggingEvent){var appender=this;
var getFormattedMessage=function(){var layout=appender.getLayout();
var formattedMessage=layout.format(loggingEvent);
if(layout.ignoresThrowable()&&loggingEvent.exception){formattedMessage+=loggingEvent.getThrowableStrRep()
}return formattedMessage
};
if((typeof opera!="undefined")&&opera.postError){opera.postError(getFormattedMessage())
}else{if(window.console&&window.console.log){var formattedMesage=getFormattedMessage();
if(window.console.debug&&Level.DEBUG.isGreaterOrEqual(loggingEvent.level)){window.console.debug(formattedMesage)
}else{if(window.console.info&&Level.INFO.equals(loggingEvent.level)){window.console.info(formattedMesage)
}else{if(window.console.warn&&Level.WARN.equals(loggingEvent.level)){window.console.warn(formattedMesage)
}else{if(window.console.error&&loggingEvent.level.isGreaterOrEqual(Level.ERROR)){window.console.error(formattedMesage)
}else{window.console.log(formattedMesage)
}}}}}}};
BrowserConsoleAppender.prototype.group=function(name){if(window.console&&window.console.group){window.console.group(name)
}};
BrowserConsoleAppender.prototype.groupEnd=function(){if(window.console&&window.console.groupEnd){window.console.groupEnd()
}};
BrowserConsoleAppender.prototype.toString=function(){return"BrowserConsoleAppender"
};
log4javascript.BrowserConsoleAppender=BrowserConsoleAppender;
function getXmlHttp(errorHandler){var xmlHttp=null;
if(typeof XMLHttpRequest=="object"||typeof XMLHttpRequest=="function"){xmlHttp=new XMLHttpRequest()
}else{try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e1){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
}catch(e2){if(errorHandler){errorHandler()
}else{handleError("getXmlHttp: unable to obtain XMLHttpRequest object")
}}}}return xmlHttp
}function isHttpRequestSuccessful(xmlHttp){return(isUndefined(xmlHttp.status)||xmlHttp.status===0||(xmlHttp.status>=200&&xmlHttp.status<300))
}function AjaxAppender(url){var appender=this;
var isSupported=true;
if(!url){handleError("AjaxAppender: URL must be specified in constructor");
isSupported=false
}var timed=this.defaults.timed;
var waitForResponse=this.defaults.waitForResponse;
var batchSize=this.defaults.batchSize;
var timerInterval=this.defaults.timerInterval;
var requestSuccessCallback=this.defaults.requestSuccessCallback;
var failCallback=this.defaults.failCallback;
var postVarName=this.defaults.postVarName;
var sendAllOnUnload=this.defaults.sendAllOnUnload;
var sessionId=null;
var queuedLoggingEvents=[];
var queuedRequests=[];
var sending=false;
var initialized=false;
function checkCanConfigure(configOptionName){if(initialized){handleError("AjaxAppender: configuration option '"+configOptionName+"' may not be set after the appender has been initialized");
return false
}return true
}this.getSessionId=function(){return sessionId
};
this.setSessionId=function(sessionIdParam){sessionId=extractStringFromParam(sessionIdParam,null);
this.layout.setCustomField("sessionid",sessionId)
};
this.setLayout=function(layoutParam){if(checkCanConfigure("layout")){this.layout=layoutParam;
if(sessionId!==null){this.setSessionId(sessionId)
}}};
this.isTimed=function(){return timed
};
this.setTimed=function(timedParam){if(checkCanConfigure("timed")){timed=bool(timedParam)
}};
this.getTimerInterval=function(){return timerInterval
};
this.setTimerInterval=function(timerIntervalParam){if(checkCanConfigure("timerInterval")){timerInterval=extractIntFromParam(timerIntervalParam,timerInterval)
}};
this.isWaitForResponse=function(){return waitForResponse
};
this.setWaitForResponse=function(waitForResponseParam){if(checkCanConfigure("waitForResponse")){waitForResponse=bool(waitForResponseParam)
}};
this.getBatchSize=function(){return batchSize
};
this.setBatchSize=function(batchSizeParam){if(checkCanConfigure("batchSize")){batchSize=extractIntFromParam(batchSizeParam,batchSize)
}};
this.isSendAllOnUnload=function(){return sendAllOnUnload
};
this.setSendAllOnUnload=function(sendAllOnUnloadParam){if(checkCanConfigure("sendAllOnUnload")){sendAllOnUnload=extractIntFromParam(sendAllOnUnloadParam,sendAllOnUnload)
}};
this.setRequestSuccessCallback=function(requestSuccessCallbackParam){requestSuccessCallback=extractFunctionFromParam(requestSuccessCallbackParam,requestSuccessCallback)
};
this.setFailCallback=function(failCallbackParam){failCallback=extractFunctionFromParam(failCallbackParam,failCallback)
};
this.getPostVarName=function(){return postVarName
};
this.setPostVarName=function(postVarNameParam){if(checkCanConfigure("postVarName")){postVarName=extractStringFromParam(postVarNameParam,postVarName)
}};
function sendAll(){if(isSupported&&enabled){sending=true;
var currentRequestBatch;
if(waitForResponse){if(queuedRequests.length>0){currentRequestBatch=queuedRequests.shift();
sendRequest(preparePostData(currentRequestBatch),sendAll)
}else{sending=false;
if(timed){scheduleSending()
}}}else{while((currentRequestBatch=queuedRequests.shift())){sendRequest(preparePostData(currentRequestBatch))
}sending=false;
if(timed){scheduleSending()
}}}}this.sendAll=sendAll;
function sendAllRemaining(){if(isSupported&&enabled){var actualBatchSize=appender.getLayout().allowBatching()?batchSize:1;
var currentLoggingEvent;
var postData="";
var batchedLoggingEvents=[];
while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);
if(queuedLoggingEvents.length>=actualBatchSize){queuedRequests.push(batchedLoggingEvents);
batchedLoggingEvents=[]
}}if(batchedLoggingEvents.length>0){queuedRequests.push(batchedLoggingEvents)
}waitForResponse=false;
timed=false;
sendAll()
}}function preparePostData(batchedLoggingEvents){var formattedMessages=[];
var currentLoggingEvent;
var postData="";
while((currentLoggingEvent=batchedLoggingEvents.shift())){var currentFormattedMessage=appender.getLayout().format(currentLoggingEvent);
if(appender.getLayout().ignoresThrowable()){currentFormattedMessage+=loggingEvent.getThrowableStrRep()
}formattedMessages.push(currentFormattedMessage)
}if(batchedLoggingEvents.length==1){postData=formattedMessages.join("")
}else{postData=appender.getLayout().batchHeader+formattedMessages.join(appender.getLayout().batchSeparator)+appender.getLayout().batchFooter
}postData=appender.getLayout().returnsPostData?postData:urlEncode(postVarName)+"="+urlEncode(postData);
if(postData.length>0){postData+="&"
}return postData+"layout="+urlEncode(appender.getLayout().toString())
}function scheduleSending(){setTimeout(sendAll,timerInterval)
}function xmlHttpErrorHandler(){var msg="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";
handleError(msg);
isSupported=false;
if(failCallback){failCallback(msg)
}}function sendRequest(postData,successCallback){try{var xmlHttp=getXmlHttp(xmlHttpErrorHandler);
if(isSupported){if(xmlHttp.overrideMimeType){xmlHttp.overrideMimeType(appender.getLayout().getContentType())
}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(isHttpRequestSuccessful(xmlHttp)){if(requestSuccessCallback){requestSuccessCallback(xmlHttp)
}if(successCallback){successCallback(xmlHttp)
}}else{var msg="AjaxAppender.append: XMLHttpRequest request to URL "+url+" returned status code "+xmlHttp.status;
handleError(msg);
if(failCallback){failCallback(msg)
}}xmlHttp.onreadystatechange=emptyFunction;
xmlHttp=null
}};
xmlHttp.open("POST",url,true);
try{xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
}catch(headerEx){var msg="AjaxAppender.append: your browser's XMLHttpRequest implementation does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";
handleError(msg);
isSupported=false;
if(failCallback){failCallback(msg)
}return 
}xmlHttp.send(postData)
}}catch(ex){var errMsg="AjaxAppender.append: error sending log message to "+url;
handleError(errMsg,ex);
isSupported=false;
if(failCallback){failCallback(errMsg+". Details: "+getExceptionStringRep(ex))
}}}this.append=function(loggingEvent){if(isSupported){if(!initialized){init()
}queuedLoggingEvents.push(loggingEvent);
var actualBatchSize=this.getLayout().allowBatching()?batchSize:1;
if(queuedLoggingEvents.length>=actualBatchSize){var currentLoggingEvent;
var postData="";
var batchedLoggingEvents=[];
while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent)
}queuedRequests.push(batchedLoggingEvents);
if(!timed){if(!waitForResponse||(waitForResponse&&!sending)){sendAll()
}}}}};
function init(){initialized=true;
if(sendAllOnUnload){addEvent(window,"unload",sendAllRemaining)
}if(timed){scheduleSending()
}}}AjaxAppender.prototype=new Appender();
AjaxAppender.prototype.defaults={waitForResponse:false,timed:false,timerInterval:1000,batchSize:1,sendAllOnUnload:true,requestSuccessCallback:null,failCallback:null,postVarName:"data"};
AjaxAppender.prototype.layout=new HttpPostDataLayout();
AjaxAppender.prototype.toString=function(){return"AjaxAppender"
};
log4javascript.AjaxAppender=AjaxAppender;
function setCookie(name,value,days,path){var expires;
path=path?"; path="+path:"";
if(days){var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires="; expires="+date.toGMTString()
}else{expires=""
}document.cookie=escape(name)+"="+escape(value)+expires+path
}function getCookie(name){var nameEquals=escape(name)+"=";
var ca=document.cookie.split(";");
for(var i=0,len=ca.length;
i<len;
i++){var c=ca[i];
while(c.charAt(0)===" "){c=c.substring(1,c.length)
}if(c.indexOf(nameEquals)===0){return unescape(c.substring(nameEquals.length,c.length))
}}return null
}function getBaseUrl(){var scripts=document.getElementsByTagName("script");
for(var i=0,len=scripts.length;
i<len;
++i){if(scripts[i].src.indexOf("log4javascript")!=-1){var lastSlash=scripts[i].src.lastIndexOf("/");
return(lastSlash==-1)?"":scripts[i].src.substr(0,lastSlash+1)
}}return null
}function isLoaded(win){try{return bool(win.loaded)
}catch(ex){return false
}}var ConsoleAppender;
(function(){var getConsoleHtmlLines=function(){return['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">','<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">',"	<head>","		<title>log4javascript</title>",'		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />',"		<!-- Make IE8 behave like IE7, having gone to all the trouble of making IE work -->",'		<meta http-equiv="X-UA-Compatible" content="IE=7" />','		<script type="text/javascript">var isIe = false, isIePre7 = false;<\/script>','		<!--[if IE]><script type="text/javascript">isIe = true<\/script><![endif]-->','		<!--[if lt IE 7]><script type="text/javascript">isIePre7 = true<\/script><![endif]-->','		<script type="text/javascript">',"			//<![CDATA[","			var loggingEnabled = true;","			var logQueuedEventsTimer = null;","			var logEntries = [];","			var logEntriesAndSeparators = [];","			var logItems = [];","			var renderDelay = 100;","			var unrenderedLogItemsExist = false;","			var rootGroup, currentGroup = null;","			var loaded = false;","			var currentLogItem = null;","			var logMainContainer;","","			function copyProperties(obj, props) {","				for (var i in props) {","					obj[i] = props[i];","				}","			}","","			/*----------------------------------------------------------------*/","","			function LogItem() {","			}","","			LogItem.prototype = {","				mainContainer: null,","				wrappedContainer: null,","				unwrappedContainer: null,","				group: null,","","				appendToLog: function() {","					for (var i = 0, len = this.elementContainers.length; i < len; i++) {","						this.elementContainers[i].appendToLog();","					}","					this.group.update();","				},","","				doRemove: function(doUpdate, removeFromGroup) {","					if (this.rendered) {","						for (var i = 0, len = this.elementContainers.length; i < len; i++) {","							this.elementContainers[i].remove();","						}","						this.unwrappedElementContainer = null;","						this.wrappedElementContainer = null;","						this.mainElementContainer = null;","					}","					if (this.group && removeFromGroup) {","						this.group.removeChild(this, doUpdate);","					}","					if (this === currentLogItem) {","						currentLogItem = null;","					}","				},","","				remove: function(doUpdate, removeFromGroup) {","					this.doRemove(doUpdate, removeFromGroup);","				},","","				render: function() {},","","				accept: function(visitor) {","					visitor.visit(this);","				},","","				getUnwrappedDomContainer: function() {","					return this.group.unwrappedElementContainer.contentDiv;","				},","","				getWrappedDomContainer: function() {","					return this.group.wrappedElementContainer.contentDiv;","				},","","				getMainDomContainer: function() {","					return this.group.mainElementContainer.contentDiv;","				}","			};","","			LogItem.serializedItemKeys = {LOG_ENTRY: 0, GROUP_START: 1, GROUP_END: 2};","","			/*----------------------------------------------------------------*/","","			function LogItemContainerElement() {","			}","","			LogItemContainerElement.prototype = {","				appendToLog: function() {","					var insertBeforeFirst = (newestAtTop && this.containerDomNode.hasChildNodes());","					if (insertBeforeFirst) {","						this.containerDomNode.insertBefore(this.mainDiv, this.containerDomNode.firstChild);","					} else {","						this.containerDomNode.appendChild(this.mainDiv);","					}","				}","			};","","			/*----------------------------------------------------------------*/","","			function SeparatorElementContainer(containerDomNode) {","				this.containerDomNode = containerDomNode;",'				this.mainDiv = document.createElement("div");','				this.mainDiv.className = "separator";','				this.mainDiv.innerHTML = "&nbsp;";',"			}","","			SeparatorElementContainer.prototype = new LogItemContainerElement();","","			SeparatorElementContainer.prototype.remove = function() {","				this.mainDiv.parentNode.removeChild(this.mainDiv);","				this.mainDiv = null;","			};","","			/*----------------------------------------------------------------*/","","			function Separator() {","				this.rendered = false;","			}","","			Separator.prototype = new LogItem();","","			copyProperties(Separator.prototype, {","				render: function() {","					var containerDomNode = this.group.contentDiv;","					if (isIe) {","						this.unwrappedElementContainer = new SeparatorElementContainer(this.getUnwrappedDomContainer());","						this.wrappedElementContainer = new SeparatorElementContainer(this.getWrappedDomContainer());","						this.elementContainers = [this.unwrappedElementContainer, this.wrappedElementContainer];","					} else {","						this.mainElementContainer = new SeparatorElementContainer(this.getMainDomContainer());","						this.elementContainers = [this.mainElementContainer];","					}","					this.content = this.formattedMessage;","					this.rendered = true;","				}","			});","","			/*----------------------------------------------------------------*/","","			function GroupElementContainer(group, containerDomNode, isRoot, isWrapped) {","				this.group = group;","				this.containerDomNode = containerDomNode;","				this.isRoot = isRoot;","				this.isWrapped = isWrapped;","				this.expandable = false;","","				if (this.isRoot) {","					if (isIe) {",'						this.contentDiv = logMainContainer.appendChild(document.createElement("div"));','						this.contentDiv.id = this.isWrapped ? "log_wrapped" : "log_unwrapped";',"					} else {","						this.contentDiv = logMainContainer;","					}","				} else {","					var groupElementContainer = this;","					",'					this.mainDiv = document.createElement("div");','					this.mainDiv.className = "group";',"",'					this.headingDiv = this.mainDiv.appendChild(document.createElement("div"));','					this.headingDiv.className = "groupheading";',"",'					this.expander = this.headingDiv.appendChild(document.createElement("span"));','					this.expander.className = "expander unselectable greyedout";',"					this.expander.unselectable = true;",'					var expanderText = this.group.expanded ? "-" : "+";',"					this.expanderTextNode = this.expander.appendChild(document.createTextNode(expanderText));","					",'					this.headingDiv.appendChild(document.createTextNode(" " + this.group.name));',"",'					this.contentDiv = this.mainDiv.appendChild(document.createElement("div"));','					var contentCssClass = this.group.expanded ? "expanded" : "collapsed";','					this.contentDiv.className = "groupcontent " + contentCssClass;',"","					this.expander.onclick = function() {","						if (groupElementContainer.group.expandable) {","							groupElementContainer.group.toggleExpanded();","						}","					};","				}","			}","","			GroupElementContainer.prototype = new LogItemContainerElement();","","			copyProperties(GroupElementContainer.prototype, {","				toggleExpanded: function() {","					if (!this.isRoot) {","						var oldCssClass, newCssClass, expanderText;","						if (this.group.expanded) {",'							newCssClass = "expanded";','							oldCssClass = "collapsed";','							expanderText = "-";',"						} else {",'							newCssClass = "collapsed";','							oldCssClass = "expanded";','							expanderText = "+";',"						}","						replaceClass(this.contentDiv, newCssClass, oldCssClass);","						this.expanderTextNode.nodeValue = expanderText;","					}","				},","","				remove: function() {","					if (!this.isRoot) {","						this.headingDiv = null;","						this.expander.onclick = null;","						this.expander = null;","						this.expanderTextNode = null;","						this.contentDiv = null;","						this.containerDomNode = null;","						this.mainDiv.parentNode.removeChild(this.mainDiv);","						this.mainDiv = null;","					}","				},","","				reverseChildren: function() {","					// Invert the order of the log entries","					var node = null;","","					// Remove all the log container nodes","					var childDomNodes = [];","					while ((node = this.contentDiv.firstChild)) {","						this.contentDiv.removeChild(node);","						childDomNodes.push(node);","					}","","					// Put them all back in reverse order","					while ((node = childDomNodes.pop())) {","						this.contentDiv.appendChild(node);","					}","				},","","				update: function() {","					if (!this.isRoot) {","						if (this.group.expandable) {",'							removeClass(this.expander, "greyedout");',"						} else {",'							addClass(this.expander, "greyedout");',"						}","					}","				},","","				clear: function() {","					if (this.isRoot) {",'						this.contentDiv.innerHTML = "";',"					}","				}","			});","","			/*----------------------------------------------------------------*/","","			function Group(name, isRoot, initiallyExpanded) {","				this.name = name;","				this.group = null;","				this.isRoot = isRoot;","				this.initiallyExpanded = initiallyExpanded;","				this.elementContainers = [];","				this.children = [];","				this.expanded = initiallyExpanded;","				this.rendered = false;","				this.expandable = false;","			}","","			Group.prototype = new LogItem();","","			copyProperties(Group.prototype, {","				addChild: function(logItem) {","					this.children.push(logItem);","					logItem.group = this;","				},","","				render: function() {","					if (isIe) {","						var unwrappedDomContainer, wrappedDomContainer;","						if (this.isRoot) {","							unwrappedDomContainer = logMainContainer;","							wrappedDomContainer = logMainContainer;","						} else {","							unwrappedDomContainer = this.getUnwrappedDomContainer();","							wrappedDomContainer = this.getWrappedDomContainer();","						}","						this.unwrappedElementContainer = new GroupElementContainer(this, unwrappedDomContainer, this.isRoot, false);","						this.wrappedElementContainer = new GroupElementContainer(this, wrappedDomContainer, this.isRoot, true);","						this.elementContainers = [this.unwrappedElementContainer, this.wrappedElementContainer];","					} else {","						var mainDomContainer = this.isRoot ? logMainContainer : this.getMainDomContainer();","						this.mainElementContainer = new GroupElementContainer(this, mainDomContainer, this.isRoot, false);","						this.elementContainers = [this.mainElementContainer];","					}","					this.rendered = true;","				},","","				toggleExpanded: function() {","					this.expanded = !this.expanded;","					for (var i = 0, len = this.elementContainers.length; i < len; i++) {","						this.elementContainers[i].toggleExpanded();","					}","				},","","				expand: function() {","					if (!this.expanded) {","						this.toggleExpanded();","					}","				},","","				accept: function(visitor) {","					visitor.visitGroup(this);","				},","","				reverseChildren: function() {","					if (this.rendered) {","						for (var i = 0, len = this.elementContainers.length; i < len; i++) {","							this.elementContainers[i].reverseChildren();","						}","					}","				},","","				update: function() {","					var previouslyExpandable = this.expandable;","					this.expandable = (this.children.length !== 0);","					if (this.expandable !== previouslyExpandable) {","						for (var i = 0, len = this.elementContainers.length; i < len; i++) {","							this.elementContainers[i].update();","						}","					}","				},","","				flatten: function() {","					var visitor = new GroupFlattener();","					this.accept(visitor);","					return visitor.logEntriesAndSeparators;","				},","","				removeChild: function(child, doUpdate) {","					array_remove(this.children, child);","					child.group = null;","					if (doUpdate) {","						this.update();","					}","				},","","				remove: function(doUpdate, removeFromGroup) {","					for (var i = 0, len = this.children.length; i < len; i++) {","						this.children[i].remove(false, false);","					}","					this.children = [];","					this.update();","					if (this === currentGroup) {","						currentGroup = this.group;","					}","					this.doRemove(doUpdate, removeFromGroup);","				},","","				serialize: function(items) {","					items.push([LogItem.serializedItemKeys.GROUP_START, this.name]);","					for (var i = 0, len = this.children.length; i < len; i++) {","						this.children[i].serialize(items);","					}","					if (this !== currentGroup) {","						items.push([LogItem.serializedItemKeys.GROUP_END]);","					}","				},","","				clear: function() {","					for (var i = 0, len = this.elementContainers.length; i < len; i++) {","						this.elementContainers[i].clear();","					}","				}","			});","","			/*----------------------------------------------------------------*/","","			function LogEntryElementContainer() {","			}","","			LogEntryElementContainer.prototype = new LogItemContainerElement();","","			copyProperties(LogEntryElementContainer.prototype, {","				remove: function() {","					this.doRemove();","				},","","				doRemove: function() {","					this.mainDiv.parentNode.removeChild(this.mainDiv);","					this.mainDiv = null;","					this.contentElement = null;","					this.containerDomNode = null;","				},","","				setContent: function(content, wrappedContent) {","					if (content === this.formattedMessage) {",'						this.contentElement.innerHTML = "";',"						this.contentElement.appendChild(document.createTextNode(this.formattedMessage));","					} else {","						this.contentElement.innerHTML = content;","					}","				},","","				setSearchMatch: function(isMatch) {",'					var oldCssClass = isMatch ? "searchnonmatch" : "searchmatch";','					var newCssClass = isMatch ? "searchmatch" : "searchnonmatch";',"					replaceClass(this.mainDiv, newCssClass, oldCssClass);","				},","","				clearSearch: function() {",'					removeClass(this.mainDiv, "searchmatch");','					removeClass(this.mainDiv, "searchnonmatch");',"				}","			});","","			/*----------------------------------------------------------------*/","","			function LogEntryWrappedElementContainer(logEntry, containerDomNode) {","				this.logEntry = logEntry;","				this.containerDomNode = containerDomNode;",'				this.mainDiv = document.createElement("div");',"				this.mainDiv.appendChild(document.createTextNode(this.logEntry.formattedMessage));",'				this.mainDiv.className = "logentry wrapped " + this.logEntry.level;',"				this.contentElement = this.mainDiv;","			}","","			LogEntryWrappedElementContainer.prototype = new LogEntryElementContainer();","","			LogEntryWrappedElementContainer.prototype.setContent = function(content, wrappedContent) {","				if (content === this.formattedMessage) {",'					this.contentElement.innerHTML = "";',"					this.contentElement.appendChild(document.createTextNode(this.formattedMessage));","				} else {","					this.contentElement.innerHTML = wrappedContent;","				}","			};","","			/*----------------------------------------------------------------*/","","			function LogEntryUnwrappedElementContainer(logEntry, containerDomNode) {","				this.logEntry = logEntry;","				this.containerDomNode = containerDomNode;",'				this.mainDiv = document.createElement("div");','				this.mainDiv.className = "logentry unwrapped " + this.logEntry.level;','				this.pre = this.mainDiv.appendChild(document.createElement("pre"));',"				this.pre.appendChild(document.createTextNode(this.logEntry.formattedMessage));",'				this.pre.className = "unwrapped";',"				this.contentElement = this.pre;","			}","","			LogEntryUnwrappedElementContainer.prototype = new LogEntryElementContainer();","","			LogEntryUnwrappedElementContainer.prototype.remove = function() {","				this.doRemove();","				this.pre = null;","			};","","			/*----------------------------------------------------------------*/","","			function LogEntryMainElementContainer(logEntry, containerDomNode) {","				this.logEntry = logEntry;","				this.containerDomNode = containerDomNode;",'				this.mainDiv = document.createElement("div");','				this.mainDiv.className = "logentry nonielogentry " + this.logEntry.level;','				this.contentElement = this.mainDiv.appendChild(document.createElement("span"));',"				this.contentElement.appendChild(document.createTextNode(this.logEntry.formattedMessage));","			}","","			LogEntryMainElementContainer.prototype = new LogEntryElementContainer();","","			/*----------------------------------------------------------------*/","","			function LogEntry(level, formattedMessage) {","				this.level = level;","				this.formattedMessage = formattedMessage;","				this.rendered = false;","			}","","			LogEntry.prototype = new LogItem();","","			copyProperties(LogEntry.prototype, {","				render: function() {","					var logEntry = this;","					var containerDomNode = this.group.contentDiv;","","					// Support for the CSS attribute white-space in IE for Windows is","					// non-existent pre version 6 and slightly odd in 6, so instead","					// use two different HTML elements","					if (isIe) {",'						this.formattedMessage = this.formattedMessage.replace(/\\r\\n/g, "\\r"); // Workaround for IE\'s treatment of white space',"						this.unwrappedElementContainer = new LogEntryUnwrappedElementContainer(this, this.getUnwrappedDomContainer());","						this.wrappedElementContainer = new LogEntryWrappedElementContainer(this, this.getWrappedDomContainer());","						this.elementContainers = [this.unwrappedElementContainer, this.wrappedElementContainer];","					} else {","						this.mainElementContainer = new LogEntryMainElementContainer(this, this.getMainDomContainer());","						this.elementContainers = [this.mainElementContainer];","					}","					this.content = this.formattedMessage;","					this.rendered = true;","				},","","				setContent: function(content, wrappedContent) {","					if (content != this.content) {","						if (isIe && (content !== this.formattedMessage)) {",'							content = content.replace(/\\r\\n/g, "\\r"); // Workaround for IE\'s treatment of white space',"						}","						for (var i = 0, len = this.elementContainers.length; i < len; i++) {","							this.elementContainers[i].setContent(content, wrappedContent);","						}","						this.content = content;","					}","				},","","				getSearchMatches: function() {","					var matches = [];","					var i, len;","					if (isIe) {",'						var unwrappedEls = getElementsByClass(this.unwrappedElementContainer.mainDiv, "searchterm", "span");','						var wrappedEls = getElementsByClass(this.wrappedElementContainer.mainDiv, "searchterm", "span");',"						for (i = 0, len = unwrappedEls.length; i < len; i++) {","							matches[i] = new Match(this.level, null, unwrappedEls[i], wrappedEls[i]);","						}","					} else {",'						var els = getElementsByClass(this.mainElementContainer.mainDiv, "searchterm", "span");',"						for (i = 0, len = els.length; i < len; i++) {","							matches[i] = new Match(this.level, els[i]);","						}","					}","					return matches;","				},","","				setSearchMatch: function(isMatch) {","					for (var i = 0, len = this.elementContainers.length; i < len; i++) {","						this.elementContainers[i].setSearchMatch(isMatch);","					}","				},","","				clearSearch: function() {","					for (var i = 0, len = this.elementContainers.length; i < len; i++) {","						this.elementContainers[i].clearSearch();","					}","				},","","				accept: function(visitor) {","					visitor.visitLogEntry(this);","				},","","				serialize: function(items) {","					items.push([LogItem.serializedItemKeys.LOG_ENTRY, this.level, this.formattedMessage]);","				}","			});","","			/*----------------------------------------------------------------*/","","			function LogItemVisitor() {","			}","","			LogItemVisitor.prototype = {","				visit: function(logItem) {","				},","","				visitParent: function(logItem) {","					if (logItem.group) {","						logItem.group.accept(this);","					}","				},","","				visitChildren: function(logItem) {","					for (var i = 0, len = logItem.children.length; i < len; i++) {","						logItem.children[i].accept(this);","					}","				},","","				visitLogEntry: function(logEntry) {","					this.visit(logEntry);","				},","","				visitSeparator: function(separator) {","					this.visit(separator);","				},","","				visitGroup: function(group) {","					this.visit(group);","				}","			};","","			/*----------------------------------------------------------------*/","","			function GroupFlattener() {","				this.logEntriesAndSeparators = [];","			}","","			GroupFlattener.prototype = new LogItemVisitor();","","			GroupFlattener.prototype.visitGroup = function(group) {","				this.visitChildren(group);","			};","","			GroupFlattener.prototype.visitLogEntry = function(logEntry) {","				this.logEntriesAndSeparators.push(logEntry);","			};","","			GroupFlattener.prototype.visitSeparator = function(separator) {","				this.logEntriesAndSeparators.push(separator);","			};","","			/*----------------------------------------------------------------*/","","			window.onload = function() {","				// Sort out document.domain","				if (location.search) {",'					var queryBits = unescape(location.search).substr(1).split("&"), nameValueBits;',"					for (var i = 0, len = queryBits.length; i < len; i++) {",'						nameValueBits = queryBits[i].split("=");','						if (nameValueBits[0] == "log4javascript_domain") {',"							document.domain = nameValueBits[1];","							break;","						}","					}","				}","","				// Create DOM objects",'				logMainContainer = $("log");',"				if (isIePre7) {",'					addClass(logMainContainer, "oldIe");',"				}","",'				rootGroup = new Group("root", true);',"				rootGroup.render();","				currentGroup = rootGroup;","				","				setCommandInputWidth();","				setLogContainerHeight();","				toggleLoggingEnabled();","				toggleSearchEnabled();","				toggleSearchFilter();","				toggleSearchHighlight();","				applyFilters();","				checkAllLevels();","				toggleWrap();","				toggleNewestAtTop();","				toggleScrollToLatest();","				renderQueuedLogItems();","				loaded = true;",'				$("command").value = "";','				$("command").autocomplete = "off";','				$("command").onkeydown = function(evt) {',"					evt = getEvent(evt);","					if (evt.keyCode == 10 || evt.keyCode == 13) { // Return/Enter","						evalCommandLine();","						stopPropagation(evt);","					} else if (evt.keyCode == 27) { // Escape",'						this.value = "";',"						this.focus();","					} else if (evt.keyCode == 38 && commandHistory.length > 0) { // Up","						currentCommandIndex = Math.max(0, currentCommandIndex - 1);","						this.value = commandHistory[currentCommandIndex];","						moveCaretToEnd(this);","					} else if (evt.keyCode == 40 && commandHistory.length > 0) { // Down","						currentCommandIndex = Math.min(commandHistory.length - 1, currentCommandIndex + 1);","						this.value = commandHistory[currentCommandIndex];","						moveCaretToEnd(this);","					}","				};","","				// Prevent the keypress moving the caret in Firefox",'				$("command").onkeypress = function(evt) {',"					evt = getEvent(evt);","					if (evt.keyCode == 38 && commandHistory.length > 0 && evt.preventDefault) { // Up","						evt.preventDefault();","					}","				};","","				// Prevent the keyup event blurring the input in Opera",'				$("command").onkeyup = function(evt) {',"					evt = getEvent(evt);","					if (evt.keyCode == 27 && evt.preventDefault) { // Up","						evt.preventDefault();","						this.focus();","					}","				};","","				// Add document keyboard shortcuts","				document.onkeydown = function keyEventHandler(evt) {","					evt = getEvent(evt);","					switch (evt.keyCode) {","						case 69: // Ctrl + shift + E: re-execute last command","							if (evt.shiftKey && (evt.ctrlKey || evt.metaKey)) {","								evalLastCommand();","								cancelKeyEvent(evt);","								return false;","							}","							break;","						case 75: // Ctrl + shift + K: focus search","							if (evt.shiftKey && (evt.ctrlKey || evt.metaKey)) {","								focusSearch();","								cancelKeyEvent(evt);","								return false;","							}","							break;","						case 40: // Ctrl + shift + down arrow: focus command line","						case 76: // Ctrl + shift + L: focus command line","							if (evt.shiftKey && (evt.ctrlKey || evt.metaKey)) {","								focusCommandLine();","								cancelKeyEvent(evt);","								return false;","							}","							break;","					}","				};","","				// Workaround to make sure log div starts at the correct size","				setTimeout(setLogContainerHeight, 20);","","				setShowCommandLine(showCommandLine);","				doSearch();","			};","","			window.onunload = function() {","				if (mainWindowExists()) {","					appender.unload();","				}","				appender = null;","			};","","			/*----------------------------------------------------------------*/","","			function toggleLoggingEnabled() {",'				setLoggingEnabled($("enableLogging").checked);',"			}","","			function setLoggingEnabled(enable) {","				loggingEnabled = enable;","			}","","			var appender = null;","","			function setAppender(appenderParam) {","				appender = appenderParam;","			}","","			function setShowCloseButton(showCloseButton) {",'				$("closeButton").style.display = showCloseButton ? "inline" : "none";',"			}","","			function setShowHideButton(showHideButton) {",'				$("hideButton").style.display = showHideButton ? "inline" : "none";',"			}","","			var newestAtTop = false;","","			/*----------------------------------------------------------------*/","","			function LogItemContentReverser() {","			}","			","			LogItemContentReverser.prototype = new LogItemVisitor();","			","			LogItemContentReverser.prototype.visitGroup = function(group) {","				group.reverseChildren();","				this.visitChildren(group);","			};","","			/*----------------------------------------------------------------*/","","			function setNewestAtTop(isNewestAtTop) {","				var oldNewestAtTop = newestAtTop;","				var i, iLen, j, jLen;","				newestAtTop = Boolean(isNewestAtTop);","				if (oldNewestAtTop != newestAtTop) {","					var visitor = new LogItemContentReverser();","					rootGroup.accept(visitor);","","					// Reassemble the matches array","					if (currentSearch) {","						var currentMatch = currentSearch.matches[currentMatchIndex];","						var matchIndex = 0;","						var matches = [];","						var actOnLogEntry = function(logEntry) {","							var logEntryMatches = logEntry.getSearchMatches();","							for (j = 0, jLen = logEntryMatches.length; j < jLen; j++) {","								matches[matchIndex] = logEntryMatches[j];","								if (currentMatch && logEntryMatches[j].equals(currentMatch)) {","									currentMatchIndex = matchIndex;","								}","								matchIndex++;","							}","						};","						if (newestAtTop) {","							for (i = logEntries.length - 1; i >= 0; i--) {","								actOnLogEntry(logEntries[i]);","							}","						} else {","							for (i = 0, iLen = logEntries.length; i < iLen; i++) {","								actOnLogEntry(logEntries[i]);","							}","						}","						currentSearch.matches = matches;","						if (currentMatch) {","							currentMatch.setCurrent();","						}","					} else if (scrollToLatest) {","						doScrollToLatest();","					}","				}",'				$("newestAtTop").checked = isNewestAtTop;',"			}","","			function toggleNewestAtTop() {",'				var isNewestAtTop = $("newestAtTop").checked;',"				setNewestAtTop(isNewestAtTop);","			}","","			var scrollToLatest = true;","","			function setScrollToLatest(isScrollToLatest) {","				scrollToLatest = isScrollToLatest;","				if (scrollToLatest) {","					doScrollToLatest();","				}",'				$("scrollToLatest").checked = isScrollToLatest;',"			}","","			function toggleScrollToLatest() {",'				var isScrollToLatest = $("scrollToLatest").checked;',"				setScrollToLatest(isScrollToLatest);","			}","","			function doScrollToLatest() {","				var l = logMainContainer;",'				if (typeof l.scrollTop != "undefined") {',"					if (newestAtTop) {","						l.scrollTop = 0;","					} else {","						var latestLogEntry = l.lastChild;","						if (latestLogEntry) {","							l.scrollTop = l.scrollHeight;","						}","					}","				}","			}","","			var closeIfOpenerCloses = true;","","			function setCloseIfOpenerCloses(isCloseIfOpenerCloses) {","				closeIfOpenerCloses = isCloseIfOpenerCloses;","			}","","			var maxMessages = null;","","			function setMaxMessages(max) {","				maxMessages = max;","				pruneLogEntries();","			}","","			var showCommandLine = false;","","			function setShowCommandLine(isShowCommandLine) {","				showCommandLine = isShowCommandLine;","				if (loaded) {",'					$("commandLine").style.display = showCommandLine ? "block" : "none";',"					setCommandInputWidth();","					setLogContainerHeight();","				}","			}","","			function focusCommandLine() {","				if (loaded) {",'					$("command").focus();',"				}","			}","","			function focusSearch() {","				if (loaded) {",'					$("searchBox").focus();',"				}","			}","","			function getLogItems() {","				var items = [];","				for (var i = 0, len = logItems.length; i < len; i++) {","					logItems[i].serialize(items);","				}","				return items;","			}","","			function setLogItems(items) {","				var loggingReallyEnabled = loggingEnabled;","				// Temporarily turn logging on","				loggingEnabled = true;","				for (var i = 0, len = items.length; i < len; i++) {","					switch (items[i][0]) {","						case LogItem.serializedItemKeys.LOG_ENTRY:","							log(items[i][1], items[i][2]);","							break;","						case LogItem.serializedItemKeys.GROUP_START:","							group(items[i][1]);","							break;","						case LogItem.serializedItemKeys.GROUP_END:","							groupEnd();","							break;","					}","				}","				loggingEnabled = loggingReallyEnabled;","			}","","			function log(logLevel, formattedMessage) {","				if (loggingEnabled) {","					var logEntry = new LogEntry(logLevel, formattedMessage);","					logEntries.push(logEntry);","					logEntriesAndSeparators.push(logEntry);","					logItems.push(logEntry);","					currentGroup.addChild(logEntry);","					if (loaded) {","						if (logQueuedEventsTimer !== null) {","							clearTimeout(logQueuedEventsTimer);","						}","						logQueuedEventsTimer = setTimeout(renderQueuedLogItems, renderDelay);","						unrenderedLogItemsExist = true;","					}","				}","			}","","			function renderQueuedLogItems() {","				logQueuedEventsTimer = null;","				var pruned = pruneLogEntries();","","				// Render any unrendered log entries and apply the current search to them","				var initiallyHasMatches = currentSearch ? currentSearch.hasMatches() : false;","				for (var i = 0, len = logItems.length; i < len; i++) {","					if (!logItems[i].rendered) {","						logItems[i].render();","						logItems[i].appendToLog();","						if (currentSearch && (logItems[i] instanceof LogEntry)) {","							currentSearch.applyTo(logItems[i]);","						}","					}","				}","				if (currentSearch) {","					if (pruned) {","						if (currentSearch.hasVisibleMatches()) {","							if (currentMatchIndex === null) {","								setCurrentMatchIndex(0);","							}","							displayMatches();","						} else {","							displayNoMatches();","						}","					} else if (!initiallyHasMatches && currentSearch.hasVisibleMatches()) {","						setCurrentMatchIndex(0);","						displayMatches();","					}","				}","				if (scrollToLatest) {","					doScrollToLatest();","				}","				unrenderedLogItemsExist = false;","			}","","			function pruneLogEntries() {","				if ((maxMessages !== null) && (logEntriesAndSeparators.length > maxMessages)) {","					var numberToDelete = logEntriesAndSeparators.length - maxMessages;","					var prunedLogEntries = logEntriesAndSeparators.slice(0, numberToDelete);","					if (currentSearch) {","						currentSearch.removeMatches(prunedLogEntries);","					}","					var group;","					for (var i = 0; i < numberToDelete; i++) {","						group = logEntriesAndSeparators[i].group;","						array_remove(logItems, logEntriesAndSeparators[i]);","						array_remove(logEntries, logEntriesAndSeparators[i]);","						logEntriesAndSeparators[i].remove(true, true);","						if (group.children.length === 0 && group !== currentGroup && group !== rootGroup) {","							array_remove(logItems, group);","							group.remove(true, true);","						}","					}","					logEntriesAndSeparators = array_removeFromStart(logEntriesAndSeparators, numberToDelete);","					return true;","				}","				return false;","			}","","			function group(name, startExpanded) {","				if (loggingEnabled) {",'					initiallyExpanded = (typeof startExpanded === "undefined") ? true : Boolean(startExpanded);',"					var newGroup = new Group(name, false, initiallyExpanded);","					currentGroup.addChild(newGroup);","					currentGroup = newGroup;","					logItems.push(newGroup);","					if (loaded) {","						if (logQueuedEventsTimer !== null) {","							clearTimeout(logQueuedEventsTimer);","						}","						logQueuedEventsTimer = setTimeout(renderQueuedLogItems, renderDelay);","						unrenderedLogItemsExist = true;","					}","				}","			}","","			function groupEnd() {","				currentGroup = (currentGroup === rootGroup) ? rootGroup : currentGroup.group;","			}","","			function mainPageReloaded() {","				currentGroup = rootGroup;","				var separator = new Separator();","				logEntriesAndSeparators.push(separator);","				logItems.push(separator);","				currentGroup.addChild(separator);","			}","","			function closeWindow() {","				if (appender && mainWindowExists()) {","					appender.close(true);","				} else {","					window.close();","				}","			}","","			function hide() {","				if (appender && mainWindowExists()) {","					appender.hide();","				}","			}","","			var mainWindow = window;",'			var windowId = "log4javascriptConsoleWindow_" + new Date().getTime() + "_" + ("" + Math.random()).substr(2);',"","			function setMainWindow(win) {","				mainWindow = win;","				mainWindow[windowId] = window;","				// If this is a pop-up, poll the opener to see if it's closed","				if (opener && closeIfOpenerCloses) {","					pollOpener();","				}","			}","","			function pollOpener() {","				if (closeIfOpenerCloses) {","					if (mainWindowExists()) {","						setTimeout(pollOpener, 500);","					} else {","						closeWindow();","					}","				}","			}","","			function mainWindowExists() {","				try {","					return (mainWindow && !mainWindow.closed &&","						mainWindow[windowId] == window);","				} catch (ex) {}","				return false;","			}","",'			var logLevels = ["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"];',"","			function getCheckBox(logLevel) {",'				return $("switch_" + logLevel);',"			}","","			function getIeWrappedLogContainer() {",'				return $("log_wrapped");',"			}","","			function getIeUnwrappedLogContainer() {",'				return $("log_unwrapped");',"			}","","			function applyFilters() {","				for (var i = 0; i < logLevels.length; i++) {","					if (getCheckBox(logLevels[i]).checked) {","						addClass(logMainContainer, logLevels[i]);","					} else {","						removeClass(logMainContainer, logLevels[i]);","					}","				}","				updateSearchFromFilters();","			}","","			function toggleAllLevels() {",'				var turnOn = $("switch_ALL").checked;',"				for (var i = 0; i < logLevels.length; i++) {","					getCheckBox(logLevels[i]).checked = turnOn;","					if (turnOn) {","						addClass(logMainContainer, logLevels[i]);","					} else {","						removeClass(logMainContainer, logLevels[i]);","					}","				}","			}","","			function checkAllLevels() {","				for (var i = 0; i < logLevels.length; i++) {","					if (!getCheckBox(logLevels[i]).checked) {",'						getCheckBox("ALL").checked = false;',"						return;","					}","				}",'				getCheckBox("ALL").checked = true;',"			}","","			function clearLog() {","				rootGroup.clear();","				currentGroup = rootGroup;","				logEntries = [];","				logItems = [];","				logEntriesAndSeparators = [];"," 				doSearch();","			}","","			function toggleWrap() {",'				var enable = $("wrap").checked;',"				if (enable) {",'					addClass(logMainContainer, "wrap");',"				} else {",'					removeClass(logMainContainer, "wrap");',"				}","				refreshCurrentMatch();","			}","","			/* ------------------------------------------------------------------- */","","			// Search","","			var searchTimer = null;","","			function scheduleSearch() {","				try {","					clearTimeout(searchTimer);","				} catch (ex) {","					// Do nothing","				}","				searchTimer = setTimeout(doSearch, 500);","			}","","			function Search(searchTerm, isRegex, searchRegex, isCaseSensitive) {","				this.searchTerm = searchTerm;","				this.isRegex = isRegex;","				this.searchRegex = searchRegex;","				this.isCaseSensitive = isCaseSensitive;","				this.matches = [];","			}","","			Search.prototype = {","				hasMatches: function() {","					return this.matches.length > 0;","				},","","				hasVisibleMatches: function() {","					if (this.hasMatches()) {","						for (var i = 0; i < this.matches.length; i++) {","							if (this.matches[i].isVisible()) {","								return true;","							}","						}","					}","					return false;","				},","","				match: function(logEntry) {","					var entryText = String(logEntry.formattedMessage);","					var matchesSearch = false;","					if (this.isRegex) {","						matchesSearch = this.searchRegex.test(entryText);","					} else if (this.isCaseSensitive) {","						matchesSearch = (entryText.indexOf(this.searchTerm) > -1);","					} else {","						matchesSearch = (entryText.toLowerCase().indexOf(this.searchTerm.toLowerCase()) > -1);","					}","					return matchesSearch;","				},","","				getNextVisibleMatchIndex: function() {","					for (var i = currentMatchIndex + 1; i < this.matches.length; i++) {","						if (this.matches[i].isVisible()) {","							return i;","						}","					}","					// Start again from the first match","					for (i = 0; i <= currentMatchIndex; i++) {","						if (this.matches[i].isVisible()) {","							return i;","						}","					}","					return -1;","				},","","				getPreviousVisibleMatchIndex: function() {","					for (var i = currentMatchIndex - 1; i >= 0; i--) {","						if (this.matches[i].isVisible()) {","							return i;","						}","					}","					// Start again from the last match","					for (var i = this.matches.length - 1; i >= currentMatchIndex; i--) {","						if (this.matches[i].isVisible()) {","							return i;","						}","					}","					return -1;","				},","","				applyTo: function(logEntry) {","					var doesMatch = this.match(logEntry);","					if (doesMatch) {","						logEntry.group.expand();","						logEntry.setSearchMatch(true);","						var logEntryContent;","						var wrappedLogEntryContent;",'						var searchTermReplacementStartTag = "<span class=\\"searchterm\\">";','						var searchTermReplacementEndTag = "<" + "/span>";','						var preTagName = isIe ? "pre" : "span";','						var preStartTag = "<" + preTagName + " class=\\"pre\\">";','						var preEndTag = "<" + "/" + preTagName + ">";',"						var startIndex = 0;","						var searchIndex, matchedText, textBeforeMatch;","						if (this.isRegex) {",'							var flags = this.isCaseSensitive ? "g" : "gi";','							var capturingRegex = new RegExp("(" + this.searchRegex.source + ")", flags);',"","							// Replace the search term with temporary tokens for the start and end tags",'							var rnd = ("" + Math.random()).substr(2);','							var startToken = "%%s" + rnd + "%%";','							var endToken = "%%e" + rnd + "%%";','							logEntryContent = logEntry.formattedMessage.replace(capturingRegex, startToken + "$1" + endToken);',"","							// Escape the HTML to get rid of angle brackets","							logEntryContent = escapeHtml(logEntryContent);","","							// Substitute the proper HTML back in for the search match","							var result;","							var searchString = logEntryContent;",'							logEntryContent = "";','							wrappedLogEntryContent = "";',"							while ((searchIndex = searchString.indexOf(startToken, startIndex)) > -1) {","								var endTokenIndex = searchString.indexOf(endToken, searchIndex);","								matchedText = searchString.substring(searchIndex + startToken.length, endTokenIndex);","								textBeforeMatch = searchString.substring(startIndex, searchIndex);","								logEntryContent += preStartTag + textBeforeMatch + preEndTag;","								logEntryContent += searchTermReplacementStartTag + preStartTag + matchedText +","									preEndTag + searchTermReplacementEndTag;","								if (isIe) {","									wrappedLogEntryContent += textBeforeMatch + searchTermReplacementStartTag +","										matchedText + searchTermReplacementEndTag;","								}","								startIndex = endTokenIndex + endToken.length;","							}","							logEntryContent += preStartTag + searchString.substr(startIndex) + preEndTag;","							if (isIe) {","								wrappedLogEntryContent += searchString.substr(startIndex);","							}","						} else {",'							logEntryContent = "";','							wrappedLogEntryContent = "";',"							var searchTermReplacementLength = searchTermReplacementStartTag.length +","								this.searchTerm.length + searchTermReplacementEndTag.length;","							var searchTermLength = this.searchTerm.length;","							var searchTermLowerCase = this.searchTerm.toLowerCase();","							var logTextLowerCase = logEntry.formattedMessage.toLowerCase();","							while ((searchIndex = logTextLowerCase.indexOf(searchTermLowerCase, startIndex)) > -1) {","								matchedText = escapeHtml(logEntry.formattedMessage.substr(searchIndex, this.searchTerm.length));","								textBeforeMatch = escapeHtml(logEntry.formattedMessage.substring(startIndex, searchIndex));","								var searchTermReplacement = searchTermReplacementStartTag +","									preStartTag + matchedText + preEndTag + searchTermReplacementEndTag;","								logEntryContent += preStartTag + textBeforeMatch + preEndTag + searchTermReplacement;","								if (isIe) {","									wrappedLogEntryContent += textBeforeMatch + searchTermReplacementStartTag +","										matchedText + searchTermReplacementEndTag;","								}","								startIndex = searchIndex + searchTermLength;","							}","							var textAfterLastMatch = escapeHtml(logEntry.formattedMessage.substr(startIndex));","							logEntryContent += preStartTag + textAfterLastMatch + preEndTag;","							if (isIe) {","								wrappedLogEntryContent += textAfterLastMatch;","							}","						}","						logEntry.setContent(logEntryContent, wrappedLogEntryContent);","						var logEntryMatches = logEntry.getSearchMatches();","						this.matches = this.matches.concat(logEntryMatches);","					} else {","						logEntry.setSearchMatch(false);","						logEntry.setContent(logEntry.formattedMessage, logEntry.formattedMessage);","					}","					return doesMatch;","				},","","				removeMatches: function(logEntries) {","					var matchesToRemoveCount = 0;","					var currentMatchRemoved = false;","					var matchesToRemove = [];","					var i, iLen, j, jLen;","","					// Establish the list of matches to be removed","					for (i = 0, iLen = this.matches.length; i < iLen; i++) {","						for (j = 0, jLen = logEntries.length; j < jLen; j++) {","							if (this.matches[i].belongsTo(logEntries[j])) {","								matchesToRemove.push(this.matches[i]);","								if (i === currentMatchIndex) {","									currentMatchRemoved = true;","								}","							}","						}","					}","","					// Set the new current match index if the current match has been deleted","					// This will be the first match that appears after the first log entry being","					// deleted, if one exists; otherwise, it's the first match overall","					var newMatch = currentMatchRemoved ? null : this.matches[currentMatchIndex];","					if (currentMatchRemoved) {","						for (i = currentMatchIndex, iLen = this.matches.length; i < iLen; i++) {","							if (this.matches[i].isVisible() && !array_contains(matchesToRemove, this.matches[i])) {","								newMatch = this.matches[i];","								break;","							}","						}","					}","","					// Remove the matches","					for (i = 0, iLen = matchesToRemove.length; i < iLen; i++) {","						array_remove(this.matches, matchesToRemove[i]);","						matchesToRemove[i].remove();","					}","","					// Set the new match, if one exists","					if (this.hasVisibleMatches()) {","						if (newMatch === null) {","							setCurrentMatchIndex(0);","						} else {","							// Get the index of the new match","							var newMatchIndex = 0;","							for (i = 0, iLen = this.matches.length; i < iLen; i++) {","								if (newMatch === this.matches[i]) {","									newMatchIndex = i;","									break;","								}","							}","							setCurrentMatchIndex(newMatchIndex);","						}","					} else {","						currentMatchIndex = null;","						displayNoMatches();","					}","				}","			};","","			function getPageOffsetTop(el, container) {","				var currentEl = el;","				var y = 0;","				while (currentEl && currentEl != container) {","					y += currentEl.offsetTop;","					currentEl = currentEl.offsetParent;","				}","				return y;","			}","","			function scrollIntoView(el) {","				var logContainer = logMainContainer;","				// Check if the whole width of the element is visible and centre if not",'				if (!$("wrap").checked) {',"					var logContainerLeft = logContainer.scrollLeft;","					var logContainerRight = logContainerLeft  + logContainer.offsetWidth;","					var elLeft = el.offsetLeft;","					var elRight = elLeft + el.offsetWidth;","					if (elLeft < logContainerLeft || elRight > logContainerRight) {","						logContainer.scrollLeft = elLeft - (logContainer.offsetWidth - el.offsetWidth) / 2;","					}","				}","				// Check if the whole height of the element is visible and centre if not","				var logContainerTop = logContainer.scrollTop;","				var logContainerBottom = logContainerTop  + logContainer.offsetHeight;","				var elTop = getPageOffsetTop(el) - getToolBarsHeight();","				var elBottom = elTop + el.offsetHeight;","				if (elTop < logContainerTop || elBottom > logContainerBottom) {","					logContainer.scrollTop = elTop - (logContainer.offsetHeight - el.offsetHeight) / 2;","				}","			}","","			function Match(logEntryLevel, spanInMainDiv, spanInUnwrappedPre, spanInWrappedDiv) {","				this.logEntryLevel = logEntryLevel;","				this.spanInMainDiv = spanInMainDiv;","				if (isIe) {","					this.spanInUnwrappedPre = spanInUnwrappedPre;","					this.spanInWrappedDiv = spanInWrappedDiv;","				}","				this.mainSpan = isIe ? spanInUnwrappedPre : spanInMainDiv;","			}","","			Match.prototype = {","				equals: function(match) {","					return this.mainSpan === match.mainSpan;","				},","","				setCurrent: function() {","					if (isIe) {",'						addClass(this.spanInUnwrappedPre, "currentmatch");','						addClass(this.spanInWrappedDiv, "currentmatch");',"						// Scroll the visible one into view",'						var elementToScroll = $("wrap").checked ? this.spanInWrappedDiv : this.spanInUnwrappedPre;',"						scrollIntoView(elementToScroll);","					} else {",'						addClass(this.spanInMainDiv, "currentmatch");',"						scrollIntoView(this.spanInMainDiv);","					}","				},","","				belongsTo: function(logEntry) {","					if (isIe) {","						return isDescendant(this.spanInUnwrappedPre, logEntry.unwrappedPre);","					} else {","						return isDescendant(this.spanInMainDiv, logEntry.mainDiv);","					}","				},","","				setNotCurrent: function() {","					if (isIe) {",'						removeClass(this.spanInUnwrappedPre, "currentmatch");','						removeClass(this.spanInWrappedDiv, "currentmatch");',"					} else {",'						removeClass(this.spanInMainDiv, "currentmatch");',"					}","				},","","				isOrphan: function() {","					return isOrphan(this.mainSpan);","				},","","				isVisible: function() {","					return getCheckBox(this.logEntryLevel).checked;","				},","","				remove: function() {","					if (isIe) {","						this.spanInUnwrappedPre = null;","						this.spanInWrappedDiv = null;","					} else {","						this.spanInMainDiv = null;","					}","				}","			};","","			var currentSearch = null;","			var currentMatchIndex = null;","","			function doSearch() {",'				var searchBox = $("searchBox");',"				var searchTerm = searchBox.value;",'				var isRegex = $("searchRegex").checked;','				var isCaseSensitive = $("searchCaseSensitive").checked;',"				var i;","",'				if (searchTerm === "") {','					$("searchReset").disabled = true;','					$("searchNav").style.display = "none";','					removeClass(document.body, "searching");','					removeClass(searchBox, "hasmatches");','					removeClass(searchBox, "nomatches");',"					for (i = 0; i < logEntries.length; i++) {","						logEntries[i].clearSearch();","						logEntries[i].setContent(logEntries[i].formattedMessage, logEntries[i].formattedMessage);","					}","					currentSearch = null;","					setLogContainerHeight();","				} else {",'					$("searchReset").disabled = false;','					$("searchNav").style.display = "block";',"					var searchRegex;","					var regexValid;","					if (isRegex) {","						try {",'							searchRegex = isCaseSensitive ? new RegExp(searchTerm, "g") : new RegExp(searchTerm, "gi");',"							regexValid = true;",'							replaceClass(searchBox, "validregex", "invalidregex");','							searchBox.title = "Valid regex";',"						} catch (ex) {","							regexValid = false;",'							replaceClass(searchBox, "invalidregex", "validregex");','							searchBox.title = "Invalid regex: " + (ex.message ? ex.message : (ex.description ? ex.description : "unknown error"));',"							return;","						}","					} else {",'						searchBox.title = "";','						removeClass(searchBox, "validregex");','						removeClass(searchBox, "invalidregex");',"					}",'					addClass(document.body, "searching");',"					currentSearch = new Search(searchTerm, isRegex, searchRegex, isCaseSensitive);","					for (i = 0; i < logEntries.length; i++) {","						currentSearch.applyTo(logEntries[i]);","					}","					setLogContainerHeight();","","					// Highlight the first search match","					if (currentSearch.hasVisibleMatches()) {","						setCurrentMatchIndex(0);","						displayMatches();","					} else {","						displayNoMatches();","					}","				}","			}","","			function updateSearchFromFilters() {","				if (currentSearch) {","					if (currentSearch.hasMatches()) {","						if (currentMatchIndex === null) {","							currentMatchIndex = 0;","						}","						var currentMatch = currentSearch.matches[currentMatchIndex];","						if (currentMatch.isVisible()) {","							displayMatches();","							setCurrentMatchIndex(currentMatchIndex);","						} else {","							currentMatch.setNotCurrent();","							// Find the next visible match, if one exists","							var nextVisibleMatchIndex = currentSearch.getNextVisibleMatchIndex();","							if (nextVisibleMatchIndex > -1) {","								setCurrentMatchIndex(nextVisibleMatchIndex);","								displayMatches();","							} else {","								displayNoMatches();","							}","						}","					} else {","						displayNoMatches();","					}","				}","			}","","			function refreshCurrentMatch() {","				if (currentSearch && currentSearch.hasVisibleMatches()) {","					setCurrentMatchIndex(currentMatchIndex);","				}","			}","","			function displayMatches() {",'				replaceClass($("searchBox"), "hasmatches", "nomatches");','				$("searchBox").title = "" + currentSearch.matches.length + " matches found";','				$("searchNav").style.display = "block";',"				setLogContainerHeight();","			}","","			function displayNoMatches() {",'				replaceClass($("searchBox"), "nomatches", "hasmatches");','				$("searchBox").title = "No matches found";','				$("searchNav").style.display = "none";',"				setLogContainerHeight();","			}","","			function toggleSearchEnabled(enable) {",'				enable = (typeof enable == "undefined") ? !$("searchDisable").checked : enable;','				$("searchBox").disabled = !enable;','				$("searchReset").disabled = !enable;','				$("searchRegex").disabled = !enable;','				$("searchNext").disabled = !enable;','				$("searchPrevious").disabled = !enable;','				$("searchCaseSensitive").disabled = !enable;','				$("searchNav").style.display = (enable && ($("searchBox").value !== "") &&',"						currentSearch && currentSearch.hasVisibleMatches()) ?",'					"block" : "none";',"				if (enable) {",'					removeClass($("search"), "greyedout");','					addClass(document.body, "searching");','					if ($("searchHighlight").checked) {','						addClass(logMainContainer, "searchhighlight");',"					} else {",'						removeClass(logMainContainer, "searchhighlight");',"					}",'					if ($("searchFilter").checked) {','						addClass(logMainContainer, "searchfilter");',"					} else {",'						removeClass(logMainContainer, "searchfilter");',"					}",'					$("searchDisable").checked = !enable;',"				} else {",'					addClass($("search"), "greyedout");','					removeClass(document.body, "searching");','					removeClass(logMainContainer, "searchhighlight");','					removeClass(logMainContainer, "searchfilter");',"				}","				setLogContainerHeight();","			}","","			function toggleSearchFilter() {",'				var enable = $("searchFilter").checked;',"				if (enable) {",'					addClass(logMainContainer, "searchfilter");',"				} else {",'					removeClass(logMainContainer, "searchfilter");',"				}","				refreshCurrentMatch();","			}","","			function toggleSearchHighlight() {",'				var enable = $("searchHighlight").checked;',"				if (enable) {",'					addClass(logMainContainer, "searchhighlight");',"				} else {",'					removeClass(logMainContainer, "searchhighlight");',"				}","			}","","			function clearSearch() {",'				$("searchBox").value = "";',"				doSearch();","			}","","			function searchNext() {","				if (currentSearch !== null && currentMatchIndex !== null) {","					currentSearch.matches[currentMatchIndex].setNotCurrent();","					var nextMatchIndex = currentSearch.getNextVisibleMatchIndex();",'					if (nextMatchIndex > currentMatchIndex || confirm("Reached the end of the page. Start from the top?")) {',"						setCurrentMatchIndex(nextMatchIndex);","					}","				}","			}","","			function searchPrevious() {","				if (currentSearch !== null && currentMatchIndex !== null) {","					currentSearch.matches[currentMatchIndex].setNotCurrent();","					var previousMatchIndex = currentSearch.getPreviousVisibleMatchIndex();",'					if (previousMatchIndex < currentMatchIndex || confirm("Reached the start of the page. Continue from the bottom?")) {',"						setCurrentMatchIndex(previousMatchIndex);","					}","				}","			}","","			function setCurrentMatchIndex(index) {","				currentMatchIndex = index;","				currentSearch.matches[currentMatchIndex].setCurrent();","			}","","			/* ------------------------------------------------------------------------- */","","			// CSS Utilities","","			function addClass(el, cssClass) {","				if (!hasClass(el, cssClass)) {","					if (el.className) {",'						el.className += " " + cssClass;',"					} else {","						el.className = cssClass;","					}","				}","			}","","			function hasClass(el, cssClass) {","				if (el.className) {",'					var classNames = el.className.split(" ");',"					return array_contains(classNames, cssClass);","				}","				return false;","			}","","			function removeClass(el, cssClass) {","				if (hasClass(el, cssClass)) {","					// Rebuild the className property",'					var existingClasses = el.className.split(" ");',"					var newClasses = [];","					for (var i = 0, len = existingClasses.length; i < len; i++) {","						if (existingClasses[i] != cssClass) {","							newClasses[newClasses.length] = existingClasses[i];","						}","					}",'					el.className = newClasses.join(" ");',"				}","			}","","			function replaceClass(el, newCssClass, oldCssClass) {","				removeClass(el, oldCssClass);","				addClass(el, newCssClass);","			}","","			/* ------------------------------------------------------------------------- */","","			// Other utility functions","","			function getElementsByClass(el, cssClass, tagName) {","				var elements = el.getElementsByTagName(tagName);","				var matches = [];","				for (var i = 0, len = elements.length; i < len; i++) {","					if (hasClass(elements[i], cssClass)) {","						matches.push(elements[i]);","					}","				}","				return matches;","			}","","			// Syntax borrowed from Prototype library","			function $(id) {","				return document.getElementById(id);","			}","","			function isDescendant(node, ancestorNode) {","				while (node != null) {","					if (node === ancestorNode) {","						return true;","					}","					node = node.parentNode;","				}","				return false;","			}","","			function isOrphan(node) {","				var currentNode = node;","				while (currentNode) {","					if (currentNode == document.body) {","						return false;","					}","					currentNode = currentNode.parentNode;","				}","				return true;","			}","","			function escapeHtml(str) {",'				return str.replace(/&/g, "&amp;").replace(/[<]/g, "&lt;").replace(/>/g, "&gt;");',"			}","","			function getWindowWidth() {","				if (window.innerWidth) {","					return window.innerWidth;","				} else if (document.documentElement && document.documentElement.clientWidth) {","					return document.documentElement.clientWidth;","				} else if (document.body) {","					return document.body.clientWidth;","				}","				return 0;","			}","","			function getWindowHeight() {","				if (window.innerHeight) {","					return window.innerHeight;","				} else if (document.documentElement && document.documentElement.clientHeight) {","					return document.documentElement.clientHeight;","				} else if (document.body) {","					return document.body.clientHeight;","				}","				return 0;","			}","","			function getToolBarsHeight() {",'				return $("switches").offsetHeight;',"			}","","			function getChromeHeight() {","				var height = getToolBarsHeight();","				if (showCommandLine) {",'					height += $("commandLine").offsetHeight;',"				}","				return height;","			}","","			function setLogContainerHeight() {","				if (logMainContainer) {","					var windowHeight = getWindowHeight();",'					$("body").style.height = getWindowHeight() + "px";','					logMainContainer.style.height = "" +','						Math.max(0, windowHeight - getChromeHeight()) + "px";',"				}","			}","","			function setCommandInputWidth() {","				if (showCommandLine) {",'					$("command").style.width = "" + Math.max(0, $("commandLineContainer").offsetWidth -','						($("evaluateButton").offsetWidth + 13)) + "px";',"				}","			}","","			window.onresize = function() {","				setCommandInputWidth();","				setLogContainerHeight();","			};","","			if (!Array.prototype.push) {","				Array.prototype.push = function() {","			        for (var i = 0, len = arguments.length; i < len; i++){","			            this[this.length] = arguments[i];","			        }","			        return this.length;","				};","			}","","			if (!Array.prototype.pop) {","				Array.prototype.pop = function() {","					if (this.length > 0) {","						var val = this[this.length - 1];","						this.length = this.length - 1;","						return val;","					}","				};","			}","","			if (!Array.prototype.shift) {","				Array.prototype.shift = function() {","					if (this.length > 0) {","						var firstItem = this[0];","						for (var i = 0, len = this.length - 1; i < len; i++) {","							this[i] = this[i + 1];","						}","						this.length = this.length - 1;","						return firstItem;","					}","				};","			}","","			if (!Array.prototype.splice) {","				Array.prototype.splice = function(startIndex, deleteCount) {","					var itemsAfterDeleted = this.slice(startIndex + deleteCount);","					var itemsDeleted = this.slice(startIndex, startIndex + deleteCount);","					this.length = startIndex;","					// Copy the arguments into a proper Array object","					var argumentsArray = [];","					for (var i = 0, len = arguments.length; i < len; i++) {","						argumentsArray[i] = arguments[i];","					}","					var itemsToAppend = (argumentsArray.length > 2) ?","						itemsAfterDeleted = argumentsArray.slice(2).concat(itemsAfterDeleted) : itemsAfterDeleted;","					for (i = 0, len = itemsToAppend.length; i < len; i++) {","						this.push(itemsToAppend[i]);","					}","					return itemsDeleted;","				};","			}","","			function array_remove(arr, val) {","				var index = -1;","				for (var i = 0, len = arr.length; i < len; i++) {","					if (arr[i] === val) {","						index = i;","						break;","					}","				}","				if (index >= 0) {","					arr.splice(index, 1);","					return index;","				} else {","					return false;","				}","			}","","			function array_removeFromStart(array, numberToRemove) {","				if (Array.prototype.splice) {","					array.splice(0, numberToRemove);","				} else {","					for (var i = numberToRemove, len = array.length; i < len; i++) {","						array[i - numberToRemove] = array[i];","					}","					array.length = array.length - numberToRemove;","				}","				return array;","			}","","			function array_contains(arr, val) {","				for (var i = 0, len = arr.length; i < len; i++) {","					if (arr[i] == val) {","						return true;","					}","				}","				return false;","			}","","			function getErrorMessage(ex) {","				if (ex.message) {","					return ex.message;","				} else if (ex.description) {","					return ex.description;","				}",'				return "" + ex;',"			}","","			function moveCaretToEnd(input) {","				if (input.setSelectionRange) {","					input.focus();","					var length = input.value.length;","					input.setSelectionRange(length, length);","				} else if (input.createTextRange) {","					var range = input.createTextRange();","					range.collapse(false);","					range.select();","				}","				input.focus();","			}","","			function stopPropagation(evt) {","				if (evt.stopPropagation) {","					evt.stopPropagation();",'				} else if (typeof evt.cancelBubble != "undefined") {',"					evt.cancelBubble = true;","				}","			}","","			function getEvent(evt) {","				return evt ? evt : event;","			}","","			function getTarget(evt) {","				return evt.target ? evt.target : evt.srcElement;","			}","","			function getRelatedTarget(evt) {","				if (evt.relatedTarget) {","					return evt.relatedTarget;","				} else if (evt.srcElement) {","					switch(evt.type) {",'						case "mouseover":',"							return evt.fromElement;",'						case "mouseout":',"							return evt.toElement;","						default:","							return evt.srcElement;","					}","				}","			}","","			function cancelKeyEvent(evt) {","				evt.returnValue = false;","				stopPropagation(evt);","			}","","			function evalCommandLine() {",'				var expr = $("command").value;',"				evalCommand(expr);",'				$("command").value = "";',"			}","","			function evalLastCommand() {","				if (lastCommand != null) {","					evalCommand(lastCommand);","				}","			}","","			var lastCommand = null;","			var commandHistory = [];","			var currentCommandIndex = 0;","","			function evalCommand(expr) {","				if (appender) {","					appender.evalCommandAndAppend(expr);","				} else {",'					var prefix = ">>> " + expr + "\\r\\n";',"					try {",'						log("INFO", prefix + eval(expr));',"					} catch (ex) {",'						log("ERROR", prefix + "Error: " + getErrorMessage(ex));',"					}","				}","				// Update command history","				if (expr != commandHistory[commandHistory.length - 1]) {","					commandHistory.push(expr);","					// Update the appender","					if (appender) {","						appender.storeCommandHistory(commandHistory);","					}","				}","				currentCommandIndex = (expr == commandHistory[currentCommandIndex]) ? currentCommandIndex + 1 : commandHistory.length;","				lastCommand = expr;","			}","			//]]>","		<\/script>",'		<style type="text/css">',"			body {","				background-color: white;","				color: black;","				padding: 0;","				margin: 0;","				font-family: tahoma, verdana, arial, helvetica, sans-serif;","				overflow: hidden;","			}","","			div#switchesContainer input {","				margin-bottom: 0;","			}","","			div.toolbar {","				border-top: solid #ffffff 1px;","				border-bottom: solid #aca899 1px;","				background-color: #f1efe7;","				padding: 3px 5px;","				font-size: 68.75%;","			}","","			div.toolbar, div#search input {","				font-family: tahoma, verdana, arial, helvetica, sans-serif;","			}","","			div.toolbar input.button {","				padding: 0 5px;","				font-size: 100%;","			}","","			div.toolbar input.hidden {","				display: none;","			}","","			div#switches input#clearButton {","				margin-left: 20px;","			}","","			div#levels label {","				font-weight: bold;","			}","","			div#levels label, div#options label {","				margin-right: 5px;","			}","","			div#levels label#wrapLabel {","				font-weight: normal;","			}","","			div#search label {","				margin-right: 10px;","			}","","			div#search label.searchboxlabel {","				margin-right: 0;","			}","","			div#search input {","				font-size: 100%;","			}","","			div#search input.validregex {","				color: green;","			}","","			div#search input.invalidregex {","				color: red;","			}","","			div#search input.nomatches {","				color: white;","				background-color: #ff6666;","			}","","			div#search input.nomatches {","				color: white;","				background-color: #ff6666;","			}","","			div#searchNav {","				display: none;","			}","","			div#commandLine {","				display: none;","			}","","			div#commandLine input#command {","				font-size: 100%;","				font-family: Courier New, Courier;","			}","","			div#commandLine input#evaluateButton {","			}","","			*.greyedout {","				color: gray !important;","				border-color: gray !important;","			}","","			*.greyedout *.alwaysenabled { color: black; }","","			*.unselectable {","				-khtml-user-select: none;","				-moz-user-select: none;","				user-select: none;","			}","","			div#log {","				font-family: Courier New, Courier;","				font-size: 75%;","				width: 100%;","				overflow: auto;","				clear: both;","				position: relative;","			}","","			div.group {","				border-color: #cccccc;","				border-style: solid;","				border-width: 1px 0 1px 1px;","				overflow: visible;","			}","","			div.oldIe div.group, div.oldIe div.group *, div.oldIe *.logentry {","				height: 1%;","			}","","			div.group div.groupheading span.expander {","				border: solid black 1px;","				font-family: Courier New, Courier;","				font-size: 0.833em;","				background-color: #eeeeee;","				position: relative;","				top: -1px;","				color: black;","				padding: 0 2px;","				cursor: pointer;","				cursor: hand;","				height: 1%;","			}","","			div.group div.groupcontent {","				margin-left: 10px;","				padding-bottom: 2px;","				overflow: visible;","			}","","			div.group div.expanded {","				display: block;","			}","","			div.group div.collapsed {","				display: none;","			}","","			*.logentry {","				overflow: visible;","				display: none;","				white-space: pre;","			}","","			span.pre {","				white-space: pre;","			}","			","			pre.unwrapped {","				display: inline !important;","			}","","			pre.unwrapped pre.pre, div.wrapped pre.pre {","				display: inline;","			}","","			div.wrapped pre.pre {","				white-space: normal;","			}","","			div.wrapped {","				display: none;","			}","","			body.searching *.logentry span.currentmatch {","				color: white !important;","				background-color: green !important;","			}","","			body.searching div.searchhighlight *.logentry span.searchterm {","				color: black;","				background-color: yellow;","			}","","			div.wrap *.logentry {","				white-space: normal !important;","				border-width: 0 0 1px 0;","				border-color: #dddddd;","				border-style: dotted;","			}","","			div.wrap #log_wrapped, #log_unwrapped {","				display: block;","			}","","			div.wrap #log_unwrapped, #log_wrapped {","				display: none;","			}","","			div.wrap *.logentry span.pre {","				overflow: visible;","				white-space: normal;","			}","","			div.wrap *.logentry pre.unwrapped {","				display: none;","			}","","			div.wrap *.logentry span.wrapped {","				display: inline;","			}","","			div.searchfilter *.searchnonmatch {","				display: none !important;","			}","","			div#log *.TRACE, label#label_TRACE {","				color: #666666;","			}","","			div#log *.DEBUG, label#label_DEBUG {","				color: green;","			}","","			div#log *.INFO, label#label_INFO {","				color: #000099;","			}","","			div#log *.WARN, label#label_WARN {","				color: #999900;","			}","","			div#log *.ERROR, label#label_ERROR {","				color: red;","			}","","			div#log *.FATAL, label#label_FATAL {","				color: #660066;","			}","","			div.TRACE#log *.TRACE,","			div.DEBUG#log *.DEBUG,","			div.INFO#log *.INFO,","			div.WARN#log *.WARN,","			div.ERROR#log *.ERROR,","			div.FATAL#log *.FATAL {","				display: block;","			}","","			div#log div.separator {","				background-color: #cccccc;","				margin: 5px 0;","				line-height: 1px;","			}","		</style>","	</head>","",'	<body id="body">','		<div id="switchesContainer">','			<div id="switches">','				<div id="levels" class="toolbar">',"					Filters:",'					<input type="checkbox" id="switch_TRACE" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide trace messages" /><label for="switch_TRACE" id="label_TRACE">trace</label>','					<input type="checkbox" id="switch_DEBUG" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide debug messages" /><label for="switch_DEBUG" id="label_DEBUG">debug</label>','					<input type="checkbox" id="switch_INFO" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide info messages" /><label for="switch_INFO" id="label_INFO">info</label>','					<input type="checkbox" id="switch_WARN" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide warn messages" /><label for="switch_WARN" id="label_WARN">warn</label>','					<input type="checkbox" id="switch_ERROR" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide error messages" /><label for="switch_ERROR" id="label_ERROR">error</label>','					<input type="checkbox" id="switch_FATAL" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide fatal messages" /><label for="switch_FATAL" id="label_FATAL">fatal</label>','					<input type="checkbox" id="switch_ALL" onclick="toggleAllLevels(); applyFilters()" checked="checked" title="Show/hide all messages" /><label for="switch_ALL" id="label_ALL">all</label>',"				</div>",'				<div id="search" class="toolbar">','					<label for="searchBox" class="searchboxlabel">Search:</label> <input type="text" id="searchBox" onclick="toggleSearchEnabled(true)" onkeyup="scheduleSearch()" size="20" />','					<input type="button" id="searchReset" disabled="disabled" value="Reset" onclick="clearSearch()" class="button" title="Reset the search" />','					<input type="checkbox" id="searchRegex" onclick="doSearch()" title="If checked, search is treated as a regular expression" /><label for="searchRegex">Regex</label>','					<input type="checkbox" id="searchCaseSensitive" onclick="doSearch()" title="If checked, search is case sensitive" /><label for="searchCaseSensitive">Match case</label>','					<input type="checkbox" id="searchDisable" onclick="toggleSearchEnabled()" title="Enable/disable search" /><label for="searchDisable" class="alwaysenabled">Disable</label>','					<div id="searchNav">','						<input type="button" id="searchNext" disabled="disabled" value="Next" onclick="searchNext()" class="button" title="Go to the next matching log entry" />','						<input type="button" id="searchPrevious" disabled="disabled" value="Previous" onclick="searchPrevious()" class="button" title="Go to the previous matching log entry" />','						<input type="checkbox" id="searchFilter" onclick="toggleSearchFilter()" title="If checked, non-matching log entries are filtered out" /><label for="searchFilter">Filter</label>','						<input type="checkbox" id="searchHighlight" onclick="toggleSearchHighlight()" title="Highlight matched search terms" /><label for="searchHighlight" class="alwaysenabled">Highlight all</label>',"					</div>","				</div>",'				<div id="options" class="toolbar">',"					Options:",'					<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="enableLoggingLabel">Log</label>','					<input type="checkbox" id="wrap" onclick="toggleWrap()" title="Enable / disable word wrap" /><label for="wrap" id="wrapLabel">Wrap</label>','					<input type="checkbox" id="newestAtTop" onclick="toggleNewestAtTop()" title="If checked, causes newest messages to appear at the top" /><label for="newestAtTop" id="newestAtTopLabel">Newest at the top</label>','					<input type="checkbox" id="scrollToLatest" onclick="toggleScrollToLatest()" checked="checked" title="If checked, window automatically scrolls to a new message when it is added" /><label for="scrollToLatest" id="scrollToLatestLabel">Scroll to latest</label>','					<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="button" title="Clear all log messages"  />','					<input type="button" id="hideButton" value="Hide" onclick="hide()" class="hidden button" title="Hide the console" />','					<input type="button" id="closeButton" value="Close" onclick="closeWindow()" class="hidden button" title="Close the window" />',"				</div>","			</div>","		</div>",'		<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>','		<div id="commandLine" class="toolbar">','			<div id="commandLineContainer">','				<input type="text" id="command" title="Enter a JavaScript command here and hit return or press \'Evaluate\'" />','				<input type="button" id="evaluateButton" value="Evaluate" class="button" title="Evaluate the command" onclick="evalCommandLine()" />',"			</div>","		</div>","	</body>","</html>",""]
};
var defaultCommandLineFunctions=[];
ConsoleAppender=function(){};
var consoleAppenderIdCounter=1;
ConsoleAppender.prototype=new Appender();
ConsoleAppender.prototype.create=function(inPage,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,focusConsoleWindow){var appender=this;
var initialized=false;
var consoleWindowCreated=false;
var consoleWindowLoaded=false;
var consoleClosed=false;
var queuedLoggingEvents=[];
var isSupported=true;
var consoleAppenderId=consoleAppenderIdCounter++;
initiallyMinimized=extractBooleanFromParam(initiallyMinimized,this.defaults.initiallyMinimized);
lazyInit=extractBooleanFromParam(lazyInit,this.defaults.lazyInit);
useDocumentWrite=extractBooleanFromParam(useDocumentWrite,this.defaults.useDocumentWrite);
var newestMessageAtTop=this.defaults.newestMessageAtTop;
var scrollToLatestMessage=this.defaults.scrollToLatestMessage;
width=width?width:this.defaults.width;
height=height?height:this.defaults.height;
var maxMessages=this.defaults.maxMessages;
var showCommandLine=this.defaults.showCommandLine;
var commandLineObjectExpansionDepth=this.defaults.commandLineObjectExpansionDepth;
var showHideButton=this.defaults.showHideButton;
var showCloseButton=this.defaults.showCloseButton;
var showLogEntryDeleteButtons=this.defaults.showLogEntryDeleteButtons;
this.setLayout(this.defaults.layout);
var init,createWindow,safeToAppend,getConsoleWindow,open;
var appenderName=inPage?"InPageAppender":"PopUpAppender";
var checkCanConfigure=function(configOptionName){if(consoleWindowCreated){handleError(appenderName+": configuration option '"+configOptionName+"' may not be set after the appender has been initialized");
return false
}return true
};
var consoleWindowExists=function(){return(consoleWindowLoaded&&isSupported&&!consoleClosed)
};
this.isNewestMessageAtTop=function(){return newestMessageAtTop
};
this.setNewestMessageAtTop=function(newestMessageAtTopParam){newestMessageAtTop=bool(newestMessageAtTopParam);
if(consoleWindowExists()){getConsoleWindow().setNewestAtTop(newestMessageAtTop)
}};
this.isScrollToLatestMessage=function(){return scrollToLatestMessage
};
this.setScrollToLatestMessage=function(scrollToLatestMessageParam){scrollToLatestMessage=bool(scrollToLatestMessageParam);
if(consoleWindowExists()){getConsoleWindow().setScrollToLatest(scrollToLatestMessage)
}};
this.getWidth=function(){return width
};
this.setWidth=function(widthParam){if(checkCanConfigure("width")){width=extractStringFromParam(widthParam,width)
}};
this.getHeight=function(){return height
};
this.setHeight=function(heightParam){if(checkCanConfigure("height")){height=extractStringFromParam(heightParam,height)
}};
this.getMaxMessages=function(){return maxMessages
};
this.setMaxMessages=function(maxMessagesParam){maxMessages=extractIntFromParam(maxMessagesParam,maxMessages);
if(consoleWindowExists()){getConsoleWindow().setMaxMessages(maxMessages)
}};
this.isShowCommandLine=function(){return showCommandLine
};
this.setShowCommandLine=function(showCommandLineParam){showCommandLine=bool(showCommandLineParam);
if(consoleWindowExists()){getConsoleWindow().setShowCommandLine(showCommandLine)
}};
this.isShowHideButton=function(){return showHideButton
};
this.setShowHideButton=function(showHideButtonParam){showHideButton=bool(showHideButtonParam);
if(consoleWindowExists()){getConsoleWindow().setShowHideButton(showHideButton)
}};
this.isShowCloseButton=function(){return showCloseButton
};
this.setShowCloseButton=function(showCloseButtonParam){showCloseButton=bool(showCloseButtonParam);
if(consoleWindowExists()){getConsoleWindow().setShowCloseButton(showCloseButton)
}};
this.getCommandLineObjectExpansionDepth=function(){return commandLineObjectExpansionDepth
};
this.setCommandLineObjectExpansionDepth=function(commandLineObjectExpansionDepthParam){commandLineObjectExpansionDepth=extractIntFromParam(commandLineObjectExpansionDepthParam,commandLineObjectExpansionDepth)
};
var minimized=initiallyMinimized;
this.isInitiallyMinimized=function(){return initiallyMinimized
};
this.setInitiallyMinimized=function(initiallyMinimizedParam){if(checkCanConfigure("initiallyMinimized")){initiallyMinimized=bool(initiallyMinimizedParam);
minimized=initiallyMinimized
}};
this.isUseDocumentWrite=function(){return useDocumentWrite
};
this.setUseDocumentWrite=function(useDocumentWriteParam){if(checkCanConfigure("useDocumentWrite")){useDocumentWrite=bool(useDocumentWriteParam)
}};
function QueuedLoggingEvent(loggingEvent,formattedMessage){this.loggingEvent=loggingEvent;
this.levelName=loggingEvent.level.name;
this.formattedMessage=formattedMessage
}QueuedLoggingEvent.prototype.append=function(){getConsoleWindow().log(this.levelName,this.formattedMessage)
};
function QueuedGroup(name,initiallyExpanded){this.name=name;
this.initiallyExpanded=initiallyExpanded
}QueuedGroup.prototype.append=function(){getConsoleWindow().group(this.name,this.initiallyExpanded)
};
function QueuedGroupEnd(){}QueuedGroupEnd.prototype.append=function(){getConsoleWindow().groupEnd()
};
var checkAndAppend=function(){safeToAppend();
if(!initialized){init()
}else{if(consoleClosed&&reopenWhenClosed){createWindow()
}}if(safeToAppend()){appendQueuedLoggingEvents()
}};
this.append=function(loggingEvent){if(isSupported){var formattedMessage=appender.getLayout().format(loggingEvent);
if(this.getLayout().ignoresThrowable()){formattedMessage+=loggingEvent.getThrowableStrRep()
}queuedLoggingEvents.push(new QueuedLoggingEvent(loggingEvent,formattedMessage));
checkAndAppend()
}};
this.group=function(name,initiallyExpanded){if(isSupported){queuedLoggingEvents.push(new QueuedGroup(name,initiallyExpanded));
checkAndAppend()
}};
this.groupEnd=function(){if(isSupported){queuedLoggingEvents.push(new QueuedGroupEnd());
checkAndAppend()
}};
var appendQueuedLoggingEvents=function(){var currentLoggingEvent;
while(queuedLoggingEvents.length>0){queuedLoggingEvents.shift().append()
}if(focusConsoleWindow){getConsoleWindow().focus()
}};
this.setAddedToLogger=function(logger){this.loggers.push(logger);
if(enabled&&!lazyInit){init()
}};
this.clear=function(){if(consoleWindowExists()){getConsoleWindow().clearLog()
}queuedLoggingEvents.length=0
};
this.focus=function(){if(consoleWindowExists()){getConsoleWindow().focus()
}};
this.focusCommandLine=function(){if(consoleWindowExists()){getConsoleWindow().focusCommandLine()
}};
this.focusSearch=function(){if(consoleWindowExists()){getConsoleWindow().focusSearch()
}};
var commandWindow=window;
this.getCommandWindow=function(){return commandWindow
};
this.setCommandWindow=function(commandWindowParam){commandWindow=commandWindowParam
};
this.executeLastCommand=function(){if(consoleWindowExists()){getConsoleWindow().evalLastCommand()
}};
var commandLayout=new PatternLayout("%m");
this.getCommandLayout=function(){return commandLayout
};
this.setCommandLayout=function(commandLayoutParam){commandLayout=commandLayoutParam
};
this.evalCommandAndAppend=function(expr){var commandReturnValue={appendResult:true,isError:false};
var commandOutput="";
try{var result,i;
if(!commandWindow.eval&&commandWindow.execScript){commandWindow.execScript("null")
}var commandLineFunctionsHash={};
for(i=0,len=commandLineFunctions.length;
i<len;
i++){commandLineFunctionsHash[commandLineFunctions[i][0]]=commandLineFunctions[i][1]
}var objectsToRestore=[];
var addObjectToRestore=function(name){objectsToRestore.push([name,commandWindow[name]])
};
addObjectToRestore("appender");
commandWindow.appender=appender;
addObjectToRestore("commandReturnValue");
commandWindow.commandReturnValue=commandReturnValue;
addObjectToRestore("commandLineFunctionsHash");
commandWindow.commandLineFunctionsHash=commandLineFunctionsHash;
var addFunctionToWindow=function(name){addObjectToRestore(name);
commandWindow[name]=function(){return this.commandLineFunctionsHash[name](appender,arguments,commandReturnValue)
}
};
for(i=0,len=commandLineFunctions.length;
i<len;
i++){addFunctionToWindow(commandLineFunctions[i][0])
}if(commandWindow===window&&commandWindow.execScript){addObjectToRestore("evalExpr");
addObjectToRestore("result");
window.evalExpr=expr;
commandWindow.execScript("window.result=eval(window.evalExpr);");
result=window.result
}else{result=commandWindow.eval(expr)
}commandOutput=isUndefined(result)?result:formatObjectExpansion(result,commandLineObjectExpansionDepth);
for(i=0,len=objectsToRestore.length;
i<len;
i++){commandWindow[objectsToRestore[i][0]]=objectsToRestore[i][1]
}}catch(ex){commandOutput="Error evaluating command: "+getExceptionStringRep(ex);
commandReturnValue.isError=true
}if(commandReturnValue.appendResult){var message=">>> "+expr;
if(!isUndefined(commandOutput)){message+=newLine+commandOutput
}var level=commandReturnValue.isError?Level.ERROR:Level.INFO;
var loggingEvent=new LoggingEvent(null,new Date(),level,[message],null);
var mainLayout=this.getLayout();
this.setLayout(commandLayout);
this.append(loggingEvent);
this.setLayout(mainLayout)
}};
var commandLineFunctions=defaultCommandLineFunctions.concat([]);
this.addCommandLineFunction=function(functionName,commandLineFunction){commandLineFunctions.push([functionName,commandLineFunction])
};
var commandHistoryCookieName="log4javascriptCommandHistory";
this.storeCommandHistory=function(commandHistory){setCookie(commandHistoryCookieName,commandHistory.join(","))
};
var writeHtml=function(doc){var lines=getConsoleHtmlLines();
doc.open();
for(var i=0,len=lines.length;
i<len;
i++){doc.writeln(lines[i])
}doc.close()
};
this.setEventTypes(["load","unload"]);
var consoleWindowLoadHandler=function(){var win=getConsoleWindow();
win.setAppender(appender);
win.setNewestAtTop(newestMessageAtTop);
win.setScrollToLatest(scrollToLatestMessage);
win.setMaxMessages(maxMessages);
win.setShowCommandLine(showCommandLine);
win.setShowHideButton(showHideButton);
win.setShowCloseButton(showCloseButton);
win.setMainWindow(window);
var storedValue=getCookie(commandHistoryCookieName);
if(storedValue){win.commandHistory=storedValue.split(",");
win.currentCommandIndex=win.commandHistory.length
}appender.dispatchEvent("load",{win:win})
};
this.unload=function(){logLog.debug("unload "+this+", caller: "+this.unload.caller);
if(!consoleClosed){logLog.debug("really doing unload "+this);
consoleClosed=true;
consoleWindowLoaded=false;
consoleWindowCreated=false;
appender.dispatchEvent("unload",{})
}};
var pollConsoleWindow=function(windowTest,interval,successCallback,errorMessage){function doPoll(){try{if(consoleClosed){clearInterval(poll)
}if(windowTest(getConsoleWindow())){clearInterval(poll);
successCallback()
}}catch(ex){clearInterval(poll);
isSupported=false;
handleError(errorMessage,ex)
}}var poll=setInterval(doPoll,interval)
};
var getConsoleUrl=function(){var documentDomainSet=(document.domain!=location.hostname);
return useDocumentWrite?"":getBaseUrl()+"console_uncompressed.html"+(documentDomainSet?"?log4javascript_domain="+escape(document.domain):"")
};
if(inPage){var containerElement=null;
var cssProperties=[];
this.addCssProperty=function(name,value){if(checkCanConfigure("cssProperties")){cssProperties.push([name,value])
}};
var windowCreationStarted=false;
var iframeContainerDiv;
var iframeId=uniqueId+"_InPageAppender_"+consoleAppenderId;
this.hide=function(){if(initialized&&consoleWindowCreated){if(consoleWindowExists()){getConsoleWindow().$("command").blur()
}iframeContainerDiv.style.display="none";
minimized=true
}};
this.show=function(){if(initialized){if(consoleWindowCreated){iframeContainerDiv.style.display="block";
this.setShowCommandLine(showCommandLine);
minimized=false
}else{if(!windowCreationStarted){createWindow(true)
}}}};
this.isVisible=function(){return !minimized&&!consoleClosed
};
this.close=function(fromButton){if(!consoleClosed&&(!fromButton||confirm("This will permanently remove the console from the page. No more messages will be logged. Do you wish to continue?"))){iframeContainerDiv.parentNode.removeChild(iframeContainerDiv);
this.unload()
}};
open=function(){var initErrorMessage="InPageAppender.open: unable to create console iframe";
function finalInit(){try{if(!initiallyMinimized){appender.show()
}consoleWindowLoadHandler();
consoleWindowLoaded=true;
appendQueuedLoggingEvents()
}catch(ex){isSupported=false;
handleError(initErrorMessage,ex)
}}function writeToDocument(){try{var windowTest=function(win){return isLoaded(win)
};
if(useDocumentWrite){writeHtml(getConsoleWindow().document)
}if(windowTest(getConsoleWindow())){finalInit()
}else{pollConsoleWindow(windowTest,100,finalInit,initErrorMessage)
}}catch(ex){isSupported=false;
handleError(initErrorMessage,ex)
}}minimized=false;
iframeContainerDiv=containerElement.appendChild(document.createElement("div"));
iframeContainerDiv.style.width=width;
iframeContainerDiv.style.height=height;
iframeContainerDiv.style.border="solid gray 1px";
for(var i=0,len=cssProperties.length;
i<len;
i++){iframeContainerDiv.style[cssProperties[i][0]]=cssProperties[i][1]
}var iframeSrc=useDocumentWrite?"":" src='"+getConsoleUrl()+"'";
iframeContainerDiv.innerHTML="<iframe id='"+iframeId+"' name='"+iframeId+"' width='100%' height='100%' frameborder='0'"+iframeSrc+"scrolling='no'></iframe>";
consoleClosed=false;
var iframeDocumentExistsTest=function(win){try{return bool(win)&&bool(win.document)
}catch(ex){return false
}};
if(iframeDocumentExistsTest(getConsoleWindow())){writeToDocument()
}else{pollConsoleWindow(iframeDocumentExistsTest,100,writeToDocument,initErrorMessage)
}consoleWindowCreated=true
};
createWindow=function(show){if(show||!initiallyMinimized){var pageLoadHandler=function(){if(!container){containerElement=document.createElement("div");
containerElement.style.position="fixed";
containerElement.style.left="0";
containerElement.style.right="0";
containerElement.style.bottom="0";
document.body.appendChild(containerElement);
appender.addCssProperty("borderWidth","1px 0 0 0");
appender.addCssProperty("zIndex",1000000);
open()
}else{try{var el=document.getElementById(container);
if(el.nodeType==1){containerElement=el
}open()
}catch(ex){handleError("InPageAppender.init: invalid container element '"+container+"' supplied",ex)
}}};
if(pageLoaded&&container&&container.appendChild){containerElement=container;
open()
}else{if(pageLoaded){pageLoadHandler()
}else{log4javascript.addEventListener("load",pageLoadHandler)
}}windowCreationStarted=true
}};
init=function(){createWindow();
initialized=true
};
getConsoleWindow=function(){var iframe=window.frames[iframeId];
if(iframe){return iframe
}};
safeToAppend=function(){if(isSupported&&!consoleClosed){if(consoleWindowCreated&&!consoleWindowLoaded&&getConsoleWindow()&&isLoaded(getConsoleWindow())){consoleWindowLoaded=true
}return consoleWindowLoaded
}return false
}
}else{var useOldPopUp=appender.defaults.useOldPopUp;
var complainAboutPopUpBlocking=appender.defaults.complainAboutPopUpBlocking;
var reopenWhenClosed=this.defaults.reopenWhenClosed;
this.isUseOldPopUp=function(){return useOldPopUp
};
this.setUseOldPopUp=function(useOldPopUpParam){if(checkCanConfigure("useOldPopUp")){useOldPopUp=bool(useOldPopUpParam)
}};
this.isComplainAboutPopUpBlocking=function(){return complainAboutPopUpBlocking
};
this.setComplainAboutPopUpBlocking=function(complainAboutPopUpBlockingParam){if(checkCanConfigure("complainAboutPopUpBlocking")){complainAboutPopUpBlocking=bool(complainAboutPopUpBlockingParam)
}};
this.isFocusPopUp=function(){return focusConsoleWindow
};
this.setFocusPopUp=function(focusPopUpParam){focusConsoleWindow=bool(focusPopUpParam)
};
this.isReopenWhenClosed=function(){return reopenWhenClosed
};
this.setReopenWhenClosed=function(reopenWhenClosedParam){reopenWhenClosed=bool(reopenWhenClosedParam)
};
this.close=function(){logLog.debug("close "+this);
try{popUp.close();
this.unload()
}catch(ex){}};
this.hide=function(){logLog.debug("hide "+this);
if(consoleWindowExists()){this.close()
}};
this.show=function(){logLog.debug("show "+this);
if(!consoleWindowCreated){open()
}};
this.isVisible=function(){return safeToAppend()
};
var popUp;
open=function(){var windowProperties="width="+width+",height="+height+",status,resizable";
var windowName="PopUp_"+location.host.replace(/[^a-z0-9]/gi,"_")+"_"+consoleAppenderId;
if(!useOldPopUp||!useDocumentWrite){windowName=windowName+"_"+uniqueId
}var checkPopUpClosed=function(win){if(consoleClosed){return true
}else{try{return bool(win)&&win.closed
}catch(ex){}}return false
};
var popUpClosedCallback=function(){if(!consoleClosed){appender.unload()
}};
function finalInit(){getConsoleWindow().setCloseIfOpenerCloses(!useOldPopUp||!useDocumentWrite);
consoleWindowLoadHandler();
consoleWindowLoaded=true;
appendQueuedLoggingEvents();
pollConsoleWindow(checkPopUpClosed,500,popUpClosedCallback,"PopUpAppender.checkPopUpClosed: error checking pop-up window")
}try{popUp=window.open(getConsoleUrl(),windowName,windowProperties);
consoleClosed=false;
consoleWindowCreated=true;
if(popUp){if(useDocumentWrite&&useOldPopUp&&isLoaded(popUp)){popUp.mainPageReloaded();
finalInit()
}else{if(useDocumentWrite){writeHtml(popUp.document)
}var popUpLoadedTest=function(win){return bool(win)&&isLoaded(win)
};
if(isLoaded(popUp)){finalInit()
}else{pollConsoleWindow(popUpLoadedTest,100,finalInit,"PopUpAppender.init: unable to create console window")
}}}else{isSupported=false;
logLog.warn("PopUpAppender.init: pop-ups blocked, please unblock to use PopUpAppender");
if(complainAboutPopUpBlocking){handleError("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.")
}}}catch(ex){handleError("PopUpAppender.init: error creating pop-up",ex)
}};
createWindow=function(){if(!initiallyMinimized){open()
}};
init=function(){createWindow();
initialized=true
};
getConsoleWindow=function(){return popUp
};
safeToAppend=function(){if(isSupported&&!isUndefined(popUp)&&!consoleClosed){if(popUp.closed||(consoleWindowLoaded&&isUndefined(popUp.closed))){appender.unload();
logLog.debug("PopUpAppender: pop-up closed");
return false
}if(!consoleWindowLoaded&&isLoaded(popUp)){consoleWindowLoaded=true
}}return isSupported&&consoleWindowLoaded&&!consoleClosed
}
}this.getConsoleWindow=getConsoleWindow
};
ConsoleAppender.addGlobalCommandLineFunction=function(functionName,commandLineFunction){defaultCommandLineFunctions.push([functionName,commandLineFunction])
};
function PopUpAppender(lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(false,null,lazyInit,initiallyMinimized,useDocumentWrite,width,height,this.defaults.focusPopUp)
}PopUpAppender.prototype=new ConsoleAppender();
PopUpAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,focusPopUp:false,lazyInit:true,useOldPopUp:true,complainAboutPopUpBlocking:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"600",height:"400",reopenWhenClosed:false,maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:true,showLogEntryDeleteButtons:true,useDocumentWrite:true};
PopUpAppender.prototype.toString=function(){return"PopUpAppender"
};
log4javascript.PopUpAppender=PopUpAppender;
function InPageAppender(container,lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(true,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,false)
}InPageAppender.prototype=new ConsoleAppender();
InPageAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,lazyInit:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"100%",height:"220px",maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:false,showLogEntryDeleteButtons:true,useDocumentWrite:true};
InPageAppender.prototype.toString=function(){return"InPageAppender"
};
log4javascript.InPageAppender=InPageAppender;
log4javascript.InlineAppender=InPageAppender
})();
function padWithSpaces(str,len){if(str.length<len){var spaces=[];
var numberOfSpaces=Math.max(0,len-str.length);
for(var i=0;
i<numberOfSpaces;
i++){spaces[i]=" "
}str+=spaces.join("")
}return str
}(function(){function dir(obj){var maxLen=0;
for(var p in obj){maxLen=Math.max(toStr(p).length,maxLen)
}var propList=[];
for(p in obj){var propNameStr="  "+padWithSpaces(toStr(p),maxLen+2);
var propVal;
try{propVal=splitIntoLines(toStr(obj[p])).join(padWithSpaces(newLine,maxLen+6))
}catch(ex){propVal="[Error obtaining property. Details: "+getExceptionMessage(ex)+"]"
}propList.push(propNameStr+propVal)
}return propList.join(newLine)
}var nodeTypes={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};
var preFormattedElements=["script","pre"];
var emptyElements=["br","img","hr","param","link","area","input","col","base","meta"];
var indentationUnit="  ";
function getXhtml(rootNode,includeRootNode,indentation,startNewLine,preformatted){includeRootNode=(typeof includeRootNode=="undefined")?true:(includeRootNode?true:false);
if(typeof indentation!="string"){indentation=""
}startNewLine=startNewLine?true:false;
preformatted=preformatted?true:false;
var xhtml;
function isWhitespace(node){return((node.nodeType==nodeTypes.TEXT_NODE)&&/^[ \t\r\n]*$/.test(node.nodeValue))
}function fixAttributeValue(attrValue){return attrValue.toString().replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")
}function getStyleAttributeValue(el){var stylePairs=el.style.cssText.split(";");
var styleValue="";
var isFirst=true;
for(var j=0,len=stylePairs.length;
j<len;
j++){var nameValueBits=stylePairs[j].split(":");
var props=[];
if(!/^\s*$/.test(nameValueBits[0])){props.push(trim(nameValueBits[0]).toLowerCase()+":"+trim(nameValueBits[1]))
}styleValue=props.join(";")
}return styleValue
}function getNamespace(el){if(el.prefix){return el.prefix
}else{if(el.outerHTML){var regex=new RegExp("<([^:]+):"+el.tagName+"[^>]*>","i");
if(regex.test(el.outerHTML)){return RegExp.$1.toLowerCase()
}}}return""
}var lt="<";
var gt=">";
if(includeRootNode&&rootNode.nodeType!=nodeTypes.DOCUMENT_FRAGMENT_NODE){switch(rootNode.nodeType){case nodeTypes.ELEMENT_NODE:var tagName=rootNode.tagName.toLowerCase();
xhtml=startNewLine?newLine+indentation:"";
xhtml+=lt;
var prefix=getNamespace(rootNode);
var hasPrefix=prefix?true:false;
if(hasPrefix){xhtml+=prefix+":"
}xhtml+=tagName;
for(i=0,len=rootNode.attributes.length;
i<len;
i++){var currentAttr=rootNode.attributes[i];
if(!currentAttr.specified||currentAttr.nodeValue===null||currentAttr.nodeName.toLowerCase()==="style"||typeof currentAttr.nodeValue!=="string"||currentAttr.nodeName.indexOf("_moz")===0){continue
}xhtml+=" "+currentAttr.nodeName.toLowerCase()+'="';
xhtml+=fixAttributeValue(currentAttr.nodeValue);
xhtml+='"'
}if(rootNode.style.cssText){var styleValue=getStyleAttributeValue(rootNode);
if(styleValue!==""){xhtml+=' style="'+getStyleAttributeValue(rootNode)+'"'
}}if(array_contains(emptyElements,tagName)||(hasPrefix&&!rootNode.hasChildNodes())){xhtml+="/"+gt
}else{xhtml+=gt;
var childStartNewLine=!(rootNode.childNodes.length===1&&rootNode.childNodes[0].nodeType===nodeTypes.TEXT_NODE);
var childPreformatted=array_contains(preFormattedElements,tagName);
for(var i=0,len=rootNode.childNodes.length;
i<len;
i++){xhtml+=getXhtml(rootNode.childNodes[i],true,indentation+indentationUnit,childStartNewLine,childPreformatted)
}var endTag=lt+"/"+tagName+gt;
xhtml+=childStartNewLine?newLine+indentation+endTag:endTag
}return xhtml;
case nodeTypes.TEXT_NODE:if(isWhitespace(rootNode)){xhtml=""
}else{if(preformatted){xhtml=rootNode.nodeValue
}else{var lines=splitIntoLines(trim(rootNode.nodeValue));
var trimmedLines=[];
for(var i=0,len=lines.length;
i<len;
i++){trimmedLines[i]=trim(lines[i])
}xhtml=trimmedLines.join(newLine+indentation)
}if(startNewLine){xhtml=newLine+indentation+xhtml
}}return xhtml;
case nodeTypes.CDATA_SECTION_NODE:return"<![CDATA["+rootNode.nodeValue+"]]>"+newLine;
case nodeTypes.DOCUMENT_NODE:xhtml="";
for(var i=0,len=rootNode.childNodes.length;
i<len;
i++){xhtml+=getXhtml(rootNode.childNodes[i],true,indentation)
}return xhtml;
default:return""
}}else{xhtml="";
for(var i=0,len=rootNode.childNodes.length;
i<len;
i++){xhtml+=getXhtml(rootNode.childNodes[i],true,indentation+indentationUnit)
}return xhtml
}}var layouts={};
function createCommandLineFunctions(appender){ConsoleAppender.addGlobalCommandLineFunction("$",function(appender,args,returnValue){return document.getElementById(args[0])
});
ConsoleAppender.addGlobalCommandLineFunction("dir",function(appender,args,returnValue){var lines=[];
for(var i=0,len=args.length;
i<len;
i++){lines[i]=dir(args[i])
}return lines.join(newLine+newLine)
});
ConsoleAppender.addGlobalCommandLineFunction("dirxml",function(appender,args,returnValue){var lines=[];
for(var i=0,len=args.length;
i<len;
i++){var win=appender.getCommandWindow();
lines[i]=getXhtml(args[i])
}return lines.join(newLine+newLine)
});
ConsoleAppender.addGlobalCommandLineFunction("cd",function(appender,args,returnValue){var win,message;
if(args.length===0||args[0]===""){win=window;
message="Command line set to run in main window"
}else{if(args[0].window==args[0]){win=args[0];
message="Command line set to run in frame '"+args[0].name+"'"
}else{win=window.frames[args[0]];
if(win){message="Command line set to run in frame '"+args[0]+"'"
}else{returnValue.isError=true;
message="Frame '"+args[0]+"' does not exist";
win=appender.getCommandWindow()
}}}appender.setCommandWindow(win);
return message
});
ConsoleAppender.addGlobalCommandLineFunction("clear",function(appender,args,returnValue){returnValue.appendResult=false;
appender.clear()
});
ConsoleAppender.addGlobalCommandLineFunction("keys",function(appender,args,returnValue){var keys=[];
for(var k in args[0]){keys.push(k)
}return keys
});
ConsoleAppender.addGlobalCommandLineFunction("values",function(appender,args,returnValue){var values=[];
for(var k in args[0]){try{values.push(args[0][k])
}catch(ex){logLog.warn("values(): Unable to obtain value for key "+k+". Details: "+getExceptionMessage(ex))
}}return values
});
ConsoleAppender.addGlobalCommandLineFunction("expansionDepth",function(appender,args,returnValue){var expansionDepth=parseInt(args[0],10);
if(isNaN(expansionDepth)||expansionDepth<0){returnValue.isError=true;
return""+args[0]+" is not a valid expansion depth"
}else{appender.setCommandLineObjectExpansionDepth(expansionDepth);
return"Object expansion depth set to "+expansionDepth
}})
}function init(){createCommandLineFunctions();
initialized=true
}init()
})();
function addWindowLoadListener(listener){var oldOnload=window.onload;
if(typeof window.onload!="function"){window.onload=listener
}else{window.onload=function(evt){if(oldOnload){oldOnload(evt)
}listener(evt)
}
}}addWindowLoadListener(function(){pageLoaded=true;
log4javascript.dispatchEvent("load",{})
});
window.log4javascript=log4javascript
})();
var ConfigUtil={createConfigValueFromString:function(A){switch(A.toString().toLowerCase()){case"true":return true;
break;
case"false":return false;
break;
default:throw"the config is probably broken. cannot convert config parameter"
}},createLogValueFromString:function(A){switch(A.toString().toLowerCase()){case"trace":return log4javascript.Level.TRACE;
break;
case"debug":return log4javascript.Level.DEBUG;
break;
case"info":return log4javascript.Level.INFO;
break;
case"warn":return log4javascript.Level.WARN;
break;
case"error":return log4javascript.Level.ERROR;
break;
case"fatal":return log4javascript.Level.FATAL;
break
}}};
self.getBoundingBox=function(A){var B={left:pageEditor.canvas.getSize().x,top:pageEditor.canvas.getSize().y,height:0,width:0};
A.each(function(C){B.left=Math.min(B.left,C.getProperty(MP_X));
B.top=Math.min(B.top,C.getProperty(MP_Y));
B.height=Math.max(B.height,new Number(C.getProperty(MP_Y))+new Number(C.getEffectiveHeight()));
B.width=Math.max(B.width,new Number(C.getProperty(MP_X))+new Number(C.getEffectiveWidth()))
});
B.height=B.height-B.top;
B.width=B.width-B.left;
B.top++;
B.left++;
if($("faceElement")){return $("faceElement").setStyles(B).setStyles({display:"block"})
}else{return new Element("div",{styles:B,"class":"multiselectBoundingBox",id:"faceElement"}).setStyles({"background-color":"red",opacity:0.4}).inject(pageEditor.canvas,"top")
}};
self.preLoad=function(A){if(self.loadingComponents==null){self.loadingComponents=new Array()
}if($("loading")==null){var B=new Element("div",{id:"loading","class":"loading",styles:{"z-index":Z_INDEX_LOADING_MESSAGE}});
B.set("text","loading");
$$("body")[0].grab(B);
self.loadSlide=new Fx.Morph("loading",{duration:"normal",transition:Fx.Transitions.Sine.easeOut})
}if(loadingComponents.length==0){loadSlide.start({opacity:1})
}if(loadingComponents.indexOf(A)==-1){loadingComponents.push(A)
}};
self.postLoad=function(A){loadingComponents=loadingComponents.filter(function(B){if(B!=A){return B
}});
if(loadingComponents.length==0){loadSlide.chain(function(){if($("loading").getStyle("opacity")!=0){this.start({opacity:0})
}})
}};
self.confirmMessage=function(A){return window.confirm(A)
};
self.userMessage=function(A){displayInlineMessage(A)
};
self.debugMessage=function(A){if(ENABLE_DEBUG_INLINE_MESSAGES===true){LogUtil.log(A)
}};
var messages=new Array();
self.displayInlineMessage=function(C){var A=USER_MESSAGE_SHOW_TIME;
var B=new Element("div",{"class":"userMessageBox",visibility:"hidden"}).setStyle("z-index",Z_INDEX_MESSAGES);
$$("body")[0].grab(B);
B.set("html",C);
B.setStyle("top",-B.getSize().y);
messages.push(new Fx.Morph(B,{duration:"long",transition:Fx.Transitions.Sine.easeOut}));
messages.getLast().toTop=B.getCoordinates().top+B.getHeight()+5;
messages.each(function(D){if(!D.hideMessage){D.cancel();
D.start({top:[D.toTop],opacity:[1]});
D.toTop=D.toTop+D.element.getHeight()+5;
if(messages.getLast()==D){(function(){this.hideMessage=true;
var E=messages;
new Fx.Morph(this.element,{duration:"long",transition:Fx.Transitions.Sine.easeOut}).start({top:[-1*this.element.getSize().y],opacity:[0.1]}).chain(function(){this.element.destroy()
})
}).delay(A,D)
}}})
};
self.createNamespace=function(nameSpace){var tmp="self";
var parts=nameSpace.split(".");
for(var i=0;
i<parts.length;
i++){var part=parts[i];
tmp+="."+part;
eval(tmp+" = new Object();")
}};
self.createNamespace2=function(nameSpace){var tmp="window";
nameSpace.split(".").each(function(part){tmp+="."+part;
if(!$chk(eval(tmp))){eval(tmp+" = new Object();")
}})
};
var dateFormat=function(F,E,C){var I=$chk(C)?C:"/";
var K=F;
var J=K.getFullYear();
var D=K.getMonth()+1;
var G=K.getDate();
if(J<1970){J=J+100
}var H=new String(J);
var A=new String(D);
var B=new String(G);
if(A.length==1){A="0"+A
}if(B.length==1){B="0"+B
}H=B+I+A+I+H;
return H
};
var timeFormat=function(H,F,C){var J=$chk(C)?C:":";
var L=H;
var G=H.getHours();
var D=H.getMinutes();
var B=H.getSeconds();
var I=new String(G);
var A=new String(D);
var K=new String(B);
if(I.length==1){I="0"+I
}if(A.length==1){A="0"+A
}if(K.length==1){K="0"+K
}var E=I+J+A+J+K;
return E
};
var sizeFormat=function(A){if(A==0){return 0
}if(A<1024){return A+" B"
}if(A>=1204&&A<=(1024*1024)){return Math.round(A/1024)+" KB"
}return Math.round(A/1024/1024)+" MB"
};
var shortenString=function(F,B,C,G){var D=B-C-G.length;
if(F.length>B){var A=null;
var E=F.length-C;
A=F.substr(0,D)+G+F.substr(E,E+B);
return A
}else{return F
}};
var createContentDropData=function(M,C,H){var N="default alt text";
var J="default src url";
var G="default thumb url";
var L="default title";
var B="default time";
var P="default size";
if($chk(M.fileSize)){P=sizeFormat(M.fileSize)
}else{P="n/a"
}if($chk(M.changeDate)){B=dateFormat(M.changeDate)
}else{B="n/a"
}var E=M.mimeType.split("/");
if(E[0]=="image"){J=M.srcUrl.valueOf();
G=M.srcUrl.valueOf();
N="bild alt text";
var A=H;
var F=4;
var K="..";
var I=A-F-K.length;
if(M.fileName.length>A){var D=M.fileName.length-F;
L=M.fileName.substr(0,I)+K+M.fileName.substr(D,D+F)
}else{L=M.fileName
}}else{if(E[0]=="video"){J=M.srcUrl.valueOf();
G=M.thumbUrl.valueOf();
N=M.fileName.valueOf();
var A=16;
var F=4;
var K="..";
var I=A-F-K.length;
if(M.fileName.length>A){var D=M.fileName.length-F;
L=M.fileName.substr(0,I)+K+M.fileName.substr(D,D+F);
log.debug("cutting long title "+M.fileName+" to "+L)
}else{L=M.fileName;
N=L
}}else{if(E[0]=="audio"){J=M.srcUrl.valueOf();
G=AUDIO_CASSETTE_ICON_PATH;
N="audio alt text";
var A=16;
var F=4;
var K="..";
var I=A-F-K.length;
if(M.fileName.length>A){var D=M.fileName.length-F;
L=M.fileName.substr(0,I)+K+M.fileName.substr(D,D+F);
log.debug("cutting long title "+M.fileName+" to "+L)
}else{L=M.fileName;
N=L
}}else{if($chk(M.thumbUrl)){J=M.thumbUrl.valueOf();
N="thumb alt text"
}else{J="/assets/images/audio_50x50.gif"
}}}}var O={type:C,content:{altText:N,thumbUrl:G,title:L,time:B,size:P,targetMashlet:C,contentDto:M}};
this.log.debug("content element created: "+O);
return O
};
var getCanvasDebugInfo=function(){var E=pageEditor.canvas.getCoordinates();
var D=pageEditor.masterPagesCanvas.getCoordinates();
var A=pageEditor.canvasContainer.getCoordinates();
var B="live: "+JSON.encode(E)+"<br>master: "+JSON.encode(D)+"<br>cont: "+JSON.encode(A);
var C="";
pageEditor.model.getMashlets().each(function(F){try{C+=F.getProperty(MP_X)+"/"+F.getProperty(MP_Y)+":"+MashletUtil.getTypeFromMashlet(F)+"@"+F.state+" "+JSON.encode(pageEditor.canvasComponent.canvasCoords(F.contentContainer))+"\n"
}catch(G){C+=" [could not get info for element: "+G+"]"
}});
return B+"\n"+C
};
var showModalDialog=function(A){userMessage(A)
};
var assertEquals=function(C,B,A){if(C!=B){throw"ASSERTION"+($chk(A)?"("+A+")":"")+": "+C+" == "+B
}};
var canvasCoords=function(A){return pageEditor.canvasComponent.canvasCoords(A)
};
var exLog=null;
if(ENABLE_EXCEPTION_LOGGING===true){exLog=log4javascript.getLogger("exceptionLog");
var exAppender=new log4javascript.AjaxAppender("/logging/AjaxExceptionLoggingServlet");
exAppender.setThreshold(log4javascript.Level.INFO);
exLog.addAppender(exAppender)
}var logException=function(A){if(ENABLE_EXCEPTION_LOGGING==false){return 
}exLog.error(JSON.encode(A))
};
