/*
	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.VolumeButton"],["require","dijit._Widget"],["require","dijit._Templated"],["require","dijit.form.Button"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.av.widget.VolumeButton"]){_4._hasResource["dojox.av.widget.VolumeButton"]=true;_4.provide("dojox.av.widget.VolumeButton");_4.require("dijit._Widget");_4.require("dijit._Templated");_4.require("dijit.form.Button");_4.declare("dojox.av.widget.VolumeButton",[_5._Widget,_5._Templated],{templateString:_4.cache("dojox.av.widget","resources/VolumeButton.html","<div class=\"Volume\" dojoAttachEvent=\"mousedown:onShowVolume\">\r\n\t<div class=\"VolumeSlider\" dojoAttachPoint=\"volumeSlider\">\r\n    \t<div class=\"VolumeSliderBack\" dojoAttachPoint=\"volumeSliderBack\"></div>\r\n    \t<div class=\"VolumeSliderHandle\" dojoAttachPoint=\"handle\" dojoAttachEvent=\"mousedown:startDrag, mouseup:endDrag, mouseover:handleOver, mouseout:handleOut\"></div>\t\r\n    </div>\r\n    <div class=\"icon\"></div>\r\n</div>\r\n"),postCreate:function(){this.handleWidth=_4.marginBox(this.handle).w;this.width=_4.marginBox(this.volumeSlider).w;this.slotWidth=100;_4.setSelectable(this.handle,false);this.volumeSlider=this.domNode.removeChild(this.volumeSlider);},setMedia:function(_7){this.media=_7;this.updateIcon();},updateIcon:function(_8){_8=(_8===undefined)?this.media.volume():_8;if(_8===0){_4.attr(this.domNode,"class","Volume mute");}else{if(_8<0.334){_4.attr(this.domNode,"class","Volume low");}else{if(_8<0.667){_4.attr(this.domNode,"class","Volume med");}else{_4.attr(this.domNode,"class","Volume high");}}}},onShowVolume:function(_9){if(this.showing==undefined){_4.body().appendChild(this.volumeSlider);this.showing=false;}if(!this.showing){var _a=2;var _b=7;var _c=this.media.volume();var _d=this._getVolumeDim();var _e=this._getHandleDim();this.x=_d.x-this.width;_4.style(this.volumeSlider,"display","");_4.style(this.volumeSlider,"top",_d.y+"px");_4.style(this.volumeSlider,"left",(this.x)+"px");var x=(this.slotWidth*_c);_4.style(this.handle,"top",(_a+(_e.w/2))+"px");_4.style(this.handle,"left",(x+_b+(_e.h/2))+"px");this.showing=true;this.clickOff=_4.connect(_4.doc,"onmousedown",this,"onDocClick");}else{this.onHideVolume();}},onDocClick:function(_f){if(!_4.isDescendant(_f.target,this.domNode)&&!_4.isDescendant(_f.target,this.volumeSlider)){this.onHideVolume();}},onHideVolume:function(){this.endDrag();_4.style(this.volumeSlider,"display","none");this.showing=false;},onDrag:function(evt){var beg=this.handleWidth/2;var end=beg+this.slotWidth;var x=evt.clientX-this.x;if(x<beg){x=beg;}if(x>end){x=end;}_4.style(this.handle,"left",(x)+"px");var p=(x-beg)/(end-beg);this.media.volume(p);this.updateIcon(p);},startDrag:function(){this.isDragging=true;this.cmove=_4.connect(_4.doc,"mousemove",this,"onDrag");this.cup=_4.connect(_4.doc,"mouseup",this,"endDrag");},endDrag:function(){this.isDragging=false;if(this.cmove){_4.disconnect(this.cmove);}if(this.cup){_4.disconnect(this.cup);}this.handleOut();},handleOver:function(){_4.addClass(this.handle,"over");},handleOut:function(){if(!this.isDragging){_4.removeClass(this.handle,"over");}},_getVolumeDim:function(){if(this._domCoords){return this._domCoords;}this._domCoords=_4.coords(this.domNode);return this._domCoords;},_getHandleDim:function(){if(this._handleCoords){return this._handleCoords;}this._handleCoords=_4.marginBox(this.handle);return this._handleCoords;},onResize:function(_10){this.onHideVolume();this._domCoords=null;}});}}};});