DynoBox=Class.create({switchers:[],targets:[],active:null,timerObj:undefined,timerRunning:false,timerPeriod:6,isSwitching:false,isClicked:false,isHovered:false,backslide:undefined,initialize:function(a){if($(a.wrapper)){this.portlet=$(a.wrapper);this.switchers=this.portlet.select("li a");this.targets=this.portlet.select(".dynobox_content div");if(a.backslide){this.backslide=a.backslide}if(a.speed){this.timerPeriod=a.speed}else{if(GlobalSettings&&GlobalSettings.DynoBox&&GlobalSettings.DynoBox.speed){this.timerPeriod=GlobalSettings.DynoBox.speed}}if(this.switchers.length==this.targets.length){this.register()}else{throw ("DynoBox.js: incorrect switchers/targets amount for #"+a.wrapper)}}else{throw ("DynoBox.js: DynoBox not found at #"+a.wrapper)}},findActive:function(){find=function(b,a){if(b.visible()){active=a}};this.targets.each(find.bind(this));return active},applyEvents:function(){apply=function(b,a){b.observe("click",this.switchBoxClick.bindAsEventListener(this,a))};this.switchers.each(apply.bind(this));portletOver=function(){this.timerStop();this.isHovered=true};portletOut=function(){this.timerStart();this.isHovered=false};this.portlet.observe("mouseover",portletOver.bind(this));this.portlet.observe("mouseout",portletOut.bind(this))},switchBoxClick:function(b,a){this.isClicked=true;this.switchBox(a);b.stop()},switchBox:function(a){if(a!=this.active&&!this.isSwitching){this.isSwitching=true;if(this.isClicked&&!this.isHovered){this.timerStop()}this.switchers[this.active].removeClassName("selected");this.switchers[a].addClassName("selected");if(this.backslide){this.backslide.swap(a)}notSwitching=function(){this.isSwitching=false;if(this.isClicked){if(!this.isHovered){this.timerStart()}this.isClicked=false}};afterEffect=function(b){new Effect.Appear(b,{duration:0.3,afterFinish:notSwitching.bind(this)})};new Effect.Fade(this.targets[this.active],{duration:0.3,afterFinish:afterEffect.bind(this,this.targets[a])});this.active=a}},switchNext:function(){if(this.active==(this.switchers.length-1)){this.switchBox(0)}else{this.switchBox(this.active+1)}},notSwitching:function(){this.isSwitching=false},timerStart:function(){if(!this.timerRunning){this.timerObj=new PeriodicalExecuter(this.switchNext.bind(this),this.timerPeriod);this.timerRunning=true}},timerStop:function(){if(this.timerRunning){this.timerObj.stop();this.timerRunning=false}},register:function(){this.active=this.findActive();this.switchers[this.active].addClassName("selected");this.applyEvents();this.timerStart()}});DynoBox.Loader=Class.create({initialize:function(a){if($(a)){this.wrapper=$(a);this.dynoboxes=this.wrapper.select("div.dynobox");this.dynoboxes.each(function(b){b.identify();new DynoBox({wrapper:b.id})})}else{throw ("DynoLoader: DynoBox wrapper not found at #"+a)}}});BackSlide=Class.create({delay:0.01,step:20,elmWrapper:undefined,objImage:undefined,animTimer:undefined,imgPrefix:null,images:[],isProcessing:false,curYoffset:0,safeYoffset:0,curImage:0,nextImage:0,initialize:function(a){if($(a.elm)){this.elmWrapper=$(a.elm);this.imgPrefix=a.prefix;this.images=a.images;if(a.step){this.step=a.step}this.objImage=new Image();this.objImage.src=this.imgPrefix+this.images[0]}else{throw ("BackSlide: No valid elm found at #"+a.elm)}},next:function(){var a=this.curImage+1;if(a>(this.images.length-1)){a=0}this.swap(a)},swap:function(a){if(!this.isProcessing){this.isProcessing=true;this.nextImage=a;this._startHiding()}},_startHiding:function(){this.safeYoffset=(this.objImage.height-2*this.objImage.height)-10;this.animTimer=new PeriodicalExecuter(this._hideLoop.bind(this),this.delay)},_hideLoop:function(){this.curYoffset-=this.step;this.elmWrapper.setStyle({backgroundPosition:"right "+this.curYoffset+"px"});if(this.curYoffset<=this.safeYoffset){this.animTimer.stop();this.onHideComplete()}},onHideComplete:function(){this._loadImage(this.nextImage)},_loadImage:function(b){if(this.images[b]){var a=this.imgPrefix+this.images[b];this.elmWrapper.setStyle({backgroundImage:"url('"+a+"')"});this.objImage=new Image();this.objImage.src=a;if(!Prototype.Browser.IE){this.objImage.onload=this.onLoadComplete.bindAsEventListener(this)}else{this.onLoadComplete()}}else{throw ("BackSlide: Offset out of range, "+b)}},onLoadComplete:function(a){this.curImage=this.nextImage;this._startShowing()},_startShowing:function(){this.animTimer=new PeriodicalExecuter(this._showLoop.bind(this),this.delay)},_showLoop:function(){this.curYoffset+=this.step;if(this.curYoffset>=0){var a="right top";var b=true}else{var a="right "+this.curYoffset+"px";var b=false}this.elmWrapper.setStyle({backgroundPosition:a});if(b){this.animTimer.stop();this.onShowComplete()}},onShowComplete:function(){this.isProcessing=false;this.nextImage=0}});SmallBlend=Class.create({duration:3,elmWrapper:undefined,elmImage:undefined,objImage:undefined,imgPrefix:null,images:[],onImgCreated:undefined,isProcessing:false,curImage:0,nextImage:0,queuedImage:-1,initialize:function(a){if($(a.elm)){this.elmWrapper=$(a.elm);this.imgPrefix=a.prefix;this.images=a.images;if(a.onImgCreated){this.onImgCreated=a.onImgCreated}this.objImage=new Image();this.objImage.src=this.imgPrefix+this.images[0]}else{throw ("SmallBlend: No valid elm found at #"+a.elm)}},next:function(){var a=this.curImage+1;if(a>(this.images.length-1)){a=0}this.swap(a)},swap:function(a){if(!this.isProcessing){this.isProcessing=true;this.nextImage=a;this._loadImage(this.nextImage)}else{this.queuedImage=a}},_loadImage:function(b){if(this.images[b]){var a=this.imgPrefix+this.images[b];this.elmImage=Builder.node("img",{src:a});this.elmWrapper.insert({top:this.elmImage});this.elmImage.hide();if(this.onImgCreated){this.onImgCreated(this.elmImage)}this.objImage=new Image();this.objImage.src=a;if(!Prototype.Browser.IE){this.objImage.onload=this.onLoadComplete.bindAsEventListener(this)}else{this.onLoadComplete()}}else{throw ("BackSlide: Offset out of range, "+b)}},onLoadComplete:function(a){new Effect.Appear(this.elmImage,{duration:this.duration,afterFinish:this.onAppearImage.bindAsEventListener(this)})},onAppearImage:function(a){this.curImage=this.nextImage;this.elmWrapper.setStyle({backgroundImage:"url('"+this.imgPrefix+this.images[this.curImage]+"')"});this.elmImage.remove();this.isProcessing=false;this.nextImage=0;if(this.queuedImage>-1){if(this.queuedImage!=this.curImage){this.swap(this.queuedImage)}else{this.queuedImage=-1}}}});
