//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

var MooTools={version:"1.2.5",build:"008d8f0f2fcc2044e54fdd3635341aaab274e757"};var Native=function(l){l=l||{};var a=l.name;var j=l.legacy;var b=l.protect;
var c=l.implement;var i=l.generics;var g=l.initialize;var h=l.afterImplement||function(){};var d=g||j;i=i!==false;d.constructor=Native;d.$family={name:"native"};
if(j&&g){d.prototype=j.prototype;}d.prototype.constructor=d;if(a){var f=a.toLowerCase();d.prototype.$family={name:f};Native.typize(d,f);}var k=function(o,m,p,n){if(!b||n||!o.prototype[m]){o.prototype[m]=p;
}if(i){Native.genericize(o,m,b);}h.call(o,m,p);return o;};d.alias=function(o,m,q){if(typeof o=="string"){var p=this.prototype[o];if((o=p)){return k(this,m,o,q);
}}for(var n in o){this.alias(n,o[n],m);}return this;};d.implement=function(n,m,q){if(typeof n=="string"){return k(this,n,m,q);}for(var o in n){k(this,o,n[o],m);
}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 j in a){new Native({name:j,initialize:a[j],protect:true});
}var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var h={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 f in h){for(var b=h[f].length;b--;){Native.genericize(a[f],h[f][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(f){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 h=b[c],g=f[c];f[c]=(g&&$type(h)=="object"&&$type(g)=="object")?$mixin(g,h):$unlink(h);}}return f;}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 f in c){b[f]=$unlink(c[f]);
}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,f){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(f,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,f){var c=[];
for(var b=0,a=this.length;b<a;b++){c[b]=d.call(f,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 f=0,b=this.length;f<b;f++){for(var d in c){if(c[d](this[f])){a[d]=this[f];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("");}});try{delete Function.prototype.bind;}catch(e){}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 f=function(){return a.apply(b.bind||null,c);};if(b.delay){return setTimeout(f,b.delay);}if(b.periodical){return setInterval(f,b.periodical);
}if(b.attempt){return $try(f);}return f();};},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(f,d){a.set(d,b.call(c,f,d,this));
},this);return a;},filter:function(b,c){var a=new Hash;Hash.each(this,function(f,d){if(b.call(c,f,d,this)){a.set(d,f);}},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(g,f){if(a){f=a+"["+f+"]";}var d;switch($type(g)){case"object":d=Hash.toQueryString(g,f);break;case"array":var c={};g.each(function(j,h){c[h]=j;
});d=Hash.toQueryString(c,f);break;default:d=f+"="+encodeURIComponent(g);}if(g!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});
var Event=new Native({name:"Event",initialize:function(a,g){g=g||window;var l=g.document;a=a||g.event;if(a.$extended){return a;}this.$extended=true;var k=a.type;
var h=a.target||a.srcElement;while(h&&h.nodeType==3){h=h.parentNode;}if(k.test(/key/)){var b=a.which||a.keyCode;var n=Event.Keys.keyOf(b);if(k=="keydown"){var d=b-111;
if(d>0&&d<13){n="f"+d;}}n=n||String.fromCharCode(b).toLowerCase();}else{if(k.match(/(click|mouse|menu)/i)){l=(!l.compatMode||l.compatMode=="CSS1Compat")?l.html:l.body;
var j={x:a.pageX||a.clientX+l.scrollLeft,y:a.pageY||a.clientY+l.scrollTop};var c={x:(a.pageX)?a.pageX-g.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-g.pageYOffset:a.clientY};
if(k.match(/DOMMouseScroll|mousewheel/)){var i=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var f=(a.which==3)||(a.button==2);var m=null;if(k.match(/over|out/)){switch(k){case"mouseover":m=a.relatedTarget||a.fromElement;
break;case"mouseout":m=a.relatedTarget||a.toElement;}if(!(function(){while(m&&m.nodeType==3){m=m.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){m=false;
}}}}return $extend(this,{event:a,type:k,page:j,client:c,rightClick:f,wheel:i,relatedTarget:m,target:h,code:b,key:n,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 f in a){Object.reset(a,f);
}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 f=this.caller,g=this._current;this.caller=g;this._current=arguments.callee;var d=c.apply(this,arguments);this._current=g;this.caller=f;return d;}.extend({_owner:a,_origin:c,_name:b});
}});Class.implement({implement:function(a,d){if($type(a)=="object"){for(var f in a){this.implement(f,a[f]);}return this;}var g=Class.Mutators[a];if(g){d=g.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=[],h=true;for(var f=0,d=this.length;f<d;f++){var g=this[f][a].apply(this[f],arguments);c.push(g);
if(h){h=($type(g)=="element");}}return(h)?new Elements(c):c;});}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var g=Array.link(arguments,{properties:Object.type,iframe:$defined});
var d=g.properties||{};var c=document.id(g.iframe);var f=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 h=$try(function(){return c.contentWindow.location.host;});if(!h||h==window.location.host){var i=new Window(c.contentWindow);
new Document(c.contentWindow.document);$extend(i.Element.prototype,Element.Prototype);}f.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(g,b){b=$extend({ddup:true,cash:true},b);
g=g||[];if(b.ddup||b.cash){var h={},f=[];for(var c=0,a=g.length;c<a;c++){var d=document.id(g[c],!b.cash);if(b.ddup){if(h[d.uid]){continue;}h[d.uid]=true;
}if(d){f.push(d);}}g=f;}return(b.cash)?$extend(g,this):g;}});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));}});(function(){var d;try{var a=document.createElement("<input name=x>");d=(a.name=="x");}catch(b){}var c=function(f){return(""+f).replace(/&/g,"&amp;").replace(/"/g,"&quot;");
};Document.implement({newElement:function(f,g){if(g&&g.checked!=null){g.defaultChecked=g.checked;}if(d&&g){f="<"+f;if(g.name){f+=' name="'+c(g.name)+'"';
}if(g.type){f+=' type="'+c(g.type)+'"';}f+=">";delete g.name;delete g.type;}return this.id(this.createElement(f)).set(g);},newTextNode:function(f){return this.createTextNode(f);
},getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var f={string:function(i,h,g){i=g.getElementById(i);return(i)?f.element(i,h):null;
},element:function(g,j){$uid(g);if(!j&&!g.$family&&!(/^object|embed$/i).test(g.tagName)){var h=Element.Prototype;for(var i in h){g[i]=h[i];}}return g;},object:function(h,i,g){if(h.toElement){return f.element(h.toElement(g),i);
}return null;}};f.textnode=f.whitespace=f.window=f.document=$arguments(0);return function(h,j,i){if(h&&h.$family&&h.uid){return h;}var g=$type(h);return(f[g])?f[g](h,j,i||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 g=[];var c=Array.flatten(arguments);for(var d=0,b=c.length;d<b;d++){var f=c[d];switch($type(f)){case"element":g.push(f);break;case"string":g.extend(this.document.getElements(f,true));
}}return new Elements(g);},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(f){var g=this.getElementsByTagName(f.trim());(b)?c.extend(g):c=g;
},this);return new Elements(c,{ddup:b,cash:!d});}});(function(){var i={},g={};var j={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};
var c=function(m){return(g[m]||(g[m]={}));};var h=function(o,m){if(!o){return;}var n=o.uid;if(m!==true){m=false;}if(Browser.Engine.trident){if(o.clearAttributes){var r=m&&o.cloneNode(false);
o.clearAttributes();if(r){o.mergeAttributes(r);}}else{if(o.removeEvents){o.removeEvents();}}if((/object/i).test(o.tagName)){for(var q in o){if(typeof o[q]=="function"){o[q]=$empty;
}}Element.dispose(o);}}if(!n){return;}i[n]=g[n]=null;};var d=function(){Hash.each(i,h);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(h);
}if(window.CollectGarbage){CollectGarbage();}i=g=null;};var k=function(o,m,t,n,q,s){var p=o[t||m];var r=[];while(p){if(p.nodeType==1&&(!n||Element.match(p,n))){if(!q){return document.id(p,s);
}r.push(p);}p=p[m];}return(q)?new Elements(r,{ddup:false,cash:!s}):null;};var f={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 l=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];
b=b.associate(b);Hash.extend(f,b);Hash.extend(f,l.associate(l.map(String.toLowerCase)));var a={before:function(n,m){if(m.parentNode){m.parentNode.insertBefore(n,m);
}},after:function(n,m){if(!m.parentNode){return;}var o=m.nextSibling;(o)?m.parentNode.insertBefore(n,o):m.parentNode.appendChild(n);},bottom:function(n,m){m.appendChild(n);
},top:function(n,m){var o=m.firstChild;(o)?m.insertBefore(n,o):m.appendChild(n);}};a.inside=a.bottom;Hash.each(a,function(m,n){n=n.capitalize();Element.implement("inject"+n,function(o){m(this,document.id(o,true));
return this;});Element.implement("grab"+n,function(o){m(document.id(o,true),this);return this;});});Element.implement({set:function(q,n){switch($type(q)){case"object":for(var o in q){this.set(o,q[o]);
}break;case"string":var m=Element.Properties.get(q);(m&&m.set)?m.set.apply(this,Array.slice(arguments,1)):this.setProperty(q,n);}return this;},get:function(n){var m=Element.Properties.get(n);
return(m&&m.get)?m.get.apply(this,Array.slice(arguments,1)):this.getProperty(n);},erase:function(n){var m=Element.Properties.get(n);(m&&m.erase)?m.erase.apply(this):this.removeProperty(n);
return this;},setProperty:function(n,o){var m=f[n];if(o==undefined){return this.removeProperty(n);}if(m&&b[n]){o=!!o;}(m)?this[m]=o:this.setAttribute(n,""+o);
return this;},setProperties:function(m){for(var n in m){this.setProperty(n,m[n]);}return this;},getProperty:function(n){var m=f[n];var o=(m)?this[m]:this.getAttribute(n,2);
return(b[n])?!!o:(m)?o:o||null;},getProperties:function(){var m=$A(arguments);return m.map(this.getProperty,this).associate(m);},removeProperty:function(n){var m=f[n];
(m)?this[m]=(m&&b[n])?false:"":this.removeAttribute(n);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;
},hasClass:function(m){return this.className.contains(m," ");},addClass:function(m){if(!this.hasClass(m)){this.className=(this.className+" "+m).clean();
}return this;},removeClass:function(m){this.className=this.className.replace(new RegExp("(^|\\s)"+m+"(?:\\s|$)"),"$1");return this;},toggleClass:function(m){return this.hasClass(m)?this.removeClass(m):this.addClass(m);
},adopt:function(){Array.flatten(arguments).each(function(m){m=document.id(m,true);if(m){this.appendChild(m);}},this);return this;},appendText:function(n,m){return this.grab(this.getDocument().newTextNode(n),m);
},grab:function(n,m){a[m||"bottom"](document.id(n,true),this);return this;},inject:function(n,m){a[m||"bottom"](this,document.id(n,true));return this;},replaces:function(m){m=document.id(m,true);
m.parentNode.replaceChild(this,m);return this;},wraps:function(n,m){n=document.id(n,true);return this.replaces(n).grab(n,m);},getPrevious:function(m,n){return k(this,"previousSibling",null,m,false,n);
},getAllPrevious:function(m,n){return k(this,"previousSibling",null,m,true,n);},getNext:function(m,n){return k(this,"nextSibling",null,m,false,n);},getAllNext:function(m,n){return k(this,"nextSibling",null,m,true,n);
},getFirst:function(m,n){return k(this,"nextSibling","firstChild",m,false,n);},getLast:function(m,n){return k(this,"previousSibling","lastChild",m,false,n);
},getParent:function(m,n){return k(this,"parentNode",null,m,false,n);},getParents:function(m,n){return k(this,"parentNode",null,m,true,n);},getSiblings:function(m,n){return this.getParent().getChildren(m,n).erase(this);
},getChildren:function(m,n){return k(this,"nextSibling","firstChild",m,true,n);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;
},getElementById:function(p,o){var n=this.ownerDocument.getElementById(p);if(!n){return null;}for(var m=n.parentNode;m!=this;m=m.parentNode){if(!m){return null;
}}return document.id(n,o);},getSelected:function(){return new Elements($A(this.options).filter(function(m){return m.selected;}));},getComputedStyle:function(n){if(this.currentStyle){return this.currentStyle[n.camelCase()];
}var m=this.getDocument().defaultView.getComputedStyle(this,null);return(m)?m.getPropertyValue([n.hyphenate()]):null;},toQueryString:function(){var m=[];
this.getElements("input, select, textarea",true).each(function(n){if(!n.name||n.disabled||n.type=="submit"||n.type=="reset"||n.type=="file"){return;}var o=(n.tagName.toLowerCase()=="select")?Element.getSelected(n).map(function(p){return p.value;
}):((n.type=="radio"||n.type=="checkbox")&&!n.checked)?null:n.value;$splat(o).each(function(p){if(typeof p!="undefined"){m.push(n.name+"="+encodeURIComponent(p));
}});});return m.join("&");},clone:function(p,m){p=p!==false;var s=this.cloneNode(p);var o=function(w,v){if(!m){w.removeAttribute("id");}if(Browser.Engine.trident){w.clearAttributes();
w.mergeAttributes(v);w.removeAttribute("uid");if(w.options){var x=w.options,t=v.options;for(var u=x.length;u--;){x[u].selected=t[u].selected;}}}var y=j[v.tagName.toLowerCase()];
if(y&&v[y]){w[y]=v[y];}};if(p){var q=s.getElementsByTagName("*"),r=this.getElementsByTagName("*");for(var n=q.length;n--;){o(q[n],r[n]);}}o(s,this);return document.id(s);
},destroy:function(){Element.empty(this);Element.dispose(this);h(this,true);return null;},empty:function(){$A(this.childNodes).each(function(m){Element.destroy(m);
});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(m){m=document.id(m,true);if(!m){return false;
}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(m.tagName)).contains(m);}return(this.contains)?(this!=m&&this.contains(m)):!!(this.compareDocumentPosition(m)&16);
},match:function(m){return(!m||(m==this)||(Element.get(this,"tag")==m));}});Native.implement([Element,Window,Document],{addListener:function(p,o){if(p=="unload"){var m=o,n=this;
o=function(){n.removeListener("unload",o);m();};}else{i[this.uid]=this;}if(this.addEventListener){this.addEventListener(p,o,false);}else{this.attachEvent("on"+p,o);
}return this;},removeListener:function(n,m){if(this.removeEventListener){this.removeEventListener(n,m,false);}else{this.detachEvent("on"+n,m);}return this;
},retrieve:function(n,m){var p=c(this.uid),o=p[n];if(m!=undefined&&o==undefined){o=p[n]=m;}return $pick(o);},store:function(n,m){var o=c(this.uid);o[n]=m;
return this;},eliminate:function(m){var n=c(this.uid);delete n[m];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 f=Array.flatten(arguments).join("");var g=Browser.Engine.trident&&a[this.get("tag")];if(g){var h=c;h.innerHTML=g[1]+f+g[2];
for(var d=g[0];d--;){h=h.firstChild;}this.empty().adopt(h.childNodes);}else{this.innerHTML=f;}}};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(f,h){var i=this.retrieve("events",{});i[f]=i[f]||{keys:[],values:[]};if(i[f].keys.contains(h)){return this;
}i[f].keys.push(h);var g=f,a=Element.Events.get(f),c=h,j=this;if(a){if(a.onAdd){a.onAdd.call(this,h);}if(a.condition){c=function(k){if(a.condition.call(this,k)){return h.call(this,k);
}return true;};}g=a.base||g;}var d=function(){return h.call(j);};var b=Element.NativeEvents[g];if(b){if(b==2){d=function(k){k=new Event(k,j.getWindow());
if(c.call(j,k)===false){k.stop();}};}this.addListener(g,d);}i[f].values.push(d);return this;},removeEvent:function(c,b){var a=this.retrieve("events");if(!a||!a[c]){return this;
}var g=a[c].keys.indexOf(b);if(g==-1){return this;}a[c].keys.splice(g,1);var f=a[c].values.splice(g,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,f):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(f){f.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(f){this.addEvent(a,f);},this);}}return this;}});try{if(typeof HTMLElement!="undefined"){HTMLElement.prototype.fireEvent=Element.prototype.fireEvent;
}}catch(e){}Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};
(function(){var 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(f,d){if(!c[d]){return"";}return($type(f)=="number")?c[d].replace("@",Math.round(f)):f;
}).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(h){switch(h){case"opacity":return this.get("opacity");
case"float":h=(Browser.Engine.trident)?"styleFloat":"cssFloat";}h=h.camelCase();var a=this.style[h];if(!$chk(a)){a=[];for(var g in Element.ShortStyles){if(h!=g){continue;
}for(var f in Element.ShortStyles[g]){a.push(this.getStyle(f));}return a.join(" ");}a=this.getComputedStyle(h);}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(h.test(/^(height|width)$/)){var b=(h=="width")?["left","right"]:["top","bottom"],d=0;
b.each(function(i){d+=this.getStyle("border-"+i+"-width").toInt()+this.getStyle("padding-"+i).toInt();},this);return this["offset"+h.capitalize()]-d+"px";
}if((Browser.Engine.presto)&&String(a).test("px")){return a;}if(h.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(h){var g=Element.ShortStyles;
var b=Element.Styles;["margin","padding"].each(function(i){var j=i+h;g[i][j]=b[j]="@px";});var f="border"+h;g.border[f]=b[f]="@px @ rgb(@, @, @)";var d=f+"Width",a=f+"Style",c=f+"Color";
g[f]={};g.borderWidth[d]=g[f][d]=b[d]="@px";g.borderStyle[a]=g[f][a]=b[a]="@";g.borderColor[c]=g[f][c]=b[c]="rgb(@, @, @)";});(function(){Element.implement({scrollTo:function(i,j){if(b(this)){this.getWindow().scrollTo(i,j);
}else{this.scrollLeft=i;this.scrollTop=j;}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 j=this,i={x:0,y:0};while(j&&!b(j)){i.x+=j.scrollLeft;i.y+=j.scrollTop;j=j.parentNode;
}return i;},getOffsetParent:function(){var i=this;if(b(i)){return null;}if(!Browser.Engine.trident){return i.offsetParent;}while((i=i.parentNode)&&!b(i)){if(d(i,"position")!="static"){return i;
}}return null;},getOffsets:function(){if(this.getBoundingClientRect){var k=this.getBoundingClientRect(),n=document.id(this.getDocument().documentElement),q=n.getScroll(),l=this.getScrolls(),j=this.getScroll(),i=(d(this,"position")=="fixed");
return{x:k.left.toInt()+l.x-j.x+((i)?0:q.x)-n.clientLeft,y:k.top.toInt()+l.y-j.y+((i)?0:q.y)-n.clientTop};}var m=this,o={x:0,y:0};if(b(this)){return o;
}while(m&&!b(m)){o.x+=m.offsetLeft;o.y+=m.offsetTop;if(Browser.Engine.gecko){if(!g(m)){o.x+=c(m);o.y+=h(m);}var p=m.parentNode;if(p&&d(p,"overflow")!="visible"){o.x+=c(p);
o.y+=h(p);}}else{if(m!=this&&Browser.Engine.webkit){o.x+=c(m);o.y+=h(m);}}m=m.offsetParent;}if(Browser.Engine.gecko&&!g(this)){o.x-=c(this);o.y-=h(this);
}return o;},getPosition:function(l){if(b(this)){return{x:0,y:0};}var m=this.getOffsets(),j=this.getScrolls();var i={x:m.x-j.x,y:m.y-j.y};var k=(l&&(l=document.id(l)))?l.getPosition():{x:0,y:0};
return{x:i.x-k.x,y:i.y-k.y};},getCoordinates:function(k){if(b(this)){return this.getWindow().getCoordinates();}var i=this.getPosition(k),j=this.getSize();
var l={left:i.x,top:i.y,width:j.x,height:j.y};l.right=l.left+l.width;l.bottom=l.top+l.height;return l;},computePosition:function(i){return{left:i.x-f(this,"margin-left"),top:i.y-f(this,"margin-top")};
},setPosition:function(i){return this.setStyles(this.computePosition(i));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var j=this.getWindow();
return{x:j.innerWidth,y:j.innerHeight};}var i=a(this);return{x:i.clientWidth,y:i.clientHeight};},getScroll:function(){var j=this.getWindow(),i=a(this);
return{x:j.pageXOffset||i.scrollLeft,y:j.pageYOffset||i.scrollTop};},getScrollSize:function(){var j=a(this),i=this.getSize();return{x:Math.max(j.scrollWidth,i.x),y:Math.max(j.scrollHeight,i.y)};
},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var i=this.getSize();return{top:0,left:0,bottom:i.y,right:i.x,height:i.y,width:i.x};
}});var d=Element.getComputedStyle;function f(i,j){return d(i,j).toInt()||0;}function g(i){return d(i,"-moz-box-sizing")=="border-box";}function h(i){return f(i,"border-top-width");
}function c(i){return f(i,"border-left-width");}function b(i){return(/^(?:body|html)$/i).test(i.tagName);}function a(i){var j=i.getDocument();return(!j.compatMode||j.compatMode=="CSS1Compat")?j.html:j.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(j,h){j=j.split(",");var c,f={};for(var d=0,b=j.length;d<b;d++){var a=j[d],g=Selectors.Utils.search(this,a,f);
if(d!=0&&g.item){g=$A(g);}c=(d==0)?g:(c.item)?$A(c).concat(g):c.concat(g);}return new Elements(c,{ddup:(j.length>1),cash:!h});}});Element.implement({match:function(b){if(!b||(b==this)){return true;
}var d=Selectors.Utils.parseTagAndID(b);var a=d[0],f=d[1];if(!Selectors.Filters.byID(this,f)||!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(i){if(Selectors.Cache.nth[i]){return Selectors.Cache.nth[i];
}var f=i.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!f){return false;}var h=parseInt(f[1],10);var d=(h||h===0)?h:1;var g=f[2]||false;var c=parseInt(f[3],10)||0;
if(d!=0){c--;while(c<1){c+=d;}while(c>=d){c-=d;}}else{d=c;g="index";}switch(g){case"n":f={a:d,b:c,special:"n"};break;case"odd":f={a:2,b:0,special:"n"};
break;case"even":f={a:2,b:1,special:"n"};break;case"first":f={a:0,special:"index"};break;case"last":f={special:"last-child"};break;case"only":f={special:"only-child"};
break;default:f={a:(d-1),special:"index"};}return Selectors.Cache.nth[i]=f;},parseSelector:function(f){if(Selectors.Cache.parsed[f]){return Selectors.Cache.parsed[f];
}var d,i={classes:[],pseudos:[],attributes:[]};while((d=Selectors.RegExps.combined.exec(f))){var j=d[1],h=d[2],g=d[3],b=d[5],c=d[6],k=d[7];if(j){i.classes.push(j);
}else{if(c){var a=Selectors.Pseudo.get(c);if(a){i.pseudos.push({parser:a,argument:k});}else{i.attributes.push({name:c,operator:"=",value:k});}}else{if(h){i.attributes.push({name:h,operator:g,value:b});
}}}}if(!i.classes.length){delete i.classes;}if(!i.attributes.length){delete i.attributes;}if(!i.pseudos.length){delete i.pseudos;}if(!i.classes&&!i.attributes&&!i.pseudos){i=null;
}return Selectors.Cache.parsed[f]=i;},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(g,c,f){var d;if(c.classes){for(d=c.classes.length;d--;d){var h=c.classes[d];if(!Selectors.Filters.byClass(g,h)){return false;}}}if(c.attributes){for(d=c.attributes.length;
d--;d){var b=c.attributes[d];if(!Selectors.Filters.byAttribute(g,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(g,a.parser,a.argument,f)){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(p,o,u){var b=[];var c=o.trim().replace(Selectors.RegExps.splitter,function(k,j,i){b.push(j);
return":)"+i;}).split(":)");var q,f,B;for(var A=0,w=c.length;A<w;A++){var z=c[A];if(A==0&&Selectors.RegExps.quick.test(z)){q=p.getElementsByTagName(z);
continue;}var a=b[A-1];var r=Selectors.Utils.parseTagAndID(z);var C=r[0],s=r[1];if(A==0){q=Selectors.Utils.getByTagAndID(p,C,s);}else{var d={},h=[];for(var y=0,x=q.length;
y<x;y++){h=Selectors.Getters[a](h,q[y],C,s,d);}q=h;}var g=Selectors.Utils.parseSelector(z);if(g){f=[];for(var v=0,t=q.length;v<t;v++){B=q[v];if(Selectors.Utils.filter(B,g,u)){f.push(B);
}}q=f;}}return q;}};Selectors.Getters={" ":function(j,h,k,a,f){var d=Selectors.Utils.getByTagAndID(h,k,a);for(var c=0,b=d.length;c<b;c++){var g=d[c];if(Selectors.Utils.chk(g,f)){j.push(g);
}}return j;},">":function(j,h,k,a,g){var c=Selectors.Utils.getByTagAndID(h,k,a);for(var f=0,d=c.length;f<d;f++){var b=c[f];if(b.parentNode==h&&Selectors.Utils.chk(b,g)){j.push(b);
}}return j;},"+":function(c,b,a,f,d){while((b=b.nextSibling)){if(b.nodeType==1){if(Selectors.Utils.chk(b,d)&&Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,f)){c.push(b);
}break;}}return c;},"~":function(c,b,a,f,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,f)){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,f){var a=Element.prototype.getProperty.call(c,d);
if(!a){return(b=="!=");}if(!b||f==undefined){return true;}switch(b){case"=":return(a==f);case"*=":return(a.contains(f));case"^=":return(a.substr(0,f.length)==f);
case"$=":return(a.substr(a.length-f.length)==f);case"!=":return(a!=f);case"~=":return a.contains(f," ");case"|=":return a.contains(f,"-");}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(h,f){h=(h==undefined)?"n":h;var c=Selectors.Utils.parseNthArgument(h);
if(c.special!="n"){return Selectors.Pseudo[c.special].call(this,c.a,f);}var g=0;f.positions=f.positions||{};var d=$uid(this);if(!f.positions[d]){var b=this;
while((b=b.previousSibling)){if(b.nodeType!=1){continue;}g++;var a=f.positions[$uid(b)];if(a!=undefined){g=a+g;break;}}f.positions[d]=g;}return(f.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(f,d){var c=JSON.encode(f);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+")");}});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(m,n){this.instance="Swiff_"+$time();this.setOptions(n);n=this.options;var b=this.id=n.id||this.instance;var a=document.id(n.container);
Swiff.CallBacks[this.instance]={};var f=n.params,h=n.vars,g=n.callBacks;var i=$extend({height:n.height,width:n.width},n.properties);var l=this;for(var d in g){Swiff.CallBacks[this.instance][d]=(function(o){return function(){return o.apply(l.object,arguments);
};})(g[d]);h[d]="Swiff.CallBacks."+this.instance+"."+d;}f.flashVars=Hash.toQueryString(h);if(Browser.Engine.trident){i.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
f.movie=m;}else{i.type="application/x-shockwave-flash";i.data=m;}var k='<object id="'+b+'"';for(var j in i){k+=" "+j+'="'+i[j]+'"';}k+=">";for(var c in f){if(f[c]){k+='<param name="'+c+'" value="'+f[c]+'" />';
}}k+="</object>";this.object=((a)?a.empty():new Element("div")).set("html",k).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,f,b){b=$splat(b);var c=b[1];if(!$chk(c)){b[1]=b[0];
b[0]=d.getStyle(f);}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(g,f){if(b){return;}var d=g.parse(c);if($chk(d)){b={value:d,parser:g};}});
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(f){a.push({value:d[f].parser.compute(d[f].value,c[f].value,b),parser:d[f].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(f,d){var c=f.href;
if(c&&c.contains("://")&&!c.contains(document.domain)){return;}var g=f.rules||f.cssRules;Array.each(g,function(k,h){if(!k.style){return;}var j=(k.selectorText)?k.selectorText.replace(/^\w+/,function(i){return i.toLowerCase();
}):null;if(!j||!j.test("^"+a+"$")){return;}Element.Styles.each(function(l,i){if(!k.style[i]||Element.ShortStyles[i]){return;}l=String(k.style[i]);b[i]=(l.test(/^rgb/))?l.rgbToHex():l;
});});});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(f,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,f,d){if(!this.check(c,f,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 f=this.get("tween"),d="opacity",a;
c=$pick(c,"toggle");switch(c){case"in":f.start(d,1);break;case"out":f.start(d,0);break;case"show":f.set(d,1);break;case"hide":f.set(d,0);break;case"toggle":var b=this.retrieve("fade:flag",this.get("opacity")==1);
f.start(d,(b)?0:1);this.store("fade:flag",!b);a=true;break;default:f.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(f,d,c){var a={};
for(var b in f){a[b]=this.parent(f[b],d[b],c);}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var f={},d={};
for(var c in b){var a=this.prepare(this.element,c,b[c]);f[c]=a.from;d[c]=a.to;}return this.parent(f,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(g){var f;for(var d=0,c=1;1;d+=c,c/=2){if(g>=(7-4*d)/11){f=c*c-Math.pow((11-6*d-11*g)/4,2);
break;}}return f;},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(l){if(!this.check(l)){return this;
}this.running=true;var j=$type(l);if(j=="string"||j=="element"){l={data:l};}var d=this.options;l=$extend({data:d.data,url:d.url,method:d.method},l);var h=l.data,b=String(l.url),a=l.method.toLowerCase();
switch($type(h)){case"element":h=document.id(h).toQueryString();break;case"object":case"hash":h=Hash.toQueryString(h);}if(this.options.format){var k="format="+this.options.format;
h=(h)?k+"&"+h:k;}if(this.options.emulation&&!["get","post"].contains(a)){var i="_method="+a;h=(h)?i+"&"+h:i;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 g="noCache="+new Date().getTime();h=(h)?g+"&"+h:g;
}var f=b.lastIndexOf("/");if(f>-1&&(f=b.indexOf("#"))>-1){b=b.substr(0,f);}if(h&&a=="get"){b=b+(b.contains("?")?"&":"?")+h;h=null;}this.xhr.open(a.toUpperCase(),b,this.options.async);
this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(n,m){try{this.xhr.setRequestHeader(m,n);}catch(o){this.fireEvent("exception",[m,n]);
}},this);this.fireEvent("request");this.xhr.send(h);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>",h;if(Browser.Engine.trident){h=new ActiveXObject("Microsoft.XMLDOM");
h.async=false;h.loadXML(d);}else{h=new DOMParser().parseFromString(d,"text/xml");}d=h.getElementsByTagName("root")[0];if(!d){return null;}for(var g=0,f=d.childNodes.length;
g<f;g++){var j=Element.clone(d.childNodes[g],true,true);if(j){a.grab(j);}}return a;})||a.set("html",c);},success:function(d){var c=this.options,b=this.response;
b.html=d.stripScripts(function(f){b.javascript=f;});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"};Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);this.parent(a)},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j)}}return c},set:function(b){for(var c in b){var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit)}}return this},start:function(c){if(!this.check(c)){return this}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to}}return this.parent(h,j)}});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 j in this.effects){e[g][j]=f?0:h[this.effects[j]]}},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.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))}});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}});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)}};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 f={};var d=function(g,e){return(e.computeSize)?g.getComputedSize(e):g.getSize()};var b=this.getParent("body");if(b&&this.getStyle("display")=="none"){f=this.measure(function(){return d(this,a)})}else{if(b){try{f=d(this,a)}catch(c){}}else{f={x:0,y:0}}}return $chk(f.x)?$extend(f,{width:f.x,height:f.y}):$extend(f,{x:f.width,y:f.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)}});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}});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(d,c,a){return new Color([d,c,a],"rgb")};var $HSB=function(d,c,a){return new Color([d,c,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 g=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,g];case 1:return[d,c,g];case 2:return[g,c,b];case 3:return[g,d,c];case 4:return[b,g,c];case 5:return[c,g,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 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},windowPadding:{x:0,y:0},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(b.options);if(b.elements){this.attach(b.elements)}this.container=new Element("div",{"class":"tip"})},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=(function(){this.show(b);this.position((this.options.fixed)?{page:b.getPosition()}:c)}).delay(this.options.showDelay,this)},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){b=b.getParent();if(!b||b==document.body){return}if(b.retrieve("tip:enter")){b.fireEvent("mouseenter",c)}else{this.fireForParent(c,b)}},elementMove:function(c,b){this.position(c)},position:function(e){if(!this.tip){document.id(this)}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]-this.options.windowPadding[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){if(!this.tip){document.id(this)}this.fireEvent("show",[this.tip,b])},hide:function(b){if(!this.tip){document.id(this)}this.fireEvent("hide",[this.tip,b])}})})();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()}}}))}))}};if(!window.console){var console={}}if(!console.log){console.log=function(){}}if(!console.warn){console.warn=console.log}if(!console.error){console.error=console.warn}MooTools.upgradeLog=function(){if(console[this.upgradeLogLevel]){console[this.upgradeLogLevel].apply(console,arguments)}};(function(){oldA=$A;window.$A=function(k,m,j){if(m!=undefined&&j!=undefined){MooTools.upgradeLog("1.1 > 1.2: $A no longer takes start and length arguments.");if(Browser.Engine.trident&&$type(k)=="collection"){m=m||0;if(m<0){m=k.length+m}j=j||(k.length-m);var l=[];for(var h=0;h<j;h++){l[h]=k[m++]}return l}m=(m||0)+((m<0)?k.length:0);var g=((!$chk(j))?k.length:j)+m;return Array.prototype.slice.call(k,m,g)}return oldA(k)};var e=["Array","Function","String","RegExp","Number","Window","Document","Element","Elements"];for(var c=0,b=e.length;c<b;c++){var d=e[c];var a=window[d];if(a){var f=a.extend;a.extend=function(g){MooTools.upgradeLog("1.1 > 1.2: native types no longer use .extend to add methods to prototypes but instead use .implement. NOTE: YOUR METHODS WERE NOT IMPLEMENTED ON THE NATIVE "+d.toUpperCase()+" PROTOTYPE.");return f.apply(this,arguments)}}}})();window.onDomReady=Window.onDomReady=function(a){MooTools.upgradeLog('1.1 > 1.2: window.onDomReady is no longer supported. Use window.addEvent("domready") instead');return window.addEvent("domready",a)};if(Browser.__defineGetter__){Browser.__defineGetter__("hasGetter",function(){return true})}if(Browser.hasGetter){window.__defineGetter__("ie",function(){MooTools.upgradeLog("1.1 > 1.2: window.ie is deprecated. Use Browser.Engine.trident");return(Browser.Engine.name=="trident")?true:false});window.__defineGetter__("ie6",function(){MooTools.upgradeLog("1.1 > 1.2: window.ie6 is deprecated. Use Browser.Engine.trident and Browser.Engine.version");return(Browser.Engine.name=="trident"&&Browser.Engine.version==4)?true:false});window.__defineGetter__("ie7",function(){MooTools.upgradeLog("1.1 > 1.2: window.ie7 is deprecated. Use Browser.Engine.trident and Browser.Engine.version");return(Browser.Engine.name=="trident"&&Browser.Engine.version==5)?true:false});window.__defineGetter__("gecko",function(){MooTools.upgradeLog("1.1 > 1.2: window.gecko is deprecated. Use Browser.Engine.gecko");return(Browser.Engine.name=="gecko")?true:false});window.__defineGetter__("webkit",function(){MooTools.upgradeLog("1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit");return(Browser.Engine.name=="webkit")?true:false});window.__defineGetter__("webkit419",function(){MooTools.upgradeLog("1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version");return(Browser.Engine.name=="webkit"&&Browser.Engine.version==419)?true:false});window.__defineGetter__("webkit420",function(){MooTools.upgradeLog("1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version");return(Browser.Engine.name=="webkit"&&Browser.Engine.version==420)?true:false});window.__defineGetter__("opera",function(){MooTools.upgradeLog("1.1 > 1.2: window.opera is deprecated. Use Browser.Engine.presto");return(Browser.Engine.name=="presto")?true:false})}else{window[Browser.Engine.name]=window[Browser.Engine.name+Browser.Engine.version]=true;window.ie=window.trident;window.ie6=window.trident4;window.ie7=window.trident5}Array.implement({copy:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Array.copy is deprecated. Use Array.splice");return $A(this,b,a)},remove:function(a){MooTools.upgradeLog("1.1 > 1.2: Array.remove is deprecated. Use Array.erase");return this.erase(a)},merge:function(a){MooTools.upgradeLog("1.1 > 1.2: Array.merge is deprecated. Use Array.combine");return this.combine(a)}});Function.implement({bindAsEventListener:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Function.bindAsEventListener is deprecated. Use bindWithEvent.");return this.bindWithEvent.call(this,b,a)}});Function.empty=function(){MooTools.upgradeLog("1.1 > 1.2: Function.empty is now just $empty.")};Hash.implement({keys:function(){MooTools.upgradeLog("1.1 > 1.2: Hash.keys is deprecated. Use Hash.getKeys");return this.getKeys()},values:function(){MooTools.upgradeLog("1.1 > 1.2: Hash.values is deprecated. Use Hash.getValues");return this.getValues()},hasKey:function(a){MooTools.upgradeLog("1.1 > 1.2: Hash.hasKey is deprecated. Use Hash.has");return this.has(a)},merge:function(a){MooTools.upgradeLog("1.1 > 1.2: Hash.merge is deprecated. Use Hash.combine");return this.extend(a)},remove:function(a){MooTools.upgradeLog("1.1 > 1.2: Hash.remove is deprecated. use Hash.erase");return this.erase(a)}});Object.toQueryString=function(a){MooTools.upgradeLog("1.1 > 1.2: Object.toQueryString() is deprecated. use Hash.toQueryString() instead");$H(a).each(function(c,b){if($type(c)=="object"||$type(c)=="array"){a[b]=c.toString()}});return Hash.toQueryString(a)};var Abstract=function(a){MooTools.upgradeLog("1.1 > 1.2: Abstract is deprecated. Use Hash");return new Hash(a)};Class.empty=function(){MooTools.upgradeLog("1.1 > 1.2: replace Class.empty with $empty");return $empty};(function(){var a=function(d){var c=function(){return this};c.prototype=d;return c};Class.prototype.extend=function(d){MooTools.upgradeLog("1.1 > 1.2: Class.extend is deprecated. See the class Extend mutator.");var c=a(d);var e=new c();e.Extends=this;return new Class(e)};var b=Class.prototype.implement;Class.prototype.implement=function(){if(arguments.length>1&&Array.every(arguments,Object.type)){MooTools.upgradeLog("1.1 > 1.2: Class.implement no longer takes more than one thing at a time, either MyClass.implement(key, value) or MyClass.implement(object) but NOT MyClass.implement(new Foo, new Bar, new Baz). See also: the class Implements mutator.");Array.each(arguments,function(c){b.call(this,c)},this);return this}return b.apply(this,arguments)}})();(function(){var c=Element.prototype.getPosition;var a=Element.prototype.getCoordinates;function b(e){return(/^(?:body|html)$/i).test(e.tagName)}var d=Element.prototype.getSize;Element.implement({getSize:function(){MooTools.upgradeLog("1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.");var e=d.apply(this,arguments);return $merge(e,{size:e,scroll:this.getScroll(),scrollSize:this.getScrollSize()})},getPosition:function(e){if(e&&$type(e)=="array"){MooTools.upgradeLog("1.1 > 1.2: Element.getPosition no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.");e=null}return c.apply(this,[e])},getCoordinates:function(e){if(e&&$type(e)=="array"){MooTools.upgradeLog("1.1 > 1.2: Element.getCoordinates no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.");e=null}return a.apply(this,[e])}});Native.implement([Document,Window],{getSize:function(){MooTools.upgradeLog("1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.");var e;var g=this.getWindow();var f=this.getDocument();f=(!f.compatMode||f.compatMode=="CSS1Compat")?f.html:f.body;if(Browser.Engine.presto||Browser.Engine.webkit){e={x:g.innerWidth,y:g.innerHeight}}else{e={x:f.clientWidth,y:f.clientHeight}}return $extend(e,{size:e,scroll:{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop},scrollSize:{x:Math.max(f.scrollWidth,e.x),y:Math.max(f.scrollHeight,e.y)}})}})})();Event.keys=Event.Keys;(function(){var a=Element.prototype.toQueryString;Element.implement({getFormElements:function(){MooTools.upgradeLog('1.1 > 1.2: Element.getFormElements is deprecated, use Element.getElements("input, textarea, select");');return this.getElements("input, textarea, select")},replaceWith:function(b){MooTools.upgradeLog("1.1 > 1.2: Element.replaceWith is deprecated, use Element.replaces instead.");b=$(b);this.parentNode.replaceChild(b,this);return b},remove:function(){MooTools.upgradeLog("1.1 > 1.2: Element.remove is deprecated - use Element.dispose.");return this.dispose.apply(this,arguments)},getText:function(){MooTools.upgradeLog('1.1 > 1.2: Element.getText is deprecated - use Element.get("text").');return this.get("text")},setText:function(b){MooTools.upgradeLog('1.1 > 1.2: Element.setText is deprecated - use Element.set("text", text).');return this.set("text",b)},setHTML:function(){MooTools.upgradeLog('1.1 > 1.2: Element.setHTML is deprecated - use Element.set("html", HTML).');return this.set("html",arguments)},getHTML:function(){MooTools.upgradeLog('1.1 > 1.2: Element.getHTML is deprecated - use Element.get("html").');return this.get("html")},getTag:function(){MooTools.upgradeLog('1.1 > 1.2: Element.getTag is deprecated - use Element.get("tag").');return this.get("tag")},getValue:function(){MooTools.upgradeLog('1.1 > 1.2: Element.getValue is deprecated - use Element.get("value").');switch(this.getTag()){case"select":var b=[];$each(this.options,function(c){if(c.selected){b.push($pick(c.value,c.text))}});return(this.multiple)?b:b[0];case"input":if(!(this.checked&&["checkbox","radio"].contains(this.type))&&!["hidden","text","password"].contains(this.type)){break}case"textarea":return this.value}return false},toQueryString:function(){MooTools.upgradeLog("1.1 > 1.2: warning Element.toQueryString is slightly different; inputs without names are excluded, inputs with type == submit, reset, and file are excluded, and inputs with undefined values are excluded.");return a.apply(this,arguments)}})})();Element.Properties.properties={set:function(a){MooTools.upgradeLog("1.1 > 1.2: Element.set({properties: {}}) is deprecated; instead of properties, just name the values at the root of the object (Element.set({src: url})).");$H(a).each(function(c,b){this.set(b,c)},this)}};Element.implement({setOpacity:function(a){MooTools.upgradeLog('1.1 > 1.2: Element.setOpacity is deprecated; use Element.setStyle("opacity", value).');return this.setStyle("opacity",a)}});Element.Properties.styles={set:function(a){MooTools.upgradeLog('1.1 > 1.2: Element.set("styles") no longer accepts a string as an argument. Pass an object instead.');if($type(a)=="string"){a.split(";").each(function(b){this.setStyle(b.split(":")[0],b.split(":")[1])},this)}else{this.setStyles(a)}}};Fx.implement({custom:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Fx.custom is deprecated. use Fx.start.");return this.start(b,a)},clearTimer:function(){MooTools.upgradeLog("1.1 > 1.2: Fx.clearTimer is deprecated. use Fx.cancel.");return this.cancel()},stop:function(){MooTools.upgradeLog("1.1 > 1.2: Fx.stop is deprecated. use Fx.cancel.");return this.cancel()}});Fx.Base=new Class({Extends:Fx,initialize:function(){MooTools.upgradeLog("1.1 > 1.2: Fx.Base is deprecated. use Fx.");this.parent.apply(this,arguments)}});Fx.Style=new Class({Extends:Fx.Tween,initialize:function(b,c,a){MooTools.upgradeLog("1.1 > 1.2: Fx.Style is deprecated. use Fx.Tween.");this.property=c;this.parent(b,a)},start:function(b,a){return this.parent(this.property,b,a)},set:function(a){return this.parent(this.property,a)},hide:function(){MooTools.upgradeLog("1.1 > 1.2: Fx.Style .hide() is deprecated; use Fx.Tween .set(0) instead");return this.set(0)}});Element.implement({effect:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Element.effect is deprecated; use Fx.Tween or Element.tween.");return new Fx.Style(this,b,a)}});Fx.Styles=new Class({Extends:Fx.Morph,initialize:function(){MooTools.upgradeLog("1.1 > 1.2: Fx.Styles is deprecated. use Fx.Morph.");this.parent.apply(this,arguments)}});Element.implement({effects:function(a){MooTools.upgradeLog("1.1 > 1.2: Element.effects is deprecated; use Fx.Morph or Element.morph.");return new Fx.Morph(this,a)}});Fx.Scroll.implement({scrollTo:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Fx.Scroll's .scrollTo is deprecated; use .start.");return this.start(b,a)}});Request.implement({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;this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};if(this.options.isSuccess.call(this,this.status)){this.success(this.response.text,this.response.xml)}else{this.failure(this.response.text,this.response.xml)}},failure:function(){this.onFailure.apply(this,arguments)},onFailure:function(){MooTools.upgradeLog("1.1 > 1.2: Note that onComplete does not receive arguments in 1.2. Also note that onComplete is invoked on BOTH success and failure (while in 1.1 it was only invoked on success). Use the onSuccess event instead if you wish to limit this invocation to success.");this.fireEvent("complete",arguments).fireEvent("failure",this.xhr)}});var XHR=new Class({Extends:Request,options:{update:false},initialize:function(a){MooTools.upgradeLog("1.1 > 1.2: XHR is deprecated. Use Request.");this.parent(a);this.transport=this.xhr},request:function(a){MooTools.upgradeLog("1.1 > 1.2: XHR.request() is deprecated. Use Request.send() instead.");return this.send(this.url,a||this.options.data)},send:function(a,b){if(!this.check(arguments.callee,a,b)){return this}return this.parent({url:a,data:b})},success:function(b,a){b=this.processScripts(b);if(this.options.update){$(this.options.update).empty().set("html",b)}this.onSuccess(b,a)},failure:function(){this.fireEvent("failure",this.xhr)}});var Ajax=new Class({Extends:XHR,initialize:function(b,a){MooTools.upgradeLog("1.1 > 1.2: Ajax is deprecated. Use Request.");this.url=b;this.parent(a)},success:function(b,a){this.processScripts(b);response=this.response;response.html=b.stripScripts(function(c){response.javascript=c});if(this.options.update){$(this.options.update).empty().set("html",response.html)}if(this.options.evalScripts){$exec(response.javascript)}this.onSuccess(b,a)}});(function(){var a=Element.prototype.send;Element.implement({send:function(b){if($type(b)=="string"){return a.apply(this,arguments)}if($type(b)=="object"){MooTools.upgradeLog("1.1 > 1.2: Element.send no longer takes an options argument as its object but rather a url. See docs.");this.set("send",b);a.call(this)}return this}})})();JSON.Remote=new Class({options:{key:"json"},Extends:Request.JSON,initialize:function(b,a){MooTools.upgradeLog("JSON.Remote is deprecated. Use Request.JSON");this.parent(a);this.onComplete=$empty;this.url=b},send:function(a){if(!this.check(arguments.callee,a)){return this}return this.parent({url:this.url,data:{json:Json.encode(a)}})},failure:function(){this.fireEvent("failure",this.xhr)}});Cookie.set=function(b,c,a){MooTools.upgradeLog("1.1 > 1.2: Cookie.set is deprecated. Use Cookie.write");return new Cookie(b,a).write(c)};Cookie.get=function(a){MooTools.upgradeLog("1.1 > 1.2: Cookie.get is deprecated. Use Cookie.read");return new Cookie(a).read()};Cookie.remove=function(b,a){MooTools.upgradeLog("1.1 > 1.2: Cookie.remove is deprecated. Use Cookie.dispose");return new Cookie(b,a).dispose()};JSON.toString=function(a){MooTools.upgradeLog("1.1 > 1.2: JSON.toString is deprecated. Use JSON.encode");return JSON.encode(a)};JSON.evaluate=function(a){MooTools.upgradeLog("1.1 > 1.2: JSON.evaluate is deprecated. Use JSON.decode");return JSON.decode(a)};var Json=JSON;Native.implement([Element,Document],{getElementsByClassName:function(a){MooTools.upgradeLog("1.1 > 1.2: Element.filterByTag is deprecated.");return this.getElements("."+a)},getElementsBySelector:function(a){MooTools.upgradeLog("1.1 > 1.2: Element.getElementsBySelector is deprecated. Use getElements()");return this.getElements(a)}});Elements.implement({filterByTag:function(a){MooTools.upgradeLog("1.1 > 1.2: Elements.filterByTag is deprecated. Use Elements.filter.");return this.filter(a)},filterByClass:function(a){MooTools.upgradeLog("1.1 > 1.2: Elements.filterByClass is deprecated. Use Elements.filter.");return this.filter("."+a)},filterById:function(a){MooTools.upgradeLog("1.1 > 1.2: Elements.filterById is deprecated. Use Elements.filter.");return this.filter("#"+a)},filterByAttribute:function(c,a,d){MooTools.upgradeLog("1.1 > 1.2: Elements.filterByAttribute is deprecated. Use Elements.filter.");var b=this.filter("["+c+(a||"")+(d||"")+"]");if(d){b=b.filter("["+c+"]")}return b}});var $E=function(a,b){MooTools.upgradeLog("1.1 > 1.2: $E is deprecated, use document.getElement.");return($(b)||document).getElement(a)};var $ES=function(a,b){MooTools.upgradeLog("1.1 > 1.2: $ES is deprecated. Use $$.");return($(b)||document).getElements(a)};(function(){if(!window.Tips){return}Tips.implement({initialize:function(){MooTools.upgradeLog("1.1 > 1.2: Tips DOM element layout has changed and your CSS classes may need to change.");var a=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(a.options);if(this.options.offsets){MooTools.upgradeLog('1.1 > 1.2: Tips no longer have an "offsets" option; use "offset".');this.options.offset=this.options.offsets}document.id(this);this.addEvent("show",function(){this.tip.addClass("tool-tip");this.tip.getElement(".tip-title").addClass("tool-title");this.tip.getElement(".tip-text").addClass("tool-text")});this.parseTitle(a.elements);if(a.elements){this.attach(a.elements)}},parseTitle:function(a){a.each(function(b){var c=b.get("title");if(c.test("::")){MooTools.upgradeLog('1.1 > 1.2: Tips no longer parse the title attribute for "::" for title/caption; use title and rel attributes instead.');b.store("tip:title",c.split("::")[0]);b.store("tip:text",c.split("::")[1]);b.set("title","")}})}})})();

var HeaderReplacement = {
    //List of images
    list : [],

    add : function(cnt, val, callBack){
		callBack = '' || callBack;
        HeaderReplacement.list[cnt] = val;
        var header = document.getElementById(val.id);
        if (!header){
            return 0;
        }
        var bits = header.id.split('_');
        var param = HeaderReplacement.list[Number(bits[1])];
        if(!param) return 1;
        header.className = header.className+' image-heading';
        var bg = param.url;
        var bgString = "url('"+bg+"') no-repeat 0 0";
        header.style.background = "url('"+bg+"') no-repeat 0 0";
        header.style.height = param.imgHeight+'px';
        header.style.width = param.imgWidth+'px';
        header.style.textIndent = '-9000em';
		header.style.display = 'block';
		if (callBack && callBack != undefined) {
			eval(callBack + '(header);');
		}
        return 1;
    }
}

function applyWidth(ti) {
	var h2El = ti.parentNode;
	if (h2El) {
		h2El.style.width = ti.style.width;
	}
	
}

/**
 * SqueezeBox - Expandable Lightbox
 *
 * Allows to open various content as modal,
 * centered and animated box.
 *
 * Dependencies: MooTools 1.2
 *
 * Inspired by
 *  ... Lokesh Dhakar	- The original Lightbox v2
 *
 * @version		1.1 rc4
 *
 * @license		MIT-style license
 * @author		Harald Kirschner <mail [at] digitarald.de>
 * @copyright	Author
 */


	/**
window.addEvent('domready', function() {


	 * That CSS selector will find all <a> elements with the
	 * class boxed.
	 *
	 * The second argument sets additional options
	 
	SqueezeBox.assign($$('a.video-link'), {
		parse: 'rel'
	});
	SqueezeBox.assign($$('a[ref=zoomed]'));

	SqueezeBox.assign($$('a.zoom'), {
		parse: 'rel'
	});
});
*/
var SqueezeBox = {

	presets: {
		onOpen: $empty,
		onClose: $empty,
		onUpdate: $empty,
		onResize: $empty,
		onMove: $empty,
		onShow: $empty,
		onHide: $empty,
		size: {x: 800, y: 600},
		sizeLoading: {x: 200, y: 150},
		marginInner: {x: 20, y: 20},
		marginImage: {x: 50, y: 125},
		handler: false,
		target: null,
		closable: true,
		closeBtn: true,
		zIndex: 65555,
		overlayOpacity: 0.1,
		classWindow: '',
		classOverlay: '',
		overlayFx: {},
		resizeFx: {},
		contentFx: {},
		parse: false, // 'rel'
		parseSecure: false,
		shadow: true,
		document: null,
		ajaxOptions: {},
		caption: '',
		captionDivId: 'sbox-caption',
                showCaption: true,
		previous: null,
		next: null,
                showSlideShow: false
	},

	initialize: function(presets) {
		if (this.options) return this;

		this.presets = $merge(this.presets, presets);
		this.doc = this.presets.document || document;
		this.options = {};
		this.setOptions(this.presets).build();
		this.bound = {
			window: this.reposition.bind(this, [null]),
			scroll: this.checkTarget.bind(this),
			close: this.close.bind(this),
			key: this.onKey.bind(this)
		};
		this.isOpen = this.isLoading = false;
		
		return this;
	},

	hasController: function() {
		//return false;
		return (this.options.previous != null) || (this.options.next != null);
	},

	drawController : function(content) {
		this.controller = new Element('div', {id: 'sbox-controller'}).inject(content, 'after');
		if (this.options.next !=null) {
			var nextBtn = new Element('a', {id:'sbox-next-btn', 'class' : 'sbox-next', 'title' : 'Next Image'});
			nextBtn.set('text', 'next');
			nextBtn.set('href', '#');
			nextBtn.addEvent('click', function(e) {
				e.stop();				
				this.options.next.fireEvent('click');
			}.bindWithEvent(this));
			this.controller.adopt(nextBtn);
		}
		if (this.options.previous != null) {
			var previousBtn = new Element('a', {id: 'sbox-previous-btn', 'class' : 'sbox-previous', 'title' : 'Previous Image'});
			previousBtn.set('text', 'previous');
			previousBtn.set('href', '#');
			previousBtn.addEvent('click', function(e) {
				e.stop();
				this.options.previous.fireEvent('click');
			}.bindWithEvent(this));
			this.controller.adopt(previousBtn);
		}
	},

	build: function() {
		this.overlay = new Element('div', {
			id: 'sbox-overlay',
			styles: {display: 'none', zIndex: this.options.zIndex}
		});
		this.win = new Element('div', {
			id: 'sbox-window',
			styles: {display: 'none', zIndex: this.options.zIndex + 2}
		});
		if (this.options.shadow) {
			if (Browser.Engine.webkit420) {
				this.win.setStyle('-webkit-box-shadow', '0 0 10px rgba(0, 0, 0, 0.7)');
			} else if (!Browser.Engine.trident4) {
				var shadow = new Element('div', {'class': 'sbox-bg-wrap'}).inject(this.win);
				var relay = function(e) {
					this.overlay.fireEvent('click', [e]);
				}.bind(this);
				['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'].each(function(dir) {
					new Element('div', {'class': 'sbox-bg sbox-bg-' + dir}).inject(shadow).addEvent('click', relay);
				});
			}
		}
		this.caption = new Element('div', {id: 'sbox-caption-wrapper'}).inject(this.win);
		//this.caption.adopt(new Element('p', {id: this.presets.captionDivId}));
		this.caption.innerHTML = '<table class="sbox-caption-table"><tr><td id="' + this.presets.captionDivId + '"></td></tr></table>';
		
		this.content = new Element('div', {id: 'sbox-content'}).inject(this.win);		

		this.closeBtn = new Element('a', {id: 'sbox-btn-close', href: '#'}).inject(this.win);
		this.fx = {
			overlay: new Fx.Tween(this.overlay, $merge({
				property: 'opacity',
				onStart: Events.prototype.clearChain,
				duration: 250,
				link: 'cancel'
			}, this.options.overlayFx)).set(0),
			win: new Fx.Morph(this.win, $merge({
				onStart: Events.prototype.clearChain,
				unit: 'px',
				duration: 750,
				transition: Fx.Transitions.Quint.easeOut,
				link: 'cancel',
				unit: 'px'
			}, this.options.resizeFx)),
			content: new Fx.Tween(this.content, $merge({
				property: 'opacity',
				duration: 250,
				link: 'cancel'
			}, this.options.contentFx)).set(0)
		};		
		
		$(this.doc.body).adopt(this.overlay, this.win);
	},

	setCaption: function(text) {
		$(this.presets.captionDivId).innerHTML = text;
	},

	assign: function(to, options) {
		return ($(to) || $$(to)).addEvent('click', function() {
			var img = this.getElement('img');
			if (img) {
				//options.caption = img.get('alt');
				if (SqueezeBox.presets.showCaption && img.get('alt') != '') {
					options = $merge(options || {}, {caption: img.get('alt')});
				}
			} else {
				//$(this.presets.captionDivId).set('class', 'hidden');
			}
			options = options || {};
                        if (SqueezeBox.presets.showSlideShow) {
                            if (to.indexOf(this) < (to.length - 1)) {
                                    var nextObj = to[to.indexOf(this) + 1];
                                    if ($chk(nextObj)) {
                                            options.next = nextObj;
                                    } else {
                                            options.next = null;
                                    }
                            } else {
                                    options.next = null;
                            }
                            if (to.indexOf(this) > 0) {
                                    var previousObj = to[to.indexOf(this) - 1];
                                    if (previousObj) {
                                            options.previous = previousObj;
                                    } else {
                                            options.previous = null;
                                    }
                            } else {
                                    options.previous = null;
                            }
                        }
			
			return !SqueezeBox.fromElement(this, options);
		});
	},
	
	open: function(subject, options) {
		this.initialize();

		if (this.element != null) this.trash();
		this.element = $(subject) || false;
		
		this.setOptions($merge(this.presets, options || {}));

		if (this.options.caption != '' && this.options.caption != null) {
			this.setCaption(this.options.caption);			
		} else {
			this.caption.setStyle('display', 'none');
		}
		

		// Turn off background in IE
		/*if (Browser.Engine.trident) {
			this.options.overlayOpacity = 0;
		}*/
		
		if (this.element && this.options.parse) {
			var obj = this.element.getProperty(this.options.parse);
			if (obj && (obj = JSON.decode(obj, this.options.parseSecure))) this.setOptions(obj);
		}
		this.url = ((this.element) ? (this.element.get('href')) : subject) || this.options.url || '';

		this.assignOptions();
		
		var handler = handler || this.options.handler;
		if (handler) return this.setContent(handler, this.parsers[handler].call(this, true));
		var ret = false;
		return this.parsers.some(function(parser, key) {
			var content = parser.call(this);
			if (content) {
				ret = this.setContent(key, content);
				return true;
			}
			return false;
		}, this);
	},
	
	fromElement: function(from, options) {
		return this.open(from, options);
	},

	assignOptions: function() {
		this.overlay.set('class', this.options.classOverlay);
		this.win.set('class', this.options.classWindow);
		if (Browser.Engine.trident4) this.win.addClass('sbox-window-ie6');
	},

	close: function(e) {
		var stoppable = ($type(e) == 'event');
		if (stoppable) e.stop();
		if (!this.isOpen || (stoppable && !$lambda(this.options.closable).call(this, e))) return this;
		this.fx.overlay.start(0).chain(this.toggleOverlay.bind(this));
		this.win.setStyle('display', 'none');
		if (this.caption) {
			this.caption.setStyle('display', 'none');
		}
		this.fireEvent('onClose', [this.content]);
		this.trash();
		this.toggleListeners();
		this.isOpen = false;
		return this;
	},

	trash: function() {
		this.element = this.asset = null;
		this.content.empty();
		this.options = {};
		this.removeEvents().setOptions(this.presets).callChain();
	},

	onError: function() {
		this.asset = null;
		this.setContent('string', this.options.errorMsg || 'An error occurred');
	},

	setContent: function(handler, content) {
		if (!this.handlers[handler]) return false;
		this.content.className = 'sbox-content-' + handler;
		this.applyTimer = this.applyContent.delay(this.fx.overlay.options.duration, this, this.handlers[handler].call(this, content));
		if (this.overlay.retrieve('opacity')) return this;
		this.toggleOverlay(true);
		this.fx.overlay.start(this.options.overlayOpacity);	
		return this.reposition();
	},

	applyContent: function(content, size) {
		if (!this.isOpen && !this.applyTimer) return;
		this.applyTimer = $clear(this.applyTimer);
		this.hideContent();
		if (!content) {
			this.toggleLoading(true);
		} else {
			if (this.isLoading) this.toggleLoading(false);
			this.fireEvent('onUpdate', [this.content], 20);
		}
		if (content) {						
			if (['string', 'array'].contains($type(content))) this.content.set('html', content);
			else if (!this.content.hasChild(content)) this.content.adopt(content);			
			if (this.hasController()) {
				this.drawController(content);
			}
		}
		this.callChain();
		if (!this.isOpen) {
			this.toggleListeners(true);
			this.resize(size, true);
			this.isOpen = true;
			this.fireEvent('onOpen', [this.content]);
		} else {
			this.resize(size);
		}
	},

	resize: function(size, instantly) {
		this.showTimer = $clear(this.showTimer || null);
		var box = this.doc.getSize(), scroll = this.doc.getScroll();
		this.size = $merge((this.isLoading) ? this.options.sizeLoading : this.options.size, size);
		var winHeight = this.size.y;
		var winWidth = this.size.x;
		

		winHeight += parseInt(this.content.getStyle('paddingTop')) + parseInt(this.content.getStyle('paddingBottom'));
		winWidth += parseInt(this.content.getStyle('paddingLeft')) + parseInt(this.content.getStyle('paddingRight'));
		var to = {
			width: winWidth,
			height: winHeight,
			left: (scroll.x + (box.x - this.size.x - this.options.marginInner.x) / 2).toInt(),
			top: (scroll.y + (box.y - this.size.y - this.options.marginInner.y) / 2).toInt()
		};
		this.hideContent();
		if (!instantly) {
			this.fx.win.start(to).chain(this.showContent.bind(this));
		} else {
			this.win.setStyles(to).setStyle('display', '');
			if (this.options.caption != null && this.options.caption != '') {
				this.caption.setStyle('display', '');
			}
			this.showTimer = this.showContent.delay(50, this);
		}
//		if (this.size.y && Browser.Engine.trident) {
//			var siders = $$('div.sbox-bg-e', 'div.sbox-bg-w');
//			siders.each(function(el) {
//				el.setStyles({ height: (winHeight) + 'px'});
//			}.bind(this));
//		}
		
		return this.reposition();
	},

	toggleListeners: function(state) {
		var fn = (state) ? 'addEvent' : 'removeEvent';
		this.closeBtn[fn]('click', this.bound.close);
		this.overlay[fn]('click', this.bound.close);
		this.doc[fn]('keydown', this.bound.key)[fn]('mousewheel', this.bound.scroll);
		this.doc.getWindow()[fn]('resize', this.bound.window)[fn]('scroll', this.bound.window);
	},

	toggleLoading: function(state) {
		this.isLoading = state;
		this.win[(state) ? 'addClass' : 'removeClass']('sbox-loading');
		if (state) this.fireEvent('onLoading', [this.win]);
	},

	toggleOverlay: function(state) {
		var full = this.doc.getSize().x;
		this.overlay.setStyle('display', (state) ? '' : 'none');
		this.doc.body[(state) ? 'addClass' : 'removeClass']('body-overlayed');
		if (state) {
			this.scrollOffset = this.doc.getWindow().getSize().x - full;
			this.doc.body.setStyle('margin-right', this.scrollOffset);
		} else {
			this.doc.body.setStyle('margin-right', '');
		}
	},

	showContent: function() {
		if (this.content.get('opacity')) this.fireEvent('onShow', [this.win]);

		var yCoordinate = $(this.presets.captionDivId).getSize().y;
		if ($chk($(this.presets.captionDivId).getParent('div'))){
			yCoordinate = $(this.presets.captionDivId).getParent('div').getSize().y;
			
			//alert(marginTop + yCoordinate);
			$(this.presets.captionDivId).getParent('div').setStyle('bottom','-'+ (yCoordinate )+'px');
			$(this.presets.captionDivId).getParent('div').setStyle('opacity',1);
		}		
		this.fx.content.start(1);
	},

	hideContent: function() {
		$(this.presets.captionDivId).getParent('div').setStyle('opacity',0);
		if (!this.content.get('opacity')) this.fireEvent('onHide', [this.win]);
		this.fx.content.cancel().set(0);
	},

	onKey: function(e) {
		switch (e.key) {
			case 'esc': this.close(e);
			case 'up': case 'down': return false;
		}
	},

	checkTarget: function(e) {
		return this.content.hasChild(e.target);
	},

	reposition: function() {
		var size = this.doc.getSize(), scroll = this.doc.getScroll(), ssize = this.doc.getScrollSize();
		this.overlay.setStyles({
			width: ssize.x + 'px',
			height: ssize.y + 'px'
		});
		this.win.setStyles({
			left: (scroll.x + (size.x - this.win.offsetWidth) / 2 - this.scrollOffset).toInt() + 'px',
			top: (scroll.y + (size.y - this.win.offsetHeight) / 2).toInt() + 'px'
		});		
		return this.fireEvent('onMove', [this.overlay, this.win]);
	},

	removeEvents: function(type){
		if (!this.$events) return this;
		if (!type) this.$events = null;
		else if (this.$events[type]) this.$events[type] = null;
		return this;
	},

	extend: function(properties) {
		return $extend(this, properties);
	},

	handlers: new Hash(),

	parsers: new Hash()

};

SqueezeBox.extend(new Events($empty)).extend(new Options($empty)).extend(new Chain($empty));

SqueezeBox.parsers.extend({

	image: function(preset) {
		return (preset || (/\.(?:jpg|png|gif)$/i).test(this.url)) ? this.url : false;
	},

	clone: function(preset) {
		if ($(this.options.target)) return $(this.options.target);
		if (this.element && !this.element.parentNode) return this.element;
		var bits = this.url.match(/#([\w-]+)$/);
		return (bits) ? $(bits[1]) : (preset ? this.element : false);
	},

	ajax: function(preset) {
		return (preset || (this.url && !(/^(?:javascript|#)/i).test(this.url))) ? this.url : false;
	},

	iframe: function(preset) {
		return (preset || this.url) ? this.url : false;
	},

	string: function(preset) {
		return true;
	}
});

SqueezeBox.handlers.extend({

	image: function(url) {
		var size, tmp = new Image();
		this.asset = null;
		tmp.onload = tmp.onabort = tmp.onerror = (function() {
			tmp.onload = tmp.onabort = tmp.onerror = null;
			if (!tmp.width) {
				this.onError.delay(10, this);
				return;
			}
			var box = this.doc.getSize();
			box.x -= this.options.marginImage.x;
			box.y -= this.options.marginImage.y;
			size = {x: tmp.width, y: tmp.height};
			for (var i = 2; i--;) {
				if (size.x > box.x) {
					size.y *= box.x / size.x;
					size.x = box.x;
				} else if (size.y > box.y) {
					size.x *= box.y / size.y;
					size.y = box.y;
				}
			}
			size.x = size.x.toInt();
			size.y = size.y.toInt();
			this.asset = $(tmp);
			tmp = null;
			this.asset.width = size.x;
			this.asset.height = size.y;
			this.applyContent(this.asset, size);
		}).bind(this);
		tmp.src = url;
		if (tmp && tmp.onload && tmp.complete) tmp.onload();
		return (this.asset) ? [this.asset, size] : null;
	},

	clone: function(el) {
		if (el) return el.clone();
		return this.onError();
	},

	adopt: function(el) {
		if (el) return el;
		return this.onError();
	},

	ajax: function(url) {
		var options = this.options.ajaxOptions || {};
		this.asset = new Request.HTML($merge({
			method: 'get',
			evalScripts: false
		}, this.options.ajaxOptions)).addEvents({
			onSuccess: function(resp) {
				this.applyContent(resp);
				if (options.evalScripts !== null && !options.evalScripts) $exec(this.asset.response.javascript);
				this.fireEvent('onAjax', [resp, this.asset]);
				this.asset = null;
			}.bind(this),
			onFailure: this.onError.bind(this)
		});
		this.asset.send.delay(10, this.asset, [{url: url}]);
	},

	iframe: function(url) {
		this.asset = new Element('iframe', $merge({
			src: url,
			frameBorder: 0,
			width: this.options.size.x,
			height: this.options.size.y
		}, this.options.iframeOptions));
		if (this.options.iframePreload) {
			this.asset.addEvent('load', function() {
				this.applyContent(this.asset.setStyle('display', ''));
			}.bind(this));
			this.asset.setStyle('display', 'none').inject(this.content);
			return false;
		}
		return this.asset;
	},

	string: function(str) {
		return str;
	}

});

SqueezeBox.handlers.url = SqueezeBox.handlers.ajax;
SqueezeBox.parsers.url = SqueezeBox.parsers.ajax;
SqueezeBox.parsers.adopt = SqueezeBox.parsers.clone;

SqueezeBox.parsers.swf = function(preset) {
	return (preset || this.url.test(/\.swf/)) ? this.url : false;
};

SqueezeBox.handlers.swf = function(url) {
	var size = this.options.size;
	return new Swiff(url + '?showsearch=0&autoplay=1&rel=0', {
		id: 'sbox-swf1',
		width: size.x,
		height: size.y,
		params: {
			showsearch : '0'
		}
	});
};

var googleAnalyticsV2 = {
	fileDownloads : {
		/**
		 * @var string google analytics stuff to record
		 */
		category : '',
		/**
		 * starts the process
		 * @param string google analytics stuff to record
		 */
		init : function(category) {
			googleAnalyticsV2.fileDownloads.category = category;
			$$('a').each(googleAnalyticsV2.fileDownloads.filter);
		},
		/**
		 * identifies if this should attach the onclick event or not
		 * @param object e element preferibly an anchor with an href...
		 */
		filter : function(e) {
			var href = $(e).getProperty('href');
			if (!href) {
				return;
			}
			if (href.match(/\.(doc|pdf|xls|ppt|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3)$/)) {
				googleAnalyticsV2.fileDownloads.attach(e);
			}
		},
		/**
		 * attaches the onclick event to the element
		 * @param object e element that is being tracked
		 */
		attach : function(e) {
			$(e).addEvent('click',googleAnalyticsV2.fileDownloads.click);
		},
		/**
		 * event triggered when clicking the object
		 * @param event e event that was triggered (the element clicked is on 'this')
		 */
		click : function(e) {
			if (googleAnalyticsV2.fileDownloads.category == '') {
				return;
			}
			googleAnalyticsV2.track(e, googleAnalyticsV2.fileDownloads.category, $(this).getProperty('href'));
		}
	},
	externalLinks : {
		/**
		 * @var string google analytics stuff to record
		 */
		category : '',
		/**
		 * starts the process
		 * @param string google analytics stuff to record
		 */
		init : function(category) {
			googleAnalyticsV2.externalLinks.category = category;
			$$('a').each(googleAnalyticsV2.externalLinks.filter);
		},
		/**
		 * identifies if this should attach the onclick event or not
		 * @param object e element preferibly an anchor with an href...
		 */
		filter : function(e) {
			var href = $(e).getProperty('href');
			if (!href) {
				return;
			}
			if (!href.match(/^http\:\/\//i) && !href.match(/^https\:\/\//i)) {
				return;
			}
			var hostProtocol = window.location.protocol + '//' + window.location.host;
			var hrefHost = href.substring(0, hostProtocol.length);
			if (hrefHost.toLowerCase() == hostProtocol.toLowerCase()) {
				return;
			}
			googleAnalyticsV2.externalLinks.attach(e);
		},
		/**
		 * attaches the onclick event to the element
		 * @param object e element that is being tracked
		 */
		attach : function(e) {
			$(e).addEvent('click',googleAnalyticsV2.externalLinks.click);
		},
		/**
		 * event triggered when clicking the object
		 * @param event e event that was triggered (the element clicked is on 'this')
		 */
		click : function(e) {
			if (googleAnalyticsV2.externalLinks.category == '') {
				return;
			}
			googleAnalyticsV2.track(e, googleAnalyticsV2.externalLinks.category, $(this).getProperty('href'));
		}
	},
	mailToLinks : {
		/**
		 * @var string google analytics stuff to record
		 */
		category : '',
		/**
		 * starts the process
		 * @param string google analytics stuff to record
		 */
		init : function(category) {
			googleAnalyticsV2.mailToLinks.category = category;
			$$('a').each(googleAnalyticsV2.mailToLinks.filter);
		},
		/**
		 * identifies if this should attach the onclick event or not
		 * @param object e element preferibly an anchor with an href...
		 */
		filter : function(e) {
			var href = $(e).getProperty('href');
			if (!href) {
				return;
			}
			if (!href.match(/^mailto\:/i)) {
				return;
			}
			googleAnalyticsV2.mailToLinks.attach(e);
		},
		/**
		 * attaches the onclick event to the element
		 * @param object e element that is being tracked
		 */
		attach : function(e) {
			$(e).addEvent('click',googleAnalyticsV2.mailToLinks.click);
		},
		/**
		 * event triggered when clicking the object
		 * @param event e event that was triggered (the element clicked is on 'this')
		 */
		click : function(e) {
			if (googleAnalyticsV2.mailToLinks.category == '') {
				return;
			}
			googleAnalyticsV2.track(e, googleAnalyticsV2.mailToLinks.category, $(this).getProperty('href'));
		}
	},
	
	/**
	 * records something against google analytics (if analytics is available, of course).
	 * http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
	 * @param event e event that was triggered (the element clicked is on 'this')
	 * @param string category
	 * @param string action
	 */
	track : function(e,category, action) {
//to debug
//e.stop();
//alert(category); alert(action);
//return true;
		try {
			if (!_gaq) {
				return;
			}
		} catch(e) {
			return;
		}
		_gaq.push(['_trackEvent', category, action]);
	}
}

/**
 * Controls the accessibilty controls on teh page. This includes the text size controls and print button.
 *
 * Assumes that the main content div #content exists and that it has a p element with font-size property, won't stricly break assume that the default
 * font size is 12px (or 1.2em at body font size of 0.625em.
 *
 * Note: below properties are all optional as they have defaults set.
 *
 * This script can be used as a standalone but it is best used as part of teh cmslibrary in conjunction with /HTMLElements/HTMLTextControl.php
 *
 * The css file textControl.css is required for this class to work.
 *
 * @author Luke Hoggett <luke@fatpublisher.com.au>
 * @property float emModifier - amount the font size increases/decreases by when the text controls are clicked on
 * @property int stepsUp - number of increments the font size can be increased by
 * @property int stepsDown - number of increments the font size can be decreased by
 * @property int cookieExpires - number days the cookie is live for
 */

TextControl = new Class({
	// implements
	Implements: [Options],

	// options
	options: {
		emModifier: 0.10,
		stepsUp: 5,
		stepsDown: 2,
		cookieExpires: 30,
		defaultSizeElement: 'p'
	},
	// class variables
	currentStep: 0,
	defaultSize: 12,
	currentSize: 0,
	maxSize: 0,
	minSize: 0,

	// initialisation
	initialize: function(options){
		// set.options
		this.setOptions(options);
		this._configure();
	},

	_configure: function() {
		this._attachEvents();
		this._setDefaultSize();
		this._setMaxSize();
		this._setMinSize();
		this.run();
	},

	run: function() {
		var cookieVal = Cookie.read('emSize');
		if(cookieVal != null) {
			if(cookieVal >= this.minSize && cookieVal <= this.maxSize) {
				this.currentSize = cookieVal;
				this._changeTextSizeEM();
			} else {
				Cookie.dispose('emSize');
				this.currentSize = this.defaultSize;
			}
		} else {
			this.currentSize = this.defaultSize;
		}
	},

	printPage: function() {
		window.print();
	},

	increaseText: function() {
		if(this.currentSize < this.maxSize) {
			this.currentSize++;
			this._changeTextSizeEM();
		}
	},

	decreaseText: function() {
		if(this.currentSize > this.minSize) {
			this.currentSize--;
			this._changeTextSizeEM();
		}
	},

	resetText: function() {
		this.currentSize = this.minimumSize;
		this._changeTextSizeEM(this.minimumSize);
	},

	/**
	 * get the default font size for the content areas
	 */
	_setDefaultSize: function () {
		if (this.options.defaultSizeElement == null) {
			this.defaultSize = $('content').getElement('p').getStyle('font-size');
		} else {
			this.defaultSize = $('content').getElement(this.options.defaultSizeElement).getStyle('font-size');
		}
		if (this.defaultSize.indexOf('em') == -1) {
			this.defaultSize = this.defaultSize.toInt();
		} else {
			// get parent wrapper size
			var size = $('content').getElement('p').getStyle('font-size').toFloat();
			// get p size
			var pSize = this.defaultSize.toFloat();
			// calculate the percentage from the parent to the p
			this.defaultSize = size * pSize * 10;
		}
	},

	/**
	 *
	 */
	_changeTextSizeEM: function() {
		var self = this;
		var size = (this.currentSize).toInt();
		$$('body').removeProperty('class').addClass('textModifier' + size);
		Cookie.write('emSize', size, {path: '/', duration: self.cookieExpires});
		return;
	},
	/**
	 * add the events to the text control buttons
	 */
	_attachEvents: function() {

		var self = this;
		$$('#contentControl button.print').addEvent('click', function() {
			self.printPage();
		});
		$$('#contentControl button.decrease').addEvent('click', function() {
			self.decreaseText();
		});
		$$('#contentControl button.increase').addEvent('click', function() {
			self.increaseText();
		});
		$$('#contentControl button.reset').addEvent('click', function() {
			self.resetText();
		});
	},

	_setMaxSize: function() {
		this.maxSize = (this.defaultSize + this.options.stepsUp).toInt();
	},
	_setMinSize: function() {
		this.minSize = (this.defaultSize - this.options.stepsDown).toInt();
	}

});

var toggle = null;
var nowTweet = 1;
window.addEvent('domready', function(){
	toggle = new ToggleMenu({handlers : '.footer-panel-129.panel ul li b', panels : '.footer-panel-129.panel ul li div', openTag : 0});
	
	var myRequest = new Request({
		method: 'get',
		url: '/ajax/ajaxModule/ModuleFooter/',
		onComplete: function(html) {
			$('twitter-panel').set('html', html);
			new TwitterControl();
		}
	}).send();

});


var TwitterControl = new Class({
	Implements: [Options, Events],
	options: {
	},
	initialize: function(options){
		this.setOptions(options);

		this.run();
		return this;
	},
	run: function() {
		// css sticker requires
		$('footer').style.height = '495px';
		$('twitter-another').addEvent('click', function() {
			var textPanel = $$('#twitter .wrapper p');
			var timePanel = $$('#twitter .wrapper em');
			var feedsText = $$('#twitter-feeds li p');
			var feedsTime = $$('#twitter-feeds li em');
			textPanel.set('html', feedsText[nowTweet].get('html'));
			timePanel.set('html', feedsTime[nowTweet].get('html'));
			nowTweet++;
			if (nowTweet >= feedsText.length) {
				nowTweet = 0;
			}
			return false;
		});
	}

});

ToggleMenu = new Class ({
	Implements: [Options],

	options: {
		handlers : 'handlers',
		panels : 'panels',
		eventType : 'click',
		openTag: -1
	},

	handlers : null,
	panels : null,
	slides : null,

	initialize: function(options) {
		this.setOptions(options);
		this.handlers = $$(this.options.handlers);
		this.panels = $$(this.options.panels);
		this.run();		
	},

	run: function() {
		
		this.slides = new Array();
		if (this.handlers && this.panels) {
			
			// Initialize the toggle events
			this.handlers.each(function(el,key) {
				var slideE = null;
				if (this.options.openTag == key) {
					this.highlightTitle(this.panels[key]);
					slideE = new Fx.Slide(this.panels[key]).slideIn();
				} else {
					this.normalTitle(this.panels[key]);
					slideE = new Fx.Slide(this.panels[key]).hide();
				}
				this.slides.include(slideE);
			}.bindWithEvent(this));

			// Adds onClick events to each handlers.
			this.handlers.each(function(el,key) {				
				el.addEvent('click', function(e) {
					this.slides[key].slideIn().chain(function(){
						this.slideIn();
					});
					this.highlightTitle(this.panels[key]);					
					for(var i = 0; i< this.slides.length; i++) {
						if (i != key) {
							this.slides[i].slideOut().chain(function(){
								this.slideOut();
							});
							this.normalTitle(this.panels[i]);
						}
					}					
					return false;
				}.bindWithEvent(this));
			}.bindWithEvent(this));						
		}
	},
	highlightTitle: function(openDiv) {
		var li = this.getParentToLi(openDiv);
		var title = li.getElementsByTagName('b')[0];
		title.addClass('active');
	},
	normalTitle: function(currentDiv) {
		var li = this.getParentToLi(currentDiv);
		var title = li.getElementsByTagName('b')[0];
		title.removeClass('active');
	},
	getParentToLi: function(el) {
		if (el.nodeName.toLowerCase() == 'li') {
			return el;
		}
		return this.getParentToLi(el.parentNode);
	}
});

window.addEvent('domready', function(){
	var errorMessage = new ErrorMessageExtender();
});

ErrorMessageExtender = new Class ({
	Implements: [Options],

	options: {
		errorClass: 'error-input',
		callBack: null
	},


	initialize: function() {
		if ($chk(displayMessage)) {
			displayMessage.overrideBuildFunc = this.build.bindWithEvent(this);
			displayMessage.overrideFlushFunc = this.flush.bindWithEvent(this);
		}
	}, 
	
	build: function(element, msg, type) {
		element.addClass(this.options.errorClass);
		if( element.get('class').contains('correct')) {
			element.removeClass('correct');
		}
		// Run call back function when necessary
		if ($chk(this.options.callBack)) {
			this.options.callBack.run('build', element, msg, type);
		}
	},
	
	flush: function() {
		if (arguments.length > 1) {
			elId = arguments[1];
			elId = replaceErrDiv(elId);
			if ($chk($(elId))) {
				$(elId).removeClass(this.options.errorClass);
				$(elId).addClass('correct');
			}
		}
		//element.removeClass(this.options.errorClass);
		// Run call back function when necessary
		if ($chk(this.options.callBack)) {
			this.options.callBack.run('flush', element);
		}
	}

});

var EventSpameChecker = new Class({
	Implements: [Options, Events],
	options: {
		'humanId' : 'human'
	},

	form: null,

	initialize: function(id, options){
		this.setOptions(options);
		this.form = $(id);
		if (!$chk(this.form)) {
			return;
		}
		this._config();
		return this;
	},

	_config: function() {
		var self = this;
		var inputs = self.form.getElements('input');
		inputs.combine(self.form.getElements('textarea'));
		inputs.combine(self.form.getElements('select'));
		inputs.each(self.attachEvent.bindWithEvent(this));
	},
	attachEvent: function(el) {
		var self = this;
		el.addEvent('change', function(e) {
			var enableEvent = true;
			if (el.get('tag') == 'input') {
				if (el.get('type') == 'submit' || el.get('type') == 'hidden') {
					enableEvent = false;
				}
			}
			if ( enableEvent ) {
				self.run();
			}
		});
	},
	run: function() {
		var humanField = $(this.options.humanId);
		if (!$chk(humanField)) {
			var newField = new Element('input', {'type' : 'hidden', 'value' : '1', 'name' : 'human', 'id' : this.options.humanId});
			this.form.adopt(newField);
		}
	}

});	


//Stores our tiny fields
var tinyElements = new Array();

function tinyOninit(){
	/*
	var tinylist = tinyMCE.getParam('elements');
	tinylist = tinylist.split(',');
	tinyElements.push(tinylist);
	*/
}

var DocumentEvents = Object();
var EventHandler = {
	attachEvent : function(id, EHonEvent, EHmyFunc){
		if (!EventHandler.hasEvent(id,EHonEvent)){
			DocumentEvents[id+EHonEvent] = new Array();
		}
		var params = new Array();
		if (arguments.length > 3){
			for (var i = 3; i < arguments.length; i++){
				params.push(arguments[i]);
			}
		}
		DocumentEvents[id+EHonEvent].push({onEvent : EHonEvent, myFunc : EHmyFunc, myParams : params});
	},
	hasEvent : function (id, EHonEvent){
		//Check if this id has an event
		var test = DocumentEvents[id+EHonEvent];
		if (test){
			return true;
		} else {
			return false;
		}
	},
	idEvents : function (id,EHonEvent ){		
		return (DocumentEvents[id+EHonEvent]);
	},
	loadEvents : function (){
		for (var et in DocumentEvents){
			var idAndEvent = EventHandler.getIdAndEvent(et);		
			if (idAndEvent){
				var eventList = DocumentEvents[et];				
				EventHandler.run(idAndEvent[0], idAndEvent[1], eventList);	
			}
		}
		//Now clear the EventsArray
		DocumentEvents = new Object();
	},
	getIdAndEvent: function (myString){
		
		var reg = new RegExp("([A-Za-z0-9_]+)(onchange|onblur|onkeyup|onclick)");
		try {
			var matches  = myString.match(reg);
			return ([matches[1],matches[2]]);	
		}
		catch (e) {
			return false;	
		}
	},
	run: function (id, myEvent, eventList){
		var element = idE(id);		
		if (element){
			var myFunc = EventHandler.generateRunFunc(eventList);
			element[myEvent] = myFunc; 	
		}
	}, 
	/**
	 * @return function
	 */
	generateRunFunc: function(eventList){
		return(function(){
			var self = this;
			for (var i=0; i < eventList.length; i++){
				//Generate Arg String if we have Params
				var eventObj = eventList[i];
				var funcReturn = EventHandler.callFunc.call(self,eventObj.myFunc,eventObj.myParams);
			}
			return funcReturn;
		});
	},
	/**
	 * Calls a user function with arguments.
	 */
	callFunc : function (funcName, params){
		
		var paramString = '';	
		if (params.length > 0){
			for (var y = 0; y < params.length;y++){
				paramString += ',params['+y+']';	
			}
		}
		var self = this;
		try {
			eval("var myCall = " +funcName+".call(self"+paramString+")");			
		} catch (e){
			//alert(e);
			return false;
		}
		
		if (typeof(myCall) == 'function'){
			myCall();
		} else if (typeof(myCall) == 'boolean'){
			return myCall;
		}
		return 1;
	}
}

/*** String functions ***/
//Option is to add these methods as prototypes of String. 
var stringTools = {	
	trim: function(str){
		return str.replace(/^\s+/, '').replace(/\s+$/, '');		
	},
	/**
	checks and validates string type. 
	eg. to check for a numeric string of max length 4 = str, numeric, 0,4
	eg. to check a string of length 5 chars = str, string, 5,5
	returns boolean
	*/ 
	check: function(str, type, params)
	{
		str = stringTools.trim(str);	
		min = Number(params[0]) || 1;
		max = Number(params[1]) || '';		
		
		//Check if there are more than 2 params. If there are, the extra ones are values this str cannot equal
		if (params.length > 2){
			for (var i = 2; i < params.length; i++){
				if (str == params[i]) return false;
			}
		}		
		//Simple string checks.
		if (type == 'string' && (min >  0 &&  (max == '' || max == 0))){
			return str.length >= min ? true : false;			
		}
		//check if both are the same
		exactMatch = min == max ? true : false;
		if (exactMatch){
			repetitionExp = '{'+min+'}';
		} else {
			repetitionExp = '{'+min+','+max+'}';			
		}
		switch (type) {
			case "string" :exp = "[\\w\\W]";break;
			case "alpha" :exp = "[a-z]";break;
			case "numeric" :exp = "[0-9 ]";break;
		}
		regEx = new RegExp("^"+exp+repetitionExp+"$","im");
		return  str.search(regEx) != -1 ;
	},
	/**
	checks and validates amount of words
	eg. to check for a numeric string of max word length 4 = str, numeric, 0,4
	returns boolean or number of words
	*/ 
	checkWords: function(str, params)
	{
		str = stringTools.trim(str);
		str = str.replace(/\s+/gi, ' ');	
		min = Number(params[0]) || 1;
		max = Number(params[1]) || '';		
		words = str.split(' ');	
		wordCount = words.length; 

		if(str == '' && min > 0) {
			return false;
		}

		//Simple string checks.
		if (min >  0 &&  (max == '' || max == 0)){
			return wordCount >= min ? true : false;			
		} else if (min >  0 &&  (max > 0) && (max != '')){
			return (wordCount >= min) && (wordCount <= max) ? true : false;
		} 
	}
}

/** This adds an onsubmit to the form in FormValidator  ***/
function validateOnSubmit(formValidator, ajaxOptions){	
	var myForm = idE(formValidator.myForm);
	var myFunc = submitForm(formValidator, ajaxOptions);
	myForm.onsubmit = myFunc;
}
/**
 * Returns the function that is called by the form onsubmit
 * @param {Object} formValidator
 * @param {Object} ajaxOptions
 */
var submitForm = function (formValidator, ajaxOptions){	
	return (function(){
		try {
			// try saving 3.2.1.1
			tinyMCE.activeEditor.save();
		} catch(e) {
			try {
				// try saving 2.0.8
				tinyMCE.selectedInstance.triggerSave();
			} catch(e) {
				
				// we might not have tinyMCE available
			}
		}
		
		var valid =  formValidator.initSubmitValidation();	
		if (formValidator.options.callback && valid) {			
			eval('var callbackValid = '+formValidator.options.callback+'();');
			if (!callbackValid) valid = false;
		}
		if (Browser.Engine.name == 'trident') {
			window.onbeforeunload = null;
		} else {
			window.removeEvents('beforeunload');
		}
		if (ajaxOptions){
			if(valid){
				AjaxLoader.formSubmit(formValidator.myForm, ajaxOptions);	
			}
			return false;
		} else {
			return valid;	
		}});
}

/************** FORM VALIDATOR OBJECT *******************/
var FormValidator = function(formId, options){
	this.options = options || {};
	this.myForm = formId;
	this.validationRules = [];
	// detect if there's an error printed by php and jump to it!
	var $error = $$('.formErrorMessage');
	if($error.length > 0) {
		var id = $error[0].getParent().getParent().get('id');
		if(id != '' && id != null) {
			window.location.hash = '#'+id;
		}
	}
}

FormValidator.prototype = {
	//Define validation for element
	findElement: function(element) {
		var that = this.validationRules;
		for(var i = 0; i < that.length; i++) {
			if(that[i].divId == element) {
				return that[i];
			}
		}
		return false;
	},
	defineValidation : function (elementArg, type, validationArgs){
		
		//Set some vars for the validationRule object.
		var vR = new ValidationRule(elementArg, validationArgs, this);	
		vR.formName = this.myForm;
		var myForm = idE(this.myForm);
		
		vR.asset = this.asset;
		//check if its a date check. This element won't exist so get the day element.
		if (type == 'date' || type == 'datetime'){
			var elementName = elementArg+'[Day]';
		} else {
			var elementName = elementArg;
		}
		
		//Set the vR element name
		vR.element = elementName;		
		var element = myForm.elements[elementName];
		
		var p  = new RegExp("\\w+\\[(\\d)\\]\\[\\w+\\]");
		//Set type if it isn't a date check
		if (type != 'date'){
			try {
				//get the type
				type = element.type.toLowerCase();
				type = type == 'hidden' ? 'text' : type;
				//Get the asset number of this field. eg ASSET[INT][FIELD] etc. this sets the INT
				/*var matches  = element.name.match(p);
				if (matches){
					vR.assetNumber = matches[1];	 
				}*/
				
			} catch (e){			
				//Check box type
				if (type == 'checkbox'){
					vR.element = elementName + '[]';
					try {
						element = myForm.elements[vR.element];
						if (!element.length) {
							element = [element];
						}
						type = element[0].type.toLowerCase();	
					} catch (e) {
						element = myForm.elements[vR.element];
						type = element.type.toLowerCase();
					}
					
				} else if (type == 'select'){
					vR.element = elementName + '[]';
					element = myForm.elements[vR.element];
					type = element.type.toLowerCase();	
				}
			}
		}
		vR.type = type;
		vR.myForm = this.myForm;
		
		//Add this into the validation rules list
		this.validationRules.push(vR);
		
		//Also append the event to the element we are checking		
		addValidationEvent.create(vR,element);

		return vR;
	},

	/**
	 * Removes an element from teh validation array
	 */
	removeValidation: function(elementArg) {

		var validationArray = this.validationRules;
		this.validationRules.each(function(vR, index) {
			if(vR.divId.contains(elementArg)) {
				validationArray.erase(vR);
			}
		});
		addValidationEvent.remove($$('input[name*='+elementArg+']'));
		this.validationRules = new Array();
		this.validationRules = validationArray;


	},

	listRules : function (){
		for (var i=0; i < this.validationRules.length; i++) {
			vR = this.validationRules[i];
		}
	},
	
	listRules : function (){	
		for (var i=0; i < this.validationRules.length; i++) {
			vR = this.validationRules[i];
		}
	},	
	//This iterates through all our rules and checks em
	//Also sets focus to the first incorrect field
	initSubmitValidation : function (){
		//error counter
		error = 0;
		for (var ii =0 ; ii < this.validationRules.length ; ii++){
			vRule = this.validationRules[ii];
			valid = vRule.validate();
			
			//if its valid do nothing, else increment
			if (!valid){
				if (error == 0){

						// it could be a tiny mce field, we'll try to focus the iframe instead
						var formType = $$('input[name=assetClass]').get('value')[0];
						var fieldName = vRule.element.substr(vRule.element.lastIndexOf('[') + 1);
						fieldName = fieldName.substr(0, fieldName.length - 1);
						
						$iframe = $(formType+'_0__'+fieldName+'__ifr');
						if($iframe) {
							$iframe.focus();
						} else {
							try {
								var e = document.forms[this.myForm].elements[vRule.element];
								//console.log(e);
								e.focus();
							} catch (e) {
								//Silent

							}
						}
					
				}
				error++;
			}
		}
		//If error is > 0 we have errors so return false
		if (error > 0){		
			return false;
		} else {
			return true;	
		}
		return false;	
	}
}

/*************** Validation Rule Object ********************/
var ValidationRule = function(element, validationArgs, vF){	
	this.divId = validationArgs.divId || element;		
	this.errorMessage = validationArgs.eMsg || 0;
	this.validationFunc = validationArgs.vFunc || 0;
	this.params = validationArgs.args ||  [];
	this.vF = vF;
	this.value = '';
	//While we create the rule, hide the error message divs if they exist.
}

//Validate prototype function for ValidationRule
ValidationRule.prototype = {
	onValidate: null,
	onValidated: null,
	onValidateSuccess: null,
	onValidateFail: null,
	validate : function(){
		try {
			if (timechooser) {
				syncEndDate();
			}
		} catch(e) {
		}
		if (arguments.length > 0){
			var obj = arguments[0];			
			if(typeof obj == 'object'){
				var obj = document.forms[this.myForm].elements[this.element];
				if (this.type == 'checkbox') {
					if (!obj.length) {
						obj = [obj];
					}
				}
				if(typeof obj != 'object') {
					obj = document.forms[this.myForm].elements[this.element + '[]'];
				}
			}
		} else {			
			//Need to define obj as the element. This is called from the onsubmit check function
			var obj = document.forms[this.myForm].elements[this.element];
			if(typeof obj != 'object') {
				obj = document.forms[this.myForm].elements[this.element + '[]'];
			}
		}
		
		
		//return false;
		if(typeof obj != 'object') {			
			// object is not available for validation
			return true;
		}

		try {
			var tr = $$(obj).getParent('tr');		
			if(tr) {
				var disp = tr.getStyle('display');
				if(disp == 'none' || disp == 'hidden' || (obj.name && obj.name == '')) {
					return true;
				}
			} else if($$(obj)) {
				if($$(obj).get('validate') == 'false') {
					
					return true;
				}
			}
		} catch(e) {			
			if($$(obj)) {			
				if($$(obj).get('validate') == 'false') {
					return true;
				}
			}
		}
	
		this.value = obj.value;
		
		if(typeof this.onValidate == 'function') {
			this.onValidate();
		}
		
		if(typeof this.params.enabled == 'undefined' || this.params.enabled) {
			
			if (this.type == 'datetime' || this.type == 'date'){				
				isValid = validateRule.isDateTime(this.myForm, this.divId);
			} else {				
				//Check if any arguments were passed. First arg is the element - onblur, onchange etc. 
	
				
				if (this.validationFunc == 'fieldDependency' || this.validationFunc == 'matchElementValue'){				
					var p  = new RegExp("(\\w+)\\[(\\d)\\]\\[\\w+\\]");
					var matches = this.element.match(p);
					
					var dName = matches[1]+'['+matches[2]+']'+'['+this.params[0]+']';
					var myForm = idE(this.myForm);	
					var isValid = validateRule[this.validationFunc](obj,myForm.elements[dName], this.params, this.type);
					
				} else if (this.validationFunc == 'thisOrThat'){
					var p  = new RegExp("(\\w+)\\[(\\d)\\]\\[\\w+\\]");
					var matches = this.element.match(p);
					var dName = matches[1]+'['+matches[2]+']'+'['+this.params[0]+']';
					var myForm = idE(this.myForm);			
					var isValid = validateRule[this.validationFunc](obj,myForm.elements[dName], this.params, this.type);
						
				} else {
					try { //Catch errors
						var isValid = validateRule[this.validationFunc](obj, this.params, this.type);	
					} catch (e){
					}
				}
			}
		} else {			
			isValid = true
		}
		
		if(this.type == 'textarea' && this.validationFunc == 'isWords') {
			
			var str = stringTools.trim(this.value);
			str = str.replace(/\s+/gi, ' ');
			
			if(str == '') {
				tmpWordLength = 0
			} else {
				tmpWordLength = str.split(' ');	
				tmpWordLength = tmpWordLength.length;
			}
			
			var tmpMinLength = this.params[0];
			var tmpMaxLength = this.params[1];
			var extraWordInfo = '';
			
			if(tmpMinLength > 0) {
				extraWordInfo = ' (minimum '+tmpMinLength+')';
			}
			
			var counterId = this.divId.replace('[', '_');
			counterId = counterId.replace(']', '_');
			counterId = counterId.replace('[', '_');
			counterId = counterId.replace(']', '_');
			
			var wordCounter = $(counterId+'-counter');
			if(!wordCounter) {
				var wordCounter = new Element('div');
				wordCounter.id = counterId+'-counter';
				wordCounter.className = 'textarea-counter';
				wordCounter.setStyles({'width' : parseInt($(counterId).getStyle('width'))+'px'});
				wordCounter.inject($(counterId).getParent(), 'bottom');
			}

			//wordCounter.innerHTML = tmpWordLength+'/'+tmpMaxLength+extraWordInfo;
		}

		if (!isValid){			
			if(typeof this.onValidateFail == 'function') {
				this.onValidateFail();
			}
			if (this.type == 'datetime' || this.type == 'date'){
				var element = document.forms[this.myForm].elements[this.divId+'[Year]'];	
			} else {
				var element = document.forms[this.myForm].elements[this.element];
				if (this.type == 'checkbox') {
					if (!element.length) {
						element = [element];
					}
				}
				if(typeof element != 'object') {
					element = document.forms[this.myForm].elements[this.element + '[]'];
				}
			}
			displayMessage.buildId(element, this.errorMessage, this.type);
		} else {			
			if (typeof this.onValidateSuccess == 'function') {
				this.onValidateSuccess();
			}
			if (this.validationFunc == 'browseableHasValue') {
				var errDiv = this.element + '[]';
				errDiv = errDiv.replace(/\]/gi, '_');
				errDiv = errDiv.replace(/\[/gi, '_');
			} else if (this.type == 'checkbox' || this.type == 'select-multiple'){
				var errDiv = this.element;
			} else {
				var errDiv = this.type == 'date' ? this.divId+'[Day]' : this.divId;	
			}

			// The following code is add for date and datetime type field
			// To remove the error message when validation is pass.
			if (this.type == 'datetime' || this.type == 'date'){
				var element = document.forms[this.myForm].elements[this.divId+'[Year]'];
				displayMessage.flush(element.get('id')+'_msg', element.get('id'));
			} 
	 		displayMessage.flush(errDiv+'_msg', errDiv);
		}
		if(typeof this.onValidated == 'function') {
			this.onValidated();
		}
		/*if(!isValid) {
			alert(this.element);
		}*/
		return isValid;
	}
}

/****************** Validation Event ***********************/
var addValidationEvent = {		
	getValidateFunc: function (vR, validKey){
		//Check if we need a valid key function
		validKey = validKey || false;
		if (validKey){
			return (function (event){if (validateRule.isValidKeyStroke(event)) vR.validate(this);});
		} else {
			return (function (){vR.validate(this);});
		}
	},		
	create: function (vR, element){
		var type = vR.type;		
		if (vR.type == 'radio')	type = 'checkbox'; //Check boxes behaviour 
		if (vR.type == 'date') type = 'datetime';
		if (vR.type == 'select-one' || vR.type == 'select-multiple')	type = 'select';

		switch (type){
			case 'text':
                                if ($chk($(element.id))) {
                                    $(element.id).addEvent('keyup', addValidationEvent.getValidateFunc(vR, true));
                                    //element.onkeyup = addValidationEvent.getValidateFunc(vR, true);
                                    //element.onblur = addValidationEvent.getValidateFunc(vR);
                                    $(element.id).addEvent('blur', addValidationEvent.getValidateFunc(vR));
                                    //EventHandler.attachEvent(element.id, 'onblur','addValidationEvent.getValidateFunc',vR);
                                }
			break;
			case 'textarea':
                            if ($chk($(element.id))) {
                                $(element.id).addEvent('keyup', addValidationEvent.getValidateFunc(vR, true));
				//element.onkeyup = addValidationEvent.getValidateFunc(vR, true);
				//element.onblur = addValidationEvent.getValidateFunc(vR);
                            }
			break;
			case 'select':
				if (vR.validationFunc != 'fieldDependency') {
					vR.validationFunc = 'isSelected';		
				}
				//Check if this element has an on change event already assigned
				EventHandler.attachEvent(element.id, 'onchange','addValidationEvent.getValidateFunc',vR);
			break;
			case 'checkbox':
				//Need to add an onclick to each on of these checkboxes	
				
				if (element.length){
					if (vR.validationFunc != 'fieldDependency'){
						vR.validationFunc = 'isChecked';	
					}
					for (var i=0; i < element.length; i++){
			   			element[i].onclick = function (){							
							vR.validate(element);
		   				}
	   				}
				}
			break;	
			case 'datetime':
					    //get day, month , year and set onChange to validate.
					    var fields = ['[Day]','[Month]','[Year]'];
					    /* CHECK THIS ON SUBMIT INSTEAD
					    for (var i = 0; i < fields.length ; i++){
						    document.forms[vR.formName].elements[vR.divId+fields[i]].onchange = function(){
							    vR.validate(this);
						    }
					    }*/
			break;			
			    }
	},

	remove: function(element) {
		element.onclick = null;
		element.onBlur = null;
		element.onkeyup = null;
	}
}


/******************** Validation Rules *********************/

var validateRule = {
	//Check if the type is a string (anything really). params is an array. 1st is minimum, 2nd is max chars	
	hasValue: function(element , params, type) {
		val = element.value || '';	
		paramList = params || [1];
		return stringTools.check(val, 'string',paramList);
	},
	browseableHasValue: function(element, params, type) {
	    var min = null;
	    var max = null;
	    if (element && element.length > 1) {
		if (params) {
		    if (params.length > 1) {
			min = params[0];
			max = params[1];
		    } else {
			min = params[0];
		    }
		    if (min) {
			if ((element.length - 1) < min) {
			    return false;
			}
		    }
		    if (max) {
			if ((element.length - 1) > max) {
			    return false;
			}
		    }
		}
		return true;
	    } else {
		return false;
	    }
	},
	isUrl: function(element , params, type){
		val = element.value;
		if (val=='') {
			return false;
		}
		return true;
	},
	//Check if the type is a string (anything really). params is an array. 1st is minimum, 2nd is max chars	
	isString: function (element , params, type){	
		val = element.value || '';	
		paramList = params || [];
		if (type == 'textarea' || (element.id && element.id.indexOf('mce_editor') === 0)){
			try {
				var tinyInt = tinyMCE.getInstanceById(element.name);
				
				if(!tinyInt) {
					var tinyInt = tinyMCE.getInstanceById(element.id);
				}
				
				if (tinyInt){				
					val = tinyInt.getBody().innerHTML;
					//Strip tags
					val = val.replace(/<\/?[^>]+>/gi, '');
					val = val.replace(/&([^;]+);/gi, ' ');
					//If the string empty, then set value as empty
					if (val == '<br>' || val == '&nbsp;'){
						val = '';
					}
				}
			} catch (e){
				//alert('line 376');
			}
		}
        return stringTools.check(val, 'string',paramList);		
	},
	isWords: function (element, params, type){
		val = element.value || '';	
		paramList = params || [];
	
		if (type == 'textarea'){
			try {
				var tinyInt = tinyMCE.getInstanceById(element.name);
				
				if(!tinyInt) {
					var tinyInt = tinyMCE.getInstanceById(element.id);
				}
				if (tinyInt){				
					//val = tinyInt.getBody().innerHTML;
					
					var strip = (tinyInt.getBody().innerHTML).replace(/(<([^>]+)>)/ig,"");
					strip = strip.replace('&nbsp;', '');
					var strLength = strip.split(' ').length;
					if(strip.replace(' ', '') == '') {
					    strLength = 0;
					}
					val = strLength;
//
//					//Strip tags
//					//If the string empty, then set value as empty
//					if (val == '<br>' || val == '&nbsp;'){
//						val = '';
//					}
//					val = val.replace(/<[^>]*>/gi, ' ');
//					val = val.replace(/\&nbsp;/gi, ' ');
//					val = val.replace(/\s{1,}/gi, ' ');
//					val = val.replace(/^\s{1,}/gi,'');
//					val = val.replace(/\s{1,}$/gi,'');
//					val = val.split(/\s/gi);
				}
			} catch (e){
				//alert('line 376');
			}
		}
		if (!val) {
			return false;
		}
		min = Number(params[0]) || 1;
		max = Number(params[1]) || 0;
		// minimum words only
		if (max == 0) {
			if (val>=min) {
				return true;
			}
			return false;
		}
		if ((val>=min) && (val<=max)) {
			return true;
		}
		return false;
	},
	fieldDependency : function (element, dependantElement, params, type) {
		// calculate the value of the dependant element
		var dependantValue = '';

		if (dependantElement[0] && dependantElement.tagName != 'SELECT'){
			if (dependantElement[0].type == 'radio'){
				for (var i=0; i < dependantElement.length ; i++){
					if (dependantElement[i].checked){
						dependantValue = dependantElement[i].value;
						break;
					}
				}
			}
		} else {
			dependantValue = dependantElement.value;
		}
		
		var val = '';
		//get element value. it could be a radio
		if (element[0]){
			if (element[0].type == 'radio'){
				for (var i=0; i < element.length ; i++){
					if (element[i].checked){
						val = element[i].value;
						break;
					}
				}
			} else if (type == 'select-one' || type == 'select-multiple') {
				var index = element.selectedIndex;	
				val =  (element.options[index].value == '') ? '' : 'hasValue';				
			}
		} else {
			val = element.value;
		}

		// only execute the validation if the dependacy is met
		if (dependantValue == params[1]){
			//Check dependancy validation
			var validationFunc = params[2];
			if (validationFunc == 'isEmail'){
				var bit = stringTools.trim(val);
				if (bit.search(/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) == -1){
					return false;
				}
			} else if (validationFunc == 'isString') {
				var otherParams = params.slice(3);
				return validateRule.isString(element,otherParams,type);	
			} else if (validationFunc == 'isRegExp') {
				regEx = new RegExp(params[3],"i");
				return regEx.test(val);
			} else if (validationFunc == 'isFile') {
				return val !== '';
			} else {
				return stringTools.check(val, 'string',[1,0]);				
			}
		}
		return true;
	},
	hasValueValidate : function (element, params){
		//First check if this element has any values, if it does then validate it
		var val = element.value || '';	
		var paramList = [1,0];
		
		if (stringTools.check(val, 'string',paramList)){
			//Get Validate Func. 
			if (params[0]){
				var correctParams = params.slice(0);
				var junk = correctParams.shift();
				return validateRule[params[0]](element,correctParams);	
			} else {
				return false;
			}
		} else {
			return true;
		}
	},
	thisOrThat : function (thisElement, thatElement, params) {
		var thisVal = thisElement.value || '';
		var thatVal = thatElement.value || '';
		
		if (!stringTools.check(thisVal, 'string',[1,0]) && !stringTools.check(thatVal, 'string',[1,0]) ){
			return false;			
		}return true;
	},
	// is it alpha only 
	isAlpha: function (element, params){	    
        val = element.value || '';
		paramList = params || [];
		return stringTools.check(val,'alpha',paramList);
	},
	//Check if the type is a string (anything really). params is an array. 1st is minimum, 2nd is max chars	
	mustEqual: function (element , params, type){	
		var val = stringTools.trim(element.value) || '';	
		paramList = params || [];
		if (params.length > 0){
			for (var i = 0; i < params.length; i++){
				if (val == params[i]) return true;
			}
		}
		return false;
	},
	/**
	 * 
	 * @param {Object} element
	 * @param {Object} params
	 */
	isRegExp : function (element,params){
		regEx = new RegExp(params[0],"i");
		return regEx.test(element.value);
	},
	/**
	 * Check that two element values are equal to each other.( used for confirmations )
	 * @param {Object} element
	 * @param {Object} params
	 */
	matchElementValue: function(element, dependantElement, params){
		if (element.value != dependantElement.value)
			return false;
		
		return true;
	},
	/**
	 * Check thats its just a number 
	 * @param {Object} element
	 * @param {Object} params
	 */
	//is it numeric only
	isNumeric: function (element, params){
		val = element.value || '';
		paramList = params || [];
		return stringTools.check(val,'numeric',paramList);
	},
	isUrlOrEmail : function (element, params) {
		if (validateRule.isUrl(element)) {
			return true;
		}
		if (validateRule.isEmail(element)) {
			return true;
		}
		return false;
	},
	/**
	 * Determines if ther integer is valid and within a RANGE
	 * USES is_numeric, instead of is_int
	 * 
	 * @param element form element - the element for the string/int we are testing
	 * @param rangeStart int - the start of the range
	 * @param rangeEnd int - the end of the range
	 * @param inclusive BOOLEAN - inclusive (true) or exclusive (false) of range
	 * @return BOOLEAN
	 */
	isNumRange: function (element, params) {
		var paramList = params || [];
		
		var rangeStart = parseInt(paramList[1]);
		var rangeEnd = parseInt(paramList[2]);
		var inclusive = paramList[3];
		
		
		if(validateRule.isNumeric(element)) {
			var eVal = parseInt(element.value);
			
			if(inclusive) {
				if(eVal >= rangeStart && eVal <= rangeEnd) return true;
			} else {
				if(eVal > rangeStart && eVal < rangeEnd) return true;
			}
		}
		
		return false;
	},

    //Is it a datetime value
    isDateTime: function (myFormArg, ePrefix){
		
		var myForm = idE(myFormArg);
		var MonthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);  		
		var day = myForm.elements[ePrefix+'[Day]'].value;
		var month = myForm.elements[ePrefix+'[Month]'].value;
		var year = myForm.elements[ePrefix+'[Year]'].value;		
		dayLimit = MonthDays[month-1];
		if (day > dayLimit)	{
			return false;
		}
		if (day == '' || month == '' || year == '')	{
			return false;
		}
		
		return true;
    },
	
	// is it an email (allow multiple emails comma separated)
	isEmail: function(elementArg){
		var element = idE(elementArg);
		var emailBits = element.value.split(',');
		for (var i=0; i < emailBits.length; i++){
			var bit = stringTools.trim(emailBits[i]);
			if (bit.search(/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) == -1){
				return false;
			}
		}
		return true;
		//return (element.value.search(/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) != -1);
	},
	
	//Is this box checked
	isChecked: function (elementArg){
		
		if (typeof elementArg == 'string'){
			var element = idE(elementArg);			
		} else {
			var element = elementArg;
		}		
		var foundValue = false;
		if (element){
			if (!element.length) {
				if (element.checked) {
					foundValue = true;
				}
			} else {
				for (var i=0; i < element.length; i++){
					if (element[i].checked){
						foundValue = true;
					}
				}
			}
   		}
		return foundValue;
	},
	
	//Selection boxes.		
	isSelected: function (element, params){
		
		if (element.type == 'select-multiple'){
			var index = element.selectedIndex;	
			var selected =  (element.options[index].value == '') ? false : true;	
			
		} else {
			var index = element.selectedIndex;	
			var selected =  (element.options[index].value == '') ? false : true;
			var val = element.options[index].value;
			
			//Check if there are more than 2 params. If there are, the extra ones are values this str cannot equal
			if (params.length > 2){
				for (var i = 2; i < params.length; i++){
					if (val == params[i]) return false;
				}
			}
			var otherId = replaceErrDiv(element.name) + '_other';	
		}
				
		return selected;
	},
	//Clear the other select box 	
	clearOther: function (element){
		otherId = replaceErrDiv(element.name) + '_other';		
		msgId = replaceErrDiv(element.name)+'[other]_msg';
		
		displayMessage.flush(otherId, element.name);
		displayMessage.flush(msgId, element.name);
	},	
	//This determines if its a valid keystroke to initiate validation
	isValidKeyStroke: function(eArg){
		var e = window.event  || eArg;
		try {
			var key = e.keyCode || e.which;
		} catch (e){
			var key = 0;
		}
		
		//var keychar = String.fromCharCode(key);		
		//9 - tab, 8 - backspace, 46 - delete, 27 - escape, 16 shift, 35 - end, 36 home
		if (key == 17 || key == 18 || key == 9 || key == 27 || key ==16 || key == 35 || key == 36){
			return false;
		}
		return true;
	}
}


//Message Display
var displayMessage = {
	overrideBuildFunc: null,
	overrideFlushFunc: null,
	//displays the innerHtml of id with msg
	inId: function (id, msg){
		
        id = replaceErrDiv (id);
		obj = idE(id);
		//set the parent class
		displayMessage.findAndSetParentClass(obj, false, 2);
		if (obj){

			obj.innerHTML = '<div class="formErrorMessage">'+msg+'</div>';
			obj.style.display = "block";
			obj.style.visibility = "";
		}
	},
	//displays the innerHtml of id with msg
	buildId: function (element, msg, type){
		if(!element) {
			return;
		}
		if ($chk(displayMessage.overrideBuildFunc)) {
			return displayMessage.overrideBuildFunc.run([element, msg, type]);
		}
		//set the parent class		
		if (type == 'checkbox' || type == 'radio'){
			var errorid =  replaceErrDiv (element[0].name+'_msg');		
		} else {
			var errorid = replaceErrDiv (element.name+'_msg');		
		}
		errorDiv = document.getElementById(errorid);
		
		if (!errorDiv){
			displayMessage.findAndSetParentClass(element, false, 2);				
			msgElement = document.createElement('div');
			msgElement.setAttribute('id',errorid);
			msgElement.className = 'formErrorMessage';
			msgElement.appendChild(document.createTextNode(msg));

			var parent = null;
			var li = null;
			if (type == 'checkbox' || type == 'radio'){
				//if its a radio or checkbox, attach the message after the last element				
				parent = displayMessage.getParentNode(element[element.length-1]);
				//element[element.length-1].parentNode.appendChild(msgElement);
			} else {
				parent = displayMessage.getParentNode(element);
				//element.parentNode.appendChild(msgElement);
			    
			}
			parent.appendChild(msgElement);
		}
	},
	getParentNode : function(el) {
		// if form is for admin
		var parentNode = el.getParent();
		if (parentNode.get('tag') == 'td') {
			return parentNode;
		}
		var parent = el.getParent('div');
		if ($chk(parent)) {			
			return parent;			
		}
		if ($chk(el.parentNode)) {
			return el.parentNode;
		}else {
			return null;
		}
	},
	//Removes the Id from the document.
	//using parentNode.removeChild
	flush: function (id){
		id = replaceErrDiv(id);
		obj = idE(id);
		
		var elementId = '';
		if (arguments.length > 1) {
			elementId = arguments[1];
		}
		if ($chk(displayMessage.overrideFlushFunc)) {
			return displayMessage.overrideFlushFunc.run(arguments);
		}        
		displayMessage.findAndSetParentClass(obj, true, 2);		
		if (obj){
			obj.parentNode.removeChild(obj);
		}
	},	
	findAndSetParentClass: function (myElement, flushClass,  limit ){
		try {
			var parentObj = displayMessage.getParentNode(myElement);
			var parentClassName = null;
			if ($chk(parentObj)) {
				parentClassName = parentObj.get('class');
			} else {
				parentClassName = myElement.parentNode.className.split(' ');
			}
			
			//See if invalidInputArea class exists
			var newClasses = [];
			
			for (var i = 0; i < parentClassName.length ; i++){
				if (parentClassName[i] != 'invalidInputArea'){
					newClasses.push(parentClassName[i]);		
				}
			}
			if (!flushClass){				
				if ($chk(parentObj)) {
					parentObj.addClass('invalidInputArea');
				} else {
					newClasses.push('invalidInputArea');
					myElement.parentNode.className = newClasses.join(' ');
				}
			} else {
				if ($chk(parentObj)) {
					parentObj.removeClass('invalidInputArea');
				}
			}
			
		} catch (e){
			//
		}
	}
}

function replaceErrDiv(str){
    var newStr = '';
    for (i = 0; i < str.length; i ++){
        charStr = str.charAt(i);
        if (charStr == '[' || charStr == ']'){
            charStr = '_';
        }
        newStr += charStr;
    }    
    return newStr;
}

function idE(elementId){	
	if (typeof elementId == 'string'){
		var e = document.getElementById(elementId);
	} else {
		var e = elementId;
	}
	return e;
}
function setFieldValue(id, value) {
    $(id).set('value', value);
}

/**
 * Calendar JS
 * Requires MOOTOOLS 1.2b2 or above
 * 
 */

var Calendar = {
	/**
	 * 	Calendar fields come in select and text field variations
	 */
	popupId : 'calendar-popup', //calendar popup id
	dateField : {}, 			//Stores the date field. 
	dates : {},					//Stores all sorts of date related stuff.
	dateFieldType :	'select',
	callback : '',
 	initCal : function(formName, dateFieldPrefix, elementID, startYearA, endYearA, obj, parameters) {	
		
		//Callback
		Calendar.callback = Calendar.boundaries = '';
		
		if (typeof(parameters) == 'string') {
			Calendar.callback = parameters;
		} else if (typeof(parameters) == 'object') {
			if (parameters.callback) {
				Calendar.callback = parameters.callback;
			}
			if (parameters.boundaries) {
				eval("Calendar.boundaries = "+parameters.boundaries+'(dateFieldPrefix)');
			}
		}
		
		//remove any instance of a calendar that may already exist.
		var calendarPopup = $('calendar-popup');
		
		if (calendarPopup) {
			calendarPopup.dispose();
			if($('ieIFRAME')) {
				$('ieIFRAME').dispose();
			}
			return;
		}
		
		//Store form object
		Calendar.myForm = $(formName);
		Calendar.anchor = $(obj);
		//check if its using select or text fields 
		
		
		if (Calendar.myForm.elements[dateFieldPrefix]){
			Calendar.dateFieldType = 'text';
			var fieldId = dateFieldPrefix.replace(/[\[\]]/ig,'_');
			Calendar.dateField.textField = $(fieldId);
			//get day month and year dd/mm/yy
			var bits = Calendar.dateField.textField.value.split('/');
			
			var curDay = '';
			var curMonth = '';
			var curYear = '';
			
			//for empty and default selections
			var correctFormat = true;
			
			if (bits.length == 3 && Calendar.dateField.textField.value != 'dd/mm/yy') {
				var curDay = Number(bits[0]);
				var curMonth = Number(bits[1]) - 1;
				var curYear = bits[2];
				if (curYear.length != 4) {
					curYear =  (curYear.charAt(0) == '0') ? '20'+curYear : '19'+curYear;	
				}
				curYear = Number(curYear);
				
				if (curDay > 31 || curMonth  > 12 || curYear > endYearA) {
					correctFormat = false;
				}
			}
			if (!correctFormat) {
				var curDay = '';
				var curMonth = '';
				var curYear = '';
			}
			
		} else {
			Calendar.dateFieldType = 'select';
			var dayFieldId = dateFieldPrefix+'[Day]';
			var fieldId = dayFieldId.replace(/[\[\]]/ig,'_');
			Calendar.dateField.year 	= Calendar.myForm.elements[dateFieldPrefix+'[Year]'];
			Calendar.dateField.month 	= Calendar.myForm.elements[dateFieldPrefix+'[Month]'];
			Calendar.dateField.day 		= $(fieldId);
			//Set the Current Date to what is shown on the select
			var curYear 	= Calendar.dateField.year.value;
			var curMonth 	= Calendar.dateField.month.selectedIndex - 1;
			var curDay 		= Calendar.dateField.day.value;
		}
		
		Calendar.processDate = new Date();
		Calendar.dates.todaysDate = Calendar.processDate.getDate();
		Calendar.dates.thisMonth = Calendar.processDate.getMonth();
		Calendar.dates.thisDay = Calendar.processDate.getDay();
		Calendar.dates.thisYear = Calendar.processDate.getFullYear();
	    Calendar.dates.startYear = startYearA;
	    Calendar.dates.endYear = endYearA;
		
		curMonth = curMonth <= 0 ? Calendar.dates.thisMonth : curMonth;
		curYear = curYear == '' ? Calendar.dates.thisYear : curYear;
		curDay = curDay == '' ? Calendar.dates.thisDay : curDay;		
		
		Calendar.processDate.setDate(curDay);
		Calendar.processDate.setYear(curYear);
		Calendar.processDate.setMonth(curMonth);
		Calendar.drawCal();
	},
		
	resetCal : function() {
		Calendar.processDate = new Date();   
		$('today_'+Calendar.popupId).set('text',Calendar.processDate.toLocaleDateString());
	    Calendar.drawCal();
	},
	setToday : function() {
		Calendar.processDate = new Date();   
		Calendar.updateElements(Calendar.processDate.getDate() - 1);
	},
	setYear: function(sVal) {
		Calendar.processDate.setFullYear(Number(sVal.value));
		Calendar.drawCal();
	},
	
	setMonth: function(sVal) {
		Calendar.processDate.setMonth(Number(sVal.value));
		Calendar.drawCal();
	},
	
	incMonth: function(amt) {
		var limitReached = false;
		//Corrects safari bug - cant go back from January	
		if (amt <0 && Calendar.processDate.getMonth() == 0){
	        if (Calendar.processDate.getFullYear() -1 >= Calendar.dates.startYear){
			    Calendar.processDate.setYear(Calendar.processDate.getFullYear() -1);
	    		Calendar.processDate.setMonth(11);
	        } else {
	            limitReached = true;
	        }
		} else {
	        if ((Calendar.processDate.getMonth() == 11) && (Calendar.processDate.getFullYear() == Calendar.dates.endYear) && amt >0){
	            limitReached = true;
	        } else {
	            Calendar.processDate.setMonth(Calendar.processDate.getMonth()+amt);	              
	        }
		}
	    if (!limitReached){
	    	Calendar.drawCal();
	    } else {
	       $(Calendar.popupId+'_msg').set('text','Limit Reached');	
	    }
	},
	
	incYear : function(amt){
		if ((amt < 0 && Calendar.processDate.getFullYear() == Calendar.dates.startYear) || (amt > 0 && Calendar.processDate.getFullYear() == Calendar.dates.endYear)){
	        $(Calendar.popupId+'_msg').set('text','Limit Reached');	
	    } else {
	        Calendar.processDate.setYear(Calendar.processDate.getFullYear() +amt);
	        Calendar.drawCal();	
	    }
	},
	
	buildCalendarHtml : function(calendarHtml){
	    var Months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	    var currentDate = new Date();
	    var string = '';
	    string += '<table class="calendar" cellpadding="0" cellspacing="0"><tr><td colspan="7" style="width:auto !important">';
	    string += '<div id="today_'+Calendar.popupId+'" class="dateField">'+currentDate.toLocaleDateString()+'</div> </td> </tr>';
	    string += '<tr><td colspan="7"><table class="calendarNav" cellpadding="0" cellspacing="0"><tr>';
	    var prevMonth  = '<td rowspan="2" ><a href="javascript:Calendar.incMonth(-1)">&lt;&lt; </a></td>';
	    string += prevMonth+'<td rowspan="2"><select name="cal_month" id="cal_month" onchange="Calendar.setMonth(this)">';
	    
	    var selectedMonth = Calendar.processDate.getMonth();
	    
	    //Highlight selected month
	    for (var j=0 ; j<12 ; j++)
	    {	
	        var selectedOption = (j == selectedMonth) ? ' selected="selected "'  : ''  ;			
	        string += '<option value="'+j+'" '+selectedOption+' >'+Months[j]+'</option>';                
	    }
	    string += '</select></td>';
	    string += '<td rowspan="2"><a href="javascript:Calendar.incMonth(1)">&gt;&gt;</a></td>';
	    string += '<td rowspan="2" style="text-align:right; !important">';
	    
	    //Draw select boxes for year
	    var yearSelection = '<select name="cal_year" id="cal_year" onchange="Calendar.setYear(this)">';
	    var selectedYear = Calendar.processDate.getFullYear();
	
	    for(var p=0; p <= Calendar.dates.endYear - Calendar.dates.startYear ; p++){
	        var theYear = Calendar.dates.endYear - p;
	        var selectedOption = (theYear == selectedYear) ? 'selected="selected"' : '';
	        yearSelection += '<option value="'+theYear+'"  '+selectedOption+'>'+theYear+'</option>'; 
	    }
	
	    yearSelection += '</select>';
	    
	    string += yearSelection;    
	    string += '&nbsp;</td><td><a href="javascript:Calendar.incYear(1)" class="calUpArrow"></a></td></tr>';
	    string += '<tr><td><a href="javascript:Calendar.incYear(-1)" class="calDownArrow"></a></td></tr>';
	    string += '</table></td></tr>';
	    string += calendarHtml;
	    string += '<tr bgcolor="#EEEEEE">';
	    string += '<td colspan="7">';
	    string += '<table class="calendarNav"><tr><td>';
	    string += '<div id="'+Calendar.popupId+'_msg" style="width:90px"></div>';
	    string += '</td>';
	    string += '<td style="text-align:right"><input type="button" name="close" value=" close " onclick="Calendar.closeCalendar()"/>&nbsp;</td>';
	    string += '<td align="right">';
	    string += '<input type="button" name="today" value=" today "  onclick="Calendar.setToday()"/>&nbsp;';
	    string += '</td></tr></table>';
	    string += '</td></tr></table>'; 
	    
	    return string;
	},
	
	drawCal: function() {	
	    //String stores calendar html string.
	    var string = '';
		
		var MonthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);	
		var daysOfWeek = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');	
		var totalDays;
		Calendar.processDate.setDate(1);
		
		var processedMonth = Calendar.processDate.getMonth();
		var processYear = Calendar.processDate.getFullYear();
		
		if (processedMonth == 1) { // February
	      if (processYear%400==0 || (processYear%4 == 0 && processYear%100!=0) ) MonthDays[1] = 29;
	   	}
		
		var startDay = Calendar.processDate.getDay();
		totalDays = MonthDays[processedMonth];	
		
		theYear = Calendar.processDate.getFullYear();
		//check boundaries
		var boundaryStartDay = 0;
		
		if (Calendar.boundaries.startDate) {
			var startDate = Calendar.boundaries.startDate;
			
			//Check if the start date boundary is valid for what we are displaying
			if (startDate.getFullYear() <= processYear && processedMonth <= startDate.getMonth()) {
				if (processedMonth == startDate.getMonth()) {
					boundaryStartDay = startDate.getDate() - 1;
				} else {
					//This month cannot be selected at all
					boundaryStartDay = 50;
				}
			}
		}
		
		var counter = 1;
		
		string += '<tr>';
		for (var i = 0; i < 7 ; i ++)
			string += '<th>'+daysOfWeek[i]+'</th>';
		string += '</tr>';
	    
		for (var i=0;i<6;i++)
		{
			if (counter-startDay > totalDays) {
				break;
			}
			string += '<tr>';
			for (var j=0;j<7;j++)
			{
				var itsToday = (((counter-startDay)==Calendar.dates.todaysDate) && (Calendar.processDate.getMonth() == Calendar.dates.thisMonth) && (Calendar.processDate.getFullYear() == Calendar.dates.thisYear))? ' class="today" ':' ';					
	            
				string += '<td >';
				if (counter-startDay >0  && (counter-startDay <=totalDays)){
					var theDay = counter-startDay-1;
					
					var href = ' href="javascript:Calendar.updateElements('+theDay+');" ';
					var ancClass = '';
					if (theDay < boundaryStartDay) {
						href = itsToday = '';	
						ancClass = ' class="invalid" ';
					}
	                string += '<a'+itsToday+ancClass+href+'>'+(counter-startDay)+'</a>';
				}
				string += '</td>';
				counter++;
			}		
			string += '</tr>';
		}		
		
		var calendarHtml = '';
		calendarHtml += Calendar.buildCalendarHtml(string);
		
		//Get calendar co-ords (underneath the date field)
		if (Calendar.dateFieldType == 'select') {
			var coords = Calendar.dateField.day.getCoordinates();		
		} else {
			var coords = Calendar.dateField.textField.getCoordinates();
		}
		//Find page size limits
		var windowSize = window.getSize();
		//calc left position
		var leftPos = coords.left+2;
		if (coords.left+240 > windowSize.x) {
			leftPos = windowSize.x - 240;
		}
		var elementHeight = coords.height;	
		
		var cElement = $(Calendar.popupId);
		
		
		if (!cElement) {

			var pTop = coords.top+elementHeight;
			if(RegExp(" AppleWebKit/").test(navigator.userAgent)) {
				//pTop -= 35;
			}
		
			var cElement = new Element('div',{
				'id' : Calendar.popupId,
				'class' : 'calendarBox',
				'styles' : {
					'top' : (pTop)+'px',
					'left' : leftPos+'px'
				}
			});
			cElement.set('html',calendarHtml);
			cElement.inject(document.body);
		} else {
			cElement.set('html',calendarHtml);
		}
		
		
		//Add iframe behind the calendar
		if (document.all && !window.opera) {
			if (!$('ieIFRAME')) {

				var ieFrame = new Element('iframe', {
					'src' :'',
					'id' : 'ieIFRAME',
					'class' : 'ieCalendarIframe',
					'scrolling' : 'no',
					'frameborder' : '0',
					'styles' : {
						'top' : (coords.top+elementHeight + 3)+'px',
						'left' : leftPos+'px',
						'height' : 243+'px',
						'background-color': '#ff0000'
					}
					
				});
				ieFrame.inject(document.body);
			}
		}
		cElement.setStyle('display', 'block');
	},
	
	closeCalendar: function()
	{
		if (document.all && !window.opera) {
			$('ieIFRAME').dispose();	
		}
		$(Calendar.popupId).dispose();
	},
	
	updateElements: function(day)
	{
	    var	valid = true;
		
		var yearIndex = (Calendar.dates.endYear - Calendar.processDate.getFullYear());
	
		if (Calendar.dateFieldType == 'select') {
			Calendar.dateField.year.selectedIndex = yearIndex + 1;
			Calendar.dateField.month.selectedIndex = Calendar.processDate.getMonth() +1;
			Calendar.dateField.day.selectedIndex = day +1; 	
		} else {
			var d = [];
			d.push(day +1);
			d.push(Calendar.processDate.getMonth()+1);
			d.push(String(Calendar.processDate.getFullYear()).substr(2,2));
			var dateValue = d.join('/');
			if (Calendar.callback != '') {
				eval("var valid = "+Calendar.callback+'(Calendar.dateField.textField, dateValue);');
			}
			if (valid) {
				Calendar.dateField.textField.value  = dateValue;
			}
		}	
		
		if (valid) {
			Calendar.closeCalendar();
		}
		
	}
}

var TipForm = new Class({
	Implements: [Options, Events],
	options: {
		form : 'form'
	},
	formObj : null,
	defaultValues : null,
	initialize: function(options){
		this.setOptions(options);
		this.formObj = $(this.options.form);
		this.defaultValues = new Array();
		this.run();
		return this;
	},
	run: function() {
		var self = this;
		var inputs = new Array();
		// Achieve all the input fields and textarea
		inputs.combine(this.formObj.getElements('input'));
		inputs.combine(this.formObj.getElements('select'));
		//inputs.combine(this.formObj.getElements('input[type=text]'));
		//inputs.combine(this.formObj.getElements('input[type=password]'));
		inputs.combine(this.formObj.getElements('textarea'));
		inputs.each(function(el, key) {
			if (el.type == 'text' || el.type== 'password' || el.get('tag') == 'textarea') {
				
				this.defaultValues[key] = this.getLabel(el);
				if ($chk(this.defaultValues[key])) {
					this.defaultValues[key].addEvent('click', function(e) {
						this.addClass('hidden');
						var li = this.getParent('li');
						var input = li.getElement('input');
						input.focus();
					});
				}
			} else {
				var label = this.getLabel(el);
				if ($chk(label)) {
					label.addClass('hidden');
				}
			}
		}.bindWithEvent(this));

		
		inputs.each(function(el, key) {
			if (el.type == 'text' || el.type== 'password' || el.get('tag') == 'textarea') {
				if (el.value != '') {
					if ($chk(this.defaultValues[key])) {
						this.defaultValues[key].addClass('hidden');
					}
				}
				if (el.get('type') == 'text' || el.get('type') == 'password') {
					el.addClass('text');
				}
				// Add focus event to remove the default label text
				el.addEvent('focus', function(e) {
					if (el.value == '') {
						if ($chk(this.defaultValues[key])) {
							//this.defaultValues[key].addClass('hidden');
                                                        this.setLabelStatus(this.defaultValues[key], 'focus');
						}
					}
					el.addClass('active');
				}.bindWithEvent(this));

                                el.addEvent('keydown', function(e) {
                                        if ($chk(this.defaultValues[key])) {
                                                //this.defaultValues[key].addClass('hidden');
                                                this.setLabelStatus(this.defaultValues[key], 'keyup');
                                        }
                                    
				}.bindWithEvent(this));

				// Adds blur event to retrieve the default label text if nothing is input
				el.addEvent('blur', function(e) {
					if(el.value == '') {
						if (this.defaultValues[key]) {
                                                    this.setLabelStatus(this.defaultValues[key], 'blur');
                                                    //this.defaultValues[key].removeClass('hidden');
						}
					}
					el.removeClass('active');
				}.bindWithEvent(this));
			}

		}, this);
		return this;
	},
        setLabelStatus: function(el, status) {
            if (!$chk(el)) return;
            if(status == 'focus') {
                el.addClass('fade');
                el.removeClass('hidden');
            } else if (status == 'keyup') {
                el.addClass('hidden');
                el.removeClass('fade');
            } else if (status == 'blur') {
                el.removeClass('hidden');
                el.removeClass('fade');
            }
        },
	getLabel: function(input) {
		var inputLi = input.getParent('li');
		//var inputLi = inputDiv.parentNode;
		if ($chk(inputLi)) {
			var inputLabel = inputLi.getElement('label');
			return inputLabel;
		}
		return null;
	},
	getLabelText: function(label) {
		return label.get('text');
	},
	hideLabel: function(input) {
		var label = this.getLabel(input);
		label.hide();
	},
	showLabel: function(input) {
		var label = this.getLabel(input);
		label.show();
	}
});


var AjaxFeedback = {	
	
	feedbackAnimation : function(element, state){
		var eList = element.split(" ");
		
		for (var y = 0; y < eList.length ; y++){
			var e = document.getElementById(eList[y]);
			if (e){
				if (state == 'processing'){
					AjaxFeedback.displayBusySignal(e);	
				} else if (state == 'ready'){
					AjaxFeedback.clearBusySignal(e);	
				}
			}
		}
	},
	displayBusySignal: function(pNode){
		
		//Generate a prefix id for our feedback animation containers.
		var idPrefix = pNode.id+'_';
		
		var containerWidth = pNode.offsetWidth;
		var containerHeight = pNode.offsetHeight;
		var busySignal = document.getElementById(idPrefix+'busySignal');
		var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');
		
		if (!busySignal){
			var busySignalContainer = document.createElement('div');
			busySignalContainer.id = idPrefix+'busySignalContainer';
			
			var busySignal = document.createElement('div');
			busySignal.id = idPrefix+"busySignal";
			busySignal.className = "busySignal";
			
			pNode.parentNode.insertBefore(busySignalContainer, pNode);
			var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');
			busySignalContainer.appendChild(busySignal);
		}
		busySignal.style.position = 'absolute';
		busySignal.style.background = '#fff url(/css/images/spinner.gif) no-repeat 50% 50%';
		busySignal.style.filter = 'alpha(opacity=50)';
		busySignal.style.opacity = '.5';
		busySignal.style.height = containerHeight + "px";
		busySignal.style.width = containerWidth+'px';
	},
	clearBusySignal: function (pNode){
		//Generate a prefix id for our feedback animation containers.
		var idPrefix = pNode.id+'_';
		
		var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');	
		var busySignal = document.getElementById(idPrefix+'busySignal');
		busySignal.parentNode.removeChild(busySignal);
		busySignalContainer.parentNode.removeChild(busySignalContainer);
	}
}
/**
 * Ajax Library
**/
var AjaxLoader = {
	attach: function (id, event , action){
		e = eId(id);
		if (e) eval("e."+event+" = function(){"+action+"};");					
	},
	formSubmit: function (formElementArg, options){
		var formElement = eId(formElementArg);
		encodedForm = FormTools.encode(formElement.id);
		//Set options
		options.requestVars = encodedForm;
		options.url = formElement.action;
		//alert(encodedForm);
		//Check if there are extra parameters to add into the requestVariable
		if (options.parameters){
			var parameters = new Array();
			for(param in options.parameters){
				paramVal = options.parameters[param];
				parameters.push(param+'='+encodeURIComponent(paramVal));
			}
			parameters = parameters.join('&');
			options.requestVars += '&'+parameters;
		}		
		//return false;
		//Run our ajax
		new Ajax(options);
	}, 
	feedbackAnimation: function (element,state){
		var e = eId(element);
		if (state == 'processing'){
			//Get height of this element.
			var myY = e.scrollHeight;
			var widthStyle ='';
			if (e.style.width){
				widthStyle = e.style.width;
			}
			var myX = e.scrollWidth;
			e.innerHTML = '';
			
			e.style.width = widthStyle == ''? myX+'px' : widthStyle;
			e.style.height = myY+'px';
			e.className = 'feedBack';	
		} else if (state == 'ready'){
			if (e){
				e.className = '';
				e.style.height = 'auto';
			}
		}
	}, 
	feedbackAnimationHP: function (element,state){
		var e = eId(element);
		if (state == 'processing'){
			//Get height of this element.
			var myY = e.scrollHeight;
			var widthStyle ='';
			if (e.style.width){
				widthStyle = e.style.width;
			}
			var myX = e.scrollWidth;
			e.innerHTML = '';
			
			e.style.width = widthStyle == ''? myX+'px' : widthStyle;
			e.style.height = myY+'px';
			e.className = 'feedBackHP';	
		} else if (state == 'ready'){
			if (e){
				e.className = '';
			}
		}
	}
}
/**
 * The Ajax Object
 * @param obj myParameters 
 */
var Ajax = function(myParameters){
	
	this.request = null;
	this.requestVars = null;	
	this.options = {
		url: null,
		method: 'post',
		requestVars: null,		
		async: true,
		feedbackFunction: null,
		feedbackElement: null,		
		updateElement: null,
		onReadyState: 'onReadyState',
		onReadyFunction: null,
		noRefresh : false
	};
	//try {
		this.init();	
		this.loadParameters(myParameters);	
		this.send();
	//}
	//catch (e) {
		//alert(e);
	//}
	return false;
};

Ajax.prototype = {
	init: function (){
	    try { this.request = new ActiveXObject("Msxml2.XMLHTTP");  return 1; } catch (e) {}
	    try { this.request = new ActiveXObject("Microsoft.XMLHTTP"); return 1; } catch (e) {}
	    try { this.request = new XMLHttpRequest( ); return 1; } catch(e) {}	
	    alert("XMLHttpRequest not supported");
		return 0;
	},
	loadParameters: function (myParameters){ //Initialises the options from creation
		for (var property in myParameters){
			this.options[property] = myParameters[property] || this.options[property];
		};
	},
	send : function (){
		
		if (this.options.method == 'post'){			
		
			this.request.open('POST', this.options.url, this.options.async);
			this.request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');			
		} else {
			var randomInt = parseInt(Math.random()*999999);
			
			// add random number to URL to avoid cache problems
			this.options.url = this.options.url;
			
			this.request.open('GET', this.options.url, this.options.async);	
		}
		var self = this;
			
		this.request.onreadystatechange = function(){
			self.onReadyState.call(self);
		}
		
		this.request.send(this.options.requestVars);
	},
	onReadyState: function (){
		var readyState = this.request.readyState;
		if (readyState == 4){
			//Check if theres a feedback function and a feedback element
			if(this.options.feedbackElement != null){
				if(this.request.responseText == 'SESSION_TIMEOUT') {
			 		window.location = '/admin';
			 	} else {
					eval(this.options.feedbackFunction+'(\''+this.options.feedbackElement+'\',\'ready\', '+this.options.noRefresh+');');
			 	}	
			}
			
			if(this.request.status == 200 || this.request.status == 0) {				
				if (this.options.updateElement != null){
					 mye = eId(this.options.updateElement);						 						 			 
					 if (mye){
					 	if(this.request.responseText.search('{SPAMERROR}') !== -1) {
					 		var responseText = this.request.responseText.replace('{SPAMERROR}', '');
					 		var myErrorEle = new Element('div', {id : 'spam-error'});
					 		myErrorEle.innerHTML = responseText;
					 		myErrorEle.inject(mye, 'top');
					 	} else if(this.request.responseText == 'SESSION_TIMEOUT') {
					 		window.location = '/admin';
					 	} else if(this.request.responseText.search('id="reloadRequired"') !== -1) {
							window.location = window.location.href.replace('#', '');
						} else {
					 		mye.innerHTML = this.request.responseText;
					 	}
					 	
					 	this.evaluateJs(); 
					 } else {
					 	window.location = window.location.href.replace('#', '');
					 }
				} else if (this.options.onReadyFunction != null) {
					if(this.request.responseText == 'SESSION_TIMEOUT') {
				 		window.location = '/admin';
				 	} else {
						eval(this.options.onReadyFunction+'(this.request.responseText);');
				 	}
				}
	        } else {
				this.cleanUp();
				return false;
	        }
	        this.cleanUp();
		} else {
			//Check if theres a feedback function and a feedback element
			if(this.options.feedbackElement != null){
				eval(this.options.feedbackFunction+'(\''+this.options.feedbackElement+'\',\'processing\','+this.options.noRefresh+');');	
			}
		}
	}, 	
	evaluateJs: function(){
		var scripts = this.request.responseText.match(/<script[^>]*?>[\S\s]*?<\/script>/g);
		if (scripts){
			for (i =0; i < scripts.length; i++){
				script = scripts[i];
				eval(script.replace(/^<script[^>]*?>/, '').replace(/<\/script>$/, ''));
			}
		}
	},
	cleanUp: function(){
		this.request = null;
	}
}



/**
 * Generic form tools. Mainly used to encode the form so it can be submitted via ajax
 */
var FormTools = {
	/**
	 * Encodes the form
	 */		
	encode: function (form){
		var encodedElements = new Array();
		form = eId(form);
		if (!form) return '';
		//Iterate through the form elements
		for (var i = 0; i < form.elements.length; i++){			
			enc = FormTools.encodeElement(form.elements[i]);
			if (typeof enc == 'string'){
				encodedElements.push(enc);
			}
		}
		
		encodedString = encodedElements.join('&');
		return(encodedString);
		
	},
	/**
	 * Encodes the element
	 */
	encodeElement: function(element){
		//check the type
		var ret = false;
		eType = element.type;
		
		if (eType == 'checkbox' || eType == 'radio'){
			ret = FormTools.encodeCheckboxRadio(element);				
		} else if (eType == 'select-multiple'){
			
		} else {
			ret = FormTools.encodeSimple(element);
		}
		return ret;	
	},
	
	/**
	 * Encode simple fields such as text, textarea, hidden, 
	 */
	encodeSimple: function (element){
		ret = false;
		if (element.name){
			ret = element.name + '=' + encodeURIComponent(element.value);
		}
		return ret;
	},
	encodeCheckboxRadio: function (element){
		ret = false;
		if (element.checked){
			ret = element.name + '=' + encodeURIComponent(element.value);
		}

		return ret;
	}
}

/**
 * eId - get document element by id.
 * @param string - the name of the id
 * @return element
 */
var eId = function (e){
	var ret  = false;
	
	if (typeof e == 'string'){
		ret = document.getElementById(e) || false;
	} else if (typeof e == 'object'){
		ret = e;
	}
	return ret;
}

var toggleSearch = null;
window.addEvent('domready', function(){
	toggleSearch = new TogglePanel({handlers : '#search a.search-button', 
						panel : 'search-bar',
						container : 'search',
						closeBtn : '#search .search-bar-close',
						callBack : function(e) {
								var input = this.panel.getElement('input[type=text]');
								input.focus();
							}
						});
});

TogglePanel = new Class ({
	Implements: [Options],

	options: {
		handlers : 'handlers',
		panel : 'panels',
		container : 'container',
		closeBtn: '.close',
		callBack : null
	},

	handlers : null,
	panel : null,
	container : null,
	closeBtn : null,

	initialize: function(options) {
		this.setOptions(options);
		this.handlers = $$(this.options.handlers);
		this.panel = $(this.options.panel);
		this.panel.removeClass('hidden');
		this.container = $(this.options.container);
		this.closeBtn = $$(this.options.closeBtn);
		this.run();
	},

	run: function() {	
		//var searchSlide = new Fx.Slide(this.panel).hide();
		this.panel.slide('hide');
		this.handlers.addEvent('click', function(e) {
			e.stop();
			var slideInt = this.panel.get('slide');
			if (slideInt.open) {
				slideInt.slideOut();
			} else {
				slideInt.slideIn();
			}
			//this.panel.slide('toggle');
		}.bindWithEvent(this));
		if( this.closeBtn) {
			this.closeBtn.addEvent('click', function(e) {
				e.stop();
				this.panel.slide('out');
			}.bindWithEvent(this));
		}
		if (this.options.callBack) {
			var searchSlide = this.panel.get('slide');
			searchSlide.addEvent('complete', this.options.callBack.bindWithEvent(this));
		}
		$(document.body).addEvent('click', function(e) {
			var slideInt = this.panel.get('slide');
			if(!this.panel.hasChild(e.target) && this.panel.id != e.target.id) {
				if (slideInt.open) {
					slideInt.slideOut();
				}
			}
		}.bindWithEvent(this));
	}
});

var onloadEvents = new Array();

function addToOnload(event){
	onloadEvents.push(event);
	window.onload = function() { 
		for (var x = 0; x < onloadEvents.length; x ++) {
			eval(onloadEvents[x]);
		}
	}
}
sfHover = function() {
	var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {

		var className = this.className;
		if(className == 'first' || className == 'last' || className == '') continue;
	
		sfEls[i].onmouseover=function() {
			var className = this.className;
			if(className.indexOf(' ') != -1) {
				var className = className.substr(0, className.indexOf(' '));
			}
			this.className+=" "+className+"-sfhover";
			hideSelects(this, true);
		}
		sfEls[i].onmouseout=function() {
			var className = this.className;
		
			if(className.indexOf(' ') != false) {
				var className = className.substr(0, className.indexOf(' '));
			}
			this.className=this.className.replace(new RegExp(" "+className+"-sfhover\\b"), "");
			hideSelects(this, false);
		}
	}
}

function hideSelects(element, hide) {
	if(hide) {
		visibility = 'hidden';
	} else {
		visibility = 'visible';
	}
	// are we on the home page.

	if(document.getElementById('home')) {
		var selects = document.getElementsByTagName('select');
		for(var i = 0; i < selects.length; i++) {
			selects[i].style.visibility = visibility;
		}
	}
	return;
	var shimID = 'shim-'+element.className.substr(4);
	//var selects = document.getElementsByTagName('select');
	//for(var i = 0; i < selects.length; i++) {
		if(!hide) {
			
			if(document.getElementById(shimID) == null) {
				var tmp = document.createElement('iframe');
				tmp.id = shimID;
				tmp.style.background = 'red';
				tmp.style.position = 'absolute';
				tmp.style.top = '30px';
				tmp.style.left = '0';
				tmp.style.width = '310px';
				tmp.style.zIndex = '9998';
				tmp.style.filter = 'progidXImageTransform.Microsoft.Alpha(style=0,op acity=0)';
				tmp.frameBorder = 0;
				
				element.appendChild(tmp);
				
				/*var iframeShim = new Element('div', {
					id: 'shim',
					src: 'javascript: false; document.write("");',
					frameBorder: 0,
					style: {
						'z-index': 9998
					}
				});*/
			} else {
				document.getElementById(shimID).style.display = 'block';
			}
		} else {
			window.status = document.getElementById(shimID);
			if(document.getElementById(shimID) != null) {
				//alert('asdf');
				document.getElementById(shimID).style.display = 'none';
			}
		}

		
		//selects[i].style.visibility = visibility;
	//}
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

// only attach for ie
if (window.attachEvent) window.attachEvent("onload", sfHover);
//uncomment these lines to activate whatever you need
//addToOnload('pageControl.init()');
//addToOnload('searchBar.init()');

addToOnload('SqueezeBox.initialize({overlayOpacity : 0.5});');

function processKeyPress(e){
	var e = window.event  || e;
	
	try {
		var key = e.keyCode || e.which;
	} catch (e){
		var key = 0;
	}
	//Esc or x (lowercase)
	if (key == 27 || key == 120) closePopup();
	
}

function closePopup() {
	e = document.getElementById('map-display');
	if (e){
		e.parentNode.removeChild(e);
	} 
}

function popupKeyListener() {document.onkeypress = processKeyPress; }

function getWindowDimensions(){
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth, myHeight];
}
/*
allHeadingsForMootools = function() {
	return (
			'h1' == this.get('tag') ||
			'h2' == this.get('tag') ||
			'h3' == this.get('tag') ||
			'h4' == this.get('tag') ||
			'h5' == this.get('tag') ||
			'h6' == this.get('tag')
	);
};

addToOnload(function() {
	if (Selectors) {
		Selectors.Pseudo.heading = allHeadingsForMootools;
	}
});
*/


function spamCheckInit(){
    $('spam-tip').setStyle('display', 'none');
    $('spam-check-hint').addEvent('click', function(e){
	if ( $('spam-tip').getStyle('display') == 'block') {
	    $('spam-tip').setStyle('display', 'none');
	    $('spam-check-hint').innerHTML = 'Why';
	} else {
	    $('spam-tip').setStyle('display', 'block');
	    $('spam-check-hint').innerHTML = 'Hide';
	}

    });
}


var BoxTools = {
	postingFeedback : function(element, state, noRefresh){
		if (state == 'processing'){
			BoxTools.displayBusySignal(element);
		} else if (state == 'ready'){
			BoxTools.clearBusySignal(element, noRefresh);
		}
	},
	displayBusySignal: function(element){
		var pNode = $(element);
		//Generate a prefix id for our feedback animation containers.
		var idPrefix = pNode.id+'_';

		var containerWidth = pNode.offsetWidth-4;
		var containerHeight = pNode.offsetHeight;

		var busySignal = document.getElementById(idPrefix+'busySignal');
		var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');

		if (!busySignal){
//			var inputs = pNode.getElements('input');
//			inputs.each(function(i) {
//			   if (i.get('type') == 'text' || i.get('type') == 'password'){
//				i.addClass('busyStatus');
//			   }
//			});
//			var textareas = pNode.getElements('textarea');
//			textareas.each(function(i) {
//			   i.addClass('busyStatus');
//			});

			var busySignalContainer = document.createElement('div');
			busySignalContainer.id = idPrefix+'busySignalContainer';
			busySignalContainer.className = 'busySignalContainer';

			var busySignal = document.createElement('div');
			busySignal.id = idPrefix+"busySignal";
			busySignal.className = "busySignal";
			//busySignal.style.marginLeft = '2px';

			pNode.parentNode.insertBefore(busySignalContainer, pNode);

			//Get the graph container and append the graph to it
			var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');
			busySignalContainer.appendChild(busySignal);
		}

		try {
			busySignal.style.filter = 'alpha(opacity=50)';
			busySignal.style.height = containerHeight + "px";
			busySignal.style.width = containerWidth+'px';
		} catch(e) {
			// do nothing
		}
	},
	clearBusySignal: function (element, noRefresh){
		var pNode = $(element);
		//Generate a prefix id for our feedback animation containers.
		var idPrefix = pNode.id+'_';

		var inputs = pNode.getElements('input');
		inputs.each(function(i) {
			if (i.get('type') == 'text' || i.get('type') == 'password'){
				i.removeClass('busyStatus');
			}
		});
		var textareas = pNode.getElements('textarea');
		textareas.each(function(i) {
			i.removeClass('busyStatus');
		});

		var busySignalContainer = document.getElementById(idPrefix+'busySignalContainer');
		if (busySignalContainer){
			var busySignal = document.getElementById(idPrefix+'busySignal');
			if (busySignal){
				busySignal.parentNode.removeChild(busySignal);
			}
			busySignalContainer.parentNode.removeChild(busySignalContainer);
		}
	},

	attachMovement: function (direction, nodeDepth){
		//Get Id of Containing Div
		//a => span => div

		var nodeDepth = nodeDepth || 1;

		var thisItem = $(this);

		for (var i = 1; i < nodeDepth; i ++	){
			thisItem = thisItem.getParent();
		}
		try {
			var prevItem = thisItem.getPrevious() || null;
			var nextItem = thisItem.getNext() || null;
		} catch(e) {
			var prevItem = null;
			var nextItem = null;
		}

		//parentElement.insertBefore(newElement, referenceElement)
		if (direction == 'down'){
			if (nextItem != null){
				BoxTools.attachAfter(thisItem, nextItem);
			}
		}

		if (direction == 'up'){
			if (prevItem != null){
				BoxTools.attachBefore(thisItem, prevItem);
			}
		}
		return false;
	},
	attachRemove: function(nodeDepth){
		var thisItem = this;
		for (var i = 1; i < nodeDepth; i ++	){
			thisItem = thisItem.parentNode;
		}
		//Remove everything inside
		while (thisItem.firstChild)
		{
			thisItem.removeChild(thisItem.firstChild);
		}
		//Remove the div now
		thisItem.parentNode.removeChild(thisItem);

	},
	attachAfter: function(newElement, referenceElement){
		var pNode = referenceElement.parentNode;
		pNode.insertBefore(newElement, referenceElement.nextSibling);
		AssetManager.moveAsset(referenceElement.id, newElement.id);
		return false;
	},
	attachBefore: function(newElement, referenceElement){
		var pNode = referenceElement.parentNode;
		var refId = referenceElement.id;
		if (refId){
			var idBits = refId.split('_');
			if (idBits[0] == 'LOCKED'){
				return false;
			}
		}
		pNode.insertBefore(newElement, referenceElement);
		AssetManager.moveAsset(newElement.id, referenceElement.id);
		return false;
	}
}


var Message = {
	init : function(){
		Message.getMessage();
	},
	addMessage : function(msg, className){
		var messageContainer = $('message-container');
		if (!messageContainer){
			return;
		}
		var ifMesgExists = false;
		var msgDivs = messageContainer.getElements('div');

		msgDivs.each(function(i){
			if (i.className == className){
				i.set('html', msg);
				ifMesgExists = true;
			}
		});
		if (!ifMesgExists ){
			var messageDiv = document.createElement('div');
			messageDiv.className = className;
			//messageDiv.set('html',msg);
			messageContainer.appendChild(messageDiv);
			messageDiv.innerHTML = msg;
		}
		//Message.getMessage();
	},
	getMessage : function(){
		var messageContainer = $('message-container');
		if (!messageContainer){
			return;
		}
		messageContainer.setStyle('opacity', 1);
		//messageContainer.innerHTML = responseText;
		setTimeout('Message.startMessageContainer()', 800);
	},
	startMessageContainer : function() {
		var messageContainer = $('message-container');
		if(messageContainer) {
			var fx = new Fx.Morph(messageContainer, {duration: 10000, transition: Fx.Transitions.Sine.easeOut});
			fx.start({'opacity' : 0});
			setTimeout('Message.checkMessageContainer()', 2000);
		}
	},
	checkMessageContainer : function() {
		var messageContainer = $('message-container');
		if(messageContainer) {
			var myFx = new Fx.Slide(messageContainer, {
				onComplete: function(){
					messageContainer.dispose();
				}
			}).slideOut();
		}
	}
}

/**
 * @param {Object} field_name - the fieldname to update
 * @param {Object} url - the url this asset browser is opening
 * @param {string} className - the name of asset
 * @param {int} width - the width of jsWindow
 * @param {int} height - the height of jsWindow
 * @param {string} scrolling - scroll statua of jsWindow
 * @param {bool} addBar - bar status of jsWindow
 */
function customAssetBrowser(field_name, url, className, width, height, scrolling, addBar){
	if (JsWindow && AssetManager){
		JsWindow.open({src : url, width: width, height: height, scrolling: scrolling, addBar : addBar});
		AssetManager.assetField = field_name;
		AssetManager.assetClass = className;
	}
	return false;
}

/*
 * Copyright (c) 2009 Simo Kinnunen.
 * Licensed under the MIT license.
 *
 * @version 1.09
 */
var Cufon=(function(){var m=function(){return m.replace.apply(null,arguments)};var x=m.DOM={ready:(function(){var C=false,E={loaded:1,complete:1};var B=[],D=function(){if(C){return}C=true;for(var F;F=B.shift();F()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",D,false);window.addEventListener("pageshow",D,false)}if(!window.opera&&document.readyState){(function(){E[document.readyState]?D():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");D()}catch(F){setTimeout(arguments.callee,1)}})()}q(window,"load",D);return function(F){if(!arguments.length){D()}else{C?F():B.push(F)}}})(),root:function(){return document.documentElement||document.body}};var n=m.CSS={Size:function(C,B){this.value=parseFloat(C);this.unit=String(C).match(/[a-z%]*$/)[0]||"px";this.convert=function(D){return D/B*this.value};this.convertFrom=function(D){return D/this.value*B};this.toString=function(){return this.value+this.unit}},addClass:function(C,B){var D=C.className;C.className=D+(D&&" ")+B;return C},color:j(function(C){var B={};B.color=C.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(E,D,F){B.opacity=parseFloat(F);return"rgb("+D+")"});return B}),fontStretch:j(function(B){if(typeof B=="number"){return B}if(/%$/.test(B)){return parseFloat(B)/100}return{"ultra-condensed":0.5,"extra-condensed":0.625,condensed:0.75,"semi-condensed":0.875,"semi-expanded":1.125,expanded:1.25,"extra-expanded":1.5,"ultra-expanded":2}[B]||1}),getStyle:function(C){var B=document.defaultView;if(B&&B.getComputedStyle){return new a(B.getComputedStyle(C,null))}if(C.currentStyle){return new a(C.currentStyle)}return new a(C.style)},gradient:j(function(F){var G={id:F,type:F.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},C=F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var E=0,B=C.length,D;E<B;++E){D=C[E].split("=",2).reverse();G.stops.push([D[1]||E/(B-1),D[0]])}return G}),quotedList:j(function(E){var D=[],C=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,B;while(B=C.exec(E)){D.push(B[3]||B[1])}return D}),recognizesMedia:j(function(G){var E=document.createElement("style"),D,C,B;E.type="text/css";E.media=G;try{E.appendChild(document.createTextNode("/**/"))}catch(F){}C=g("head")[0];C.insertBefore(E,C.firstChild);D=(E.sheet||E.styleSheet);B=D&&!D.disabled;C.removeChild(E);return B}),removeClass:function(D,C){var B=RegExp("(?:^|\\s+)"+C+"(?=\\s|$)","g");D.className=D.className.replace(B,"");return D},supports:function(D,C){var B=document.createElement("span").style;if(B[D]===undefined){return false}B[D]=C;return B[D]===C},textAlign:function(E,D,B,C){if(D.get("textAlign")=="right"){if(B>0){E=" "+E}}else{if(B<C-1){E+=" "}}return E},textShadow:j(function(F){if(F=="none"){return null}var E=[],G={},B,C=0;var D=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(B=D.exec(F)){if(B[0]==","){E.push(G);G={};C=0}else{if(B[1]){G.color=B[1]}else{G[["offX","offY","blur"][C++]]=B[2]}}}E.push(G);return E}),textTransform:(function(){var B={uppercase:function(C){return C.toUpperCase()},lowercase:function(C){return C.toLowerCase()},capitalize:function(C){return C.replace(/\b./g,function(D){return D.toUpperCase()})}};return function(E,D){var C=B[D.get("textTransform")];return C?C(E):E}})(),whiteSpace:(function(){var D={inline:1,"inline-block":1,"run-in":1};var C=/^\s+/,B=/\s+$/;return function(H,F,G,E){if(E){if(E.nodeName.toLowerCase()=="br"){H=H.replace(C,"")}}if(D[F.get("display")]){return H}if(!G.previousSibling){H=H.replace(C,"")}if(!G.nextSibling){H=H.replace(B,"")}return H}})()};n.ready=(function(){var B=!n.recognizesMedia("all"),E=false;var D=[],H=function(){B=true;for(var K;K=D.shift();K()){}};var I=g("link"),J=g("style");function C(K){return K.disabled||G(K.sheet,K.media||"screen")}function G(M,P){if(!n.recognizesMedia(P||"all")){return true}if(!M||M.disabled){return false}try{var Q=M.cssRules,O;if(Q){search:for(var L=0,K=Q.length;O=Q[L],L<K;++L){switch(O.type){case 2:break;case 3:if(!G(O.styleSheet,O.media.mediaText)){return false}break;default:break search}}}}catch(N){}return true}function F(){if(document.createStyleSheet){return true}var L,K;for(K=0;L=I[K];++K){if(L.rel.toLowerCase()=="stylesheet"&&!C(L)){return false}}for(K=0;L=J[K];++K){if(!C(L)){return false}}return true}x.ready(function(){if(!E){E=n.getStyle(document.body).isUsable()}if(B||(E&&F())){H()}else{setTimeout(arguments.callee,10)}});return function(K){if(B){K()}else{D.push(K)}}})();function s(D){var C=this.face=D.face,B={"\u0020":1,"\u00a0":1,"\u3000":1};this.glyphs=D.glyphs;this.w=D.w;this.baseSize=parseInt(C["units-per-em"],10);this.family=C["font-family"].toLowerCase();this.weight=C["font-weight"];this.style=C["font-style"]||"normal";this.viewBox=(function(){var F=C.bbox.split(/\s+/);var E={minX:parseInt(F[0],10),minY:parseInt(F[1],10),maxX:parseInt(F[2],10),maxY:parseInt(F[3],10)};E.width=E.maxX-E.minX;E.height=E.maxY-E.minY;E.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")};return E})();this.ascent=-parseInt(C.ascent,10);this.descent=-parseInt(C.descent,10);this.height=-this.ascent+this.descent;this.spacing=function(L,N,E){var O=this.glyphs,M,K,G,P=[],F=0,J=-1,I=-1,H;while(H=L[++J]){M=O[H]||this.missingGlyph;if(!M){continue}if(K){F-=G=K[H]||0;P[I]-=G}F+=P[++I]=~~(M.w||this.w)+N+(B[H]?E:0);K=M.k}P.total=F;return P}}function f(){var C={},B={oblique:"italic",italic:"oblique"};this.add=function(D){(C[D.style]||(C[D.style]={}))[D.weight]=D};this.get=function(H,I){var G=C[H]||C[B[H]]||C.normal||C.italic||C.oblique;if(!G){return null}I={normal:400,bold:700}[I]||parseInt(I,10);if(G[I]){return G[I]}var E={1:1,99:0}[I%100],K=[],F,D;if(E===undefined){E=I>400}if(I==500){I=400}for(var J in G){if(!k(G,J)){continue}J=parseInt(J,10);if(!F||J<F){F=J}if(!D||J>D){D=J}K.push(J)}if(I<F){I=F}if(I>D){I=D}K.sort(function(M,L){return(E?(M>=I&&L>=I)?M<L:M>L:(M<=I&&L<=I)?M>L:M<L)?-1:1});return G[K[0]]}}function r(){function D(F,G){if(F.contains){return F.contains(G)}return F.compareDocumentPosition(G)&16}function B(G){var F=G.relatedTarget;if(!F||D(this,F)){return}C(this,G.type=="mouseover")}function E(F){C(this,F.type=="mouseenter")}function C(F,G){setTimeout(function(){var H=d.get(F).options;m.replace(F,G?h(H,H.hover):H,true)},10)}this.attach=function(F){if(F.onmouseenter===undefined){q(F,"mouseover",B);q(F,"mouseout",B)}else{q(F,"mouseenter",E);q(F,"mouseleave",E)}}}function u(){var C=[],D={};function B(H){var E=[],G;for(var F=0;G=H[F];++F){E[F]=C[D[G]]}return E}this.add=function(F,E){D[F]=C.push(E)-1};this.repeat=function(){var E=arguments.length?B(arguments):C,F;for(var G=0;F=E[G++];){m.replace(F[0],F[1],true)}}}function A(){var D={},B=0;function C(E){return E.cufid||(E.cufid=++B)}this.get=function(E){var F=C(E);return D[F]||(D[F]={})}}function a(B){var D={},C={};this.extend=function(E){for(var F in E){if(k(E,F)){D[F]=E[F]}}return this};this.get=function(E){return D[E]!=undefined?D[E]:B[E]};this.getSize=function(F,E){return C[F]||(C[F]=new n.Size(this.get(F),E))};this.isUsable=function(){return !!B}}function q(C,B,D){if(C.addEventListener){C.addEventListener(B,D,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){return D.call(C,window.event)})}}}function v(C,B){var D=d.get(C);if(D.options){return C}if(B.hover&&B.hoverables[C.nodeName.toLowerCase()]){b.attach(C)}D.options=B;return C}function j(B){var C={};return function(D){if(!k(C,D)){C[D]=B.apply(null,arguments)}return C[D]}}function c(F,E){var B=n.quotedList(E.get("fontFamily").toLowerCase()),D;for(var C=0;D=B[C];++C){if(i[D]){return i[D].get(E.get("fontStyle"),E.get("fontWeight"))}}return null}function g(B){return document.getElementsByTagName(B)}function k(C,B){return C.hasOwnProperty(B)}function h(){var C={},B,F;for(var E=0,D=arguments.length;B=arguments[E],E<D;++E){for(F in B){if(k(B,F)){C[F]=B[F]}}}return C}function o(E,M,C,N,F,D){var K=document.createDocumentFragment(),H;if(M===""){return K}var L=N.separate;var I=M.split(p[L]),B=(L=="words");if(B&&t){if(/^\s/.test(M)){I.unshift("")}if(/\s$/.test(M)){I.push("")}}for(var J=0,G=I.length;J<G;++J){H=z[N.engine](E,B?n.textAlign(I[J],C,J,G):I[J],C,N,F,D,J<G-1);if(H){K.appendChild(H)}}return K}function l(D,M){var C=D.nodeName.toLowerCase();if(M.ignore[C]){return}var E=!M.textless[C];var B=n.getStyle(v(D,M)).extend(M);var F=c(D,B),G,K,I,H,L,J;if(!F){return}for(G=D.firstChild;G;G=I){K=G.nodeType;I=G.nextSibling;if(E&&K==3){if(H){H.appendData(G.data);D.removeChild(G)}else{H=G}if(I){continue}}if(H){D.replaceChild(o(F,n.whiteSpace(H.data,B,H,J),B,M,G,D),H);H=null}if(K==1){if(G.firstChild){if(G.nodeName.toLowerCase()=="cufon"){z[M.engine](F,null,B,M,G,D)}else{arguments.callee(G,M)}}J=G}}}var t=" ".split(/\s+/).length==0;var d=new A();var b=new r();var y=new u();var e=false;var z={},i={},w={autoDetect:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},ignore:{applet:1,canvas:1,col:1,colgroup:1,head:1,iframe:1,map:1,optgroup:1,option:1,script:1,select:1,style:1,textarea:1,title:1,pre:1},printable:true,selector:(window.Sizzle||(window.jQuery&&function(B){return jQuery(B)})||(window.dojo&&dojo.query)||(window.Ext&&Ext.query)||(window.YAHOO&&YAHOO.util&&YAHOO.util.Selector&&YAHOO.util.Selector.query)||(window.$$&&function(B){return $$(B)})||(window.$&&function(B){return $(B)})||(document.querySelectorAll&&function(B){return document.querySelectorAll(B)})||g),separate:"words",textless:{dl:1,html:1,ol:1,table:1,tbody:1,thead:1,tfoot:1,tr:1,ul:1},textShadow:"none"};var p={words:/\s/.test("\u00a0")?/[^\S\u00a0]+/:/\s+/,characters:"",none:/^/};m.now=function(){x.ready();return m};m.refresh=function(){y.repeat.apply(y,arguments);return m};m.registerEngine=function(C,B){if(!B){return m}z[C]=B;return m.set("engine",C)};m.registerFont=function(D){if(!D){return m}var B=new s(D),C=B.family;if(!i[C]){i[C]=new f()}i[C].add(B);return m.set("fontFamily",'"'+C+'"')};m.replace=function(D,C,B){C=h(w,C);if(!C.engine){return m}if(!e){n.addClass(x.root(),"cufon-active cufon-loading");n.ready(function(){n.addClass(n.removeClass(x.root(),"cufon-loading"),"cufon-ready")});e=true}if(C.hover){C.forceHitArea=true}if(C.autoDetect){delete C.fontFamily}if(typeof C.textShadow=="string"){C.textShadow=n.textShadow(C.textShadow)}if(typeof C.color=="string"&&/^-/.test(C.color)){C.textGradient=n.gradient(C.color)}else{delete C.textGradient}if(!B){y.add(D,arguments)}if(D.nodeType||typeof D=="string"){D=[D]}n.ready(function(){for(var F=0,E=D.length;F<E;++F){var G=D[F];if(typeof G=="string"){m.replace(C.selector(G),C,true)}else{l(G,C)}}});return m};m.set=function(B,C){w[B]=C;return m};return m})();Cufon.registerEngine("canvas",(function(){var b=document.createElement("canvas");if(!b||!b.getContext||!b.getContext.apply){return}b=null;var a=Cufon.CSS.supports("display","inline-block");var e=!a&&(document.compatMode=="BackCompat"||/frameset|transitional/i.test(document.doctype.publicId));var f=document.createElement("style");f.type="text/css";f.appendChild(document.createTextNode(("cufon{text-indent:0;}@media screen,projection{cufon{display:inline;display:inline-block;position:relative;vertical-align:middle;"+(e?"":"font-size:1px;line-height:1px;")+"}cufon cufontext{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}"+(a?"cufon canvas{position:relative;}":"cufon canvas{position:absolute;}")+"}@media print{cufon{padding:0;}cufon canvas{display:none;}}").replace(/;/g,"!important;")));document.getElementsByTagName("head")[0].appendChild(f);function d(p,h){var n=0,m=0;var g=[],o=/([mrvxe])([^a-z]*)/g,k;generate:for(var j=0;k=o.exec(p);++j){var l=k[2].split(",");switch(k[1]){case"v":g[j]={m:"bezierCurveTo",a:[n+~~l[0],m+~~l[1],n+~~l[2],m+~~l[3],n+=~~l[4],m+=~~l[5]]};break;case"r":g[j]={m:"lineTo",a:[n+=~~l[0],m+=~~l[1]]};break;case"m":g[j]={m:"moveTo",a:[n=~~l[0],m=~~l[1]]};break;case"x":g[j]={m:"closePath"};break;case"e":break generate}h[g[j].m].apply(h,g[j].a)}return g}function c(m,k){for(var j=0,h=m.length;j<h;++j){var g=m[j];k[g.m].apply(k,g.a)}}return function(V,w,P,t,C,W){var k=(w===null);if(k){w=C.getAttribute("alt")}var A=V.viewBox;var m=P.getSize("fontSize",V.baseSize);var B=0,O=0,N=0,u=0;var z=t.textShadow,L=[];if(z){for(var U=z.length;U--;){var F=z[U];var K=m.convertFrom(parseFloat(F.offX));var I=m.convertFrom(parseFloat(F.offY));L[U]=[K,I];if(I<B){B=I}if(K>O){O=K}if(I>N){N=I}if(K<u){u=K}}}var Z=Cufon.CSS.textTransform(w,P).split("");var E=V.spacing(Z,~~m.convertFrom(parseFloat(P.get("letterSpacing"))||0),~~m.convertFrom(parseFloat(P.get("wordSpacing"))||0));if(!E.length){return null}var h=E.total;O+=A.width-E[E.length-1];u+=A.minX;var s,n;if(k){s=C;n=C.firstChild}else{s=document.createElement("cufon");s.className="cufon cufon-canvas";s.setAttribute("alt",w);n=document.createElement("canvas");s.appendChild(n);if(t.printable){var S=document.createElement("cufontext");S.appendChild(document.createTextNode(w));s.appendChild(S)}}var aa=s.style;var H=n.style;var j=m.convert(A.height);var Y=Math.ceil(j);var M=Y/j;var G=M*Cufon.CSS.fontStretch(P.get("fontStretch"));var J=h*G;var Q=Math.ceil(m.convert(J+O-u));var o=Math.ceil(m.convert(A.height-B+N));n.width=Q;n.height=o;H.width=Q+"px";H.height=o+"px";B+=A.minY;H.top=Math.round(m.convert(B-V.ascent))+"px";H.left=Math.round(m.convert(u))+"px";var r=Math.max(Math.ceil(m.convert(J)),0)+"px";if(a){aa.width=r;aa.height=m.convert(V.height)+"px"}else{aa.paddingLeft=r;aa.paddingBottom=(m.convert(V.height)-1)+"px"}var X=n.getContext("2d"),D=j/A.height;X.scale(D,D*M);X.translate(-u,-B);X.save();function T(){var x=V.glyphs,ab,l=-1,g=-1,y;X.scale(G,1);while(y=Z[++l]){var ab=x[Z[l]]||V.missingGlyph;if(!ab){continue}if(ab.d){X.beginPath();if(ab.code){c(ab.code,X)}else{ab.code=d("m"+ab.d,X)}X.fill()}X.translate(E[++g],0)}X.restore()}if(z){for(var U=z.length;U--;){var F=z[U];X.save();X.fillStyle=F.color;X.translate.apply(X,L[U]);T()}}var q=t.textGradient;if(q){var v=q.stops,p=X.createLinearGradient(0,A.minY,0,A.maxY);for(var U=0,R=v.length;U<R;++U){p.addColorStop.apply(p,v[U])}X.fillStyle=p}else{X.fillStyle=P.get("color")}T();return s}})());Cufon.registerEngine("vml",(function(){var e=document.namespaces;if(!e){return}e.add("cvml","urn:schemas-microsoft-com:vml");e=null;var b=document.createElement("cvml:shape");b.style.behavior="url(#default#VML)";if(!b.coordsize){return}b=null;var h=(document.documentMode||0)<8;document.write(('<style type="text/css">cufoncanvas{text-indent:0;}@media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}cufoncanvas{position:absolute;text-align:left;}cufon{display:inline-block;position:relative;vertical-align:'+(h?"middle":"text-bottom")+";}cufon cufontext{position:absolute;left:-10000in;font-size:1px;}a cufon{cursor:pointer}}@media print{cufon cufoncanvas{display:none;}}</style>").replace(/;/g,"!important;"));function c(i,j){return a(i,/(?:em|ex|%)$|^[a-z-]+$/i.test(j)?"1em":j)}function a(l,m){if(m==="0"){return 0}if(/px$/i.test(m)){return parseFloat(m)}var k=l.style.left,j=l.runtimeStyle.left;l.runtimeStyle.left=l.currentStyle.left;l.style.left=m.replace("%","em");var i=l.style.pixelLeft;l.style.left=k;l.runtimeStyle.left=j;return i}function f(l,k,j,n){var i="computed"+n,m=k[i];if(isNaN(m)){m=k.get(n);k[i]=m=(m=="normal")?0:~~j.convertFrom(a(l,m))}return m}var g={};function d(p){var q=p.id;if(!g[q]){var n=p.stops,o=document.createElement("cvml:fill"),i=[];o.type="gradient";o.angle=180;o.focus="0";o.method="sigma";o.color=n[0][1];for(var m=1,l=n.length-1;m<l;++m){i.push(n[m][0]*100+"% "+n[m][1])}o.colors=i.join(",");o.color2=n[l][1];g[q]=o}return g[q]}return function(ac,G,Y,C,K,ad,W){var n=(G===null);if(n){G=K.alt}var I=ac.viewBox;var p=Y.computedFontSize||(Y.computedFontSize=new Cufon.CSS.Size(c(ad,Y.get("fontSize"))+"px",ac.baseSize));var y,q;if(n){y=K;q=K.firstChild}else{y=document.createElement("cufon");y.className="cufon cufon-vml";y.alt=G;q=document.createElement("cufoncanvas");y.appendChild(q);if(C.printable){var Z=document.createElement("cufontext");Z.appendChild(document.createTextNode(G));y.appendChild(Z)}if(!W){y.appendChild(document.createElement("cvml:shape"))}}var ai=y.style;var R=q.style;var l=p.convert(I.height),af=Math.ceil(l);var V=af/l;var P=V*Cufon.CSS.fontStretch(Y.get("fontStretch"));var U=I.minX,T=I.minY;R.height=af;R.top=Math.round(p.convert(T-ac.ascent));R.left=Math.round(p.convert(U));ai.height=p.convert(ac.height)+"px";var F=Y.get("color");var ag=Cufon.CSS.textTransform(G,Y).split("");var L=ac.spacing(ag,f(ad,Y,p,"letterSpacing"),f(ad,Y,p,"wordSpacing"));if(!L.length){return null}var k=L.total;var x=-U+k+(I.width-L[L.length-1]);var ah=p.convert(x*P),X=Math.round(ah);var O=x+","+I.height,m;var J="r"+O+"ns";var u=C.textGradient&&d(C.textGradient);var o=ac.glyphs,S=0;var H=C.textShadow;var ab=-1,aa=0,w;while(w=ag[++ab]){var D=o[ag[ab]]||ac.missingGlyph,v;if(!D){continue}if(n){v=q.childNodes[aa];while(v.firstChild){v.removeChild(v.firstChild)}}else{v=document.createElement("cvml:shape");q.appendChild(v)}v.stroked="f";v.coordsize=O;v.coordorigin=m=(U-S)+","+T;v.path=(D.d?"m"+D.d+"xe":"")+"m"+m+J;v.fillcolor=F;if(u){v.appendChild(u.cloneNode(false))}var ae=v.style;ae.width=X;ae.height=af;if(H){var s=H[0],r=H[1];var B=Cufon.CSS.color(s.color),z;var N=document.createElement("cvml:shadow");N.on="t";N.color=B.color;N.offset=s.offX+","+s.offY;if(r){z=Cufon.CSS.color(r.color);N.type="double";N.color2=z.color;N.offset2=r.offX+","+r.offY}N.opacity=B.opacity||(z&&z.opacity)||1;v.appendChild(N)}S+=L[aa++]}var M=v.nextSibling,t,A;if(C.forceHitArea){if(!M){M=document.createElement("cvml:rect");M.stroked="f";M.className="cufon-vml-cover";t=document.createElement("cvml:fill");t.opacity=0;M.appendChild(t);q.appendChild(M)}A=M.style;A.width=X;A.height=af}else{if(M){q.removeChild(M)}}ai.width=Math.max(Math.ceil(p.convert(k*P)),0);if(h){var Q=Y.computedYAdjust;if(Q===undefined){var E=Y.get("lineHeight");if(E=="normal"){E="1em"}else{if(!isNaN(E)){E+="em"}}Y.computedYAdjust=Q=0.5*(a(ad,E)-parseFloat(ai.height))}if(Q){ai.marginTop=Math.ceil(Q)+"px";ai.marginBottom=Q+"px"}}return y}})());

/*!
 * The following copyright notice may not be removed under any circumstances.
 * 
 * Copyright:
 * Copyright (c) 2007 Monotype Imaging Inc. Soho is designed by Sebastian Lester.
 * All rights reserved.
 * 
 * Trademark:
 * Soho is a trademark of Monotype Imaging, Inc and may be registered in certain
 * jurisdictions.
 * 
 * Full name:
 * SohoStd-Medium
 * 
 * Manufacturer:
 * Sebastian Lester
 * 
 * Designer:
 * Sebastian Lester
 * 
 * Vendor URL:
 * http://www.monotypeimaging.com
 * 
 * License information:
 * http://www.monotypeimaging.com
 */
Cufon.registerFont({"w":222,"face":{"font-family":"Soho Std","font-weight":500,"font-stretch":"normal","units-per-em":"360","panose-1":"2 4 6 3 4 5 6 2 2 4","ascent":"280","descent":"-80","x-height":"5","bbox":"-9 -309 381 79.0998","underline-thickness":"14.04","underline-position":"-17.64","stemh":"40","stemv":"48","unicode-range":"U+0020-U+007E"},"glyphs":{" ":{"w":70,"k":{"s":4,"S":3,".":7,",":12}},"!":{"d":"76,0r-49,0r0,-55r49,0r0,55xm77,-280r-4,204r-43,0r-5,-204r52,0","w":102},"\"":{"d":"140,-276r-19,92r-34,0r9,-92r44,0xm60,-276r-43,0r-10,92r34,0","w":147},"#":{"d":"246,-67r-50,0r-7,67r-41,0r8,-67r-55,0r-7,67r-41,0r7,-67r-33,0r0,-35r37,0r7,-60r-44,0r0,-35r48,0r8,-70r40,0r-8,70r55,0r8,-70r40,0r-7,70r35,0r0,35r-39,0r-7,60r46,0r0,35xm166,-162r-55,0r-6,60r54,0","w":273},"$":{"d":"210,-72v0,43,-25,69,-72,75r0,42r-42,0r0,-40v-27,-1,-53,-5,-65,-8r0,-60r33,0r3,26v36,2,98,4,92,-34v4,-30,-52,-45,-76,-57v-35,-18,-59,-34,-59,-75v0,-40,24,-62,72,-68r0,-38r42,0r0,37v27,1,53,5,63,8r0,57r-34,0r-4,-23v-34,-3,-92,-8,-89,27v-4,28,51,43,75,54v39,18,61,37,61,77","w":233},"%":{"d":"381,-88v0,57,-17,92,-67,92v-51,0,-67,-35,-67,-92v0,-50,22,-76,67,-76v44,0,67,26,67,76xm314,-27v22,6,29,-26,29,-61v0,-37,-12,-45,-29,-45v-22,-6,-29,26,-29,61v0,37,12,45,29,45xm309,-268r-175,268r-43,0r175,-268r43,0xm154,-197v0,55,-12,93,-67,93v-55,0,-67,-39,-67,-93v0,-45,18,-76,67,-76v49,0,67,30,67,76xm87,-135v25,0,29,-28,29,-62v0,-35,-9,-45,-29,-45v-25,0,-29,27,-29,61v0,35,9,46,29,46","w":401},"&":{"d":"265,-133r-18,3v0,33,-6,61,-21,84r37,35r0,11r-55,0r-14,-14v-47,28,-174,37,-174,-53v0,-31,11,-51,48,-70v-58,-42,-49,-136,52,-136v32,0,66,6,79,9r0,57r-32,0r-4,-25v-25,-1,-83,-11,-83,24v0,18,8,27,29,47r88,86v6,-14,10,-34,10,-55r-18,-3r0,-28r76,0r0,28xm166,-41r-71,-69v-43,19,-32,79,22,79v21,0,39,-4,49,-10","w":280},"'":{"d":"60,-276r-19,92r-34,0r10,-92r43,0","w":67},"(":{"d":"123,73r-44,0v-25,-32,-57,-92,-56,-171v0,-78,31,-137,56,-169r44,0v-68,84,-68,256,0,340","w":137},")":{"d":"114,-98v1,79,-31,139,-55,171r-45,0v69,-84,70,-256,0,-340r45,0v24,32,55,91,55,169","w":137},"*":{"d":"174,-211v-17,4,-33,11,-51,13v13,12,22,26,33,39r-29,23v-10,-14,-21,-26,-29,-42v-8,16,-19,28,-29,41r-29,-22v11,-13,19,-26,32,-39v-18,-2,-33,-9,-49,-13r11,-36v17,5,33,10,48,17v-2,-17,-2,-32,-2,-50r36,0v0,18,1,34,-2,51v15,-8,31,-13,48,-18","w":196},"+":{"d":"217,-120r-73,0r0,73r-37,0r0,-73r-75,0r0,-39r75,0r0,-73r37,0r0,73r73,0r0,39","w":248},",":{"d":"96,-56r-46,89r-40,0r34,-89r52,0","w":114,"k":{"*":25}},"-":{"d":"116,-87r-92,0r0,-38r92,0r0,38","w":140},".":{"d":"75,0r-48,0r0,-55r48,0r0,55","w":101,"k":{"*":25}},"\/":{"d":"158,-267r-104,267r-48,0r105,-267r47,0","w":164},"0":{"d":"224,-153v0,94,-21,158,-102,158v-82,0,-102,-64,-102,-158v0,-78,34,-120,102,-120v67,0,102,42,102,120xm122,-36v43,10,51,-57,51,-117v0,-60,-20,-78,-51,-78v-42,-10,-51,57,-51,117v0,60,21,78,51,78","w":243},"1":{"d":"190,0r-169,0r0,-39r60,-2r0,-179r-60,17r0,-40v35,-10,61,-30,110,-26r0,228r59,2r0,39","w":210},"2":{"d":"201,0r-179,0v-3,-85,10,-115,81,-151v47,-24,51,-32,51,-52v0,-34,-55,-32,-93,-28r-3,24r-33,0r0,-56v11,-4,51,-10,82,-10v68,0,98,20,98,67v0,35,-16,57,-71,87v-55,30,-64,37,-63,77r94,0r3,-23r33,0r0,65","w":224,"k":{"4":1}},"3":{"d":"206,-81v3,64,-31,86,-100,86v-32,0,-68,-6,-81,-10r0,-58r33,0r4,27v46,2,102,9,94,-46v10,-47,-73,-35,-117,-36r0,-38v47,-2,129,13,117,-41v9,-40,-53,-36,-94,-34r-3,24r-33,0r0,-56v9,-3,48,-10,80,-10v68,0,101,19,100,77v0,23,-9,46,-32,58v24,12,32,34,32,57","w":226},"4":{"d":"230,-64r-38,0r0,34r18,2r0,28r-87,0r0,-28r18,-2r0,-34r-124,0r0,-42r127,-161r48,0r0,163r38,0r0,40xm143,-104r0,-103r-83,103r83,0","w":246},"5":{"d":"202,-86v0,67,-34,91,-102,91v-37,0,-71,-6,-82,-9r0,-58r33,0r4,26v49,3,109,5,97,-49v11,-53,-80,-38,-130,-40r13,-142r158,0r0,61r-32,0r-4,-20r-81,0r-6,62v80,-4,132,12,132,78"},"6":{"d":"219,-94v0,76,-51,99,-98,99v-60,0,-101,-23,-101,-109v0,-97,-5,-172,105,-169v34,0,69,6,81,9r0,57r-32,0r-4,-24v-12,-1,-27,-1,-40,-1v-60,0,-60,25,-60,70v66,-13,149,-16,149,68xm122,-33v30,1,47,-21,47,-60v0,-54,-54,-41,-99,-35v-4,54,9,103,52,95","w":239,"k":{"7":3}},"7":{"d":"207,-221r-117,221r-55,0r123,-226r-102,0r-3,21r-33,0r0,-62r187,0r0,46","k":{"4":3,".":32}},"8":{"d":"226,-80v1,78,-48,85,-103,85v-53,0,-104,-8,-102,-85v0,-29,11,-45,30,-58v-19,-12,-30,-31,-29,-61v0,-63,49,-74,103,-74v54,0,102,13,100,78v0,28,-10,46,-28,57v19,13,29,29,29,58xm123,-33v33,1,54,-6,54,-47v0,-46,-33,-41,-73,-40v-27,0,-33,14,-33,43v0,39,21,44,52,44xm104,-157v39,0,72,3,72,-40v0,-32,-21,-37,-53,-37v-32,0,-53,7,-52,40v0,23,7,37,33,37","w":247},"9":{"d":"219,-165v0,97,6,173,-105,170v-34,0,-70,-6,-82,-9r0,-57r33,0r4,25v13,1,27,1,41,1v59,0,59,-26,59,-70v-72,14,-149,14,-149,-81v0,-70,54,-87,97,-87v61,0,102,23,102,108xm169,-139v4,-54,-9,-103,-52,-95v-31,-1,-47,21,-47,60v0,54,54,41,99,35","w":239},":":{"d":"76,0r-48,0r0,-56r48,0r0,56xm76,-199r0,55r-48,0r0,-55r48,0","w":104},";":{"d":"89,-56r-47,89r-39,0r33,-89r53,0xm85,-144r-48,0r0,-55r48,0r0,55","w":112},"<":{"d":"203,-46r-56,0r-102,-94r102,-93r56,0r-101,93","w":248},"=":{"d":"208,-74r-168,0r0,-40r168,0r0,40xm208,-165r-168,0r0,-40r168,0r0,40","w":248},">":{"d":"203,-140r-102,94r-56,0r102,-94r-102,-93r56,0","w":248},"?":{"d":"167,-225v15,45,-86,99,-73,137r0,12r-43,0v0,-41,0,-54,31,-87v26,-27,31,-37,31,-55v0,-27,-32,-27,-61,-24r-3,23r-31,0r0,-55v54,-17,157,-18,149,49xm49,-55r47,0r0,55r-47,0r0,-55","w":194},"@":{"d":"292,-132v0,67,-33,115,-133,115v-65,0,-80,-25,-76,-83v6,-85,72,-84,137,-69r-12,116v37,-9,54,-38,54,-80v0,-54,-32,-80,-95,-80v-91,0,-119,66,-119,152v0,50,24,79,94,79v28,0,60,-4,66,-4r0,20v-5,1,-38,6,-66,6v-87,0,-123,-37,-123,-101v0,-99,37,-177,148,-177v81,0,125,38,125,106xm158,-145v-28,-10,-41,37,-38,72v-3,24,19,27,49,26r9,-97v-6,-1,-13,-1,-20,-1","w":310},"A":{"d":"99,0r-85,0r0,-38r18,-2r60,-188r-19,-1r0,-38r105,0r71,227r18,2r0,38r-86,0r0,-38r13,-1r-11,-36r-85,0r-12,36r13,1r0,38xm174,-116r-32,-116r-3,0v-7,40,-22,78,-32,116r67,0","w":281,"k":{"v":31,"p":8,"X":1,"V":45,"?":2,"*":30}},"B":{"d":"232,-81v4,104,-117,81,-215,81r0,-39r19,-2r0,-186r-19,-2r0,-38v93,-1,213,-23,213,73v0,23,-9,45,-33,56v25,10,35,34,35,57xm85,-39v49,0,104,4,98,-42v8,-38,-53,-42,-98,-39r0,81xm85,-156v44,2,107,2,96,-39v5,-41,-54,-34,-96,-33r0,72","w":250,"k":{"y":3,"u":3,"t":3,"s":1,"j":3,"g":1,"Z":6,"Y":10,"W":7,"U":5,"T":3,"R":6,"P":6,"N":6,"M":6,"L":6,"K":6,"J":2,"I":6,"H":6,"F":6,"E":6,"D":6,"B":6,"A":8,"x":4,"r":1,"p":1,"X":8,"V":9,";":3,":":-1,".":6,",":12}},"C":{"d":"201,-1v-92,15,-189,10,-182,-115r0,-36v-5,-125,89,-131,182,-114r0,62r-34,0r-4,-24v-60,-4,-93,3,-93,76v0,67,7,114,66,114v9,0,18,-1,27,-1r4,-24r34,0r0,62","w":219,"k":{"v":9,";":1,",":1,"w":9,"y":10,"C":11,"G":11,"O":11,"Q":11,"c":4,"d":4,"e":4,"o":4,"q":4,"a":1,"j":3,"t":9,"u":8}},"D":{"d":"243,-151v0,99,-20,154,-123,153v-33,0,-70,-1,-103,-2r0,-38r19,-3r0,-186r-19,-3r0,-37v33,-1,68,-3,103,-3v87,0,123,41,123,119xm119,-41v64,6,74,-41,74,-110v0,-73,-41,-79,-108,-76r0,186r34,0","w":263,"k":{"x":3,"X":15,"V":16,"?":4,".":7,",":7,"T":11,"W":15,"Y":17,"U":8,"J":10,"a":1,"j":3,"t":3,"S":3,"A":18,"Z":9,"B":8,"D":8,"E":8,"F":8,"H":8,"I":8,"K":8,"L":8,"M":8,"N":8,"P":8,"R":8}},"E":{"d":"206,0r-189,0r0,-38r18,-2r0,-188r-18,-1r0,-38r189,0r0,61r-34,0r-3,-20r-83,0r0,68r112,0r0,40r-112,0r0,77r83,0r3,-21r34,0r0,62","w":225,"k":{"v":6,"p":3,";":1,",":1,"w":6,"y":6,"C":1,"G":1,"O":1,"Q":1,"t":4}},"F":{"d":"198,-117r-112,0r0,77r18,2r0,38r-87,0r0,-38r19,-2r0,-188r-19,-1r0,-38r189,0r0,61r-33,0r-4,-20r-83,0r0,68r112,0r0,41","k":{"z":1,"y":3,"w":3,"u":3,"t":4,"q":6,"o":6,"g":4,"e":6,"d":6,"c":6,"a":10,"Z":3,"Q":3,"O":3,"G":3,"C":3,"A":27,"x":3,"v":3,";":12,":":7,".":28,",":33}},"G":{"d":"219,-3v-15,3,-50,8,-88,8v-62,0,-112,-23,-112,-120r0,-38v-5,-143,116,-124,199,-111r0,60r-33,0r-4,-24v-63,-2,-112,-10,-112,75v0,67,8,115,66,115v13,0,26,0,36,-1r0,-67r-33,-3r0,-34r81,0r0,140","w":240,"k":{"y":8,"w":6,"u":2,"j":5,"v":6,";":1,",":1}},"H":{"d":"185,-267r87,0r0,38r-19,1r0,188r19,2r0,38r-87,0r0,-38r18,-2r0,-78r-117,0r0,78r18,2r0,38r-87,0r0,-38r19,-2r0,-188r-19,-1r0,-38r87,0r0,38r-18,1r0,67r117,0r0,-67r-18,-1r0,-38","w":289,"k":{"v":9,"p":4,"w":9,"y":11,"C":6,"G":6,"O":6,"Q":6,"c":6,"d":6,"e":6,"o":6,"q":6,"g":1,"a":3,"j":1,"t":6,"u":6}},"I":{"d":"105,0r-87,0r0,-38r18,-2r0,-188r-18,-1r0,-38r87,0r0,38r-18,1r0,188r18,2r0,38","w":123,"k":{"v":9,"p":4,"w":9,"y":11,"C":6,"G":6,"O":6,"Q":6,"c":6,"d":6,"e":6,"o":6,"q":6,"g":1,"a":3,"j":1,"t":6,"u":6}},"J":{"d":"103,-229r-18,1r0,241v5,57,-41,73,-94,62r0,-35v25,0,44,4,44,-25r0,-243r-18,-1r0,-38r86,0r0,38","w":121,"k":{"x":8,"v":6,"r":4,"p":4,";":2,",":2,"w":6,"y":6,"C":7,"G":7,"O":7,"Q":7,"c":9,"d":9,"e":9,"o":9,"q":9,"g":6,"a":11,"t":6,"u":6,"s":6,"A":11,"Z":3,"z":3}},"K":{"d":"104,0r-87,0r0,-38r18,-2r0,-188r-18,-1r0,-38r87,0r0,38r-18,1r0,85r103,-124r54,0r0,38r-21,1r-82,93r82,95r21,2r0,38r-58,0r-99,-126r0,86r18,2r0,38","w":258,"k":{"v":23,"p":6,";":1,"-":6,",":1,"w":23,"y":23,"C":15,"G":15,"O":15,"Q":15,"c":9,"d":9,"e":9,"o":9,"q":9,"g":6,"a":4,"j":6,"t":16,"u":14,"S":1,"s":1}},"L":{"d":"199,0r-182,0r0,-38r18,-2r0,-188r-18,-1r0,-38r87,0r0,38r-18,1r0,186r76,0r4,-24r33,0r0,66","w":214,"k":{"v":21,"p":3,"V":33,"?":9,";":1,"-":4,",":1,"*":14,"T":24,"W":26,"Y":39,"w":20,"y":19,"U":17,"C":6,"G":6,"O":6,"Q":6,"J":5,"c":3,"d":3,"e":3,"o":3,"q":3,"f":2,"j":1,"t":20,"u":12,"S":2}},"M":{"d":"102,0r-85,0r0,-38r18,-2r0,-188r-18,-1r0,-38r73,0r71,125v21,-45,46,-83,70,-125r73,0r0,38r-18,1r0,188r18,2r0,38r-85,0r0,-38r18,-2r1,-159v-17,36,-38,68,-58,101r-40,0r-58,-101v4,51,1,105,2,159r18,2r0,38","w":321,"k":{"v":9,"p":4,"w":9,"y":11,"C":6,"G":6,"O":6,"Q":6,"c":6,"d":6,"e":6,"o":6,"q":6,"g":1,"a":3,"j":1,"t":6,"u":6}},"N":{"d":"182,-267r83,0r0,38r-18,1r0,228r-59,0r-109,-200v4,51,1,106,2,160r19,2r0,38r-83,0r0,-38r18,-2r0,-188r-18,-1r0,-38r76,0r88,156v7,13,12,29,21,40v-3,-52,-2,-103,-2,-157r-18,-1r0,-38","w":282,"k":{"x":8,"v":11,"r":3,"p":6,";":3,"0":1,",":3,"w":11,"y":11,"C":8,"G":8,"O":8,"Q":8,"c":9,"d":9,"e":9,"o":9,"q":9,"f":6,"g":6,"a":10,"j":4,"t":10,"u":9,"S":1,"s":6,"A":12,"z":6}},"O":{"d":"239,-149v0,98,-31,154,-110,154v-78,0,-110,-55,-110,-154v0,-87,42,-124,110,-124v68,0,110,37,110,124xm129,-38v46,0,60,-47,60,-111v0,-59,-23,-80,-60,-80v-46,0,-60,47,-60,111v0,60,24,80,60,80","w":258,"k":{"x":3,"X":15,"V":16,"?":4,".":7,",":7,"T":11,"W":15,"Y":17,"U":8,"J":10,"a":1,"j":3,"t":3,"S":3,"A":18,"Z":9,"B":8,"D":8,"E":8,"F":8,"H":8,"I":8,"K":8,"L":8,"M":8,"N":8,"P":8,"R":8}},"P":{"d":"103,0r-86,0r0,-39r19,-1r0,-188r-19,-1r0,-38v96,-1,217,-26,214,85v-2,84,-68,88,-146,86r0,56r18,2r0,38xm85,-139v51,1,104,3,97,-47v4,-46,-49,-41,-97,-41r0,88","w":242,"k":{"q":8,"o":8,"g":5,"e":8,"d":8,"c":8,"a":10,"Z":10,"Y":12,"W":10,"U":7,"T":1,"R":6,"Q":1,"P":6,"O":1,"N":6,"M":6,"L":6,"K":6,"J":5,"I":6,"H":6,"G":1,"F":6,"E":6,"D":6,"C":1,"B":6,"A":37,"x":3,"X":13,"V":11,";":4,".":36,"-":7,",":44}},"Q":{"d":"239,-150v0,87,-23,147,-87,153v0,20,-5,30,23,30r30,0r0,32v-45,11,-114,12,-100,-62v-64,-7,-86,-66,-86,-153v0,-87,43,-123,110,-123v67,0,110,36,110,123xm129,-38v47,0,60,-48,60,-112v0,-59,-24,-79,-60,-79v-47,0,-60,48,-60,112v0,59,24,79,60,79","w":258,"k":{"x":3,"X":15,"V":16,"?":4,".":7,",":7,"T":11,"W":15,"Y":17,"U":8,"J":10,"a":1,"j":3,"t":3,"S":3,"A":18,"Z":9,"B":8,"D":8,"E":8,"F":8,"H":8,"I":8,"K":8,"L":8,"M":8,"N":8,"P":8,"R":8}},"R":{"d":"103,0r-86,0r0,-38r19,-2r0,-188r-19,-1r0,-38v94,0,214,-25,214,84v0,41,-18,62,-46,74r43,69r20,2r0,38r-56,0r-58,-99r-49,1r0,58r18,2r0,38xm85,-139v51,1,103,0,97,-46v5,-45,-48,-43,-97,-42r0,88","w":262,"k":{"v":13,"p":5,"V":21,"?":8,";":1,"-":1,",":1,"T":16,"W":19,"Y":24,"w":13,"y":14,"U":17,"C":11,"G":11,"O":11,"Q":11,"J":6,"c":11,"d":11,"e":11,"o":11,"q":11,"f":6,"g":1,"a":2,"j":9,"t":14,"u":12,"S":7,"s":1}},"S":{"d":"204,-72v0,52,-33,77,-94,77v-35,0,-71,-4,-85,-8r0,-59r33,0r4,25v32,2,98,8,92,-33v4,-30,-51,-45,-76,-57v-36,-18,-59,-33,-59,-75v0,-49,33,-71,96,-71v34,0,67,6,80,9r0,57r-33,0r-4,-24v-36,-1,-93,-7,-90,27v-4,29,52,43,76,55v39,19,60,37,60,77","k":{"x":7,"v":12,"r":3,"p":5,"V":7,"?":1,";":4,",":4,"T":6,"W":5,"Y":7,"w":13,"y":15,"U":4,"C":2,"G":2,"O":2,"Q":2,"J":3,"c":5,"d":5,"e":5,"o":5,"q":5,"f":7,"g":1,"j":3,"t":16,"u":8,"S":4,"s":1,"A":6,"Z":3}},"T":{"d":"225,-204r-32,0r-3,-22r-45,0r0,187r19,2r0,37r-87,0r0,-37r18,-2r0,-187r-44,0r-3,22r-33,0r0,-63r210,0r0,63","w":240,"k":{"x":4,"v":8,";":5,".":25,"-":6,",":29,"w":8,"y":12,"C":6,"G":6,"O":6,"Q":6,"c":22,"d":22,"e":22,"o":22,"q":22,"f":4,"g":22,"a":21,"t":4,"u":8,"s":12,"A":35,"z":4,"i":7}},"U":{"d":"178,-267r86,0r0,38r-18,1r0,119v0,77,-37,114,-105,114v-68,0,-105,-37,-105,-114r0,-119r-19,-1r0,-38r87,0r0,38r-19,1v5,73,-25,191,56,191v81,0,49,-119,55,-191r-18,-1r0,-38","w":281,"k":{"x":12,"v":9,"r":4,"p":12,";":5,".":15,",":18,"w":12,"y":9,"C":6,"G":6,"O":6,"Q":6,"c":10,"d":10,"e":10,"o":10,"q":10,"f":1,"g":10,"a":10,"j":3,"t":7,"u":7,"S":3,"s":8,"A":23,"Z":3,"z":10,"i":3}},"V":{"d":"179,-267r87,0r0,38r-19,1r-71,228r-74,0r-70,-228r-18,-1r0,-38r86,0r0,38r-15,1r43,146v6,15,6,36,12,48v13,-68,37,-130,54,-194r-15,-1r0,-38","w":279,"k":{"z":17,"y":14,"w":15,"u":17,"t":17,"s":22,"q":27,"o":27,"j":7,"i":5,"g":24,"f":13,"e":27,"d":27,"c":27,"a":27,"Q":14,"O":14,"G":14,"C":14,"A":42,"x":17,"v":14,"r":9,"p":14,";":14,":":1,".":30,"-":4,",":34}},"W":{"d":"265,-267r83,0r0,38r-18,1r-41,228r-65,0r-44,-171r-42,171r-66,0r-40,-228r-19,-1r0,-38r84,0r0,38r-15,1r28,174r2,0v7,-56,26,-107,39,-159r60,0v13,52,32,103,39,159r2,0r27,-174r-14,-1r0,-38","w":361,"k":{"x":17,"v":14,"r":6,"p":11,";":15,":":9,".":25,"-":4,",":26,"w":13,"y":12,"C":12,"G":12,"O":12,"Q":12,"c":23,"d":23,"e":23,"o":23,"q":23,"f":12,"g":23,"a":22,"j":6,"t":13,"u":14,"S":2,"s":18,"A":31,"z":14,"i":3}},"X":{"d":"248,0r-57,0r-62,-93r-62,93r-53,0r0,-38r20,-2r65,-95r-63,-92r-20,-2r0,-38r56,0r62,92r60,-92r52,0r0,38r-20,1r-64,94r64,94r22,2r0,38","w":261,"k":{"y":23,"w":20,"u":14,"t":17,"s":1,"q":10,"o":10,"j":2,"g":1,"f":6,"e":10,"d":10,"c":10,"a":4,"Q":14,"O":14,"G":14,"C":14,"A":1,"v":22,"p":5,";":1,"-":4,",":1}},"Y":{"d":"229,-229r-18,1r-65,125r0,63r18,2r0,38r-86,0r0,-38r18,-2r0,-62r-65,-126r-17,-1r0,-38r50,0r40,77v7,13,11,30,18,40v15,-41,38,-79,57,-117r50,0r0,38","w":242,"k":{"x":20,"v":19,"r":9,"p":21,";":17,":":10,".":29,"-":8,",":39,"w":19,"y":17,"C":17,"G":17,"O":17,"Q":17,"c":36,"d":36,"e":36,"o":36,"q":36,"f":7,"g":36,"a":32,"j":4,"t":21,"u":23,"S":7,"s":24,"A":40,"Z":3,"z":18,"i":6}},"Z":{"d":"212,0r-193,0r0,-46r131,-179r-91,0r-4,21r-32,0r0,-63r184,0r0,45r-131,180r99,0r4,-23r33,0r0,65","w":230,"k":{"v":14,"p":3,";":2,",":1,"T":1,"w":12,"y":12,"U":1,"C":9,"G":9,"O":9,"Q":9,"c":6,"d":6,"e":6,"o":6,"q":6,"g":3,"a":1,"t":14,"u":9,"S":3}},"[":{"d":"133,73r-97,0r0,-340r97,0r0,39r-50,0r0,262r50,0r0,39","w":153},"\\":{"d":"162,0r-47,0r-105,-267r48,0","w":172},"]":{"d":"117,73r-98,0r0,-39r50,0r0,-262r-50,0r0,-39r98,0r0,340","w":153},"^":{"d":"222,-152r-47,0r-46,-95r-47,95r-47,0r58,-117r72,0","w":257},"_":{"d":"213,45r-212,0r0,-28r212,0r0,28","w":214},"`":{"d":"121,-225r-45,0r-57,-54r55,0","w":171},"a":{"d":"203,0r-62,0r0,-13v-36,28,-137,28,-123,-47v-2,-62,56,-63,120,-62v1,-34,0,-49,-42,-47v-9,0,-18,0,-28,1r-3,18r-33,0r0,-47v9,-3,39,-11,72,-11v106,0,78,82,82,168r17,2r0,38xm139,-41r0,-51v-40,0,-84,-5,-75,39v-2,39,62,20,75,12","w":219,"k":{"v":17,"p":8,"?":21,";":2,",":2,"w":14,"y":17,"c":7,"d":7,"e":7,"o":7,"q":7,"f":11,"g":1,"a":4,"j":10,"t":20,"u":12,"s":3}},"b":{"d":"202,-118v0,80,-21,123,-95,123v-27,0,-46,-1,-82,-5r0,-240r-18,-2r0,-38r65,0r0,81v67,-24,130,-1,130,81xm107,-35v44,0,47,-35,47,-83v0,-58,-40,-56,-82,-42r0,123v8,0,20,2,35,2","w":221,"k":{"x":10,"v":13,"r":4,"p":5,"b":5,"w":13,"y":16,"f":7,"a":4,"t":14,"u":7,"z":5,"i":1}},"c":{"d":"168,-3v-10,3,-32,8,-63,8v-67,1,-85,-45,-85,-119v0,-62,27,-94,85,-94v30,0,54,5,63,8r0,51r-32,0r-4,-18v-40,-1,-63,0,-65,53v-2,47,7,79,46,79v12,0,29,-1,55,-3r0,35","w":185,"k":{"t":1,"q":7,"o":7,"e":7,"d":7,"c":7,"a":2,"?":4}},"d":{"d":"215,0r-63,0r0,-10v-56,32,-132,15,-132,-75v0,-100,40,-140,129,-119r0,-41r-20,-2r0,-33r68,0r0,240r18,2r0,38xm150,-44r0,-121v-49,-5,-83,-13,-83,51v0,42,0,79,41,79v15,0,29,-4,42,-9","w":230,"k":{"v":12,"p":9,"?":3,";":2,",":2,"w":12,"y":13,"c":7,"d":7,"e":7,"o":7,"q":7,"f":7,"g":2,"a":4,"j":9,"t":14,"u":10,"s":2}},"e":{"d":"202,-86r-136,0v0,33,3,52,54,52v22,0,54,-2,73,-5r0,35v-15,4,-41,9,-75,9v-80,1,-99,-37,-99,-114v0,-66,32,-99,91,-99v75,1,95,51,92,122xm154,-118v0,-26,-4,-52,-44,-52v-39,0,-43,26,-43,52r87,0","w":219,"k":{"x":6,"v":9,"p":5,"?":6,";":3,",":3,"T":28,"w":9,"y":10,"f":6,"g":1,"a":4,"j":3,"t":10,"u":6,"s":2,"i":1}},"f":{"d":"148,-165r-52,0r0,125r18,2r0,38r-83,0r0,-38r18,-2r0,-125r-36,-3r0,-35r36,0v-1,-47,2,-82,56,-82v17,0,33,2,44,5r0,31v-26,-1,-60,-8,-53,28r0,18r52,0r0,38","w":162,"k":{"?":-3,";":3,".":2,",":3,"c":11,"d":11,"e":11,"o":11,"q":11,"g":6,"a":9}},"g":{"d":"204,14v0,44,-30,65,-95,65v-88,0,-116,-58,-74,-106v-23,-15,-21,-48,2,-62v-31,-48,-25,-125,73,-119r95,0r0,29r-20,4v4,5,12,18,12,37v0,65,-73,82,-132,65v-12,8,-13,24,10,23v67,-3,129,-2,129,64xm158,14v9,-36,-49,-28,-86,-29v-16,22,-21,60,37,60v39,0,49,-10,49,-31xm151,-138v0,-22,-6,-35,-42,-35v-37,0,-42,14,-42,35v0,22,7,36,42,36v36,0,42,-14,42,-36","w":221,"k":{"?":4,";":2,".":7,",":2,"c":9,"d":9,"e":9,"o":9,"q":9,"g":2,"a":7,"s":3}},"h":{"d":"228,0r-65,0r0,-128v10,-59,-58,-38,-82,-26r0,114r18,2r0,38r-83,0r0,-38r17,-2r0,-200r-17,-2r0,-38r65,0r0,90v14,-8,37,-18,63,-18v91,0,60,91,66,168r18,2r0,38","w":244,"k":{"v":18,"p":8,"b":4,"?":9,";":2,",":2,"w":18,"y":17,"c":11,"d":11,"e":11,"o":11,"q":11,"f":13,"g":4,"a":3,"j":10,"t":19,"u":16,"s":4}},"i":{"d":"99,0r-83,0r0,-38r17,-2r0,-123r-17,-2r0,-38r65,0r0,163r18,2r0,38xm82,-234r-49,0r0,-46r49,0r0,46","w":114,"k":{"v":12,"p":9,"?":3,";":2,",":2,"w":12,"y":13,"c":7,"d":7,"e":7,"o":7,"q":7,"f":7,"g":2,"a":4,"j":9,"t":14,"u":10,"s":2}},"j":{"d":"82,17v6,60,-39,68,-87,59r0,-34v22,1,40,6,40,-25r0,-180r-18,-2r0,-38r65,0r0,220xm83,-234r-49,0r0,-46r49,0r0,46","w":106,"k":{"j":1}},"k":{"d":"205,0r-52,0r-72,-96r0,96r-65,0r0,-38r17,-2r0,-200r-17,-2r0,-38r65,0r0,168r72,-91r52,0r0,38r-24,2r-51,57r54,66r21,2r0,38","w":221,"k":{"?":4,";":2,"-":4,",":2,"y":1,"c":11,"d":11,"e":11,"o":11,"q":11,"g":2,"a":4,"s":1}},"l":{"d":"99,0r-83,0r0,-38r17,-2r0,-200r-17,-2r0,-38r65,0r0,240r18,2r0,38","w":114,"k":{"v":12,"p":9,"?":3,";":2,",":2,"w":12,"y":13,"c":7,"d":7,"e":7,"o":7,"q":7,"f":7,"g":2,"a":4,"j":9,"t":14,"u":10,"s":2}},"m":{"d":"328,0r-66,0r0,-133v8,-45,-41,-39,-68,-23r1,156r-47,0r0,-133v8,-48,-44,-36,-67,-22r0,115r18,2r0,38r-83,0r0,-38r17,-2r0,-123r-17,-2r0,-38r63,0r0,17v26,-24,89,-33,107,0v23,-16,44,-22,63,-22v92,3,52,93,61,168r18,2r0,38","w":343,"k":{"v":18,"p":8,"b":4,"?":9,";":2,",":2,"w":18,"y":17,"c":11,"d":11,"e":11,"o":11,"q":11,"f":13,"g":4,"a":3,"j":10,"t":19,"u":16,"s":4}},"n":{"d":"228,0r-65,0r0,-129v2,-57,-45,-40,-82,-25r0,114r18,2r0,38r-83,0r0,-38r17,-2r0,-123r-17,-2r0,-38r63,0r0,17v22,-13,44,-22,67,-22v91,-2,58,92,64,168r18,2r0,38","w":244,"k":{"v":18,"p":8,"b":4,"?":9,";":2,",":2,"w":18,"y":17,"c":11,"d":11,"e":11,"o":11,"q":11,"f":13,"g":4,"a":3,"j":10,"t":19,"u":16,"s":4}},"o":{"d":"203,-114v0,77,-24,119,-92,119v-68,0,-92,-42,-92,-119v0,-64,33,-94,92,-94v59,0,92,30,92,94xm111,-35v40,0,44,-34,44,-79v0,-39,-13,-53,-44,-53v-40,0,-44,33,-44,78v0,39,13,54,44,54","k":{"x":10,"v":13,"r":4,"p":5,"b":5,"w":13,"y":16,"f":7,"a":4,"t":14,"u":7,"z":5,"i":1}},"p":{"d":"211,-117v0,98,-43,138,-130,118r0,33r18,2r0,38r-83,0r0,-38r17,-2r0,-197r-17,-2r0,-38r62,0r0,14v59,-38,133,-23,133,72xm118,-35v38,0,45,-34,45,-82v0,-61,-40,-57,-82,-39r0,117v14,3,25,4,37,4","w":230,"k":{"x":10,"v":13,"r":4,"p":5,"b":5,"w":13,"y":16,"f":7,"a":4,"t":14,"u":7,"z":5,"i":1}},"q":{"d":"129,36r17,-1r0,-40v-69,25,-130,6,-130,-80v0,-84,22,-123,98,-123v26,0,43,2,79,6r0,237r18,1r0,38r-82,0r0,-38xm146,-44r0,-122v-46,-1,-82,-11,-82,52v0,40,-3,79,36,79v9,0,27,-2,46,-9","w":220,"k":{"u":4}},"r":{"d":"148,-164v-24,0,-51,5,-67,12r0,112r18,2r0,38r-83,0r0,-38r17,-2r0,-123r-17,-2r0,-38r62,0r0,17v20,-17,45,-22,70,-22r0,44","w":160,"k":{"?":4,";":5,":":-1,".":21,"-":4,",":27,"c":14,"d":14,"e":14,"o":14,"q":14,"g":9,"a":10,"s":3,"z":1}},"s":{"d":"172,-55v0,37,-22,60,-82,60v-28,0,-60,-5,-69,-8r0,-50r33,0r3,20v23,2,75,4,68,-20v7,-15,-29,-28,-51,-37v-38,-16,-57,-31,-57,-63v0,-40,28,-55,82,-55v25,0,56,5,66,8r0,47r-33,0r-3,-17v-24,-1,-68,-6,-65,16v-6,16,29,27,47,35v45,19,61,32,61,64","w":189,"k":{"x":1,"v":3,"p":4,"?":12,";":3,",":3,"w":4,"y":4,"c":7,"d":7,"e":7,"o":7,"q":7,"f":4,"g":1,"a":1,"j":1,"t":8,"u":3,"s":1}},"t":{"d":"150,0v-5,1,-23,5,-41,5v-82,0,-48,-102,-55,-170r-38,-3r0,-35r38,0r0,-50r47,0r0,50r49,0r0,38r-49,0r0,111v-7,33,30,21,49,21r0,33","w":168,"k":{";":1,",":1,"c":9,"d":9,"e":9,"o":9,"q":9,"a":5,"t":3,"s":1}},"u":{"d":"228,0r-63,0r0,-16v-24,13,-47,21,-71,21v-85,-1,-55,-94,-61,-168r-17,-2r0,-38r65,0r0,129v-3,57,44,40,82,25r0,-114r-18,-2r0,-38r65,0r0,163r18,2r0,38","w":244,"k":{"v":12,"p":9,"?":3,";":2,",":2,"w":12,"y":13,"c":7,"d":7,"e":7,"o":7,"q":7,"f":7,"g":2,"a":4,"j":9,"t":14,"u":10,"s":2}},"v":{"d":"220,-165r-18,3r-52,162r-66,0r-52,-162r-18,-3r0,-38r56,0r48,171r47,-171r55,0r0,38","w":235,"k":{"s":1,"q":13,"o":13,"g":6,"e":13,"d":13,"c":13,"a":11,"?":4,".":19,"-":3,",":21}},"w":{"d":"249,-203r78,0r0,38r-17,2r-36,163r-61,0v-13,-44,-34,-92,-42,-139v-11,44,-29,96,-44,139r-60,0r-36,-163r-17,-2r0,-38r79,0r0,36r-15,2v10,39,13,85,26,120v9,-45,26,-91,40,-133r54,0r42,133r24,-120r-15,-2r0,-36","w":342,"k":{"x":3,"?":4,";":4,".":22,",":25,"c":13,"d":13,"e":13,"o":13,"q":13,"g":9,"a":12,"j":1,"s":3,"z":3}},"x":{"d":"212,0r-52,0r-49,-66r-47,66r-49,0r0,-38r22,-2r46,-65r-43,-58r-22,-2r0,-38r53,0r46,64r44,-64r48,0r0,38r-22,2r-43,60r47,63r21,2r0,38","w":228,"k":{"t":3,"q":10,"o":10,"g":1,"e":10,"d":10,"c":10,"a":5,"?":4,";":1,"-":4,",":1}},"y":{"d":"227,-165r-21,2r-58,170v-15,66,-59,80,-125,67r0,-34v47,5,65,3,74,-41r-62,-162r-21,-2r0,-38r61,0r33,104v7,17,8,38,15,54v11,-55,29,-105,43,-158r61,0r0,38","w":241,"k":{"?":4,".":22,"-":4,",":30,"c":14,"d":14,"e":14,"o":14,"q":14,"g":6,"a":9,"s":1}},"z":{"d":"174,0r-157,0r0,-42r104,-123r-66,0r-3,16r-31,0r0,-54r153,0r0,42r-105,123r71,0r4,-19r30,0r0,57","w":191},"{":{"d":"139,74v-62,3,-98,-8,-98,-61v0,-39,10,-84,-22,-95r0,-30v32,-12,22,-56,22,-95v0,-53,34,-63,97,-60r0,39v-24,1,-56,-6,-49,21v-1,46,7,96,-27,110v34,16,26,63,27,110v-7,28,25,21,50,22r0,39","w":159},"|":{"d":"83,74r-47,0r0,-341r47,0r0,341","w":118},"}":{"d":"140,-82v-32,12,-22,56,-22,95v0,53,-35,64,-98,61r0,-39v25,-1,58,6,51,-22v1,-47,-7,-94,27,-110v-34,-15,-26,-63,-27,-110v6,-27,-26,-20,-50,-21r0,-39v62,-2,97,6,97,60v0,39,-10,84,22,95r0,30","w":159},"~":{"d":"216,-188v10,62,-42,89,-88,57v-11,-8,-27,-24,-42,-25v-17,-1,-15,18,-15,35r-34,0v-9,-64,42,-87,86,-56v13,9,26,24,45,24v16,1,14,-19,14,-35r34,0","w":253},"\u00a0":{"w":70,"k":{"s":4,"S":3,".":7,",":12}}}});


window.addEvent('domready', function(){
	new TogglePanel({
		handlers : '#browse-work a.trigger',
		panel : 'browse-panel',
		callBack : function(togglePanel) {
			// If panel is close
			var slideInt = togglePanel.get('slide');
			if (slideInt.open) {
				$$('#browse-work a.trigger').addClass('active');
			} else {
				$$('#browse-work a.trigger').removeClass('active');
			}

		}
	});
});

var video_element_id = 'video';
window.moogaloop = false;
var force_player_runs = 0
var player_loaded = false;
var video_element_vimeo_id = 13358322;

function vimeo_force_player_loaded()
{
	if (player_loaded) {
		return;
	}
	if (force_player_runs > 15 && document.getElementById('video').tagName.toLowerCase() == 'object') {
		var problem = false;
		try {
			vimeo_player_loaded(video_element_id);
		} catch(e) {
			problem = true;
		}
		if (!problem) {
			return;
		}
	}
	if (force_player_runs > 120) {
		return;
	}
	force_player_runs++;
	setTimeout(vimeo_force_player_loaded, 500);
}

function vimeo_player_loaded(swf_id)
{
	moogaloop = document.getElementById(swf_id);
	moogaloop.api_addEventListener('onPlay',	'vimeo_on_play');
	moogaloop.api_addEventListener('onPause',	'vimeo_on_pause');
	moogaloop.api_addEventListener('onFinish',	'vimeo_on_finish');
	$('play-button').setStyle('visibility','visible');
	player_loaded = true;
}

function vimeo_on_play(swf_id)
{
	$('play-button').setStyle('visibility','hidden');
}

function vimeo_on_pause(swf_id)
{
	$('play-button').setStyle('visibility','visible');
}

function vimeo_on_finish(swf_id)
{
	$('play-button').setStyle('visibility','visible');
}

function drawVimeo()
{
	var swf_id = 'moogaloop';
	var moogaloop = new Swiff('http://vimeo.com/moogaloop.swf', {
		id: swf_id,
		container: video_element_id,
		width: 580,
		height: 330,
		vars: {
			clip_id: video_element_vimeo_id,
			show_portrait: 1,
			show_byline: 1,
			show_title: 1,
			js_api: 1, // required in order to use the Javascript API
			js_onLoad: 'vimeo_player_loaded', // moogaloop will call this JS function when it's done loading (optional)
			js_swf_id: 'moogaloop' // this will be passed into all event methods so you can keep track of multiple moogaloops (optional)
		}
	});
	setTimeout(vimeo_force_player_loaded, 500);
}

function attachEvents()
{
	$('play-button').addEvents({
		'click': function() {
			moogaloop.api_play();
		}
	});
}


var WorkThumb = new Class({

    variable1: false,

	elements : null,

    initialize: function(to){
		this.elements = $$(to);
		this.elements.each(function(el) {
			el.addEvent('mouseover', this.onHover);
			el.addEvent('mouseout', this.onBlur);
		}, this);
        
    },

    onHover: function(e){
		var el = e.target;
		el.set('morph', {duration: 200});
		el.morph({opacity: 0.4});
    },

	onBlur: function(e) {
		var el = e.target;
		el.set('morph', {duration: 200});
		el.morph({opacity: 1.0});
	}

});
  

var carouselExt = {
	init: function(panels, nextController, previousController, eventType, offset) {
		if ($chk($$(panels))) {
		   carouselExt = new CarouselExt({
										nextController : nextController,
										previousController : previousController,
										panels : panels,
										eventType : eventType,
										offset: offset});
		}
	}
}

CarouselExt = new Class ({
	Implements: [Options],

	options: {
		nextController : null,
		previousController : null,
		panels : 'panels',
		eventType : 'click',
		offset: '840px'
	},

	nextController : null,
	previousController : null,
	panels : null,
	slides : null,
	currentPanel : 0,
	offset: '840px',
	effectProperty : 'left',

	initialize: function(options) {
		this.setOptions(options);
		this.nextController = $$(this.options.nextController);
		this.previousController = $$(this.options.previousController);
		this.panels = $$(this.options.panels);
		this.run();
	},

	run: function() {
		this.slides = new Array();
		if (this.panels) {

			// Initialize the toggle events
			this.panels.each(function(el,key) {
				var slideE = null;
				slideE = new Fx.Tween(el);				
				this.slides.include(slideE);
			}.bindWithEvent(this));

			// get the offset
			var offset = this.options.offset;

			// Adds onClick events to each controller.
			this.nextController.addEvent(this.options.eventType, function(e) {
				e.stop();
				if (this.lock) {
					return;
				}
				var nextPanel = this.currentPanel + 1;
				if (nextPanel >= this.slides.length) {
					nextPanel = 0;
				}
				this.slides[this.currentPanel].onComplete = function() {
					this.lock = false;
				}.bindWithEvent(this);
				this.lock = true;
				this.slides[this.currentPanel].start(this.effectProperty, '0', '-' + offset);
				this.slides[nextPanel].start(this.effectProperty, offset, '0');
				this.currentPanel = nextPanel;
			}.bindWithEvent(this));

			this.previousController.addEvent(this.options.eventType, function(e) {
				e.stop();
				if (this.lock) {
					return;
				}
				var previousPanel = this.currentPanel - 1;
				if (previousPanel < 0) {
					previousPanel = this.slides.length - 1;
				}
				this.slides[this.currentPanel].onComplete = function() {
					this.lock = false;
				}.bindWithEvent(this);
				this.lock = true;
				this.slides[this.currentPanel].start(this.effectProperty, '0', offset);
				this.slides[previousPanel].start(this.effectProperty, '-' + offset, '0');
				this.currentPanel = previousPanel;
			}.bindWithEvent(this));
		}
	}
});


