
Type.registerNamespace('Monster.Client.Behavior');Monster.Client.Behavior.DivTransitionAdapter=function(element){Monster.Client.Behavior.DivTransitionAdapter.initializeBase(this,[element]);this.createProperty("rotationTime");this._currentIdx=0;this._prevIdx=0;this._cntr=0;this._opacity=0;this._showIntervalId;this._fadeIntervalId;this._divs=new Array();this._links=new Array();this._maxDivs=0;}
Monster.Client.Behavior.DivTransitionAdapter.prototype={initialize:function(){Monster.Client.Behavior.DivTransitionAdapter.callBaseMethod(this,'initialize');if(!MonsPageManager.enableInitOnDemand){this.initOnDemand();}
else{MonsPageManager.registerInitState(this._id,false,null);}
this._divs=$(this._element).find(".rotating-div");if(this._divs[0]){$(this._divs[0]).show();}
this._links=$(this._element).find(".carousel-link");this._maxDivs=this._divs.length;var self=this;for(var i=0;i<this._maxDivs;i++){var div4event=$(this._divs[i]);div4event.bind("click",function(e){self.stopTransitions();});div4event.bind("mouseenter",function(e){self.pauseTransitions()});div4event.bind("mouseleave",function(e){self.startTransitions()});}
this.registerDataProperty("changeCarousel");this.startTransitions();if(typeof publishCarouselInitProgressWT!=="undefined"){publishCarouselInitProgressWT();}},initOnDemand:function()
{},dispose:function(){for(var i=0;i<this._maxDivs;i++){$(this._divs[i]).unbind("click mouseenter mouseleave");}},onDataStoreEvent:function(sender,args){if(args.get_propertyName()=="changeCarousel"){this.slideshow();if(this._cntr==0){this._showIntervalId=window.setInterval(function(){sender.set_property("changeCarousel",this);;},this.rotationTime*1000);this._cntr++;}}},initHandlers:function(element,event,context){$addHandlers(element,{click:this.switchTo},{idx:context,adapter:this});if(Sys.Browser.agent!=Sys.Browser.InternetExplorer){this.switchTo.call({idx:context,adapter:this},event);}},initTrans:function(){if(this._maxDivs>1){this.carouselLinks();if(this._currentIdx<this._prevIdx){for(var i=parseInt(this._currentIdx)+1;i<this._prevIdx;i++)
$(this._divs[i]).hide();$(this._divs[this._prevIdx]).fadeOut(2000);}else{$(this._divs[this._currentIdx]).fadeIn(2000);}}},carouselLinks:function(){$(this._links[this._currentIdx]).addClass("current");$(this._links[this._prevIdx]).removeClass("current");},next:function(){this._prevIdx=this._currentIdx;this._currentIdx++;if(this._currentIdx>=this._maxDivs){this._currentIdx=0;}
this.initTrans();},prev:function(){this._prevIdx=this._currentIdx;this._currentIdx--;if(this._currentIdx<0)this._currentIdx=this._maxDivs-1;this.initTrans();},stopTransitions:function(){this.stopIntervals();this._cntr=-1;},switchTo:function(event){var idx=this.idx;var adapter=this.adapter;adapter.stopIntervals();adapter._cntr=-1;switch(idx){case"next":adapter.next();publishCarouselNextClickWT(adapter._currentIdx);break;case"prev":adapter.prev();publishCarouselPreviousClickWT(adapter._currentIdx);break;default:if(adapter._currentIdx!=idx){adapter._prevIdx=adapter._currentIdx;adapter._currentIdx=idx;adapter.initTrans();publishCarouselClickWT(adapter._currentIdx);}}},stopIntervals:function(){if(this._showIntervalId)window.clearInterval(this._showIntervalId);},pauseTransitions:function(){this.stopIntervals();if(this._cntr>0)this._cntr=0;},startTransitions:function(){this._dataStore.set_property("changeCarousel",this);},slideshow:function(){if(this._cntr>0){this.next();this._cntr++;if(typeof publishCarouselAutoProgressWT!=="undefined"){publishCarouselAutoProgressWT(this._currentIdx);}}}}
Monster.Client.Behavior.DivTransitionAdapter.registerClass('Monster.Client.Behavior.DivTransitionAdapter',Monster.Client.Behavior.DataAdapterBase);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
;
