/** @license
 * 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.97a.20110801
*/
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
/*jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */
(function(a){function c(b,c){function bO(a){return function(b){return!this._t||!this._t._a?(this._t&&this._t.sID?e._wD(h+"ignoring "+b.type+": "+this._t.sID):e._wD(h+"ignoring "+b.type),null):a.call(this,b)}}this.flashVersion=8,this.debugMode=!0,this.debugFlash=!1,this.useConsole=!0,this.consoleOnly=!1,this.waitForWindowLoad=!1,this.nullURL="about:blank",this.allowPolling=!0,this.useFastPolling=!1,this.useMovieStar=!0,this.bgColor="#ffffff",this.useHighPerformance=!1,this.flashPollingInterval=null,this.flashLoadTimeout=1e3,this.wmode=null,this.allowScriptAccess="always",this.useFlashBlock=!1,this.useHTML5Audio=!0,this.html5Test=/^(probably|maybe)$/i,this.preferFlash=!0,this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.defaultOptions={autoLoad:!1,stream:!0,autoPlay:!1,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,onbeforefinish:null,onbeforefinishtime:5e3,onbeforefinishcomplete:null,onjustbeforefinish:null,onjustbeforefinishtime:200,multiShot:!0,multiShotEvents:!1,position:null,pan:0,type:null,usePolicyFile:!1,volume:100},this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null},this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null},this.version=null,this.versionNumber="V2.97a.20110801",this.movieURL=null,this.url=b||null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.o=null,this.movieID="sm2-container",this.id=c||"sm2movie",this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"},this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.specialWmodeCase=!1,this.didFlashBlock=!1,this.filePattern=null,this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i},this.baseMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.netStreamMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.netStreamTypes=["aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"],this.netStreamPattern=new RegExp("\\.("+this.netStreamTypes.join("|")+")(\\?.*)?$","i"),this.mimePattern=this.baseMimeTypes,this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1},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.hasHTML5=typeof Audio!="undefined"&&typeof (new Audio).canPlayType!="undefined",this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var d,e=this,f="soundManager",g=f+"::",h="HTML5::",i,j=navigator.userAgent,k=a,l=k.location.href.toString(),m=this.flashVersion,n=document,o,p,q=[],r=!0,s,t=!1,u=!1,v=!1,w=!1,x=!1,y,z=0,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S=["log","info","warn","error"],T=8,U,V,W,X=null,Y=null,Z,$,_,ba,bb,bc,bd,be,bf=!1,bg=!1,bh,bi,bj,bk,bl=null,bm,bn,bo,bp,bq,br,bs,bt=Array.prototype.slice,bu=!1,bv,bw,bx,by,bz,bA=j.match(/(ipad|iphone|ipod)/i),bB=j.match(/(mobile|pre\/|xoom)/i)||bA,bC=j.match(/msie/i),bD=j.match(/webkit/i),bE=j.match(/safari/i)&&!j.match(/chrome/i),bF=j.match(/opera/i),bG=!l.match(/usehtml5audio/i)&&!l.match(/sm2\-ignorebadua/i)&&bE&&j.match(/OS X 10_6_([3-7])/i),bH=typeof console!="undefined"&&typeof console.log!="undefined",bI=typeof n.hasFocus!="undefined"?n.hasFocus():null,bJ=bE&&typeof n.hasFocus=="undefined",bK=!bJ,bL=/(mp3|mp4|mpa)/i,bM=n.location?n.location.protocol.match(/http/i):null,bN=bM?"":"http:";this.useAltURL=!bM,this._global_a=null,bB&&(e.useHTML5Audio=!0,e.preferFlash=!1,bA&&(e.ignoreFlash=!0,bu=!0)),this.ok=function(){return bl?v&&!w:e.useHTML5Audio&&e.hasHTML5},this.supported=this.ok,this.getMovie=function(a){return bC?k[a]:bE?i(a)||n[a]:i(a)},this.createSound=function(a){function i(){return c=bb(c),e.sounds[h.id]=new d(h),e.soundIDs.push(h.id),e.sounds[h.id]}var b=f+".createSound(): ",c=null,g=null,h=null;return!v||!e.ok()?(bd(b+Z(v?"notOK":"notReady")),!1):(arguments.length===2&&(a={id:arguments[0],url:arguments[1]}),c=B(a),h=c,h.id.toString().charAt(0).match(/^[0-9]$/)&&e._wD(b+Z("badID",h.id),2),e._wD(b+h.id+" ("+h.url+")",1),be(h.id,!0)?(e._wD(b+h.id+" exists",1),e.sounds[h.id]):(bn(h)?(g=i(),e._wD("Loading sound "+h.id+" via HTML5"),g._setup_html5(h)):(m>8&&e.useMovieStar&&(h.isMovieStar===null&&(h.isMovieStar=h.serverURL||(h.type?h.type.match(e.netStreamPattern):!1)||h.url.match(e.netStreamPattern)?!0:!1),h.isMovieStar&&e._wD(b+"using MovieStar handling"),h.isMovieStar&&(h.usePeakData&&(y("noPeak"),h.usePeakData=!1),h.loops>1&&y("noNSLoop"))),h=bc(h,b),g=i(),m===8?e.o._createSound(h.id,h.onjustbeforefinishtime,h.loops||1,h.usePolicyFile):(e.o._createSound(h.id,h.url,h.onjustbeforefinishtime,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,h.isMovieStar?h.bufferTime:!1,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(g.connected=!0,h.onconnect&&h.onconnect.apply(g))),!h.serverURL&&(h.autoLoad||h.autoPlay)&&g.load(h)),!h.serverURL&&h.autoPlay&&g.play(),g))},this.destroySound=function(a,b){if(!be(a))return!1;var c=e.sounds[a],d;c._iO={},c.stop(),c.unload();for(d=0;d<e.soundIDs.length;d++)if(e.soundIDs[d]===a){e.soundIDs.splice(d,1);break}return b||c.destruct(!0),c=null,delete e.sounds[a],!0},this.load=function(a,b){return be(a)?e.sounds[a].load(b):!1},this.unload=function(a){return be(a)?e.sounds[a].unload():!1},this.play=function(a,b){var c=f+".play(): ";return!v||!e.ok()?(bd(c+Z(v?"notOK":"notReady")),!1):be(a)?e.sounds[a].play(b):(b instanceof Object||(b={url:b}),b&&b.url?(e._wD(c+'attempting to create "'+a+'"',1),b.id=a,e.createSound(b).play()):!1)},this.start=this.play,this.setPosition=function(a,b){return be(a)?e.sounds[a].setPosition(b):!1},this.stop=function(a){return be(a)?(e._wD(f+".stop("+a+")",1),e.sounds[a].stop()):!1},this.stopAll=function(){var a;e._wD(f+".stopAll()",1);for(a in e.sounds)e.sounds.hasOwnProperty(a)&&e.sounds[a].stop()},this.pause=function(a){return be(a)?e.sounds[a].pause():!1},this.pauseAll=function(){var a;for(a=e.soundIDs.length;a--;)e.sounds[e.soundIDs[a]].pause()},this.resume=function(a){return be(a)?e.sounds[a].resume():!1},this.resumeAll=function(){var a;for(a=e.soundIDs.length;a--;)e.sounds[e.soundIDs[a]].resume()},this.togglePause=function(a){return be(a)?e.sounds[a].togglePause():!1},this.setPan=function(a,b){return be(a)?e.sounds[a].setPan(b):!1},this.setVolume=function(a,b){return be(a)?e.sounds[a].setVolume(b):!1},this.mute=function(a){var b=f+".mute(): ",c=0;typeof a!="string"&&(a=null);if(!a){e._wD(b+"Muting all sounds");for(c=e.soundIDs.length;c--;)e.sounds[e.soundIDs[c]].mute();return e.muted=!0,!0}return be(a)?(e._wD(b+'Muting "'+a+'"'),e.sounds[a].mute()):!1},this.muteAll=function(){e.mute()},this.unmute=function(a){var b=f+".unmute(): ",c;typeof a!="string"&&(a=null);if(!a){e._wD(b+"Unmuting all sounds");for(c=e.soundIDs.length;c--;)e.sounds[e.soundIDs[c]].unmute();return e.muted=!1,!0}return be(a)?(e._wD(b+'Unmuting "'+a+'"'),e.sounds[a].unmute()):!1},this.unmuteAll=function(){e.unmute()},this.toggleMute=function(a){return be(a)?e.sounds[a].toggleMute():!1},this.getMemoryUse=function(){var a=0;return e.o&&m!==8&&(a=parseInt(e.o._getMemoryUse(),10)),a},this.disable=function(a){var b;typeof a=="undefined"&&(a=!1);if(w)return!1;w=!0,y("shutdown",1);for(b=e.soundIDs.length;b--;)U(e.sounds[e.soundIDs[b]]);return A(a),bs.remove(k,"load",E),!0},this.canPlayMIME=function(a){var b;return e.hasHTML5&&(b=bo({type:a})),!bl||b?b:a?a.match(e.mimePattern)?!0:!1:null},this.canPlayURL=function(a){var b;return e.hasHTML5&&(b=bo({url:a})),!bl||b?b:a?a.match(e.filePattern)?!0:!1:null},this.canPlayLink=function(a){return typeof a.type!="undefined"&&a.type&&e.canPlayMIME(a.type)?!0:e.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)throw new Error(f+".getSoundById(): sID is null/undefined");var c=e.sounds[a];return!c&&!b&&e._wD('"'+a+'" is an invalid sound ID.',2),c},this.onready=function(a,b){var c="onready";if(a&&a instanceof Function)return v&&e._wD(Z("queue",c)),b||(b=k),C(c,a,b),D(),!0;throw Z("needFunction",c)},this.ontimeout=function(a,b){var c="ontimeout";if(a&&a instanceof Function)return v&&e._wD(Z("queue",c)),b||(b=k),C(c,a,b),D({type:c}),!0;throw Z("needFunction",c)},this._writeDebug=function(a,b,c){var d="soundmanager-debug",f,g,h;if(!e.debugMode)return!1;typeof c!="undefined"&&c&&(a=a+" | "+(new Date).getTime());if(bH&&e.useConsole){h=S[b],typeof console[h]!="undefined"?console[h](a):console.log(a);if(e.useConsoleOnly)return!0}try{f=i(d);if(!f)return!1;g=n.createElement("div"),++z%2===0&&(g.className="sm2-alt"),typeof b=="undefined"?b=0:b=parseInt(b,10),g.appendChild(n.createTextNode(a)),b&&(b>=2&&(g.style.fontWeight="bold"),b===3&&(g.style.color="#ff3333")),f.insertBefore(g,f.firstChild)}catch(j){}return f=null,!0},this._wD=this._writeDebug,this._debug=function(){var a,b;y("currentObj",1);for(a=0,b=e.soundIDs.length;a<b;a++)e.sounds[e.soundIDs[a]]._debug()},this.reboot=function(){e._wD(f+".reboot()"),e.soundIDs.length&&e._wD("Destroying "+e.soundIDs.length+" SMSound objects...");var a,b;for(a=e.soundIDs.length;a--;)e.sounds[e.soundIDs[a]].destruct();try{bC&&(Y=e.o.innerHTML),X=e.o.parentNode.removeChild(e.o),e._wD("Flash movie removed.")}catch(c){y("badRemove",2)}Y=X=bl=null,e.enabled=M=v=bf=bg=t=u=w=e.swfLoaded=!1,e.soundIDs=e.sounds=[],e.o=null;for(a in q)if(q.hasOwnProperty(a))for(b=q[a].length;b--;)q[a][b].fired=!1;e._wD(f+": Rebooting..."),k.setTimeout(e.beginDelayedInit,20)},this.getMoviePercent=function(){return e.o&&typeof e.o.PercentLoaded!="undefined"?e.o.PercentLoaded():null},this.beginDelayedInit=function(){x=!0,L(),setTimeout(function(){return bg?!1:(O(),K(),bg=!0,!0)},20),F()},this.destruct=function(){e._wD(f+".destruct()"),e.disable(!0)},by={abort:bO(function(a){e._wD(h+"abort: "+this._t.sID)}),canplay:bO(function(a){if(this._t._html5_canplay)return!0;this._t._html5_canplay=!0,e._wD(h+"canplay: "+this._t.sID+", "+this._t.url),this._t._onbufferchange(0);var b=isNaN(this._t.position)?null:this._t.position/1e3;if(this._t.position&&this.currentTime!==b){e._wD(h+"canplay: settings position to "+b);try{this.currentTime=b}catch(c){e._wD(h+"settings position failed: "+c.message,2)}}}),load:bO(function(a){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(!0))}),emptied:bO(function(a){e._wD(h+"emptied: "+this._t.sID)}),ended:bO(function(a){e._wD(h+"ended: "+this._t.sID),this._t._onfinish()}),error:bO(function(a){e._wD(h+"error: "+this.error.code),this._t._onload(!1)}),loadeddata:bO(function(a){var b=this._t,c=b.bytesTotal||1;e._wD(h+"loadeddata: "+this._t.sID),!b._loaded&&!bE&&(b.duration=b._get_html5_duration(),b._whileloading(c,c,b._get_html5_duration()),b._onload(!0))}),loadedmetadata:bO(function(a){e._wD(h+"loadedmetadata: "+this._t.sID)}),loadstart:bO(function(a){e._wD(h+"loadstart: "+this._t.sID),this._t._onbufferchange(1)}),play:bO(function(a){e._wD(h+"play: "+this._t.sID+", "+this._t.url),this._t._onbufferchange(0)}),playing:bO(function(a){e._wD(h+"playing: "+this._t.sID+", "+this._t.url),this._t._onbufferchange(0)}),progress:bO(function(a){if(this._t.loaded)return!1;var b,c,d,f=0,g=a.type==="progress",i=a.target.buffered,j=a.loaded||0,k=a.total||1;if(i&&i.length){for(b=i.length;b--;)f=i.end(b)-i.start(b);j=f/a.target.duration;if(g&&i.length>1){d=[],c=i.length;for(b=0;b<c;b++)d.push(a.target.buffered.start(b)+"-"+a.target.buffered.end(b));e._wD(h+"progress: timeRanges: "+d.join(", "))}g&&!isNaN(j)&&e._wD(h+"progress: "+this._t.sID+": "+Math.floor(j*100)+"% loaded")}isNaN(j)||(this._t._onbufferchange(0),this._t._whileloading(j,k,this._t._get_html5_duration()),j&&k&&j===k&&by.load.call(this,a))}),ratechange:bO(function(a){e._wD(h+"ratechange: "+this._t.sID)}),suspend:bO(function(a){e._wD(h+"suspend: "+this._t.sID),by.progress.call(this,a)}),stalled:bO(function(a){e._wD(h+"stalled: "+this._t.sID)}),timeupdate:bO(function(a){this._t._onTimer()}),waiting:bO(function(a){e._wD(h+"waiting: "+this._t.sID),this._t._onbufferchange(1)})},d=function(a){var b=this,c,d,f;this.sID=a.id,this.url=a.url,this.options=B(a),this.instanceOptions=this.options,this._iO=this.instanceOptions,this.pan=this.options.pan,this.volume=this.options.volume,this._lastURL=null,this.isHTML5=!1,this._a=null,this.id3={},this._debug=function(){if(e.debugMode){var a=null,c=[],d,f,g=64;for(a in b.options)b.options[a]!==null&&(b.options[a]instanceof Function?(d=b.options[a].toString(),d=d.replace(/\s\s+/g," "),f=d.indexOf("{"),c.push(" "+a+": {"+d.substr(f+1,Math.min(Math.max(d.indexOf("\n")-1,g),g)).replace(/\n/g,"")+"... }")):c.push(" "+a+": "+b.options[a]));e._wD("SMSound() merged options: {\n"+c.join(", \n")+"\n}")}},this._debug(),this.load=function(a){var c=null;typeof a!="undefined"?(b._iO=B(a,b.options),b.instanceOptions=b._iO):(a=b.options,b._iO=a,b.instanceOptions=b._iO,b._lastURL&&b._lastURL!==b.url&&(y("manURL"),b._iO.url=b.url,b.url=null)),b._iO.url||(b._iO.url=b.url),e._wD("SMSound.load(): "+b._iO.url,1);if(b._iO.url===b.url&&b.readyState!==0&&b.readyState!==2)return y("onURL",1),b;b._lastURL=b.url,b.loaded=!1,b.readyState=1,b.playState=0;if(bn(b._iO))c=b._setup_html5(b._iO),c._called_load?e._wD(h+"ignoring request to load again: "+b.sID):(e._wD(h+"load: "+b.sID),b._html5_canplay=!1,c.load(),c._called_load=!0,b._iO.autoPlay&&b.play());else try{b.isHTML5=!1,b._iO=bc(bb(b._iO)),m===8?e.o._load(b.sID,b._iO.url,b._iO.stream,b._iO.autoPlay,b._iO.whileloading?1:0,b._iO.loops||1,b._iO.usePolicyFile):e.o._load(b.sID,b._iO.url,b._iO.stream?!0:!1,b._iO.autoPlay?!0:!1,b._iO.loops||1,b._iO.autoLoad?!0:!1,b._iO.usePolicyFile)}catch(d){y("smError",2),s("onload",!1),P({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return b},this.unload=function(){return b.readyState!==0&&(e._wD('SMSound.unload(): "'+b.sID+'"'),b.isHTML5?(d(),b._a&&(b._a.pause(),b._a.src="")):m===8?e.o._unload(b.sID,e.nullURL):e.o._unload(b.sID),c()),b},this.destruct=function(a){e._wD('SMSound.destruct(): "'+b.sID+'"'),b.isHTML5?(d(),b._a&&(b._a.pause(),b._a.src="",bu||b._remove_html5_events(),b._a._t=null,b._a=null)):(b._iO.onfailure=null,e.o._destroySound(b.sID)),a||e.destroySound(b.sID,!0)},this.play=function(a,c){var d="SMSound.play(): ",g,h;c=c===undefined?!0:c,a||(a={}),b._iO=B(a,b._iO),b._iO=B(b._iO,b.options),b.instanceOptions=b._iO;if(b._iO.serverURL&&!b.connected)return b.getAutoPlay()||(e._wD(d+" Netstream not connected yet - settings autoPlay"),b.setAutoPlay(!0)),b;bn(b._iO)&&(b._setup_html5(b._iO),f());if(b.playState===1&&!b.paused){g=b._iO.multiShot;if(!g)return e._wD(d+'"'+b.sID+'" already playing (one-shot)',1),b;e._wD(d+'"'+b.sID+'" already playing (multi-shot)',1)}if(!b.loaded)if(b.readyState===0)e._wD(d+'Attempting to load "'+b.sID+'"',1),b.isHTML5||(b._iO.autoPlay=!0),b.load(b._iO);else{if(b.readyState===2)return e._wD(d+'Could not load "'+b.sID+'" - exiting',2),b;e._wD(d+'"'+b.sID+'" is loading - attempting to play..',1)}else e._wD(d+'"'+b.sID+'"');return!b.isHTML5&&m===9&&b.position>0&&b.position===b.duration&&(e._wD(d+'"'+b.sID+'": Sound at end, resetting to position:0'),b._iO.position=0),b.paused&&b.position&&b.position>0?(e._wD(d+'"'+b.sID+'" is resuming from paused state',1),b.resume()):(e._wD(d+'"'+b.sID+'" is starting to play'),b.playState=1,b.paused=!1,(!b.instanceCount||b._iO.multiShotEvents||!b.isHTML5&&m>8&&!b.getAutoPlay())&&b.instanceCount++,b.position=typeof b._iO.position!="undefined"&&!isNaN(b._iO.position)?b._iO.position:0,b.isHTML5||(b._iO=bc(bb(b._iO))),b._iO.onplay&&c&&(b._iO.onplay.apply(b),b._onplay_called=!0),b.setVolume(b._iO.volume,!0),b.setPan(b._iO.pan,!0),b.isHTML5?(f(),h=b._setup_html5(),b.setPosition(b._iO.position),h.play()):e.o._start(b.sID,b._iO.loops||1,m===9?b._iO.position:b._iO.position/1e3)),b},this.start=this.play,this.stop=function(a){return b.playState===1&&(b._onbufferchange(0),b.resetOnPosition(0),b.isHTML5||(b.playState=0),b.paused=!1,b._iO.onstop&&b._iO.onstop.apply(b),b.isHTML5?b._a&&(b.setPosition(0),b._a.pause(),b.playState=0,b._onTimer(),d(),b.unload()):(e.o._stop(b.sID,a),b._iO.serverURL&&b.unload()),b.instanceCount=0,b._iO={}),b},this.setAutoPlay=function(a){e._wD("sound "+b.sID+" turned autoplay "+(a?"on":"off")),b._iO.autoPlay=a,b.isHTML5||(e.o._setAutoPlay(b.sID,a),a&&!b.instanceCount&&b.readyState===1&&(b.instanceCount++,e._wD("sound "+b.sID+" incremented instance count to "+b.instanceCount)))},this.getAutoPlay=function(){return b._iO.autoPlay},this.setPosition=function(a){a===undefined&&(a=0);var c,d,f,g=b.isHTML5?Math.max(a,0):Math.min(b.duration||b._iO.duration,Math.max(a,0));c=b.position,b.position=g,f=b.position/1e3,b.resetOnPosition(b.position),b._iO.position=g;if(!b.isHTML5)d=m===9?b.position:f,b.readyState&&b.readyState!==2&&e.o._setPosition(b.sID,d,b.paused||!b.playState);else if(b._a)if(b._html5_canplay){if(b._a.currentTime!==f){e._wD("setPosition("+f+"): settings position");try{b._a.currentTime=f,(b.playState===0||b.paused)&&b._a.pause()}catch(h){e._wD("setPosition("+f+"): settings position failed: "+h.message,2)}}}else e._wD("setPosition("+f+"): delaying, sound not ready");return b.isHTML5&&b.paused&&b._onTimer(!0),b},this.pause=function(a){return b.paused||b.playState===0&&b.readyState!==1?b:(e._wD("SMSound.pause()"),b.paused=!0,b.isHTML5?(b._setup_html5().pause(),d()):(a||a===undefined)&&e.o._pause(b.sID),b._iO.onpause&&b._iO.onpause.apply(b),b)},this.resume=function(){return b.paused?(e._wD("SMSound.resume()"),b.paused=!1,b.playState=1,b.isHTML5?(b._setup_html5().play(),f()):(b._iO.isMovieStar&&b.setPosition(b.position),e.o._pause(b.sID)),!b._onplay_called&&b._iO.onplay?(b._iO.onplay.apply(b),b._onplay_called=!0):b._iO.onresume&&b._iO.onresume.apply(b),b):b},this.togglePause=function(){return e._wD("SMSound.togglePause()"),b.playState===0?(b.play({position:m===9&&!b.isHTML5?b.position:b.position/1e3}),b):(b.paused?b.resume():b.pause(),b)},this.setPan=function(a,c){return typeof a=="undefined"&&(a=0),typeof c=="undefined"&&(c=!1),b.isHTML5||e.o._setPan(b.sID,a),b._iO.pan=a,c||(b.pan=a,b.options.pan=a),b},this.setVolume=function(a,c){return typeof a=="undefined"&&(a=100),typeof c=="undefined"&&(c=!1),b.isHTML5?b._a&&(b._a.volume=Math.max(0,Math.min(1,a/100))):e.o._setVolume(b.sID,e.muted&&!b.muted||b.muted?0:a),b._iO.volume=a,c||(b.volume=a,b.options.volume=a),b},this.mute=function(){return b.muted=!0,b.isHTML5?b._a&&(b._a.muted=!0):e.o._setVolume(b.sID,0),b},this.unmute=function(){b.muted=!1;var a=typeof b._iO.volume!="undefined";return b.isHTML5?b._a&&(b._a.muted=!1):e.o._setVolume(b.sID,a?b._iO.volume:b.options.volume),b},this.toggleMute=function(){return b.muted?b.unmute():b.mute()},this.onposition=function(a,c,d){return b._onPositionItems.push({position:a,method:c,scope:typeof d!="undefined"?d:b,fired:!1}),b},this.processOnPosition=function(){var a,c,d=b._onPositionItems.length;if(!d||!b.playState||b._onPositionFired>=d)return!1;for(a=d;a--;)c=b._onPositionItems[a],!c.fired&&b.position>=c.position&&(c.method.apply(c.scope,[c.position]),c.fired=!0,e._onPositionFired++);return!0},this.resetOnPosition=function(a){var c,d,f=b._onPositionItems.length;if(!f)return!1;for(c=f;c--;)d=b._onPositionItems[c],d.fired&&a<=d.position&&(d.fired=!1,e._onPositionFired--);return!0},f=function(){b.isHTML5&&bj(b)},d=function(){b.isHTML5&&bk(b)},c=function(){b._onPositionItems=[],b._onPositionFired=0,b._hasTimer=null,b._onplay_called=!1,b._a=null,b._html5_canplay=!1,b.bytesLoaded=null,b.bytesTotal=null,b.position=null,b.duration=b._iO&&b._iO.duration?b._iO.duration:null,b.durationEstimate=null,b.failures=0,b.loaded=!1,b.playState=0,b.paused=!1,b.readyState=0,b.muted=!1,b.didBeforeFinish=!1,b.didJustBeforeFinish=!1,b.isBuffering=!1,b.instanceOptions={},b.instanceCount=0,b.peakData={left:0,right:0},b.waveformData={left:[],right:[]},b.eqData=[],b.eqData.left=[],b.eqData.right=[]},c(),this._onTimer=function(a){var c,d={};if(b._hasTimer||a)return b._a&&(a||(b.playState>0||b.readyState===1)&&!b.paused)?(b.duration=b._get_html5_duration(),b.durationEstimate=b.duration,c=b._a.currentTime?b._a.currentTime*1e3:0,b._whileplaying(c,d,d,d,d),!0):(e._wD('_onTimer: Warn for "'+b.sID+'": '+(b._a?"":"Could not find element. ")+(b.playState===0?"playState bad, 0?":"playState = "+b.playState+", OK")),!1)},this._get_html5_duration=function(){var a=b._a?b._a.duration*1e3:b._iO?b._iO.duration:undefined,c=a&&!isNaN(a)&&a!==Infinity?a:b._iO?b._iO.duration:null;return c},this._setup_html5=function(a){var d=B(b._iO,a),f=decodeURI,g=bu?e._global_a:b._a,h=f(d.url),i=g&&g._t?g._t.instanceOptions:null;if(g){if(g._t&&i.url===d.url&&(!b._lastURL||b._lastURL===i.url))return g;e._wD("settings new URL on existing object: "+h+(b._lastURL?", old URL: "+b._lastURL:"")),bu&&g._t&&g._t.playState&&d.url!==i.url&&g._t.stop(),c(),g.src=d.url,b.url=d.url,b._lastURL=d.url,g._called_load=!1}else e._wD("creating HTML5 Audio() element with URL: "+h),g=new Audio(d.url),g._called_load=!1,bu&&(e._global_a=g);return b.isHTML5=!0,b._a=g,g._t=b,b._add_html5_events(),g.loop=d.loops>1?"loop":"",d.autoLoad||d.autoPlay?(g.autobuffer="auto",g.preload="auto",b.load(),g._called_load=!0):(g.autobuffer=!1,g.preload="none"),g.loop=d.loops>1?"loop":"",g},this._add_html5_events=function(){function c(a,c,d){return b._a?b._a.addEventListener(a,c,d||!1):null}if(b._a._added_events)return!1;var a;e._wD(h+"adding event listeners: "+b.sID),b._a._added_events=!0;for(a in by)by.hasOwnProperty(a)&&c(a,by[a]);return!0},this._remove_html5_events=function(){function c(a,c,d){return b._a?b._a.removeEventListener(a,c,d||!1):null}var a;e._wD(h+"removing event listeners: "+b.sID),b._a._added_events=!1;for(a in by)by.hasOwnProperty(a)&&c(a,by[a])},this._onload=function(a){var c="SMSound._onload(): ",d=a?!0:!1;return e._wD(c+'"'+b.sID+'"'+(d?" loaded.":" failed to load? - "+b.url),d?1:2),!d&&!b.isHTML5&&(e.sandbox.noRemote===!0&&e._wD(c+Z("noNet"),1),e.sandbox.noLocal===!0&&e._wD(c+Z("noLocal"),1)),b.loaded=d,b.readyState=d?3:2,b._onbufferchange(0),b._iO.onload&&b._iO.onload.apply(b,[d]),!0},this._onbufferchange=function(a){var c="SMSound._onbufferchange()";return b.playState===0?!1:a&&b.isBuffering||!a&&!b.isBuffering?!1:(b.isBuffering=a===1,b._iO.onbufferchange&&(e._wD(c+": "+a),b._iO.onbufferchange.apply(b)),!0)},this._onfailure=function(a,c,d){b.failures++,e._wD('SMSound._onfailure(): "'+b.sID+'" count '+b.failures),b._iO.onfailure&&b.failures===1?b._iO.onfailure(b,a,c,d):e._wD("SMSound._onfailure(): ignoring")},this._onbeforefinish=function(){b.didBeforeFinish||(b.didBeforeFinish=!0,b._iO.onbeforefinish&&(e._wD('SMSound._onbeforefinish(): "'+b.sID+'"'),b._iO.onbeforefinish.apply(b)))},this._onjustbeforefinish=function(a){b.didJustBeforeFinish||(b.didJustBeforeFinish=!0,b._iO.onjustbeforefinish&&(e._wD('SMSound._onjustbeforefinish(): "'+b.sID+'"'),b._iO.onjustbeforefinish.apply(b)))},this._onfinish=function(){var a=b._iO.onfinish;b._onbufferchange(0),b.resetOnPosition(0),b._iO.onbeforefinishcomplete&&b._iO.onbeforefinishcomplete.apply(b),b.didBeforeFinish=!1,b.didJustBeforeFinish=!1,b.instanceCount&&(b.instanceCount--,b.instanceCount||(b.playState=0,b.paused=!1,b.instanceCount=0,b.instanceOptions={},b._iO={},d()),(!b.instanceCount||b._iO.multiShotEvents)&&a&&(e._wD('SMSound._onfinish(): "'+b.sID+'"'),a.apply(b)))},this._whileloading=function(a,c,d,e){b.bytesLoaded=a,b.bytesTotal=c,b.duration=Math.floor(d),b.bufferLength=e,b._iO.isMovieStar?(b.durationEstimate=b.duration,b.readyState!==3&&b._iO.whileloading&&b._iO.whileloading.apply(b)):(b._iO.duration?b.durationEstimate=b.duration>b._iO.duration?b.duration:b._iO.duration:b.durationEstimate=parseInt(b.bytesTotal/b.bytesLoaded*b.duration,10),b.durationEstimate===undefined&&(b.durationEstimate=b.duration),b.readyState!==3&&b._iO.whileloading&&b._iO.whileloading.apply(b))},this._whileplaying=function(a,c,d,f,g){if(isNaN(a)||a===null)return!1;b.position=a,b.processOnPosition();if(!b.isHTML5&&m>8){b._iO.usePeakData&&typeof c!="undefined"&&c&&(b.peakData={left:c.leftPeak,right:c.rightPeak}),b._iO.useWaveformData&&typeof d!="undefined"&&d&&(b.waveformData={left:d.split(","),right:f.split(",")});if(b._iO.useEQData&&typeof g!="undefined"&&g&&g.leftEQ){var h=g.leftEQ.split(",");b.eqData=h,b.eqData.left=h,typeof g.rightEQ!="undefined"&&g.rightEQ&&(b.eqData.right=g.rightEQ.split(","))}}return b.playState===1&&(!b.isHTML5&&e.flashVersion===8&&!b.position&&b.isBuffering&&b._onbufferchange(0),b._iO.whileplaying&&b._iO.whileplaying.apply(b),(b.loaded||!b.loaded&&b._iO.isMovieStar)&&b._iO.onbeforefinish&&b._iO.onbeforefinishtime&&!b.didBeforeFinish&&b.duration-b.position<=b._iO.onbeforefinishtime&&b._onbeforefinish()),!0},this._onid3=function(a,c){e._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var d=[],f,g;for(f=0,g=a.length;f<g;f++)d[a[f]]=c[f];b.id3=B(b.id3,d),b._iO.onid3&&b._iO.onid3.apply(b)},this._onconnect=function(a){var c="SMSound._onconnect(): ";a=a===1,e._wD(c+'"'+b.sID+'"'+(a?" connected.":" failed to connect? - "+b.url),a?1:2),b.connected=a,a&&(b.failures=0,be(b.sID)&&(b.getAutoPlay()?b.play(undefined,b.getAutoPlay()):b._iO.autoLoad&&b.load()),b._iO.onconnect&&b._iO.onconnect.apply(b,[a]))},this._ondataerror=function(a){b.playState>0&&(e._wD("SMSound._ondataerror(): "+a),b._iO.ondataerror&&b._iO.ondataerror.apply(b))}},N=function(){return n.body||n._docElement||n.getElementsByTagName("div")[0]},i=function(a){return n.getElementById(a)},B=function(a,b){var c={},d,f,g;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);f=typeof b=="undefined"?e.defaultOptions:b;for(g in f)f.hasOwnProperty(g)&&typeof c[g]=="undefined"&&(c[g]=f[g]);return c},bs=function(){function c(b){var c=bt.call(b),d=c.length;return a?(c[1]="on"+c[1],d>3&&c.pop()):d===3&&c.push(!1),c}function d(c,d){var e=c.shift(),f=[b[d]];a?e[f](c[0],c[1]):e[f].apply(e,c)}function e(){d(c(arguments),"add")}function f(){d(c(arguments),"remove")}var a=k.attachEvent,b={add:a?"attachEvent":"addEventListener",remove:a?"detachEvent":"removeEventListener"};return{add:e,remove:f}}(),bn=function(a){return!a.serverURL&&(a.type?bo({type:a.type}):bo({url:a.url})||e.html5Only)},bo=function(a){function j(a){return e.preferFlash&&bv&&!e.ignoreFlash&&typeof e.flash[a]!="undefined"&&e.flash[a]}if(!e.useHTML5Audio||!e.hasHTML5)return!1;var b=a.url||null,c=a.type||null,d=e.audioFormats,f,g,h,i;if(c&&e.html5[c]!=="undefined")return e.html5[c]&&!j(c);if(!bp){bp=[];for(i in d)d.hasOwnProperty(i)&&(bp.push(i),d[i].related&&(bp=bp.concat(d[i].related)));bp=new RegExp("\\.("+bp.join("|")+")(\\?.*)?$","i")}h=b?b.toLowerCase().match(bp):null;if(!h||!h.length){if(!c)return!1;g=c.indexOf(";"),h=(g!==-1?c.substr(0,g):c).substr(6)}else h=h[1];return h&&typeof e.html5[h]!="undefined"?e.html5[h]&&!j(h):(c="audio/"+h,f=e.html5.canPlayType({type:c}),e.html5[h]=f,f&&e.html5[c]&&!j(c))},br=function(){function g(b){var c,d,f,g=!1;if(!a||typeof a.canPlayType!="function")return!1;if(b instanceof Array){for(d=0,f=b.length;d<f&&!g;d++)if(e.html5[b[d]]||a.canPlayType(b[d]).match(e.html5Test))g=!0,e.html5[b[d]]=!0,e.flash[b[d]]=!!(e.preferFlash&&bv&&b[d].match(bL));return g}return c=a&&typeof a.canPlayType=="function"?a.canPlayType(b):!1,!!c&&!!c.match(e.html5Test)}if(!e.useHTML5Audio||typeof Audio=="undefined")return!1;var a=typeof Audio!="undefined"?bF?new Audio(null):new Audio:null,b,c={},d,f;d=e.audioFormats;for(b in d)if(d.hasOwnProperty(b)){c[b]=g(d[b].type),c["audio/"+b]=c[b],e.preferFlash&&!e.ignoreFlash&&b.match(bL)?e.flash[b]=!0:e.flash[b]=!1;if(d[b]&&d[b].related)for(f=d[b].related.length;f--;)c["audio/"+d[b].related[f]]=c[b],e.html5[d[b].related[f]]=c[b],e.flash[d[b].related[f]]=c[b]}return c.canPlayType=a?g:null,e.html5=B(e.html5,c),!0},J={notReady:"Not loaded yet - wait for soundManager.onload()/onready()",notOK:"Audio support is not available.",domError:g+"createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.",spcWmode:g+"createMovie(): Removing wmode, preventing known SWF loading issue(s)",swf404:f+": Verify that %s is a valid path.",tryDebug:"Try "+f+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:f+": Non-HTTP page ("+n.location.protocol+" URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:f+": Special case: Waiting for focus-related event..",waitImpatient:f+": Getting impatient, still waiting for Flash%s...",waitForever:f+": Waiting indefinitely for Flash (will recover if unblocked)...",needFunction:f+": Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',noMS:"MovieStar mode not enabled. Exiting.",currentObj:"--- "+f+"._debug(): Current sound objects ---",waitEI:g+"initMovie(): Waiting for ExternalInterface call from Flash..",waitOnload:f+": Waiting for window.onload()",docLoaded:f+": Document already loaded",onload:g+"initComplete(): calling soundManager.onload()",onloadOK:f+".onload() complete",init:g+"init()",didInit:g+"init(): Already called?",flashJS:f+": Attempting to call Flash from JS..",noPolling:f+": 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:f+".disable(): Shutting down",queue:f+": Queueing %s handler",smFail:f+": Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+e.swfCSS.swfTimedout+" CSS..",fbLoaded:"Flash loaded",fbHandler:g+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:f+".load(): current URL already assigned.",badFV:f+'.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',as2loop:"Note: AdminSetting stream:false so looping can work (flash 8 limitation)",noNSLoop:"Note: Looping not implemented for MovieStar formats",needfl9:"Note: Switching to flash 9, required for MP4 formats.",mfTimeout:"AdminSetting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case",mfOn:"mobileFlash::enabling on-screen flash repositioning",policy:"Enabling usePolicyFile for data access"},Z=function(){var a=bt.call(arguments),b=a.shift(),c=J&&J[b]?J[b]:"",d,e;if(c&&a&&a.length)for(d=0,e=a.length;d<e;d++)c=c.replace("%s",a[d]);return c},bb=function(a){return m===8&&a.loops>1&&a.stream&&(y("as2loop"),a.stream=!1),a},bc=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(e._wD((b||"")+Z("policy")),a.usePolicyFile=!0),a},bd=function(a){typeof console!="undefined"&&typeof console.warn!="undefined"?console.warn(a):e._wD(a)},o=function(){return!1},U=function(a){var b;for(b in a)a.hasOwnProperty(b)&&typeof a[b]=="function"&&(a[b]=o);b=null},V=function(a){typeof a=="undefined"&&(a=!1);if(w||a)y("smFail",2),e.disable(a)},W=function(a){var b=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){b=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4);if(b)return a}else a.lastIndexOf("/")!==a.length-1&&(
a+="/");return(a&&a.lastIndexOf("/")!==-1?a.substr(0,a.lastIndexOf("/")+1):"./")+e.movieURL},H=function(){m!==8&&m!==9&&(e._wD(Z("badFV",m,T)),e.flashVersion=T);var a=e.debugMode||e.debugFlash?"_debug.swf":".swf";e.useHTML5Audio&&!e.html5Only&&e.audioFormats.mp4.required&&e.flashVersion<9&&(e._wD(Z("needfl9")),e.flashVersion=9),m=e.flashVersion,e.version=e.versionNumber+(e.html5Only?" (HTML5-only mode)":m===9?" (AS3/Flash 9)":" (AS2/Flash 8)"),m>8&&(e.defaultOptions=B(e.defaultOptions,e.flash9Options),e.features.buffering=!0),m>8&&e.useMovieStar?(e.defaultOptions=B(e.defaultOptions,e.movieStarOptions),e.filePatterns.flash9=new RegExp("\\.(mp3|"+e.netStreamTypes.join("|")+")(\\?.*)?$","i"),e.mimePattern=e.netStreamMimeTypes,e.features.movieStar=!0):(e.useMovieStar=!1,e.features.movieStar=!1),e.filePattern=e.filePatterns[m!==8?"flash9":"flash8"],e.movieURL=(m===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),e.features.peakData=e.features.waveformData=e.features.eqData=m>8},Q=function(a,b){if(!e.o||!e.allowPolling)return!1;e.o._setPolling(a,b)},R=function(){e.debugURLParam.test(l)&&(e.debugMode=!0);if(i(e.debugID))return!1;var a,b,c,d,f;if(e.debugMode&&!i(e.debugID)&&(!bH||!e.useConsole||e.useConsole&&bH&&!e.consoleOnly)){a=n.createElement("div"),a.id=e.debugID+"-toggle",d={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},a.appendChild(n.createTextNode("-")),a.onclick=ba,a.title="Toggle SM2 debug console",j.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(f in d)d.hasOwnProperty(f)&&(a.style[f]=d[f]);b=n.createElement("div"),b.id=e.debugID,b.style.display=e.debugMode?"block":"none";if(e.debugMode&&!i(a.id)){try{c=N(),c.appendChild(a)}catch(g){throw new Error(Z("domError")+" \n"+g.toString())}c.appendChild(b)}}c=null},be=this.getSoundById,y=function(a,b){return a?e._wD(Z(a),b):""},l.indexOf("sm2-debug=alert")+1&&e.debugMode&&(e._wD=function(b){a.alert(b)}),ba=function(){var a=i(e.debugID),b=i(e.debugID+"-toggle");if(!a)return!1;r?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),r=!r},s=function(a,b,c){if(typeof sm2Debugger!="undefined")try{sm2Debugger.handleEvent(a,b,c)}catch(d){}return!0},_=function(){var a=[];return e.debugMode&&a.push(e.swfCSS.sm2Debug),e.debugFlash&&a.push(e.swfCSS.flashDebug),e.useHighPerformance&&a.push(e.swfCSS.highPerf),a.join(" ")},$=function(){var a=Z("fbHandler"),b=e.getMoviePercent(),c=e.swfCSS,d={type:"FLASHBLOCK"};if(e.html5Only)return!1;e.ok()?(e.didFlashBlock&&e._wD(a+": Unblocked"),e.oMC&&(e.oMC.className=[_(),c.swfDefault,c.swfLoaded+(e.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(bl&&(e.oMC.className=_()+" "+c.swfDefault+" "+(b===null?c.swfTimedout:c.swfError),e._wD(a+": "+Z("fbTimeout")+(b?" ("+Z("fbLoaded")+")":""))),e.didFlashBlock=!0,D({type:"ontimeout",ignoreInit:!0,error:d}),P(d))},C=function(a,b,c){typeof q[a]=="undefined"&&(q[a]=[]),q[a].push({method:b,scope:c||null,fired:!1})},D=function(a){a||(a={type:"onready"});if(!v&&a&&!a.ignoreInit)return!1;if(a.type==="ontimeout"&&e.ok())return!1;var b={success:a&&a.ignoreInit?e.ok():!w},c=a&&a.type?q[a.type]||[]:[],d=[],g,h,i=[b],j=bl&&e.useFlashBlock&&!e.ok();a.error&&(i[0].error=a.error);for(g=0,h=c.length;g<h;g++)c[g].fired!==!0&&d.push(c[g]);if(d.length){e._wD(f+": Firing "+d.length+" "+a.type+"() item"+(d.length===1?"":"s"));for(g=0,h=d.length;g<h;g++)d[g].scope?d[g].method.apply(d[g].scope,i):d[g].method.apply(this,i),j||(d[g].fired=!0)}return!0},E=function(){k.setTimeout(function(){e.useFlashBlock&&$(),D(),e.onload instanceof Function&&(y("onload",1),e.onload.apply(k),y("onloadOK",1)),e.waitForWindowLoad&&bs.add(k,"load",E)},1)},bw=function(){if(bv!==undefined)return bv;var a=!1,b=navigator,c=b.plugins,d,e,f,g=k.ActiveXObject;if(c&&c.length)e="application/x-shockwave-flash",f=b.mimeTypes,f&&f[e]&&f[e].enabledPlugin&&f[e].enabledPlugin.description&&(a=!0);else if(typeof g!="undefined"){try{d=new g("ShockwaveFlash.ShockwaveFlash")}catch(h){}a=!!d}return bv=a,a},bm=function(){var a,b,c=j.match(/iphone os (1|2|3_0|3_1)/i)?!0:!1;if(c)return e.hasHTML5=!1,e.html5Only=!0,e.oMC&&(e.oMC.style.display="none"),!1;if(!e.useHTML5Audio)return!0;if(!e.html5||!e.html5.canPlayType)return e._wD("SoundManager: No HTML5 Audio() support detected."),e.hasHTML5=!1,!0;e.hasHTML5=!0;if(bG){e._wD(g+"Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - "+(bv?"will use flash fallback for MP3/MP4, if available":" would use flash fallback for MP3/MP4, but none detected."),1);if(bw())return!0}for(b in e.audioFormats)e.audioFormats.hasOwnProperty(b)&&(e.audioFormats[b].required&&!e.html5.canPlayType(e.audioFormats[b].type)||e.flash[b]||e.flash[e.audioFormats[b].type])&&(a=!0);return e.ignoreFlash&&(a=!1),e.html5Only=e.hasHTML5&&e.useHTML5Audio&&!a,!e.html5Only},bj=function(a){a._hasTimer||(a._hasTimer=!0)},bk=function(a){a._hasTimer&&(a._hasTimer=!1)},P=function(a){a=typeof a!="undefined"?a:{},e.onerror instanceof Function&&e.onerror.apply(k,[{type:typeof a.type!="undefined"?a.type:null}]),typeof a.fatal!="undefined"&&a.fatal&&e.disable()},bx=function(){if(!bG||!bw())return!1;var a=e.audioFormats,b,c;for(c in a)if(a.hasOwnProperty(c))if(c==="mp3"||c==="mp4"){e._wD(f+": Using flash fallback for "+c+" format"),e.html5[c]=!1;if(a[c]&&a[c].related)for(b=a[c].related.length;b--;)e.html5[a[c].related[b]]=!1}},this._setSandboxType=function(a){var b=e.sandbox;b.type=a,b.description=b.types[typeof b.types[a]!="undefined"?a:"unknown"],e._wD("Flash security sandbox type: "+b.type),b.type==="localWithFile"?(b.noRemote=!0,b.noLocal=!1,y("secNote",2)):b.type==="localWithNetwork"?(b.noRemote=!1,b.noLocal=!0):b.type==="localTrusted"&&(b.noRemote=!1,b.noLocal=!1)},this._externalInterfaceOK=function(a){if(e.swfLoaded)return!1;var b=(new Date).getTime();e._wD(g+"externalInterfaceOK()"+(a?" (~"+(b-a)+" ms)":"")),s("swf",!0),s("flashtojs",!0),e.swfLoaded=!0,bJ=!1,bG&&bx(),bC?setTimeout(p,100):p()},O=function(a,b){function c(){e._wD("-- SoundManager 2 "+e.version+(!e.html5Only&&e.useHTML5Audio?e.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"")+(e.html5Only?"":(e.useMovieStar?", MovieStar mode":"")+(e.useHighPerformance?", high performance mode, ":", ")+((e.flashPollingInterval?"custom ("+e.flashPollingInterval+"ms)":e.useFastPolling?"fast":"normal")+" polling")+(e.wmode?", wmode: "+e.wmode:"")+(e.debugFlash?", flash debug mode":"")+(e.useFlashBlock?", flashBlock mode":""))+" --",1)}function C(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(t&&u)return!1;if(e.html5Only)return H(),c(),e.oMC=i(e.movieID),p(),t=!0,u=!0,!1;var d=b||e.url,f=e.altURL||d,h="JS/Flash audio component (SoundManager 2)",k,l,m=N(),o,q,r,s=_(),v,w,x,z="auto",A=null,B=n.getElementsByTagName("html")[0];A=B&&B.dir&&B.dir.match(/rtl/i),a=typeof a=="undefined"?e.id:a,H(),e.url=W(bM?d:f),b=e.url,e.wmode=!e.wmode&&e.useHighPerformance&&!e.useMovieStar?"transparent":e.wmode,e.wmode!==null&&(j.match(/msie 8/i)||!bC&&!e.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(e.specialWmodeCase=!0,y("spcWmode"),e.wmode=null),k={name:a,id:a,src:b,width:z,height:z,quality:"high",allowScriptAccess:e.allowScriptAccess,bgcolor:e.bgColor,pluginspage:bN+"//www.macromedia.com/go/getflashplayer",title:h,type:"application/x-shockwave-flash",wmode:e.wmode,hasPriority:"true"},e.debugFlash&&(k.FlashVars="debug=1"),e.wmode||delete k.wmode;if(bC)l=n.createElement("div"),q=['<object id="'+a+'" data="'+b+'" type="'+k.type+'" title="'+k.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+bN+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+k.width+'" height="'+k.height+'">',C("movie",b),C("AllowScriptAccess",e.allowScriptAccess),C("quality",k.quality),e.wmode?C("wmode",e.wmode):"",C("bgcolor",e.bgColor),C("hasPriority","true"),e.debugFlash?C("FlashVars",k.FlashVars):"","</object>"].join("");else{l=n.createElement("embed");for(o in k)k.hasOwnProperty(o)&&l.setAttribute(o,k[o])}R(),s=_(),m=N();if(m){e.oMC=i(e.movieID)||n.createElement("div");if(!e.oMC.id){e.oMC.id=e.movieID,e.oMC.className=e.swfCSS.swfDefault+" "+s,v=null,r=null,e.useFlashBlock||(e.useHighPerformance?v={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(v={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},A&&(v.left=Math.abs(parseInt(v.left,10))+"px"))),bD&&(e.oMC.style.zIndex=1e4);if(!e.debugFlash)for(w in v)v.hasOwnProperty(w)&&(e.oMC.style[w]=v[w]);try{bC||e.oMC.appendChild(l),m.appendChild(e.oMC),bC&&(r=e.oMC.appendChild(n.createElement("div")),r.className=e.swfCSS.swfBox,r.innerHTML=q),u=!0}catch(D){throw new Error(Z("domError")+" \n"+D.toString())}}else x=e.oMC.className,e.oMC.className=(x?x+" ":e.swfCSS.swfDefault)+(s?" "+s:""),e.oMC.appendChild(l),bC&&(r=e.oMC.appendChild(n.createElement("div")),r.className=e.swfCSS.swfBox,r.innerHTML=q),u=!0}return t=!0,c(),e._wD(g+"createMovie(): Trying to load "+b+(!bM&&e.altURL?" (alternate URL)":""),1),!0},K=function(){return e.html5Only?(O(),!1):e.o?!1:(e.o=e.getMovie(e.id),e.o||(X?(bC?e.oMC.innerHTML=Y:e.oMC.appendChild(X),X=null,t=!0):O(e.id,e.url),e.o=e.getMovie(e.id)),e.o&&y("waitEI"),e.oninitmovie instanceof Function&&setTimeout(e.oninitmovie,1),!0)},F=function(){setTimeout(G,1e3)},G=function(){if(bf)return!1;bf=!0,bs.remove(k,"load",F);if(bJ&&!bI)return y("waitFocus"),!1;var a;v||(a=e.getMoviePercent(),e._wD(Z("waitImpatient",a===100?" (SWF loaded)":a>0?" (SWF "+a+"% loaded)":""))),setTimeout(function(){a=e.getMoviePercent(),v||(e._wD(f+": No Flash response within expected time.\nLikely causes: "+(a===0?"Loading "+e.movieURL+" may have failed (and/or Flash "+m+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(e.debugFlash?" "+Z("checkSWF"):""),2),!bM&&a&&(y("localFail",2),e.debugFlash||y("tryDebug",2)),a===0&&e._wD(Z("swf404",e.url)),s("flashtojs",!1,": Timed out"+bM?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)")),!v&&bK&&(a===null?e.useFlashBlock||e.flashLoadTimeout===0?(e.useFlashBlock&&$(),y("waitForever")):V(!0):e.flashLoadTimeout===0?y("waitForever"):V(!0))},e.flashLoadTimeout)},I=function(){function a(){bs.remove(k,"focus",I),bs.remove(k,"load",I)}return bI||!bJ?(a(),!0):(bK=!0,bI=!0,e._wD(g+"handleFocus()"),bE&&bJ&&bs.remove(k,"mousemove",I),bf=!1,a(),!0)},A=function(a){if(v)return!1;if(e.html5Only)return e._wD("-- SoundManager 2: loaded --"),v=!0,E(),s("onload",!0),!0;var b=e.useFlashBlock&&e.flashLoadTimeout&&!e.getMoviePercent(),c;return b||(v=!0,w&&(c={type:!bv&&bl?"NO_FLASH":"INIT_TIMEOUT"})),e._wD("-- SoundManager 2 "+(w?"failed to load":"loaded")+" ("+(w?"security/load error":"OK")+") --",1),w||a?(e.useFlashBlock&&e.oMC&&(e.oMC.className=_()+" "+(e.getMoviePercent()===null?e.swfCSS.swfTimedout:e.swfCSS.swfError)),D({type:"ontimeout",error:c}),s("onload",!1),P(c),!1):(s("onload",!0),bs.add(k,"unload",o),e.waitForWindowLoad&&!x?(y("waitOnload"),bs.add(k,"load",E),!1):(e.waitForWindowLoad&&x&&y("docLoaded"),E(),!0))},bz=function(){var a,b=[];if(e.useHTML5Audio&&e.hasHTML5){for(a in e.audioFormats)e.audioFormats.hasOwnProperty(a)&&b.push(a+": "+e.html5[a]+(!e.html5[a]&&bv&&e.flash[a]?" (using flash)":e.preferFlash&&e.flash[a]&&bv?" (preferring flash)":e.html5[a]?"":" ("+(e.audioFormats[a].required?"required, ":"")+"and no flash support)"));e._wD("-- SoundManager 2: HTML5 support tests ("+e.html5Test+"): "+b.join(", ")+" --",1)}},p=function(){function a(){bs.remove(k,"load",e.beginDelayedInit)}y("init");if(v)return y("didInit"),!1;if(e.html5Only)return v||(a(),e.enabled=!0,A()),!0;K();try{y("flashJS"),e.o._externalInterfaceTest(!1),e.allowPolling?Q(!0,e.flashPollingInterval||(e.useFastPolling?10:50)):y("noPolling",1),e.debugMode||e.o._disableDebug(),e.enabled=!0,s("jstoflash",!0)}catch(b){return e._wD("js/flash exception: "+b.toString()),s("jstoflash",!1),P({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),V(!0),A(),!1}return A(),a(),!0},L=function(){return M?!1:(M=!0,R(),function(){var a="sm2-usehtml5audio=",b=l.toLowerCase(),c=null,d="sm2-preferflash=",f=null,g=typeof console!="undefined"&&typeof console.log!="undefined";b.indexOf(a)!==-1&&(c=b.charAt(b.indexOf(a)+a.length)==="1",g&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),e.useHTML5Audio=c),b.indexOf(d)!==-1&&(f=b.charAt(b.indexOf(d)+d.length)==="1",g&&console.log((f?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),e.preferFlash=f)}(),!bv&&e.hasHTML5&&(e._wD("SoundManager: No Flash detected"+(e.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5.")),e.useHTML5Audio=!0,e.preferFlash=!1),br(),e.html5.usingFlash=bm(),bl=e.html5.usingFlash,bz(),!bv&&bl&&(e._wD("SoundManager: Fatal error: Flash is needed to play some required formats, but is not available."),e.flashLoadTimeout=1),n.removeEventListener&&n.removeEventListener("DOMContentLoaded",L,!1),K(),!0)},bq=function(){return n.readyState==="complete"&&(L(),n.detachEvent("onreadystatechange",bq)),!0},bw(),bs.add(k,"focus",I),bs.add(k,"load",I),bs.add(k,"load",F),bE&&bJ&&bs.add(k,"mousemove",I),n.addEventListener?n.addEventListener("DOMContentLoaded",L,!1):n.attachEvent?n.attachEvent("onreadystatechange",bq):(s("onload",!1),P({type:"NO_DOM2_EVENTS",fatal:!0})),n.readyState==="complete"&&setTimeout(L,100)}var b=null;if(typeof SM2_DEFER=="undefined"||!SM2_DEFER)b=new c;a.SoundManager=c,a.soundManager=b})(window)
