
/************
       TITLE: Pulse.Player.AudioControl Object
     VERSION: 4.5
        TYPE: Object Definition
      AUTHOR: Chris van Rensburg
   COPYRIGHT: (c)2002-2003 Pulse Entertainment Inc. <http://www.pulse3d.com>
 DESCRIPTION: Implements an audio transport control object to facilitate playback of audio through the Pulse Player
    REQUIRES: Pulse.Player
************/

(function(){var _a=Pulse.Player,_b='STOPPED',_c='PLAYING',_d='PAUSED',_e='undefined',_f='return false';var _g=_a.AudioControl=function(){var _h=this,_i=_a.getGIN(),_j=arguments,_k=(_j.length==1&&typeof _j[0]=='object')?_j[0]:{audioUrl:_j[0],targetPlayer:_j[1]};_h._i=_i;_h._l=new Function(_i+'.pause ();'+_f);_h._m=new Function(_i+'.play ();'+_f);_h._n=new Function(_i+'.stop ();'+_f);_h._o=_b;_h._p=_a.instances[_a.instances.length-1];_h._q=_h._r=false;_h.objectName=_i;_h.setupInstance(_k);_h._p.addEventHandler('veeperReady',_i+'.targetPlayerLoaded ()');_h._p.addEventHandler('Audio Started',_i+'.setAudioPlaying (true)');
_h._p.addEventHandler('Audio Stopped',_i+'.setAudioPlaying (false)');_h._p.addEventHandler('Unload Main',_i+'.setAudioPlaying (false)');_a.addEventHandler('Global Mute Changed',_i+'.updateButtons ()');_h.wireUi(_k);return _h;},_s=_g.prototype;function _t(_u,_v){var _w=_x[_u]={_y:16,_z:16,_A:3},_B='small_'+_v;function _C(_D){return _a.pathToResources+'images/Pulse.Player.AudioControl/'+_B+'_'+_D+'.gif';}_w._E=_C('pause_dim'),_w._F=_C('pause'),_w._G=_C('pause_lit'),_w._H=_C('play_dim'),_w._I=_C('play'),_w._J=_C('play_lit'),_w._K=_C('stop_dim'),_w._L=_C('stop'),_w._M=_C('stop_lit'),_w._N=_C('mute'),_w._O=_C('mute_lit')}var _x=_g.uiPresets={clearButtonStates:{_P:false,_E:'',_G:'',_H:'',_J:'',_K:'',_M:''}};_t('smallBlue','blue');_t('smallGray','gray');_s._Q=function(){return this._p.playerSupportsEvents()};_s._R=function(){return this._p.isReady()&&this._S!=''&& !_a.getGlobalMute();};_s._T=function(){var _h=this,_U=_h._R(),_V=_h._p.isReady(),_W=_V&&_U,_X=_h._o==_c,_Y=_h._o==_d,_Z=_h._o==_b,_0=_a.showElement;
function _1(){_a.toggleGlobalMute(1)}function _2(_3){if(typeof _3=='string')_3=_a.getElementById(_3);return _3!=null;}function _4(_5,_6,_7,_8){_a.wireElementOnclick(_5,_6,_7);_0(_5,_8);}_0(_h._9,_V&& !_U);_0(_h._ba,_V&& !_U);_0(_h._bb,_V&& !_U);_4(_h._bc,_h._l,'Pause',_W&&(!_Y|| !(_2(_h._bd)||_2(_h._9))));_4(_h._bd,_h._l,'Resume',_W&&_Y);_4(_h._be,_h._m,'Play',_W&&(!_X|| !(_2(_h._bf)||_2(_h._ba))));_4(_h._bf,_h._bg?_h._l:_h._m,_h._bg?'Pause':'Play',_W&&_X);_4(_h._bh,_h._n,'Stop',_W&&(!_Z|| !(_2(_h._bi)||_2(_h._bb))));_4(_h._bi,_h._n,'Stop',_W&&_Z);_4(_h._bj,_1,'Mute Pulse Audio',_V&& !_a.getGlobalMute());_4(_h._bk,_1,'Unmute Pulse Audio',_V&&_a.getGlobalMute());};_s._bl=function(){var _h=this;_h._o=(_h._q&&_h._p.get('audioUrl')==_h._S)?_c:_b;_h._T();};_s.setAudioPlaying=function(_bm){this._q=_bm;this._bl();};_s.targetPlayerLoaded=function(){var _h=this,_bn=false;if(_h._p.playerSupportsScripting()|| !_h._r){_bn=_h.autoStart;_h._r=true;}if(_bn){setTimeout(_h._i+'.togglePlay ()',100);}else{_h._T();}};
_s.updateButtons=_s._T;_s.insertUi=_s.insertUI=function(_k){this.set(_k);var _h=this,_bo=_h.substituteResources(_h._bo);if(_bo==''){function _bp(_bq,_br){return(_bq!='')?_bq:_br}var _bg=_h._bg,_bs= !_bg&&_h._p.playerTag!='APPLET',_bt=_h._y+_h._A,_bu=_bs?_bt:0,_bv=_bu+_bt,_bw=_bv+_bt,_bx=_a.pathToResources+'images/blank.gif';function _by(_bz,_bA,_bB){return'<img id="'+_bz+'" src="'+_bB+'" style="left:'+_bA+'px; position:absolute; top:0px; width:'+_h._y+'px; height:'+_h._z+'px; visibility:hidden;" width="'+_h._y+'" height="'+_h._z+'" hspace="0" vspace="0" border="0">';}_bo+='<div style="position:relative; width:'+(_h._y+_bu+_bt+(_h._P?_bt:0))+'px; height:'+_h._z+'px;">'+_by(_h._ba,0,_bp(_h._H,_bx))+_by(_h._be,0,_h._I)+_by(_h._bf,0,_bg?_h._F:_bp(_h._J,_h._I));if(_bs){_bo+=_by(_h._9,_bu,_bp(_h._E,_bx))+_by(_h._bc,_bu,_h._F)+_by(_h._bd,_bu,_bp(_h._G,_h._F));}_bo+=_by(_h._bb,_bv,_bp(_h._K,_bx))+_by(_h._bh,_bv,_h._L)+_by(_h._bi,_bv,_bp(_h._M,_h._L));if(_h._P){_bo+=_by(_h._bj,_bw,_h._N)+_by(_h._bk,_bw,_h._O);}
_bo+='</div>';}_a.insertHtml(_bo,_h._bC);};_s.pause=function(){if(this._o!=_b)this.togglePlay();};_s.play=function(_S){var _h=this;_h.set({_S:_S});if(_h._p.playerSupportsScripting()&&_h._o!=_d)_h.stop();_h.togglePlay();};_s.setAudio=function(_S){this.set({_S:_S})};_s.stop=function(){if(this._o!=_b|| !this._Q())this._p.stopAudio();};_s.togglePlay=function(){var _h=this,_p=_h._p;if(_h._R()|| !_p.playerSupportsScripting()){if(_h._o==_b){_p.playAudio(_h._S);if(_h._Q())_h.setAudioPlaying(true);}else if(_h._o==_c){_p.doScript('pausePkg');_h._o=_d;}else if(_h._o==_d){_p.doScript('resumePkg');_h._o=_c;}}_h._T();};_s.wireUi=function(_k){this.set(_k);this._T();};_a.inherit(_g,{_S:{name:'audioUrl',onChange:_s._bl},autoStart:'autoStart',_A:'buttonSpacing',_bC:'container',_bD:{name:'elementIdPrefix',onChange:function(){var _h=this;_h._bD=_h.substituteResources(this._bD);_h._bc=_h._bD+'pause';_h._9=_h._bc+'Dimmed';_h._bd=_h._bc+'Lit';_h._be=_h._bD+'play';_h._ba=_h._be+'Dimmed';_h._bf=_h._be+'Lit';_h._bh=_h._bD+'stop';
_h._bb=_h._bh+'Dimmed';_h._bi=_h._bh+'Lit';_h._bj=_h._bD+'mute';_h._bk=_h._bj+'Lit';}},_z:'height',_bo:'html',_bj:'muteElement',_N:'muteImageUrl',_bk:'muteLitElement',_O:'muteLitImageUrl',_bc:'pauseElement',_9:'pauseDimmedElement',_E:'pauseDimmedImageUrl',_F:'pauseImageUrl',_bd:'pauseLitElement',_G:'pauseLitImageUrl',_ba:'playDimmedElement',_H:'playDimmedImageUrl',_be:'playElement',_I:'playImageUrl',_bf:'playLitElement',_J:'playLitImageUrl',_bg:'playPauseCombo',_P:'showGlobalMute',_bb:'stopDimmedElement',_K:'stopDimmedImageUrl',_bh:'stopElement',_L:'stopImageUrl',_bi:'stopLitElement',_M:'stopLitImageUrl',_p:'targetPlayer',_y:'width'});_g.set({_S:'',autoStart:true,_bC:null,_bD:'[#objectName]_',_bo:'',_bg:false,_P:true});_g.set(_x.smallGray);_g.setUiProperties=_s.setUiProperties=_s.set;})();