var SmoothRotate=new Class({Extends:Options,mContainer:null,mChildrens:null,mIndex:0,mMaxIndex:0,mLoaded:false,mRotateDelay:null,mSpotShowDelay:null,mSpotHideDelay:null,initialize:function(b,a){this.setOptions(a);this.mContainer=b;this._recalculateMax();if(!["absolute","relative"].contains(this.mContainer.getStyle("position"))){this.mContainer.setStyle("position","relative")}this.mContainer.setStyle("overflow","hidden");this._setElementsStyles();this._start.delay(this.options.pause,this)},setOptions:function(a){this.parent(a);if(true==this.mLoaded){this._start()}},_recalculateMax:function(){this.mChildrens=this.mContainer.getChildren();this.mMaxIndex=this.mChildrens.length},_setElementsStyles:function(){var a=true;this.mChildrens.each(function(e){if(a){var d=1;var c=2;a=false}else{var d=0;var c=1}e.setStyles({position:"absolute",left:0,top:0,"z-index":c,opacity:d});var b=e.getElement("*[rel=imageRotate-spot]");if(b){e._spot=new Element("span",{"class":"imageRotate-container"}).injectInside(e);e._spotShadow=new Element("span",{"class":"imageRotate-shadow"}).injectInside(e._spot);b.injectInside(e._spot);e._spotShadow.setStyles({position:"absolute",left:0,top:0,width:"100%",height:"100%","z-index":1});b.setStyles({position:"absolute",left:0,top:0,"z-index":2,display:"block"});e._spot.setStyles({position:"absolute","min-height":50,width:"100%",left:0});e._spot.setStyle("bottom",-1*e._spot.getSize().y)}})},_start:function(){if(1>=this.mChildrens.length){return}$clear(this.mRotateDelay);$clear(this.mSpotShowDelay);$clear(this.mSpotJideDelay);this._spot();this.mRotateDelay=this.next.periodical(this.options.rotateDelay,this)},_getCurrent:function(){return this.mChildrens[this.mIndex]},_getNext:function(){next=((this.mIndex+1)%this.mMaxIndex);return this.mChildrens[next]},_spot:function(){var a=this._getCurrent();if(!a._spot){return}this.mSpotShowDelay=a._spot.tween.delay(this.options.rotateDelay-this.options.spotDiff,a._spot,["bottom",parseInt(a._spot.getStyle("bottom"))]);this.mSpotHideDelay=a._spot.tween.delay(this.options.spotDiff,a._spot,["bottom",0])},next:function(){if(this.old){this.old.setStyle("z-index",1)}var a=this._getNext();var b=this._getCurrent();a.setStyles({"z-index":3,opacity:0});b.setStyle("z-index",2);this.old=b;a.fade(1);this.mIndex=(++this.mIndex%this.mMaxIndex);this._spot()}});var SmoothRotate_Assignment=new Class({mGlobalIndex:1,mRotators:{},mRotateDelay:5000,mSpotDiff:500,initialize:function(){document.getElements('*[rel*="imageRotate"]').each(function(g){var b="item_"+(this.mGlobalIndex++);var a={};try{var c=g.getProperty("rel").match(/\[(.+)\]/)[1];var f=c.match(/(\w+)=(\d+)/g);f.each(function(j){var h=j.match(/(\w+)=(\d+)/);try{a[h[1]]=h[2]}catch(i){}})}catch(d){var f={}}this.mRotators[b]=new SmoothRotate(g,{rotateDelay:a.delay||this.mRotateDelay,spotDiff:this.mSpotDiff,pause:a.pause||0});g.getSmoothRotate=function(e){return this.mRotators[e]}.bind(this,[b])}.bind(this))}});window.addEvent("domready",function(){new SmoothRotate_Assignment()});
