/*
   SoundManager 2: Javascript Sound for the Web
   --------------------------------------------
   http://schillmania.com/projects/soundmanager2/

   Copyright (c) 2007, Scott Schiller. All rights reserved.
   Code provided under the BSD License:
   http://schillmania.com/projects/soundmanager2/license.txt

   V2.95b.20100323
*/
(function(c){var b=null;function a(e,d){this.flashVersion=8;this.debugMode=true;this.debugFlash=false;this.useConsole=true;this.consoleOnly=false;this.waitForWindowLoad=false;this.nullURL="null.mp3";this.allowPolling=true;this.useFastPolling=false;this.useMovieStar=false;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashLoadTimeout=1000;this.wmode=null;this.allowFullScreen=true;this.allowScriptAccess="always";this.useFlashBlock=false;this.defaultOptions={autoLoad:false,stream:true,autoPlay:false,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfinish:null,onbeforefinish:null,onbeforefinishtime:5000,onbeforefinishcomplete:null,onjustbeforefinish:null,onjustbeforefinishtime:200,multiShot:true,multiShotEvents:false,position:null,pan:0,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null};this.movieStarOptions={onmetadata:null,useVideo:false,bufferTime:2};var k,j=this,h="soundManager",g,i="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html",f;this.version=null;this.versionNumber="V2.95b.20100323";this.movieURL=null;this.url=(e||null);this.altURL=null;this.swfLoaded=false;this.enabled=false;this.o=null;this.movieID="sm2-container";this.id=(d||"sm2movie");this.swfCSS={swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.oMC=null;this.sounds={};this.soundIDs=[];this.muted=false;this.isFullScreen=false;this.isIE=(navigator.userAgent.match(/MSIE/i));this.isSafari=(navigator.userAgent.match(/safari/i));this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.specialWmodeCase=false;this.didFlashBlock=false;this._onready=[];this._debugOpen=true;this._didAppend=false;this._appendSuccess=false;this._didInit=false;this._disabled=false;this._windowLoaded=false;this._hasConsole=(typeof console!=="undefined"&&typeof console.log!=="undefined");this._debugLevels=["log","info","warn","error"];this._defaultFlashVersion=8;this._oRemoved=null;this._oRemovedHTML=null;g=function(l){return document.getElementById(l)};this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?\.*)?$/i,flash9:/\.mp3(\?\.*)?$/i};this.baseMimeTypes=/^audio\/(?:x-)?(?:mp(?:eg|3))\s*;?/i;this.netStreamMimeTypes=/^audio\/(?:x-)?(?:mp(?:eg|3)|mp4a-latm|aac|speex)\s*;?/i;this.netStreamTypes=["aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"];this.netStreamPattern=new RegExp("\\.("+this.netStreamTypes.join("|")+")(\\?.*)?$","i");this.mimePattern=j.baseMimeTypes;this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};this._setVersionInfo=function(){if(j.flashVersion!==8&&j.flashVersion!==9){alert(j._str("badFV",j.flashVersion,j._defaultFlashVersion));j.flashVersion=j._defaultFlashVersion}j.version=j.versionNumber+(j.flashVersion===9?" (AS3/Flash 9)":" (AS2/Flash 8)");if(j.flashVersion>8){j.defaultOptions=j._mergeObjects(j.defaultOptions,j.flash9Options);j.features.buffering=true}if(j.flashVersion>8&&j.useMovieStar){j.defaultOptions=j._mergeObjects(j.defaultOptions,j.movieStarOptions);j.filePatterns.flash9=new RegExp("\\.(mp3|"+j.netStreamTypes.join("|")+")(\\?.*)?$","i");j.mimePattern=j.netStreamMimeTypes;j.features.movieStar=true}else{j.useMovieStar=false;j.features.movieStar=false}j.filePattern=j.filePatterns[(j.flashVersion!==8?"flash9":"flash8")];j.movieURL=(j.flashVersion===8?"soundmanager2.swf":"soundmanager2_flash9.swf");j.features.peakData=j.features.waveformData=j.features.eqData=(j.flashVersion>8)};this._overHTTP=(document.location?document.location.protocol.match(/http/i):null);this._waitingforEI=false;this._initPending=false;this._tryInitOnFocus=(this.isSafari&&typeof document.hasFocus==="undefined");this._isFocused=(typeof document.hasFocus!=="undefined"?document.hasFocus():null);this._okToDisable=!this._tryInitOnFocus;this.useAltURL=!this._overHTTP;this.strings={notReady:"Not loaded yet - wait for soundManager.onload() before calling sound-related methods",appXHTML:h+"_createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.",swf404:h+": Verify that %s is a valid path.",tryDebug:"Try "+h+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:h+": Non-HTTP page ("+document.location.protocol+" URL?) Review Flash player security settings for this special case:\n"+i+"\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:h+": Special case: Waiting for focus-related event..",waitImpatient:h+": Getting impatient, still waiting for Flash%s...",waitForever:h+": Waiting indefinitely for Flash (will recover if unblocked)...",needFunction:h+".onready(): Function object expected",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',fl9Vid:"flash 9 required for video. Exiting.",noMS:"MovieStar mode not enabled. Exiting.",spcWmode:h+"._createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue",currentObj:"--- "+h+"._debug(): Current sound objects ---",waitEI:h+"._initMovie(): Waiting for ExternalInterface call from Flash..",waitOnload:h+": Waiting for window.onload()",docLoaded:h+": Document already loaded",onload:h+".initComplete(): calling soundManager.onload()",onloadOK:h+".onload() complete",init:"-- "+h+".init() --",didInit:h+".init(): Already called?",flashJS:h+": Attempting to call Flash from JS..",noPolling:h+": Polling (whileloading()/whileplaying() support) is disabled.",secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html",badRemove:"Warning: Failed to remove flash movie.",noPeak:"Warning: peakData features unsupported for movieStar formats",shutdown:h+".disable(): Shutting down",queue:h+".onready(): Queueing handler",smFail:h+": Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+j.swfCSS.swfTimedout+" CSS..",manURL:"SMSound.load(): Using manually-assigned URL",onURL:h+".load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.'};this._str=function(){var q=Array.prototype.slice.call(arguments),p=q.shift(),n=(j.strings&&j.strings[p]?j.strings[p]:""),m,l;if(n&&q&&q.length){for(m=0,l=q.length;m<l;m++){n=n.replace("%s",q[m])}}return n};this.supported=function(){return(j._didInit&&!j._disabled)};this.getMovie=function(l){return j.isIE?c[l]:(j.isSafari?g(l)||document[l]:g(l))};this.loadFromXML=function(l){try{j.o._loadFromXML(l)}catch(m){j._failSafely();return true}};this.createSound=function(m){var o="soundManager.createSound(): ",n=null,l=null;if(!j._didInit){throw j._complain(o+j._str("notReady"),arguments.callee.caller)}if(arguments.length===2){m={id:arguments[0],url:arguments[1]}}n=j._mergeObjects(m);l=n;if(l.id.toString().charAt(0).match(/^[0-9]$/)){j._wD(o+j._str("badID",l.id),2)}j._wD(o+l.id+" ("+l.url+")",1);if(j._idCheck(l.id,true)){j._wD(o+l.id+" exists",1);return j.sounds[l.id]}if(j.flashVersion>8&&j.useMovieStar){if(l.isMovieStar===null){l.isMovieStar=(l.url.match(j.netStreamPattern)?true:false)}if(l.isMovieStar){j._wD(o+"using MovieStar handling")}if(l.isMovieStar&&l.usePeakData){j._wDS("noPeak");l.usePeakData=false}}j.sounds[l.id]=new k(l);j.soundIDs[j.soundIDs.length]=l.id;if(j.flashVersion===8){j.o._createSound(l.id,l.onjustbeforefinishtime)}else{j.o._createSound(l.id,l.url,l.onjustbeforefinishtime,l.usePeakData,l.useWaveformData,l.useEQData,l.isMovieStar,(l.isMovieStar?l.useVideo:false),(l.isMovieStar?l.bufferTime:false))}if(l.autoLoad||l.autoPlay){if(j.sounds[l.id]){j.sounds[l.id].load(l)}}if(l.autoPlay){j.sounds[l.id].play()}return j.sounds[l.id]};this.createVideo=function(l){var m="soundManager.createVideo(): ";if(arguments.length===2){l={id:arguments[0],url:arguments[1]}}if(j.flashVersion>=9){l.isMovieStar=true;l.useVideo=true}else{j._wD(m+j._str("f9Vid"),2);return false}if(!j.useMovieStar){j._wD(m+j._str("noMS"),2)}return j.createSound(l)};this.destroySound=function(m,l){if(!j._idCheck(m)){return false}for(var n=0;n<j.soundIDs.length;n++){if(j.soundIDs[n]===m){j.soundIDs.splice(n,1);continue}}j.sounds[m].unload();if(!l){j.sounds[m].destruct()}delete j.sounds[m]};this.destroyVideo=this.destroySound;this.load=function(l,m){if(!j._idCheck(l)){return false}j.sounds[l].load(m)};this.unload=function(l){if(!j._idCheck(l)){return false}j.sounds[l].unload()};this.play=function(l,m){var n="soundManager.play(): ";if(!j._didInit){throw j._complain(n+j._str("notReady"),arguments.callee.caller)}if(!j._idCheck(l)){if(!(m instanceof Object)){m={url:m}}if(m&&m.url){j._wD(n+'attempting to create "'+l+'"',1);m.id=l;return j.createSound(m).play()}else{return false}}j.sounds[l].play(m)};this.start=this.play;this.setPosition=function(l,m){if(!j._idCheck(l)){return false}j.sounds[l].setPosition(m)};this.stop=function(l){if(!j._idCheck(l)){return false}j._wD("soundManager.stop("+l+")",1);j.sounds[l].stop()};this.stopAll=function(){j._wD("soundManager.stopAll()",1);for(var l in j.sounds){if(j.sounds[l] instanceof k){j.sounds[l].stop()}}};this.pause=function(l){if(!j._idCheck(l)){return false}j.sounds[l].pause()};this.pauseAll=function(){for(var l=j.soundIDs.length;l--;){j.sounds[j.soundIDs[l]].pause()}};this.resume=function(l){if(!j._idCheck(l)){return false}j.sounds[l].resume()};this.resumeAll=function(){for(var l=j.soundIDs.length;l--;){j.sounds[j.soundIDs[l]].resume()}};this.togglePause=function(l){if(!j._idCheck(l)){return false}j.sounds[l].togglePause()};this.setPan=function(l,m){if(!j._idCheck(l)){return false}j.sounds[l].setPan(m)};this.setVolume=function(m,l){if(!j._idCheck(m)){return false}j.sounds[m].setVolume(l)};this.mute=function(l){var n="soundManager.mute(): ",m=0;if(typeof l!=="string"){l=null}if(!l){j._wD(n+"Muting all sounds");for(m=j.soundIDs.length;m--;){j.sounds[j.soundIDs[m]].mute()}j.muted=true}else{if(!j._idCheck(l)){return false}j._wD(n+'Muting "'+l+'"');j.sounds[l].mute()}};this.muteAll=function(){j.mute()};this.unmute=function(l){var n="soundManager.unmute(): ",m;if(typeof l!=="string"){l=null}if(!l){j._wD(n+"Unmuting all sounds");for(m=j.soundIDs.length;m--;){j.sounds[j.soundIDs[m]].unmute()}j.muted=false}else{if(!j._idCheck(l)){return false}j._wD(n+'Unmuting "'+l+'"');j.sounds[l].unmute()}};this.unmuteAll=function(){j.unmute()};this.toggleMute=function(l){if(!j._idCheck(l)){return false}j.sounds[l].toggleMute()};this.getMemoryUse=function(){if(j.flashVersion===8){return 0}if(j.o){return parseInt(j.o._getMemoryUse(),10)}};this.disable=function(m){if(typeof m==="undefined"){m=false}if(j._disabled){return false}j._disabled=true;j._wDS("shutdown",1);for(var l=j.soundIDs.length;l--;){j._disableObject(j.sounds[j.soundIDs[l]])}j.initComplete(m)};this.canPlayMIME=function(l){return(l?(l.match(j.mimePattern)?true:false):null)};this.canPlayURL=function(l){return(l?(l.match(j.filePattern)?true:false):null)};this.canPlayLink=function(l){if(typeof l.type!=="undefined"&&l.type){if(j.canPlayMIME(l.type)){return true}}return j.canPlayURL(l.href)};this.getSoundById=function(m,n){if(!m){throw new Error("SoundManager.getSoundById(): sID is null/undefined")}var l=j.sounds[m];if(!l&&!n){j._wD('"'+m+'" is an invalid sound ID.',2)}return l};this.onready=function(m,l){if(m&&m instanceof Function){if(j._didInit){j._wDS("queue")}if(!l){l=c}j._addOnReady(m,l);j._processOnReady();return true}else{throw j._str("needFunction")}};this.oninitmovie=function(){};this.onload=function(){j._wD("soundManager.onload()",1)};this.onerror=function(){};this._idCheck=this.getSoundById;this._complain=function(n,o){var m="Error: ",l;if(!o){return new Error(m+n)}if(typeof console!=="undefined"&&typeof console.trace!=="undefined"){console.trace()}l=m+n+". \nCaller: "+o.toString();return new Error(l)};f=function(){return false};f._protected=true;this._disableObject=function(m){for(var l in m){if(typeof m[l]==="function"&&typeof m[l]._protected==="undefined"){m[l]=f}}l=null};this._failSafely=function(l){if(typeof l==="undefined"){l=false}if(!j._disabled||l){j._wDS("smFail",2);j.disable(l)}};this._normalizeMovieURL=function(l){var m=null;if(l){if(l.match(/\.swf(\?\.*)?$/i)){m=l.substr(l.toLowerCase().lastIndexOf(".swf?")+4);if(m){return l}}else{if(l.lastIndexOf("/")!==l.length-1){l=l+"/"}}}return(l&&l.lastIndexOf("/")!==-1?l.substr(0,l.lastIndexOf("/")+1):"./")+j.movieURL};this._getDocument=function(){return(document.body?document.body:(document.documentElement?document.documentElement:document.getElementsByTagName("div")[0]))};this._getDocument._protected=true;this._setPolling=function(l,m){if(!j.o||!j.allowPolling){return false}j.o._setPolling(l,m)};this._createMovie=function(D,r){var y=null,C=(r?r:j.url),w=(j.altURL?j.altURL:C),G,t,F,z,v,n,o,B,A,u,p,q,H,l="100%";if(j.debugURLParam.test(c.location.href.toString())){j.debugMode=true}if(j._didAppend&&j._appendSuccess){return false}j._didAppend=true;j._setVersionInfo();j.url=j._normalizeMovieURL(j._overHTTP?C:w);r=j.url;if(j.useHighPerformance&&j.useMovieStar&&j.defaultOptions.useVideo===true){y="soundManager note: disabling highPerformance, not applicable with movieStar mode+useVideo";j.useHighPerformance=false}j.wmode=(!j.wmode&&j.useHighPerformance&&!j.useMovieStar?"transparent":j.wmode);if(j.wmode!==null&&!j.isIE&&!j.useHighPerformance&&navigator.platform.match(/win32/i)){j.specialWmodeCase=true;j._wDS("spcWmode");j.wmode=null}if(j.flashVersion===8){j.allowFullScreen=false}G={name:D,id:D,src:r,width:l,height:l,quality:"high",allowScriptAccess:j.allowScriptAccess,bgcolor:j.bgColor,pluginspage:"http://www.macromedia.com/go/getflashplayer",type:"application/x-shockwave-flash",wmode:j.wmode,allowfullscreen:(j.allowFullScreen?"true":"false")};if(j.debugFlash){G.FlashVars="debug=1"}if(!j.wmode){delete G.wmode}if(j.isIE){t=document.createElement("div");z='<object id="'+D+'" data="'+r+'" type="'+G.type+'" width="'+G.width+'" height="'+G.height+'"><param name="movie" value="'+r+'" /><param name="AllowScriptAccess" value="'+j.allowScriptAccess+'" /><param name="quality" value="'+G.quality+'" />'+(j.wmode?'<param name="wmode" value="'+j.wmode+'" /> ':"")+'<param name="bgcolor" value="'+j.bgColor+'" /><param name="allowFullScreen" value="'+G.allowFullScreen+'" />'+(j.debugFlash?'<param name="FlashVars" value="'+G.FlashVars+'" />':"")+"<!-- --></object>"}else{t=document.createElement("embed");for(F in G){if(G.hasOwnProperty(F)){t.setAttribute(F,G[F])}}}if(j.debugMode){n=document.createElement("div");n.id=j.debugID+"-toggle";o={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};n.appendChild(document.createTextNode("-"));n.onclick=j._toggleDebug;n.title="Toggle SM2 debug console";if(navigator.userAgent.match(/msie 6/i)){n.style.position="absolute";n.style.cursor="hand"}for(F in o){if(o.hasOwnProperty(F)){n.style[F]=o[F]}}}A=j.getSWFCSS();B=j._getDocument();if(B){j.oMC=g(j.movieID)?g(j.movieID):document.createElement("div");if(!j.oMC.id){j.oMC.id=j.movieID;j.oMC.className=j.swfCSS.swfDefault+" "+A;u=null;v=null;if(!j.useFlashBlock){if(j.useHighPerformance){u={position:"fixed",width:"6px",height:"6px",bottom:"0px",left:"0px",overflow:"hidden"}}else{u={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"}}}p=null;if(!j.debugFlash){for(p in u){if(u.hasOwnProperty(p)){j.oMC.style[p]=u[p]}}}try{if(!j.isIE){j.oMC.appendChild(t)}B.appendChild(j.oMC);if(j.isIE){v=j.oMC.appendChild(document.createElement("div"));v.className="sm2-object-box";v.innerHTML=z}j._appendSuccess=true}catch(E){throw new Error(j._str("appXHTML"))}}else{H=j.oMC.className;j.oMC.className=(H?H+" ":j.swfCSS.swfDefault)+(A?" "+A:"");j.oMC.appendChild(t);if(j.isIE){v=j.oMC.appendChild(document.createElement("div"));v.className="sm2-object-box";v.innerHTML=z}j._appendSuccess=true}if(j.debugMode&&!g(j.debugID)&&((!j._hasConsole||!j.useConsole)||(j.useConsole&&j._hasConsole&&!j.consoleOnly))){q=document.createElement("div");q.id=j.debugID;q.style.display=(j.debugMode?"block":"none");if(j.debugMode&&!g(n.id)){try{B.appendChild(n)}catch(m){throw new Error(j._str("appXHTML"))}B.appendChild(q)}}B=null}if(y){j._wD(y)}j._wD("-- SoundManager 2 "+j.version+(j.useMovieStar?", MovieStar mode":"")+(j.useHighPerformance?", high performance mode, ":", ")+((j.useFastPolling?"fast":"normal")+" polling")+(j.wmode?", wmode: "+j.wmode:"")+(j.debugFlash?", flash debug mode":"")+(j.useFlashBlock?", flashBlock mode":"")+" --",1);j._wD("soundManager._createMovie(): Trying to load "+r+(!j._overHTTP&&j.altURL?" (alternate URL)":""),1)};this._writeDebug=function(m,t,p){var s="soundmanager-debug",r,q,l;if(!j.debugMode){return false}if(typeof p!=="undefined"&&p){m=m+" | "+new Date().getTime()}if(j._hasConsole&&j.useConsole){l=j._debugLevels[t];if(typeof console[l]!=="undefined"){console[l](m)}else{console.log(m)}if(j.useConsoleOnly){return true}}try{r=g(s);if(!r){return false}q=document.createElement("div");if(++j._wdCount%2===0){q.className="sm2-alt"}if(typeof t==="undefined"){t=0}else{t=parseInt(t,10)}q.appendChild(document.createTextNode(m));if(t){if(t>=2){q.style.fontWeight="bold"}if(t===3){q.style.color="#ff3333"}}r.insertBefore(q,r.firstChild)}catch(n){}r=null};this._writeDebug._protected=true;this._wdCount=0;this._wdCount._protected=true;this._wD=this._writeDebug;this._wDS=function(m,l){if(!m){return""}else{return j._wD(j._str(m),l)}};this._wDS._protected=true;this._wDAlert=function(l){alert(l)};if(c.location.href.indexOf("debug=alert")+1&&j.debugMode){j._wD=j._wDAlert}this._toggleDebug=function(){var m=g(j.debugID),l=g(j.debugID+"-toggle");if(!m){return false}if(j._debugOpen){l.innerHTML="+";m.style.display="none"}else{l.innerHTML="-";m.style.display="block"}j._debugOpen=!j._debugOpen};this._toggleDebug._protected=true;this._debug=function(){j._wDS("currentObj",1);for(var m=0,l=j.soundIDs.length;m<l;m++){j.sounds[j.soundIDs[m]]._debug()}};this._debugTS=function(o,l,m){if(typeof sm2Debugger!=="undefined"){try{sm2Debugger.handleEvent(o,l,m)}catch(n){}}};this._debugTS._protected=true;this._mergeObjects=function(m,l){var q={},n,p,r;for(n in m){if(m.hasOwnProperty(n)){q[n]=m[n]}}p=(typeof l==="undefined"?j.defaultOptions:l);for(r in p){if(p.hasOwnProperty(r)&&typeof q[r]==="undefined"){q[r]=p[r]}}return q};this.createMovie=function(l){if(l){j.url=l}j._initMovie()};this.go=this.createMovie;this._initMovie=function(){if(j.o){return false}j.o=j.getMovie(j.id);if(!j.o){if(!j.oRemoved){j._createMovie(j.id,j.url)}else{if(!j.isIE){j.oMC.appendChild(j.oRemoved)}else{j.oMC.innerHTML=j.oRemovedHTML}j.oRemoved=null;j._didAppend=true}j.o=j.getMovie(j.id)}if(j.o){j._wD("soundManager._initMovie(): Got "+j.o.nodeName+" element ("+(j._didAppend?"created via JS":"static HTML")+")",1);j._wDS("waitEI")}if(typeof j.oninitmovie==="function"){setTimeout(j.oninitmovie,1)}};this.waitForExternalInterface=function(){if(j._waitingForEI){return false}j._waitingForEI=true;if(j._tryInitOnFocus&&!j._isFocused){j._wDS("waitFocus");return false}var l;if(!j._didInit){l=j.getMoviePercent();j._wD(j._str("waitImpatient",(l===100?" (SWF loaded)":(l>0?" (SWF "+l+"% loaded)":""))))}setTimeout(function(){l=j.getMoviePercent();if(!j._didInit){j._wD(h+": No Flash response within expected time.\nLikely causes: "+(l===0?"Loading "+j.movieURL+" may have failed (and/or Flash "+j.flashVersion+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(j.debugFlash?" "+j._str("checkSWF"):""),2);if(!j._overHTTP&&l){j._wDS("localFail",2);if(!j.debugFlash){j._wDS("tryDebug",2)}}if(l===0){j._wD(j._str("swf404",j.url))}j._debugTS("flashtojs",false,": Timed out"+(j._overHTTP)?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)")}if(!j._didInit&&j._okToDisable){if(!l){if(j.useFlashBlock||j.flashLoadTimeout===0){if(j.useFlashBlock){j.flashBlockHandler()}j._wDS("waitForever")}else{j._failSafely(true)}}else{if(j.flashLoadTimeout===0){j._wDS("waitForever")}else{j._failSafely(true)}}}},j.flashLoadTimeout)};this.getSWFCSS=function(){var l=[];if(j.debugMode){l.push(j.swfCSS.sm2Debug)}if(j.debugFlash){l.push(j.swfCSS.flashDebug)}if(j.useHighPerformance){l.push(j.swfCSS.highPerf)}return l.join(" ")};this.flashBlockHandler=function(){var l="soundManager.flashBlockHandler()",m=j.getMoviePercent();j._wD(l);if(!j.supported()){j.oMC.className=j.getSWFCSS()+" "+j.swfCSS.swfDefault+" "+(!m?j.swfCSS.swfTimedout:j.swfCSS.swfError);if(!m){j._wD(l+": "+j.strings.fbTimeout)}j._processOnReady(true);if(j.onerror instanceof Function){j.onerror.apply(c)}j.didFlashBlock=true}else{j.oMC.className=j.getSWFCSS()+" "+j.swfCSS.swfDefault+(" "+j.swfCSS.swfUnblocked)}};this.getMoviePercent=function(){return(j.o&&typeof j.o.PercentLoaded!=="undefined"?j.o.PercentLoaded():null)};this.handleFocus=function(){if(j._isFocused||!j._tryInitOnFocus){return true}j._okToDisable=true;j._isFocused=true;j._wD("soundManager.handleFocus()");if(j._tryInitOnFocus){c.removeEventListener("mousemove",j.handleFocus,false)}j._waitingForEI=false;setTimeout(j.waitForExternalInterface,500);if(c.removeEventListener){c.removeEventListener("focus",j.handleFocus,false)}else{if(c.detachEvent){c.detachEvent("onfocus",j.handleFocus)}}};this.initComplete=function(m){if(j._didInit){return false}var n=j.oMC.className,l=(j.useFlashBlock&&j.flashLoadTimeout&&!j.getMoviePercent());if(!l){j._didInit=true}j._wD("-- SoundManager 2 "+(j._disabled?"failed to load":"loaded")+" ("+(j._disabled?"security/load error":"OK")+") --",1);if(j._disabled||m){if(j.useFlashBlock){j.oMC.className=j.getSWFCSS()+" "+(!j.getMoviePercent()?j.swfCSS.swfTimedout:j.swfCSS.swfError)}j._processOnReady();j._debugTS("onload",false);if(j.onerror instanceof Function){j.onerror.apply(c)}return false}else{j._debugTS("onload",true)}if(j.waitForWindowLoad&&!j._windowLoaded){j._wDS("waitOnload");if(c.addEventListener){c.addEventListener("load",j._initUserOnload,false)}else{if(c.attachEvent){c.attachEvent("onload",j._initUserOnload)}}return false}else{if(j.waitForWindowLoad&&j._windowLoaded){j._wDS("docLoaded")}j._initUserOnload()}};this._addOnReady=function(m,l){j._onready.push({method:m,scope:(l||null),fired:false})};this._processOnReady=function(q){if(!j._didInit&&!q){return false}var m={success:(q?j.supported():!j._disabled)},l=[],p,o,n=(!j.useFlashBlock||(j.useFlashBlock&&!j.supported()));for(p=0,o=j._onready.length;p<o;p++){if(j._onready[p].fired!==true){l.push(j._onready[p])}}if(l.length){j._wD(h+": Firing "+l.length+" onready() item"+(l.length>1?"s":""));for(p=0,o=l.length;p<o;p++){if(l[p].scope){l[p].method.apply(l[p].scope,[m])}else{l[p].method(m)}if(!n){l[p].fired=true}}}};this._initUserOnload=function(){c.setTimeout(function(){if(j.useFlashBlock){j.flashBlockHandler()}j._processOnReady();j._wDS("onload",1);j.onload.apply(c);j._wDS("onloadOK",1)})};this.init=function(){j._wDS("init");j._initMovie();if(j._didInit){j._wDS("didInit");return false}if(c.removeEventListener){c.removeEventListener("load",j.beginDelayedInit,false)}else{if(c.detachEvent){c.detachEvent("onload",j.beginDelayedInit)}}try{j._wDS("flashJS");j.o._externalInterfaceTest(false);if(!j.allowPolling){j._wDS("noPolling",1)}else{j._setPolling(true,j.useFastPolling?true:false)}if(!j.debugMode){j.o._disableDebug()}j.enabled=true;j._debugTS("jstoflash",true)}catch(l){j._wD("js/flash exception: "+l.toString());j._debugTS("jstoflash",false);j._failSafely(true);j.initComplete();return false}j.initComplete()};this.beginDelayedInit=function(){j._windowLoaded=true;setTimeout(j.waitForExternalInterface,500);setTimeout(j.beginInit,20)};this.beginInit=function(){if(j._initPending){return false}j.createMovie();j._initMovie();j._initPending=true;return true};this.domContentLoaded=function(){if(document.removeEventListener){document.removeEventListener("DOMContentLoaded",j.domContentLoaded,false)}j.go()};this._externalInterfaceOK=function(l){if(j.swfLoaded){return false}var m=new Date().getTime();j._wD("soundManager._externalInterfaceOK()"+(l?" (~"+(m-l)+" ms)":""));j._debugTS("swf",true);j._debugTS("flashtojs",true);j.swfLoaded=true;j._tryInitOnFocus=false;if(j.isIE){setTimeout(j.init,100)}else{j.init()}};this._setSandboxType=function(l){var m=j.sandbox;m.type=l;m.description=m.types[(typeof m.types[l]!=="undefined"?l:"unknown")];j._wD("Flash security sandbox type: "+m.type);if(m.type==="localWithFile"){m.noRemote=true;m.noLocal=false;j._wDS("secNote",2)}else{if(m.type==="localWithNetwork"){m.noRemote=false;m.noLocal=true}else{if(m.type==="localTrusted"){m.noRemote=false;m.noLocal=false}}}};this.reboot=function(){j._wD("soundManager.reboot()");if(j.soundIDs.length){j._wD("Destroying "+j.soundIDs.length+" SMSound objects...")}for(var l=j.soundIDs.length;l--;){j.sounds[j.soundIDs[l]].destruct()}try{if(j.isIE){j.oRemovedHTML=j.o.innerHTML}j.oRemoved=j.o.parentNode.removeChild(j.o);j._wD("Flash movie removed.")}catch(m){j._wDS("badRemove",2)}j.oRemovedHTML=null;j.oRemoved=null;j.enabled=false;j._didInit=false;b._waitingForEI=false;j._initPending=false;j._didAppend=false;j._appendSuccess=false;j._disabled=false;j.swfLoaded=false;j.soundIDs={};j.sounds=[];j.o=null;for(l=j._onready.length;l--;){j._onready[l].fired=false}j._wD(h+": Rebooting...");c.setTimeout(b.beginDelayedInit,20)};this.destruct=function(){j._wD("soundManager.destruct()");j.disable(true)};k=function(l){var m=this;this.sID=l.id;this.url=l.url;this.options=j._mergeObjects(l);this.instanceOptions=this.options;this._iO=this.instanceOptions;this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this._debug=function(){if(j.debugMode){var p=null,r=[],o,q,n=64;for(p in m.options){if(m.options[p]!==null){if(m.options[p] instanceof Function){o=m.options[p].toString();o=o.replace(/\s\s+/g," ");q=o.indexOf("{");r[r.length]=" "+p+": {"+o.substr(q+1,(Math.min(Math.max(o.indexOf("\n")-1,n),n))).replace(/\n/g,"")+"... }"}else{r[r.length]=" "+p+": "+m.options[p]}}}j._wD("SMSound() merged options: {\n"+r.join(", \n")+"\n}")}};this._debug();this.id3={};this.resetProperties=function(n){m.bytesLoaded=null;m.bytesTotal=null;m.position=null;m.duration=null;m.durationEstimate=null;m.loaded=false;m.playState=0;m.paused=false;m.readyState=0;m.muted=false;m.didBeforeFinish=false;m.didJustBeforeFinish=false;m.isBuffering=false;m.instanceOptions={};m.instanceCount=0;m.peakData={left:0,right:0};m.waveformData={left:[],right:[]};m.eqData=[];m.eqData.left=[];m.eqData.right=[]};m.resetProperties();this.load=function(n){if(typeof n!=="undefined"){m._iO=j._mergeObjects(n);m.instanceOptions=m._iO}else{n=m.options;m._iO=n;m.instanceOptions=m._iO;if(m._lastURL&&m._lastURL!==m.url){j._wDS("manURL");m._iO.url=m.url;m.url=null}}if(typeof m._iO.url==="undefined"){m._iO.url=m.url}j._wD("soundManager.load(): "+m._iO.url,1);if(m._iO.url===m.url&&m.readyState!==0&&m.readyState!==2){j._wDS("onURL",1);return false}m.url=m._iO.url;m._lastURL=m._iO.url;m.loaded=false;m.readyState=1;m.playState=0;try{if(j.flashVersion===8){j.o._load(m.sID,m._iO.url,m._iO.stream,m._iO.autoPlay,(m._iO.whileloading?1:0))}else{j.o._load(m.sID,m._iO.url,m._iO.stream?true:false,m._iO.autoPlay?true:false);if(m._iO.isMovieStar&&m._iO.autoLoad&&!m._iO.autoPlay){m.pause()}}}catch(o){j._wDS("smError",2);j._debugTS("onload",false);j.onerror();j.disable()}};this.unload=function(){if(m.readyState!==0){j._wD('SMSound.unload(): "'+m.sID+'"');if(m.readyState!==2){m.setPosition(0,true)}j.o._unload(m.sID,j.nullURL);m.resetProperties()}};this.destruct=function(){j._wD('SMSound.destruct(): "'+m.sID+'"');j.o._destroySound(m.sID);j.destroySound(m.sID,true)};this.play=function(o){var p="SMSound.play(): ",n;if(!o){o={}}m._iO=j._mergeObjects(o,m._iO);m._iO=j._mergeObjects(m._iO,m.options);m.instanceOptions=m._iO;if(m.playState===1){n=m._iO.multiShot;if(!n){j._wD(p+'"'+m.sID+'" already playing (one-shot)',1);return false}else{j._wD(p+'"'+m.sID+'" already playing (multi-shot)',1)}}if(!m.loaded){if(m.readyState===0){j._wD(p+'Attempting to load "'+m.sID+'"',1);m._iO.autoPlay=true;m.load(m._iO)}else{if(m.readyState===2){j._wD(p+'Could not load "'+m.sID+'" - exiting',2);return false}else{j._wD(p+'"'+m.sID+'" is loading - attempting to play..',1)}}}else{j._wD(p+'"'+m.sID+'"')}if(m.paused){m.resume()}else{m.playState=1;if(!m.instanceCount||j.flashVersion>8){m.instanceCount++}m.position=(typeof m._iO.position!=="undefined"&&!isNaN(m._iO.position)?m._iO.position:0);if(m._iO.onplay){m._iO.onplay.apply(m)}m.setVolume(m._iO.volume,true);m.setPan(m._iO.pan,true);j.o._start(m.sID,m._iO.loop||1,(j.flashVersion===9?m.position:m.position/1000))}};this.start=this.play;this.stop=function(n){if(m.playState===1){m.playState=0;m.paused=false;if(m._iO.onstop){m._iO.onstop.apply(m)}j.o._stop(m.sID,n);m.instanceCount=0;m._iO={}}};this.setPosition=function(o,n){if(typeof o==="undefined"){o=0}var p=Math.min(m.duration,Math.max(o,0));m._iO.position=p;if(!n){}j.o._setPosition(m.sID,(j.flashVersion===9?m._iO.position:m._iO.position/1000),(m.paused||!m.playState))};this.pause=function(){if(m.paused||m.playState===0){return false}j._wD("SMSound.pause()");m.paused=true;j.o._pause(m.sID);if(m._iO.onpause){m._iO.onpause.apply(m)}};this.resume=function(){if(!m.paused||m.playState===0){return false}j._wD("SMSound.resume()");m.paused=false;j.o._pause(m.sID);if(m._iO.onresume){m._iO.onresume.apply(m)}};this.togglePause=function(){j._wD("SMSound.togglePause()");if(m.playState===0){m.play({position:(j.flashVersion===9?m.position:m.position/1000)});return false}if(m.paused){m.resume()}else{m.pause()}};this.setPan=function(o,n){if(typeof o==="undefined"){o=0}if(typeof n==="undefined"){n=false}j.o._setPan(m.sID,o);m._iO.pan=o;if(!n){m.pan=o}};this.setVolume=function(n,o){if(typeof n==="undefined"){n=100}if(typeof o==="undefined"){o=false}j.o._setVolume(m.sID,(j.muted&&!m.muted)||m.muted?0:n);m._iO.volume=n;if(!o){m.volume=n}};this.mute=function(){m.muted=true;j.o._setVolume(m.sID,0)};this.unmute=function(){m.muted=false;var n=typeof m._iO.volume!=="undefined";j.o._setVolume(m.sID,n?m._iO.volume:m.options.volume)};this.toggleMute=function(){if(m.muted){m.unmute()}else{m.mute()}};this._whileloading=function(n,o,p){if(!m._iO.isMovieStar){m.bytesLoaded=n;m.bytesTotal=o;m.duration=Math.floor(p);m.durationEstimate=parseInt((m.bytesTotal/m.bytesLoaded)*m.duration,10);if(m.durationEstimate===undefined){m.durationEstimate=m.duration}if(m.readyState!==3&&m._iO.whileloading){m._iO.whileloading.apply(m)}}else{m.bytesLoaded=n;m.bytesTotal=o;m.duration=Math.floor(p);m.durationEstimate=m.duration;if(m.readyState!==3&&m._iO.whileloading){m._iO.whileloading.apply(m)}}};this._onid3=function(q,n){j._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var r=[],p,o;for(p=0,o=q.length;p<o;p++){r[q[p]]=n[p]}m.id3=j._mergeObjects(m.id3,r);if(m._iO.onid3){m._iO.onid3.apply(m)}};this._whileplaying=function(p,q,s,o,r){if(isNaN(p)||p===null){return false}if(m.playState===0&&p>0){p=0}m.position=p;if(j.flashVersion>8){if(m._iO.usePeakData&&typeof q!=="undefined"&&q){m.peakData={left:q.leftPeak,right:q.rightPeak}}if(m._iO.useWaveformData&&typeof s!=="undefined"&&s){m.waveformData={left:s.split(","),right:o.split(",")}}if(m._iO.useEQData){if(typeof r!=="undefined"&&r.leftEQ){var n=r.leftEQ.split(",");m.eqData=n;m.eqData.left=n;if(typeof r.rightEQ!=="undefined"&&r.rightEQ){m.eqData.right=r.rightEQ.split(",")}}}}if(m.playState===1){if(m.isBuffering){m._onbufferchange(0)}if(m._iO.whileplaying){m._iO.whileplaying.apply(m)}if(m.loaded&&m._iO.onbeforefinish&&m._iO.onbeforefinishtime&&!m.didBeforeFinish&&m.duration-m.position<=m._iO.onbeforefinishtime){j._wD("duration-position &lt;= onbeforefinishtime: "+m.duration+" - "+m.position+" &lt= "+m._iO.onbeforefinishtime+" ("+(m.duration-m.position)+")");m._onbeforefinish()}}};this._onload=function(n){var o="SMSound._onload(): ";n=(n===1?true:false);j._wD(o+'"'+m.sID+'"'+(n?" loaded.":" failed to load? - "+m.url),(n?1:2));if(!n){if(j.sandbox.noRemote===true){j._wD(o+j._str("noNet"),1)}if(j.sandbox.noLocal===true){j._wD(o+j._str("noLocal"),1)}}m.loaded=n;m.readyState=n?3:2;if(m._iO.onload){m._iO.onload.apply(m)}};this._onbeforefinish=function(){if(!m.didBeforeFinish){m.didBeforeFinish=true;if(m._iO.onbeforefinish){j._wD('SMSound._onbeforefinish(): "'+m.sID+'"');m._iO.onbeforefinish.apply(m)}}};this._onjustbeforefinish=function(n){if(!m.didJustBeforeFinish){m.didJustBeforeFinish=true;if(m._iO.onjustbeforefinish){j._wD('SMSound._onjustbeforefinish(): "'+m.sID+'"');m._iO.onjustbeforefinish.apply(m)}}};this._onfinish=function(){if(m._iO.onbeforefinishcomplete){m._iO.onbeforefinishcomplete.apply(m)}m.didBeforeFinish=false;m.didJustBeforeFinish=false;if(m.instanceCount){m.instanceCount--;if(!m.instanceCount){m.playState=0;m.paused=false;m.instanceCount=0;m.instanceOptions={}}if(!m.instanceCount||m._iO.multiShotEvents){if(m._iO.onfinish){j._wD('SMSound._onfinish(): "'+m.sID+'"');m._iO.onfinish.apply(m)}}}else{if(m.useVideo){}}};this._onmetadata=function(o){var n="SMSound.onmetadata()";j._wD(n);if(!o.width&&!o.height){j._wDS("noWH");o.width=320;o.height=240}m.metadata=o;m.width=o.width;m.height=o.height;if(m._iO.onmetadata){j._wD(n+': "'+m.sID+'"');m._iO.onmetadata.apply(m)}j._wD(n+" complete")};this._onbufferchange=function(o){var n="SMSound._onbufferchange()";if(m.playState===0){return false}if(o===m.isBuffering){j._wD(n+": ignoring false default / loaded sound");return false}m.isBuffering=(o===1?true:false);if(m._iO.onbufferchange){j._wD(n+": "+o);m._iO.onbufferchange.apply(m)}};this._ondataerror=function(n){if(m.playState>0){j._wD("SMSound._ondataerror(): "+n);if(m._iO.ondataerror){m._iO.ondataerror.apply(m)}}else{}}};this._onfullscreenchange=function(l){j._wD("onfullscreenchange(): "+l);j.isFullScreen=(l===1?true:false);if(!j.isFullScreen){try{c.focus();j._wD("window.focus()")}catch(m){}}};if(c.addEventListener){c.addEventListener("focus",j.handleFocus,false);c.addEventListener("load",j.beginDelayedInit,false);c.addEventListener("unload",j.destruct,false);if(j._tryInitOnFocus){c.addEventListener("mousemove",j.handleFocus,false)}}else{if(c.attachEvent){c.attachEvent("onfocus",j.handleFocus);c.attachEvent("onload",j.beginDelayedInit);c.attachEvent("unload",j.destruct)}else{j._debugTS("onload",false);b.onerror();b.disable()}}if(document.addEventListener){document.addEventListener("DOMContentLoaded",j.domContentLoaded,false)}}if(typeof SM2_DEFER==="undefined"||!SM2_DEFER){b=new a()}c.SoundManager=a;c.soundManager=b}(window));