var slidePromo=function(){var a=Cookie.read("cicPromoShown")==="true";if(!a&&$("slidepromo")){$$("#slidepromo .close").addEvent("click",function(){pageTracker._trackEvent("Promo","Close","CIC");$("slidepromo").dispose()});$$("#slidepromo a.cic, #slidepromo a.more").addEvent("click",function(){pageTracker._trackEvent("Promo","Click","CIC")});var b=new Fx.Tween("slidepromo",{duration:"long",transition:"quad",property:"right"});if(!a){a=true;b.start(-460,20);Cookie.write("cicPromoShown","true",{duration:1});pageTracker._trackEvent("Promo","View","CIC")}}};var Promo=new Class({initialize:function(b){this.box=b.box;this.items=b.items;this.size=b.size||403;this.currentIndex=null;this.previousIndex=null;this.nextIndex=null;this._play=null;this.interval=b.interval||8000;this.handles=b.handles||null;this.running=false;if(this.handles){this.addHandleButtons(this.handles)}this.buttons={previous:[],next:[],play:[],stop:[],toggle:[]};if(b.addButtons){for(var a in b.addButtons){this.addActionButtons(a,$type(b.addButtons[a])=="array"?b.addButtons[a]:[b.addButtons[a]])}}this.fx=new Fx.Tween(this.box,$extend((b.fxOptions||{duration:500,wait:false,transition:Fx.Transitions.Quad.easeInOut}),{property:"left"}));this.walk(0,true)},addHandleButtons:function(b){for(var a=0;a<b.length;a++){b[a].addEvent("click",this.walk.bind(this,[a,true]))}},addActionButtons:function(c,b){for(var a=0;a<b.length;a++){switch(c){case"previous":b[a].addEvent("click",this.previous.bind(this,[true]));break;case"next":b[a].addEvent("click",this.next.bind(this,[true]));break;case"play":b[a].addEvent("click",this.play.bind(this,[this.interval,false]));break;case"stop":b[a].addEvent("click",this.stop.bind(this));break;case"toggle":b[a].addEvent("click",this.toggle.bind(this));break}this.buttons[c].push(b[a])}},previous:function(a){this.walk((this.currentIndex>0?this.currentIndex-1:this.items.length-1),a)},next:function(a){this.walk((this.currentIndex<this.items.length-1?this.currentIndex+1:0),a)},stop:function(){$clear(this._play);this.running=false},toggle:function(){if(this.running){$clear(this._play);this.running=false}else{this.running=true;this.walk((this.currentIndex<this.items.length-1?this.currentIndex+1:0),true)}},play:function(a,b){this.stop();if(!b){this.next(false)}this.running=true;this._play=this.next.periodical(a,this,[false])},walk:function(b,a){if(b!=this.currentIndex){this.currentIndex=b;this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(a){this.stop()}this.fx.start(this.size*-this.currentIndex);if(a){this.play(this.interval,true)}}}});
