/*
 * Copyright (c) 2001-2007, TIBCO Software Inc.
 * Use, modification, and distribution subject to terms of license.
 */
jsx3.require("jsx3.gui.Painted","jsx3.gui.Interactive");jsx3.Class.defineClass("jsx3.gui.Sound",jsx3.gui.Painted,[jsx3.gui.Interactive],function(p,e){p.sB={};p.sB.AF=function(k){return typeof(k.GetQuickTimeVersion)!="undefined";};p.sB.tu=function(a){a.Play();};p.sB.gf=function(k){k.Stop();};p.sB.dr=function(g){g.Stop();g.Rewind();};p.sB.Be=function(o){return o.GetDuration()/o.GetTimeScale();};p.sB.Xk=function(a){return a.GetTime()/a.GetTimeScale();};p.sB.bq=function(f,i){f.SetTime(i*f.GetTimeScale());};p.sB.dG=function(c,s){c.SetVolume(this.gu(s));};p.sB.gu=function(g){return Math.round(g*255/100);};p.sB.toString=function(){return "Apple QuickTime";};p.sB._z=function(b){return this+" "+b.GetQuickTimeVersion();};p.GE={};p.GE.AF=function(d){return typeof(d.GetVersionInfo)!="undefined";};p.GE.tu=function(a){if(a.CanPlay()){a.DoPlay();if(a.jsxlength==null){a.jsxlength=a.GetLength();a.SetPreFetch(false);}}};p.GE.gf=function(c){if(c.CanPause())c.DoPause();};p.GE.dr=function(k){if(k.CanStop())k.DoStop();};p.GE.Be=function(m){if(m.GetPlayState()!=0||m.GetPreFetch()){return m.GetLength()/1000;}else{return m.jsxlength!=null?m.jsxlength/1000:Number.NaN;}};p.GE.Xk=function(a){return a.GetPosition()/1000;};p.GE.bq=function(i,l){if(i.GetPlayState()!=0){i.SetPosition(l*1000);}else{i.DoPlay();i.SetPosition(l*1000);i.DoPause();}};p.GE.sl=function(h){return h.GetPlayState()==3;};p.GE.dG=function(b,r){b.SetVolume(this.gu(r));};p.GE.gu=function(a){return Math.round(a);};p.GE.toString=function(){return "RealPlayer";};p.GE._z=function(n){return this+" "+n.GetVersionInfo();};p.hf={};p.hf.AF=function(f){return typeof(f.GetMediaInfoString)!="undefined";};p.hf.tu=function(a){a.Play();};p.hf.gf=function(j){j.Pause();};p.hf.dr=function(g){g.Stop();};p.hf.Be=function(a){return a.Duration;};p.hf.Xk=function(q){return q.CurrentPosition;};p.hf.bq=function(c,f){c.CurrentPosition=f;};p.hf.sl=function(m){return m.PlayState==2;};p.hf.dG=function(b,r){b.Volume=this.gu(r);};p.hf.gu=function(n){return Math.max(-10000,Math.round(2500*Math.log(n*100)/Math.LN10-10000));};p.hf.toString=function(){return "Windows Media Player";};p.hf._z=function(j){if(this.VERSION==null){try{this.VERSION="Unknown Version";if(window.ActiveXObject){this.ACTIVEX=new ActiveXObject("WMPlayer.OCX.7");this.VERSION=this.ACTIVEX.versionInfo;}}catch(Kc){}}return this+" "+this.VERSION;};p.of={};p.of.AF=function(j){return true;};p.of.tu=function(o){if(typeof(o.Play)!="undefined")o.Play();};p.of.gf=function(i){if(typeof(i.Pause)!="undefined")i.Pause();};p.of.dr=function(k){if(typeof(k.Stop)!="undefined")k.Stop();};p.of.Be=function(k){return Number.NaN;};p.of.Xk=function(g){return Number.NaN;};p.of.bq=function(a,d){};p.of.sl=function(f){return false;};p.of.dG=function(k,h){if(typeof(k.SetVolume)!="undefined")k.SetVolume(this.gu(h));};p.of.gu=function(r){return Math.round(r);};p.of.toString=function(){return "Generic";};p.of._z=function(d){return this.toString();};p.Rg=[p.sB,p.GE,p.hf,p.of];e.jsxurl=null;e.jsxvolume=50;e._jsxAj=null;e.init=function(s,b){this.jsxsuper(s);this.jsxurl=b;};e.getURL=function(){return this.jsxurl;};e.setURL=function(j){this.jsxurl=j;return this;};e.getVolume=function(){return this.jsxvolume;};e.Tz=function(){var x=this.jsxvolume!=null?this.jsxvolume:this.prototype.jsxvolume;return this.hr().gu(x);};e.setVolume=function(q){this.jsxvolume=q==null?null:Math.max(0,Math.min(100,q));var Hb=this.getRendered();if(Hb!=null){var P=this.jsxvolume!=null?this.jsxvolume:this.prototype.jsxvolume;this.hr().dG(Hb,P);}return this;};e.play=function(){var Mc=this.getRendered();if(Mc!=null)this.hr().tu(Mc);};e.pause=function(){var H=this.getRendered();if(H!=null)this.hr().gf(H);};e.rewind=function(){var O=this.getRendered();if(O!=null)this.hr().dr(O);};e.getLength=function(){var db=this.getRendered();return db!=null?this.hr().Be(db):Number.NaN;};e.getPosition=function(){var dc=this.getRendered();return dc!=null?this.hr().Xk(dc):Number.NaN;};e.setPosition=function(c){var tc=this.getRendered();if(tc!=null)this.hr().bq(tc,c);};e.getPluginVersion=function(){var hb=this.getRendered();if(hb!=null){try{return this.hr()._z(hb);}catch(Kc){}}return this.hr().toString();};e.hr=function(){if(this._jsxAj!=null)return this._jsxAj;var mc=this.getRendered();if(mc!=null){for(var Rb=0;Rb<p.Rg.length;Rb++){var w=p.Rg[Rb];if(w.AF(mc)){this._jsxAj=w;break;}}return this._jsxAj;}else{return p.of;}};e.paint=function(){this.applyDynamicProperties();var Z=this.Tz();return "<embed id=\""+this.getId()+"\" name=\""+this.getId()+"\" class=\"jsx30sound\" src=\""+this.getUriResolver().resolveURI(this.getURL())+"\" enablejavascript=\"true\" autostart=\"false\" "+this.renderAttributes()+" volume=\""+Z+"\" prefetch=\"true\" unselectable=\"on\"/>";};e.onDestroy=function(h){this.jsxsuper(h);this.doEvent(jsx3.gui.Interactive.DESTROY,{objPARENT:h});};});
