
var carousel2=new Class({getOptions:function(){return{transition:Fx.Transitions.Back.easeOut,carItemsInView:7,moveCount:1,moveLeft:'carouselLeft',moveRight:'carouselRight',duration:750};},initialize:function(carouselCont,Opts){this.setOptions(this.getOptions(),Opts);this.myFx=new Fx.Morph(carouselCont,{'wait':true,'duration':this.options.duration,'transition':this.options.transition});this.moveAmt=this.options.moveCount;this.carItems=parseInt($(carouselCont).getChildren().length);this.firstCarWidth=parseInt($(carouselCont).getFirst().getStyle('width'));this.totalCarWidth=this.carItems*this.firstCarWidth;$(carouselCont).setStyle('width',this.totalCarWidth);this.maxCarScroll=this.options.carItemsInView*this.firstCarWidth;this.moveRight=$(carouselCont).getParent('div').getNext();this.moveLeft=$(carouselCont).getParent('div').getPrevious();$(this.moveLeft).addEvent('click',function(el){var curPos=parseInt($(carouselCont).getStyle('margin-left'));$(this.moveRight).setStyle('opacity','1');var moveTo=(curPos+(this.moveAmt*this.firstCarWidth));if(moveTo>=0){moveTo=0;$(this.moveLeft).setStyle('opacity','0');}
this.myFx.start({'margin-left':[parseInt(curPos),moveTo]});}.bind(this));$(this.moveRight).addEvent('click',function(el){var curPos=parseInt($(carouselCont).getStyle('margin-left'));var stopRight=(-(this.totalCarWidth-(this.options.carItemsInView*this.firstCarWidth)));$(this.moveLeft).setStyle('opacity','1');var moveTo=((this.moveAmt*this.firstCarWidth)-curPos);maxMoveRight=this.totalCarWidth-(this.options.carItemsInView*this.firstCarWidth);if(moveTo>=maxMoveRight){$(this.moveRight).setStyle('opacity','0');moveTo=maxMoveRight;}
this.myFx.start({'margin-left':[parseInt(curPos),-moveTo]});}.bind(this));}});carousel2.implement(new Options);