/**
 * Includes: Initializer, SimpleCarousel, TabSwapper, Slidebar
 */
var Initializer=new Class({initialize:function(a){this.queue=[];window.addEvent("domready",function(){this.run()}.bind(this));return this.enqueue(a)},run:function(){this.queue&&this.queue.each(function(a){a()})},enqueue:function(a){if(a){this.queue.extend($splat(a).filter(function(b){return $type(b)=="function"}))}return this}});Slidebar=new Class({Extends:Fx,options:{mode:"horizontal",min:0},initialize:function(b,a,c){this.addEvent("complete",function(){this.open=(this.wrapper.getStyle(this.layout).toInt()!=this.min);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper)}},true);this.element=this.subject=$(b);this.parent(a);var d=this.element.retrieve("wrapper");this.wrapper=d||new Element("div",{styles:$extend($extend(this.element.getStyles("margin","position"),{overflow:"hidden"}),c)}).wraps(this.element);this.element.store("wrapper",this.wrapper);this.now=[];this.open=true},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;this.min=this.options.min},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;this.min=this.options.min},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);return this},compute:function(e,d,c){var b=[];var a=2;a.times(function(f){b[f]=Fx.compute(e[f],d[f],c)});return b},step:function(){this.fireEvent("step");this.parent()},start:function(b,e){if(!this.check(arguments.callee,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+this.min,this.min]];var f;switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(this.open?g:a);break}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+this.min,this.min])},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)}});var dbug={logged:[],timers:{},firebug:false,enabled:false,log:function(){dbug.logged.push(arguments)},nolog:function(a){dbug.logged.push(arguments)},time:function(a){dbug.timers[a]=new Date().getTime()},timeEnd:function(b){if(dbug.timers[b]){var a=new Date().getTime()-dbug.timers[b];dbug.timers[b]=false;dbug.log("%s: %s",b,a)}else{dbug.log("no such timer: %s",b)}},enable:function(a){if(dbug.firebug){try{dbug.enabled=true;dbug.log=function(){(console.debug||console.log).apply(console,arguments)};dbug.time=function(){console.time.apply(console,arguments)};dbug.timeEnd=function(){console.timeEnd.apply(console,arguments)};if(!a){dbug.log("enabling dbug")}for(var b=0;b<dbug.logged.length;b++){dbug.log.apply(console,dbug.logged[b])}dbug.logged=[]}catch(c){dbug.enable.delay(400)}}},disable:function(){if(dbug.firebug){dbug.enabled=false}dbug.log=dbug.nolog;dbug.time=function(){};dbug.timeEnd=function(){}},cookie:function(d){var c=document.cookie.match("(?:^|;)\\s*jsdebug=([^;]*)");var b=c?unescape(c[1]):false;if((b!="true"||d)&&!d){dbug.enable();dbug.log("setting debugging cookie");var a=new Date();a.setTime(a.getTime()+(24*60*60*1000));document.cookie="jsdebug=true;expires="+a.toGMTString()+";path=/;"}else{dbug.disableCookie()}},disableCookie:function(){dbug.log("disabling debugging cookie");document.cookie="jsdebug=false;path=/;"}};(function(){var c=typeof console!="undefined";var b=["debug","info","warn","error","assert","dir","dirxml"];var a=["trace","group","groupEnd","profile","profileEnd","count"];function d(g,e){for(var f=0;f<g.length;f++){dbug[g[f]]=(c&&console[g[f]])?console[g[f]]:e}}d(b,dbug.log);d(a,function(){})})();if(typeof console!="undefined"&&console.warn){dbug.firebug=true;var value=document.cookie.match("(?:^|;)\\s*jsdebug=([^;]*)");var debugCookie=value?unescape(value[1]):false;if(window.location.href.indexOf("jsdebug=true")>0||debugCookie=="true"){dbug.enable()}if(debugCookie=="true"){dbug.log("debugging cookie enabled")}if(window.location.href.indexOf("jsdebugCookie=true")>0){dbug.cookie();if(!dbug.enabled){dbug.enable()}}if(window.location.href.indexOf("jsdebugCookie=false")>0){dbug.disableCookie()}}Element.implement({expose:function(){if(this.getStyle("display")!="none"){return $empty}var b={};var a={visibility:"hidden",display:"block",position:"absolute"};$each(a,function(d,c){b[c]=this.style[c]||""},this);this.setStyles(a);return(function(){this.setStyles(b)}).bind(this)},getDimensions:function(a){a=$merge({computeSize:false},a);var f={};function d(g,e){return(e.computeSize)?g.getComputedSize(e):g.getSize()}if(this.getStyle("display")=="none"){var b=this.expose();f=d(this,a);b()}else{try{f=d(this,a)}catch(c){}}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=this.getStyles.apply(this,b);var d=[];$each(a.plains,function(g,f){c["total"+f.capitalize()]=0;c["computed"+f.capitalize()]=0;g.each(function(h){c["computed"+h.capitalize()]=0;b.each(function(k,j){if(k.test(h)){e[k]=e[k].toInt();if(isNaN(e[k])){e[k]=0}c["total"+f.capitalize()]=c["total"+f.capitalize()]+e[k];c["computed"+h.capitalize()]=c["computed"+h.capitalize()]+e[k]}if(k.test(h)&&f!=k&&(k.test("border")||k.test("padding"))&&!d.contains(k)){d.push(k);c["computed"+f.capitalize()]=c["computed"+f.capitalize()]-e[k]}})})});if($chk(c.width)){c.width=c.width+this.offsetWidth+c.computedWidth;c.totalWidth=c.width+c.totalWidth;delete c.computedWidth}if($chk(c.height)){c.height=c.height+this.offsetHeight+c.computedHeight;c.totalHeight=c.height+c.totalHeight;delete c.computedHeight}return $extend(e,c)}});Element.implement({isVisible:function(){return this.getStyle("display")!="none"},toggle:function(){return this[this.isVisible()?"hide":"show"]()},hide:function(){var b;try{b=this.getStyle("display")}catch(a){}this.store("originalDisplay",b||"block");this.setStyle("display","none");return this},show:function(a){original=this.retrieve("originalDisplay")?this.retrieve("originalDisplay"):this.get("originalDisplay");this.setStyle("display",(a||original||"block"));return this},swapClass:function(a,b){return this.removeClass(a).addClass(b)},fxOpacityOk:function(){return !Browser.Engine.trident4}});var TabSwapper=new Class({Implements:[Options,Events],options:{selectedClass:"tabSelected",mouseoverClass:"tabOver",deselectedClass:"",rearrangeDOM:true,initPanel:0,smooth:false,smoothSize:false,maxSize:null,effectOptions:{duration:500},cookieName:null,cookieDays:999},tabs:[],sections:[],clickers:[],sectionFx:[],initialize:function(a){this.setOptions(a);this.setup();if(this.options.cookieName&&this.recall()){this.show(this.recall().toInt())}else{this.show(this.options.initPanel)}},setup:function(){var a=this.options;sections=$$(a.sections);tabs=$$(a.tabs);clickers=$$(a.clickers);tabs.each(function(c,b){this.addTab(c,sections[b],clickers[b],b)},this);return this},addTab:function(c,d,a,b){c=$(c);a=$(a);d=$(d);if(this.tabs.indexOf(c)>=0&&c.retrieve("tabbered")&&this.tabs.indexOf(c)!=b&&this.options.rearrangeDOM){this.moveTab(this.tabs.indexOf(c),b);return this}if(!$defined(b)){b=this.tabs.length}if(b>0&&this.tabs[b-1]&&this.options.rearrangeDOM){c.inject(this.tabs[b-1],"after");d.inject(this.tabs[b-1].retrieve("section"),"after")}this.tabs.splice(b,0,c);a=a||c;c.addEvents({mouseout:function(){c.removeClass(this.options.mouseoverClass)}.bind(this),mouseover:function(){c.addClass(this.options.mouseoverClass)}.bind(this)});a.addEvent("click",function(){this.show(b)}.bind(this));c.store("tabbered",true);c.store("section",d);c.store("clicker",a);this.hideSection(b);return this},removeTab:function(b){var a=this.tabs[this.now];if(this.now==b){if(b>0){this.show(b-1)}else{if(b<this.tabs.length){this.show(b+1)}}}this.now=this.tabs.indexOf(a);return this},moveTab:function(h,g){var c=this.tabs[h];var b=c.retrieve("clicker");var e=c.retrieve("section");var a=this.tabs[g];var f=a.retrieve("clicker");var d=a.retrieve("section");this.tabs.erase(c).splice(g,0,c);c.inject(a,"before");b.inject(f,"before");e.inject(d,"before");return this},show:function(a){if(!$chk(this.now)){this.tabs.each(function(c,b){if(a!=b){this.hideSection(b)}},this)}this.showSection(a).save(a);return this},save:function(a){if(this.options.cookieName){Cookie.write(this.options.cookieName,a,{duration:this.options.cookieDays})}return this},recall:function(){return(this.options.cookieName)?$pick(Cookie.read(this.options.cookieName),false):false},hideSection:function(a){var c=this.tabs[a];if(!c){return this}var b=c.retrieve("section");if(!b){return this}if(b.getStyle("display")!="none"){this.lastHeight=b.getSize().y;b.setStyle("display","none");c.swapClass(this.options.selectedClass,this.options.deselectedClass);this.fireEvent("onBackground",[a,b,c])}return this},showSection:function(a){var e=this.tabs[a];if(!e){return this}var b=e.retrieve("section");if(!b){return this}var f=this.options.smooth&&(!Browser.Engine.trident4||(Browser.Engine.trident4&&b.fxOpacityOk()));if(this.now!=a){if(!e.retrieve("tabFx")){e.store("tabFx",new Fx.Morph(b,this.options.effectOptions))}var g={display:"block",overflow:"hidden"};if(f){g.opacity=0}var d=false;if(f){d={opacity:1}}else{if(b.getStyle("opacity").toInt()<1){b.setStyle("opacity",1);if(!this.options.smoothSize){this.fireEvent("onActiveAfterFx",[a,b,e])}}}if(this.options.smoothSize){var c=b.getDimensions().height;if($chk(this.options.maxSize)&&this.options.maxSize<c){c=this.options.maxSize}if(!d){d={}}d.height=c}if($chk(this.now)){this.hideSection(this.now)}if(this.options.smoothSize&&this.lastHeight){g.height=this.lastHeight}b.setStyles(g);if(d){e.retrieve("tabFx").start(d).chain(function(){this.fireEvent("onActiveAfterFx",[a,b,e]);b.setStyle("height","auto")}.bind(this))}this.now=a;this.fireEvent("onActive",[a,b,e])}e.swapClass(this.options.deselectedClass,this.options.selectedClass);return this}});var SimpleCarousel=new Class({Implements:[Options,Events],options:{slideInterval:4000,transitionDuration:700,startIndex:0,buttonOnClass:"selected",buttonOffClass:"off",rotateAction:"none",rotateActionDuration:100,autoplay:true},initialize:function(a,c,d,b){this.container=$(a);if(this.container.hasClass("hasCarousel")){return false}this.setOptions(b);this.container.addClass("hasCarousel");this.slides=$$(c);this.buttons=$$(d);this.createFx();this.showSlide(this.options.startIndex);if(this.options.autoplay){this.autoplay()}if(this.options.rotateAction!="none"){this.setupAction(this.options.rotateAction)}return this},toElement:function(){return this.container},setupAction:function(a){this.buttons.each(function(c,b){$(c).addEvent(a,function(){this.slideFx.setOptions(this.slideFx.options,{duration:this.options.rotateActionDuration});if(this.currentSlide!=b){this.showSlide(b)}this.stop()}.bind(this))},this)},createFx:function(){if(!this.slideFx){this.slideFx=new Fx.Elements(this.slides,{duration:this.options.transitionDuration})}this.slides.each(function(a){a.setStyle("opacity",0)})},showSlide:function(b){var a={};this.slides.each(function(c,d){if(d==b&&d!=this.currentSlide){$(this.buttons[d]).swapClass(this.options.buttonOffClass,this.options.buttonOnClass);a[d.toString()]={opacity:1}}else{$(this.buttons[d]).swapClass(this.options.buttonOnClass,this.options.buttonOffClass);a[d.toString()]={opacity:0}}},this);this.fireEvent("onShowSlide",b);this.currentSlide=b;this.slideFx.start(a);return this},autoplay:function(){this.slideshowInt=this.rotate.periodical(this.options.slideInterval,this);this.fireEvent("onAutoPlay");return this},stop:function(){$clear(this.slideshowInt);this.fireEvent("onStop");return this},rotate:function(){current=this.currentSlide;next=(current+1>=this.slides.length)?0:current+1;this.showSlide(next);this.fireEvent("onRotate",next);return this}});
