/*
	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.av.widget.ProgressSlider"],["require","dijit._Widget"],["require","dijit._Templated"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.av.widget.ProgressSlider"]){_4._hasResource["dojox.av.widget.ProgressSlider"]=true;_4.provide("dojox.av.widget.ProgressSlider");_4.require("dijit._Widget");_4.require("dijit._Templated");_4.declare("dojox.av.widget.ProgressSlider",[_5._Widget,_5._Templated],{templateString:_4.cache("dojox.av.widget","resources/ProgressSlider.html","<div class=\"Progress\" dojoAttachEvent=\"mousedown:startDrag\">\r\n    \r\n    <div class=\"ProgressLoaded\" dojoAttachPoint=\"progressLoaded\"></div>\r\n    <div class=\"ProgressPosition\" dojoAttachPoint=\"progressPosition\"></div>\r\n\t<div class=\"ProgressHandle\" dojoAttachPoint=\"handle\" dojoAttachEvent=\"mouseover:handleOver, mouseout:handleOut\"></div>\r\n</div>\r\n"),postCreate:function(){this.seeking=false;this.handleWidth=_4.marginBox(this.handle).w;var _7=_4.coords(this.domNode);this.finalWidth=_7.w;this.width=_7.w-this.handleWidth;this.x=_7.x;_4.setSelectable(this.domNode,false);_4.setSelectable(this.handle,false);},setMedia:function(_8,_9){this.playerWidget=_9;this.media=_8;_4.connect(this.media,"onMetaData",this,function(_a){if(_a&&_a.duration){this.duration=_a.duration;}});_4.connect(this.media,"onEnd",this,function(){_4.disconnect(this.posCon);this.setHandle(this.duration);});_4.connect(this.media,"onStart",this,function(){this.posCon=_4.connect(this.media,"onPosition",this,"setHandle");});_4.connect(this.media,"onDownloaded",this,function(_b){this.setLoadedPosition(_b*0.01);this.width=this.finalWidth*0.01*_b;});},onDrag:function(_c){var x=_c.clientX-this.x;if(x<0){x=0;}if(x>this.width-this.handleWidth){x=this.width-this.handleWidth;}var p=x/this.finalWidth;this.media.seek(this.duration*p);_4.style(this.handle,"marginLeft",x+"px");_4.style(this.progressPosition,"width",x+"px");},startDrag:function(){_4.setSelectable(this.playerWidget.domNode,false);this.seeking=true;this.cmove=_4.connect(_4.doc,"mousemove",this,"onDrag");this.cup=_4.connect(_4.doc,"mouseup",this,"endDrag");},endDrag:function(){_4.setSelectable(this.playerWidget.domNode,true);this.seeking=false;if(this.cmove){_4.disconnect(this.cmove);}if(this.cup){_4.disconnect(this.cup);}this.handleOut();},setHandle:function(_d){if(!this.seeking){var w=this.width-this.handleWidth;var p=_d/this.duration;var x=p*w;_4.style(this.handle,"marginLeft",x+"px");_4.style(this.progressPosition,"width",x+"px");}},setLoadedPosition:function(_e){_4.style(this.progressLoaded,"width",(this.finalWidth*_e)+"px");},handleOver:function(){_4.addClass(this.handle,"over");},handleOut:function(){if(!this.seeking){_4.removeClass(this.handle,"over");}},onResize:function(_f){var dim=_4.coords(this.domNode);this.finalWidth=dim.w;}});}}};});