/** @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.20130324 ("Mahalo" Edition) */ (function(m,g){function ba(ba,qa){function ca(a){return c.preferFlash&&A&&!c.ignoreFlash&&c.flash[a]!==g&&c.flash[a]}function s(a){return function(d){var e=this._s;!e||!e._a?(e&&e.id?c._wD(e.id+": Ignoring "+d.type):c._wD(ob+"Ignoring "+d.type),d=null):d=a.call(this,d);return d}}this.setupOptions={url:ba||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1E3, wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,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.audioFormats={mp3:{type:['audio/mpeg; codecs\x3d"mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs\x3d"mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs\x3dvorbis"],required:!1},opus:{type:["audio/ogg; codecs\x3dopus", "audio/opus"],required:!1},wav:{type:['audio/wav; codecs\x3d"1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID="sm2-container";this.id=qa||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20130324";this.altURL=this.movieURL=this.version=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i}; 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.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var Qa,c=this,Ra=null,l=null,ob="HTML5::", B,u=navigator.userAgent,S=m.location.href.toString(),h=document,ra,Sa,sa,p,D=[],ta=!0,y,T=!1,U=!1,q=!1,t=!1,da=!1,n,pb=0,V,x,ua,L,va,J,M,N,Ta,wa,ea,G,fa,xa,O,ya,W,ga,ha,P,Ua,za,Va=["log","info","warn","error"],Wa,Aa,Xa,X=null,Ba=null,r,Ca,Q,Ya,ia,ja,R,v,Y=!1,Da=!1,Za,$a,ab,ka=0,Z=null,la,K=[],C=null,bb,ma,$,H,Ea,Fa,cb,w,db=Array.prototype.slice,E=!1,Ga,A,Ha,eb,F,fb,Ia,na,oa=u.match(/(ipad|iphone|ipod)/i),gb=u.match(/android/i),I=u.match(/msie/i),qb=u.match(/webkit/i),Ja=u.match(/safari/i)&&!u.match(/chrome/i), Ka=u.match(/opera/i),La=u.match(/(mobile|pre\/|xoom)/i)||oa||gb,Ma=!S.match(/usehtml5audio/i)&&!S.match(/sm2\-ignorebadua/i)&&Ja&&!u.match(/silk/i)&&u.match(/OS X 10_6_([3-7])/i),hb=m.console!==g&&console.log!==g,Na=h.hasFocus!==g?h.hasFocus():null,pa=Ja&&(h.hasFocus===g||!h.hasFocus()),ib=!pa,jb=/(mp3|mp4|mpa|m4a|m4b)/i,aa=h.location?h.location.protocol.match(/http/i):null,kb=!aa?"http://":"",lb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,mb="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "), rb=RegExp("\\.("+mb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!aa;var Oa;try{Oa=Audio!==g&&(Ka&&opera!==g&&10>opera.version()?new Audio(null):new Audio).canPlayType!==g}catch(sb){Oa=!1}this.hasHTML5=Oa;this.setup=function(a){var d=!c.url;a!==g&&(q&&C&&c.ok()&&(a.flashVersion!==g||a.url!==g||a.html5Test!==g))&&R(r("setupLate"));ua(a);d&&(W&&a.url!==g)&&c.beginDelayedInit();!W&&(a.url!==g&&"complete"===h.readyState)&&setTimeout(O,1);return c}; this.supported=this.ok=function(){return C?q&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return B(c)||h[c]||m[c]};this.createSound=function(a,d){function e(){f=ia(f);c.sounds[f.id]=new Qa(f);c.soundIDs.push(f.id);return c.sounds[f.id]}var b,f;b=null;b="soundManager.createSound(): "+r(!q?"notReady":"notOK");if(!q||!c.ok())return R(b),!1;d!==g&&(a={id:a,url:d});f=x(a);f.url=la(f.url);f.id.toString().charAt(0).match(/^[0-9]$/)&&c._wD("soundManager.createSound(): "+r("badID",f.id),2);c._wD("soundManager.createSound(): "+ f.id+" ("+f.url+")",1);if(v(f.id,!0))return c._wD("soundManager.createSound(): "+f.id+" exists",1),c.sounds[f.id];ma(f)?(b=e(),c._wD(f.id+": Using HTML5"),b._setup_html5(f)):(8
=a)return!1;for(a-=1;0<=a;a--)c=z[a],!c.fired&&b.position>=c.position&&(c.fired=!0,u++,c.method.apply(c.scope,[c.position]));return!0};this._resetOnPosition=function(b){var a,c;a=z.length;if(!a)return!1;for(a-=1;0<=a;a--)c=z[a],c.fired&&b<=c.position&&(c.fired=!1,u--);return!0};w=function(){var a=b._iO,d=a.from,e=a.to,f,g;g=function(){c._wD(b.id+': "To" time of '+e+" reached.");b.clearOnPosition(e,g);b.stop()};f=function(){c._wD(b.id+': Playing "from" '+d);if(null!==
e&&!isNaN(e))b.onPosition(e,g)};null!==d&&!isNaN(d)&&(a.position=d,a.multiShot=!1,f());return a};q=function(){var a,c=b._iO.onposition;if(c)for(a in c)if(c.hasOwnProperty(a))b.onPosition(parseInt(a,10),c[a])};Pa=function(){var a,c=b._iO.onposition;if(c)for(a in c)c.hasOwnProperty(a)&&b.clearOnPosition(parseInt(a,10))};h=function(){b.isHTML5&&Za(b)};k=function(){b.isHTML5&&$a(b)};f=function(a){a||(z=[],u=0);s=!1;b._hasTimer=null;b._a=null;b._html5_canplay=!1;b.bytesLoaded=null;b.bytesTotal=null;b.duration=
b._iO&&b._iO.duration?b._iO.duration:null;b.durationEstimate=null;b.buffered=[];b.eqData=[];b.eqData.left=[];b.eqData.right=[];b.failures=0;b.isBuffering=!1;b.instanceOptions={};b.instanceCount=0;b.loaded=!1;b.metadata={};b.readyState=0;b.muted=!1;b.paused=!1;b.peakData={left:0,right:0};b.waveformData={left:[],right:[]};b.playState=0;b.position=null;b.id3={}};f();this._onTimer=function(a){var c,f=!1,g={};if(b._hasTimer||a){if(b._a&&(a||(0 opera.version()?new Audio(null):new Audio:null,e,b,f={},h;h=c.audioFormats;for(e in h)if(h.hasOwnProperty(e)&&(b="audio/"+e,f[e]=a(h[e].type),f[b]=f[e],e.match(jb)?(c.flash[e]=!0,c.flash[b]=!0):(c.flash[e]=!1,c.flash[b]=!1),h[e]&&h[e].related))for(b=h[e].related.length-1;0<=b;b--)f["audio/"+h[e].related[b]]=
f[e],c.html5[h[e].related[b]]=f[e],c.flash[h[e].related[b]]=f[e];f.canPlayType=d?a:null;c.html5=x(c.html5,f);return!0};G={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:"soundManagerexception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:"soundManager: Verify that %s is a valid path.",tryDebug:"Try soundManager.debugFlash \x3d true for more security details (output goes to SWF.)",
checkSWF:"See SWF output for more debug info.",localFail:"soundManager: Non-HTTP page ("+h.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:"soundManager: Special case: Waiting for SWF to load with window focus...",waitForever:"soundManager: Waiting indefinitely for Flash (will recover if unblocked)...",
waitSWF:"soundManager: Waiting for 100% SWF load...",needFunction:"soundManager: Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:"soundManager: _debug(): Current sound objects",waitOnload:"soundManager: Waiting for window.onload()",docLoaded:"soundManager: Document already loaded",onload:"soundManager: initComplete(): calling soundManager.onload()",onloadOK:"soundManager.onload() complete",didInit:"soundManager: init(): Already called?",
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:"soundManager: Failed to remove Flash node.",shutdown:"soundManager.disable(): Shutting down",queue:"soundManager: Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying .swf_timedout CSS...",
fbLoaded:"Flash loaded",flRemoved:"soundManager: Flash movie removed.",fbHandler:"soundManager: flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:"soundManager.load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',as2loop:"Note: Setting 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:"Setting flashLoadTimeout \x3d 0 (infinite) for off-screen, mobile flash case",needFlash:"soundManager: Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:"soundManager: Got window focus.",policy:"Enabling usePolicyFile for data access",setup:"soundManager.setup(): allowed parameters: %s",setupError:'soundManager.setup(): "%s" cannot be assigned with this method.',setupUndef:'soundManager.setup(): Could not find option "%s"',setupLate:"soundManager.setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",
noURL:"soundManager: Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready.",reset:"soundManager.reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."};r=function(){var a=db.call(arguments),c=a.shift(),c=G&&G[c]?G[c]:"",e,b;if(c&&a&&a.length){e=0;for(b=a.length;ep)&&(c._wD(r("needfl9")),c.flashVersion=p=9);c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":
9===p?" (AS3/Flash 9)":" (AS2/Flash 8)");8 a&&(d=!0));setTimeout(function(){a=
c.getMoviePercent();if(d)return Y=!1,c._wD(r("waitSWF")),m.setTimeout(N,1),!1;q||(c._wD("soundManager: No Flash response within expected time. Likely causes: "+(0===a?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+r("checkSWF"):""),2),!aa&&a&&(n("localFail",2),c.debugFlash||n("tryDebug",2)),0===a&&c._wD(r("swf404",c.url),1),y("flashtojs",!1,": Timed out"+aa?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!q&&ib&&(null===a?c.useFlashBlock||
0===c.flashLoadTimeout?(c.useFlashBlock&&Ca(),n("waitForever")):(n("waitForever"),J({type:"ontimeout",ignoreInit:!0})):0===c.flashLoadTimeout?n("waitForever"):Aa(!0))},c.flashLoadTimeout)};ea=function(){if(Na||!pa)return w.remove(m,"focus",ea),!0;Na=ib=!0;n("gotFocus");Y=!1;N();w.remove(m,"focus",ea);return!0};Ia=function(){K.length&&(c._wD("SoundManager 2: "+K.join(" "),1),K=[])};fb=function(){Ia();var a,d=[];if(c.useHTML5Audio&&c.hasHTML5){for(a in c.audioFormats)c.audioFormats.hasOwnProperty(a)&&
d.push(a+" \x3d "+c.html5[a]+(!c.html5[a]&&A&&c.flash[a]?" (using flash)":c.preferFlash&&c.flash[a]&&A?" (preferring flash)":!c.html5[a]?" ("+(c.audioFormats[a].required?"required, ":"")+"and no flash support)":""));c._wD("SoundManager 2 HTML5 support: "+d.join(", "),1)}};V=function(a){if(q)return!1;if(c.html5Only)return n("sm2Loaded"),q=!0,M(),y("onload",!0),!0;var d=!0,e;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())q=!0,t&&(e={type:!A&&C?"NO_FLASH":"INIT_TIMEOUT"});c._wD("SoundManager 2 "+
(t?"failed to load":"loaded")+" ("+(t?"Flash security/load error":"OK")+")",t?2:1);t||a?(c.useFlashBlock&&c.oMC&&(c.oMC.className=Q()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error")),J({type:"ontimeout",error:e,ignoreInit:!0}),y("onload",!1),P(e),d=!1):y("onload",!0);t||(c.waitForWindowLoad&&!da?(n("waitOnload"),w.add(m,"load",M)):(c.waitForWindowLoad&&da&&n("docLoaded"),M()));return d};Sa=function(){var a,d=c.setupOptions;for(a in d)d.hasOwnProperty(a)&&(c[a]===g?c[a]=d[a]:c[a]!==d[a]&&
(c.setupOptions[a]=c[a]))};sa=function(){if(q)return n("didInit"),!1;if(c.html5Only)return q||(w.remove(m,"load",c.beginDelayedInit),c.enabled=!0,V()),!0;fa();try{l._externalInterfaceTest(!1),Ua(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||l._disableDebug(),c.enabled=!0,y("jstoflash",!0),c.html5Only||w.add(m,"unload",ra)}catch(a){return c._wD("js/flash exception: "+a.toString()),y("jstoflash",!1),P({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),Aa(!0),V(),!1}V();w.remove(m,"load",
c.beginDelayedInit);return!0};O=function(){if(W)return!1;W=!0;Sa();za();var a=null,a=null,d=m.console!==g&&"function"===typeof console.log,e=S.toLowerCase();-1!==e.indexOf("sm2-usehtml5audio\x3d")&&(a="1"===e.charAt(e.indexOf("sm2-usehtml5audio\x3d")+18),d&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.setup({useHTML5Audio:a}));-1!==e.indexOf("sm2-preferflash\x3d")&&(a="1"===e.charAt(e.indexOf("sm2-preferflash\x3d")+16),d&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),
c.setup({preferFlash:a}));!A&&c.hasHTML5&&(c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode."),1),c.setup({useHTML5Audio:!0,preferFlash:!1}));cb();c.html5.usingFlash=bb();C=c.html5.usingFlash;!A&&C&&(K.push(G.needFlash),c.setup({flashLoadTimeout:1}));h.removeEventListener&&h.removeEventListener("DOMContentLoaded",O,!1);fa();return!0};Fa=function(){"complete"===h.readyState&&(O(),h.detachEvent("onreadystatechange",Fa));return!0};ya=function(){da=
!0;w.remove(m,"load",ya)};xa=function(){if(La&&((!c.setupOptions.useHTML5Audio||c.setupOptions.preferFlash)&&K.push(G.mobileUA),c.setupOptions.useHTML5Audio=!0,c.setupOptions.preferFlash=!1,oa||gb&&!u.match(/android\s2\.3/i)))K.push(G.globalHTML5),oa&&(c.ignoreFlash=!0),E=!0};xa();Ha();w.add(m,"focus",ea);w.add(m,"load",N);w.add(m,"load",ya);h.addEventListener?h.addEventListener("DOMContentLoaded",O,!1):h.attachEvent?h.attachEvent("onreadystatechange",Fa):(y("onload",!1),P({type:"NO_DOM2_EVENTS",
fatal:!0}))}var qa=null;if(void 0===m.SM2_DEFER||!SM2_DEFER)qa=new ba;m.SoundManager=ba;m.soundManager=qa})(window);