!function(a){a.Carousel.Extra=new Class({Extends:a.Carousel,Binds:["update","start","stop"],initialize:function(b){this.parent(Object.append({interval:5,delay:10,autostart:true},b));var d,c=this.events={click:function(h){h.stop();d=this.active;if(d){this.stop()}var g=h.event.target,f=this.tabs.indexOf(g);while(g&&f==-1){g=g.parentNode;f=this.tabs.indexOf(g)}if(f==-1){return}this.move(f);if(d){this.start.delay(this.options.delay*1000)}}.bind(this)};this.tabs.each(function(e){e.removeEvents(this.events).addEvents(c)},this);this.events=c;["previous","next"].each(function(e){if($(this.options[e])){$(this.options[e]).addEvent("click",function(f){f.stop();d=this.active;if(d){this.stop().start.delay(this.options.delay*1000);this.active=d}}.bind(this))}},this);this.timer=new PeriodicalExecuter(this.update,this.options.interval).stop();this[this.options.autostart?"start":"stop"]()},update:function(){return this[this.options.reverse?"previous":"next"]()},start:function(){this.timer.registerCallback();this.active=true;return this},stop:function(){this.timer.stop();this.active=false;return this},toggle:function(){return this[this.active?"stop":"start"]()}})}(this);
