/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.widget.AutoRotator"],["require","dojox.widget.Rotator"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.widget.AutoRotator"]){_4._hasResource["dojox.widget.AutoRotator"]=true;_4.provide("dojox.widget.AutoRotator");_4.require("dojox.widget.Rotator");(function(d){d.declare("dojox.widget.AutoRotator",_6.widget.Rotator,{suspendOnHover:false,duration:4000,autoStart:true,pauseOnManualChange:false,cycles:-1,random:false,reverse:false,constructor:function(){var _7=this;if(_7.cycles-0==_7.cycles&&_7.cycles>0){_7.cycles++;}else{_7.cycles=_7.cycles?-1:0;}_7._connects=[d.connect(_7._domNode,"onmouseover",function(){if(_7.suspendOnHover&&!_7.anim&&!_7.wfe){var t=_7._endTime,n=_7._now();_7._suspended=true;_7._resetTimer();_7._resumeDuration=t>n?t-n:0.01;}}),d.connect(_7._domNode,"onmouseout",function(){if(_7.suspendOnHover&&!_7.anim){_7._suspended=false;if(_7.playing&&!_7.wfe){_7.play(true);}}})];if(_7.autoStart&&_7.panes.length>1){_7.play();}else{_7.pause();}},destroy:function(){d.forEach(this._connects,d.disconnect);this.inherited(arguments);},play:function(_8,_9){this.playing=true;this._resetTimer();if(_8!==true&&this.cycles>0){this.cycles--;}if(this.cycles==0){this.pause();}else{if(!this._suspended){this.onUpdate("play");if(_9){this._cycle();}else{var r=(this._resumeDuration||0)-0,u=(r>0?r:(this.panes[this.idx].duration||this.duration))-0;this._resumeDuration=0;this._endTime=this._now()+u;this._timer=setTimeout(d.hitch(this,"_cycle",false),u);}}}},pause:function(){this.playing=this._suspended=false;this.cycles=-1;this._resetTimer();this.onUpdate("pause");},_now:function(){return (new Date()).getTime();},_resetTimer:function(){clearTimeout(this._timer);},_cycle:function(_a){var _b=this,i=_b.idx,j;if(_b.random){do{j=Math.floor(Math.random()*_b.panes.length+1);}while(j==i);}else{j=i+(_b.reverse?-1:1);}var _c=_b.go(j);if(_c){_c.addCallback(function(_d){_b.onUpdate("cycle");if(_b.playing){_b.play(false,_d);}});}},onManualChange:function(_e){this.cycles=-1;if(_e!="play"){this._resetTimer();if(this.pauseOnManualChange){this.pause();}}if(this.playing){this.play();}}});})(_4);}}};});