var Rotator=new Class({Implements:[Events,Options],options:{autoRotate:true,delay:6E3,stopOnOver:false,elements:{rotatorCont:"rotator-cont",rotatorItems:".rotatorItem"},controller:false,onSlideChange:function(){}},counter:1,completedLoading:false,initialize:function(a){this.setOptions(a);if(!($$(this.options.elements.rotatorItems).length>1))return false;this.rotatorCont=$(this.options.elements.rotatorCont);this.rotatorItems=$$(this.options.elements.rotatorItems);this.maxIndex=this.rotatorItems.length; this.timer=$empty;this.timerStopper=false;if(this.options.controller){a=this.options.controller.getChildren("a");a[0].addEvents({click:function(){this.previous();return false}.bind(this)});a[1].addEvents({click:function(b){this.play_pause(b);return false}.bind(this,a[1])});a[2].addEvents({click:function(){this.next();return false}.bind(this)})}this.manage();if(this.options.autoRotate)this.timer=this.increment.periodical(this.options.delay,this);this.rotate(0);this.counter=0},rotate:function(a){if(a< 0)a=this.rotatorItems.length-1;if(a>=this.rotatorItems.length)a=0;if(this.completedLoading)this.rotatorItems.fade("out");else{this.completedLoading=true;this.rotatorItems.setStyle("display","none");this.rotatorItems.fade("out");this.rotatorItems[a].setStyle("display","block");(function(){this.rotatorItems.setStyle("display","block")}).bind(this).delay(500)}this.rotatorItems[a].fade("in");this.counter=a},manage:function(){this.options.stopOnOver&&this.rotatorCont.addEvents({mouseenter:function(){this.timer= $clear(this.timer)}.bind(this),mouseleave:function(){if(this.options.autoRotate)if(!this.timerStopper)this.timer=this.increment.periodical(this.options.delay,this)}.bind(this)})},increment:function(){this.counter=++this.counter%this.maxIndex;this.rotate(this.counter)},next:function(){this.timer=$clear(this.timer);this.timer=this.increment.periodical(this.options.delay,this);this.rotate(this.counter+1)},previous:function(){this.timer=$clear(this.timer);this.timer=this.increment.periodical(this.options.delay, this);this.rotate(this.counter-1)},play_pause:function(a){if(a.hasClass("play_style")){this.timer=$clear(this.timer);this.timer=this.increment.periodical(this.options.delay,this);this.options.autoRotate=true}else{this.timer=$clear(this.timer);this.options.autoRotate=false}var b=a.get("rel").split("|"),c=b[0];b=b[1];a.set("rel",a.get("class")+"|"+a.get("text"));a.set("class",c);a.set("title",b);a.set("text",b)}});
