diff --git a/js/fireworks/audio/boom1.mp3 b/js/fireworks/audio/boom1.mp3 new file mode 100755 index 00000000..d87bf5df Binary files /dev/null and b/js/fireworks/audio/boom1.mp3 differ diff --git a/js/fireworks/audio/boom2.mp3 b/js/fireworks/audio/boom2.mp3 new file mode 100755 index 00000000..e66f7f6c Binary files /dev/null and b/js/fireworks/audio/boom2.mp3 differ diff --git a/js/fireworks/audio/boom3.mp3 b/js/fireworks/audio/boom3.mp3 new file mode 100755 index 00000000..767e7bb8 Binary files /dev/null and b/js/fireworks/audio/boom3.mp3 differ diff --git a/js/fireworks/audio/boom4.mp3 b/js/fireworks/audio/boom4.mp3 new file mode 100755 index 00000000..db9ec2bf Binary files /dev/null and b/js/fireworks/audio/boom4.mp3 differ diff --git a/js/fireworks/audio/pop1.mp3 b/js/fireworks/audio/pop1.mp3 new file mode 100755 index 00000000..aa218785 Binary files /dev/null and b/js/fireworks/audio/pop1.mp3 differ diff --git a/js/fireworks/audio/pop2.mp3 b/js/fireworks/audio/pop2.mp3 new file mode 100755 index 00000000..52e93ad3 Binary files /dev/null and b/js/fireworks/audio/pop2.mp3 differ diff --git a/js/fireworks/audio/pop3.mp3 b/js/fireworks/audio/pop3.mp3 new file mode 100755 index 00000000..7c900bba Binary files /dev/null and b/js/fireworks/audio/pop3.mp3 differ diff --git a/js/fireworks/audio/pop4.mp3 b/js/fireworks/audio/pop4.mp3 new file mode 100755 index 00000000..2f76b38b Binary files /dev/null and b/js/fireworks/audio/pop4.mp3 differ diff --git a/js/fireworks/audio/pop5.mp3 b/js/fireworks/audio/pop5.mp3 new file mode 100755 index 00000000..6c34c742 Binary files /dev/null and b/js/fireworks/audio/pop5.mp3 differ diff --git a/js/fireworks/audio/pop6.mp3 b/js/fireworks/audio/pop6.mp3 new file mode 100755 index 00000000..b7874960 Binary files /dev/null and b/js/fireworks/audio/pop6.mp3 differ diff --git a/js/fireworks/fireworks.js b/js/fireworks/fireworks.js new file mode 100755 index 00000000..c997323f --- /dev/null +++ b/js/fireworks/fireworks.js @@ -0,0 +1,616 @@ +/* + * fireworks.js: A JavaScript animation experiment + * ----------------------------------------------- + * http://schillmania.com/projects/fireworks/ + * + * Provided "as-is", free and without warranty + * Originally written in 2005. Old code ahead. + * + * Includes SoundManager 2 API (BSD). + * http://schillmania.com/projects/soundmanager2/ + * + * v0.9.1.20110703 +*/ + +/*jslint white: false, onevar: false, undef: true, nomen: false, eqeqeq: false, plusplus: false, bitwise: true, regexp: false, newcap: true, immed: true */ +/*global window, document, navigator, setTimeout, setInterval, clearInterval, enableDebugMode, writeDebug, soundManager, FireworkParticle, attachEvent */ + +var fc; + +function Animator() { + + var self = this; + writeDebug('Animator()'); + this.tweens = []; + this.tweens['default'] = [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]; + this.tweens.blast = [12,12,11,10,10,9,8,7,6,5,4,3,2,1]; + this.tweens.fade = [10,10,10,10,10,10,10,10,10,10]; + this.queue = []; + this.queue.IDs = []; + this.active = false; + this.timer = null; + + this.createTween = function(start,end,type) { + // return array of tween coordinate data (start->end) + type = type||'default'; + var tween = [start]; + var tmp = start; + var diff = end-start; + var x = self.tweens[type].length; + for (var i=0; i= 0.4 && pos <= 0.6) { + pos = 0.5; + } + pos = parseInt(pos*100, 10); + // writeDebug('getPanX('+x+'): '+pos+'%'); + return pos; + }; + + this.isEmpty = function(o) { + // needs further hacking + return (typeof(o)=='undefined'||(o===null&&o!==0)||(o===''&&o!==0)||o=='null'); + }; + + this.init = function() { + self.oFW = document.getElementById('fw'); + self.oFP = document.getElementById('fp'); + if (typeof(enableDebugMode)!='undefined' && (self.DEBUG||window.location.toString().toLowerCase().indexOf('debug')>=0)) { + enableDebugMode(); + } + self.getWindowCoords(); + self.animator = new Animator(); + }; + + this.destructor = function() { + for (var i=self.fireworks.length; i--;) { + self.fireworks[i] = null; + } + self.fireworks = null; + }; + + if (this.isSafari || this.isOpera) { + this.getWindowCoords = this.getWindowCoordsAlt; + } + +} + +function Firework(oC,startX,startY,burstX,burstY,burstType,nRadius,nParticles,nCircles,allowRandom,obeyBoundaries) { + var self = this; + this.oID = 'fp'+(fc.gOID++); // may be unneeded + var p = ''; + for (var i=0; i=self.tween.length) { + self.active = false; + self.frame = 0; + if (self._oncomplete) { + self._oncomplete(); + } + self._oncomplete = null; + return false; + } + return true; + }; + + this.destructor = function() { + writeDebug('firework.destructor()'); + // for (var i=0; i=self.tween[0].length-1) { + self.active = false; + self.frame = 0; + if (self._oncomplete) { + self._oncomplete(); + } + self._oncomplete = null; + return false; + } + return true; + }; + + this.createBurst = function(circles,nMax,rMax,type) { + // c: # of circles, n: # of particles per circle, r: max radius + writeDebug('firework.createBurst('+circles+','+nMax+','+rMax+','+type+')'); + var i=0, j=0; + var tmp = 0; + var radiusInc = rMax/circles; + var radius = radiusInc; + var angle = 0; + var angleInc = 0; // per-loop increment + var radiusOffset = (self.allowRandom?(0.33+Math.random()):1); + var particlesPerCircle = []; + var isRandom = Math.random()>0.5; + var circleTypes = [type,circles>1?parseInt(Math.random()*fc.particleTypes, 10):type]; + var thisType = null; + + for (i=0; i=0) { + if (toX>=xMax) { + self.vx *= -1; + } + } else if (self.vx<0 && toX+self.baseX<=0) { + self.vx *= -1; + } + if (self.vy>=0) { + if (toY>=yMax) { + self.vy *= -1; + } + } else if (self.vy<0) { + if (toY+self.baseY-yMin<=0) { + self.vy *= -1; + } + } + } + self.moveTo(self.x+self.vx,self.y+self.vy); + }; + + this.setOpacity = function(n) { // where n = 0..100 + self.oImg.style.marginLeft = -100+(n*fc.particleXY/10)+'px'; + }; + + this.nextState = function() { + var vis = self.o.style.visibility; + if (self.state == 2 && vis != 'hidden') { + self.o.style.visibility = 'hidden'; + } else if (self.state != 2 && vis == 'hidden') { + self.o.style.visibility = 'visible'; + } + self.state = parseInt(Math.random()*3, 10); + }; + + this.slideTo = function(x1,y1) { + // writeDebug('slideTo (x/y): '+x1+','+y1); + if (self.isRandom) { + // randomize a bit + x1 += (x1*0.2*(Math.random()>0.5?1:-1)); + y1 += (y1*0.2*(Math.random()>0.5?1:-1)); + } + self.tween = [fc.animator.createTween(self.x,x1,self.tweenType),fc.animator.createTween(self.y,y1,self.tweenType)]; + // prevent X overflow (scrolling) + var xMax = fc.canvasX-fc.particleXY; + var yMax = fc.canvasY-fc.particleXY; + var xMin = fc.particleXY-self.baseX; + var yMin = fc.scrollY; + var toX = null; + var toY = null; + if (self.obeyBoundaries) { + for (var i=self.tween[0].length; i--;) { + // bounce off walls where applicable + toX = self.tween[0][i].data+self.baseX; + toY = self.tween[1][i].data+self.baseY; + if (toX>=xMax) { + self.tween[0][i].data -= (toX-xMax)*2; + // self.tween[0][i].event = 'bounce'; + } else if (toX<0) { + self.tween[0][i].data -= (toX*2); + // self.tween[0][i].event = 'bounce'; + } + if (toY>=yMax) { + self.tween[1][i].data -= (toY-yMax)*2; + // self.tween[1][i].event = 'bounce'; + } else if (toY-yMin<=0) { + self.tween[1][i].data -= (toY-yMin)*2; + // self.tween[1][i].event = 'bounce'; + } + } + } + }; + + this.animate = function() { + var f0 = self.tween[0][self.frame].data; + var f1 = self.tween[1][self.frame].data; + self.moveTo(f0,f1); + // possible bounce event/sound hooks + // if (self.tween[0][self.frame].event) soundManager.play(self.tween[0][self.frame].event); + // if (self.tween[1][self.frame].event) soundManager.play(self.tween[1][self.frame].event); + if (self.frame++>=self.tween[0].length-1) { + if (self._oncomplete) { + self._oncomplete(); + } + self._oncomplete = null; + self.active = false; + self.frame = 0; + return false; + } else if (self.frame>10) { + self.nextState(); + } + return true; + }; + + this.destructor = function() { + self.oImg = null; + self.oC.removeChild(self.o); + self.oC = null; + self.o = null; + }; + + this.setType = function(t) { + self.type = t; + self.oImg.style.marginTop = -(fc.particleXY*t)+'px'; + }; + + self.setType(type); + self.oC.appendChild(self.o); + +} + +function createFirework(nRadius,nParticles,nCircles,nBurstType,startX,startY,burstX,burstY,allowRandom,obeyBoundaries) { + + // check all arguments, supply random defaults if needed + var tmp = ''; + for (var i in arguments) { + if (arguments.hasOwnProperty(i)) { + tmp += i+','; + } + } + writeDebug('createFirework('+tmp+')'); + + if (fc.isEmpty(startX)) { + startX = parseInt(Math.random()*fc.canvasX, 10); + } else { + startX = parseInt(fc.canvasX*startX/100, 10); + } + + if (fc.isEmpty(startY)) { + startY = fc.canvasY-fc.particleXY; + } else { + startY = fc.canvasY-fc.screenY+parseInt(fc.screenY*startY/100, 10); + } + + if (fc.isEmpty(burstX)) { + burstX = parseInt(fc.canvasX*0.1+(Math.random()*fc.canvasX*0.8), 10); + } else { + burstX = parseInt(fc.canvasX*burstX/100, 10); + } + + if (fc.isEmpty(burstY)) { + burstY = fc.canvasY-parseInt(Math.random()*fc.screenY, 10); + } else { + burstY = fc.canvasY-parseInt(fc.screenY*(100-burstY)/100, 10); + } + + if (fc.isEmpty(nBurstType)) { + nBurstType = parseInt(Math.random()*fc.particleTypes, 10); + } + + if (fc.isEmpty(nRadius)) { + nRadius = 64+parseInt(Math.random()*fc.screenY*0.75, 10); + } else if (nRadius.toString().indexOf('%')>=0) { + nRadius = parseInt(parseInt(nRadius, 10)/100*fc.screenY, 10); + } else if (nRadius.toString().indexOf('.')>=0) { + nRadius = parseInt(nRadius*fc.screenY, 10); + } else { + nRadius = parseInt(nRadius*fc.screenY/100, 10); + } + + if (fc.isEmpty(nParticles)) { + nParticles = 4+parseInt(Math.random()*64, 10); + } + + if (fc.isEmpty(nCircles)) { + nCircles = Math.random()>0.5?2:1; + } + + if (fc.isEmpty(allowRandom)) { + allowRandom = Math.random()>0.5; + } + + if (fc.isEmpty(obeyBoundaries)) { + obeyBoundaries = Math.random()>0.5; + } + + // update screen coordinates + fc.getWindowCoords(); + + fc.fireworks[fc.fireworks.length] = new Firework(document.getElementById('fireContainer'),startX,startY,burstX,burstY,nBurstType,nRadius,nParticles,nCircles,allowRandom,obeyBoundaries); + +} + +soundManager.url = '../js/fireworks/swf/'; +soundManager.useHighPerformance = true; +soundManager.useHTML5Audio = true; +soundManager.wmode = 'transparent'; + +soundManager.onready(function() { + + var sounds = { + 'fire0': 'boom3.mp3', + 'fire1': 'boom4.mp3', + 'boom0': 'boom1.mp3', + 'boom1': 'boom2.mp3', + 'boom2': 'pop1.mp3', + 'boom3': 'pop2.mp3', + 'boom4': 'pop3.mp3', + 'boom5': 'pop4.mp3', + 'boom6': 'pop5.mp3', + 'boom7': 'pop6.mp3' + }; + + for (var item in sounds) { + if (sounds.hasOwnProperty(item)) { + soundManager.createSound({ + id: item, + url: '/js/fireworks/audio/' + sounds[item], + autoLoad: true + }); + } + } + +}); + +fc = new FireworksController(); + +// create null objects if APIs not present +if (typeof(writeDebug)=='undefined') { + window.writeDebug = function() { + return false; + }; +} + +function addEventHandler(o,evtName,evtHandler) { + return (typeof(attachEvent)=='undefined'?o.addEventListener(evtName,evtHandler,false):o.attachEvent('on'+evtName,evtHandler)); +} + +function removeEventHandler(o,evtName,evtHandler) { + return (typeof(attachEvent)=='undefined'?o.removeEventListener(evtName,evtHandler,false):o.detachEvent('on'+evtName,evtHandler)); +} + +addEventHandler(window,'resize',fc.getWindowCoords); +addEventHandler(window,'scroll',fc.getWindowCoords); +addEventHandler(window,'load',fc.init); +addEventHandler(window,'unload',fc.destructor); diff --git a/js/fireworks/image/particles.gif b/js/fireworks/image/particles.gif new file mode 100644 index 00000000..47bf4766 Binary files /dev/null and b/js/fireworks/image/particles.gif differ diff --git a/js/fireworks/index.html b/js/fireworks/index.html new file mode 100755 index 00000000..e1175c43 --- /dev/null +++ b/js/fireworks/index.html @@ -0,0 +1,273 @@ + + + +Fireworks.js: A DHTML fireworks effect + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ + + +
+ +
+ +

Fireworks.js

+ +

A javascript animation experiment

+ +

What's this all about? (AKA, "Holy pointless lightshow, Batman!")

+ +

Fireworks.js is a bit of Javascript that creates starburst-type explosions in a web document; in short, it's a fireworks effect someone could theoretically use on their site. And come on, who doesn't want something like that? As far as appropriateness is concerned, this effect could be compared to the dripping-blood-line, skull and fireball animated .GIF images so popular on the web in 1997. Exploding firework animations are hot, the new black, the script equivalent of the blink tag. Mmm, blink tag.

+ +

Nonetheless, Fireworks has been published here for fun, experimenting a bit with simple trigonometry and math, and those who are perhaps interested in javascript animation, object-oriented code or script-driven sound. It also serves as a dirty browser performance test of sorts, as a large number of elements are dynamically created, moved and destroyed on this page as the script runs.

+ +

Demo Controls

+ +

Why explain through reading when you can demonstrate by example? Try playing around with the sliders below for a wide range of visual effects. Not all combinations will look good, but the idea is to experiment.

+ +

Drag the sliders (or click a point on the bar) to set the various parameters available such as blast radius and the number of particles per explosion, then click "fire" to see the results.

+ +

The code required to generate the current effect is dynamically updated as you adjust the controls; refer to the createFirework() API call below.

+ +

Fireworks Parameters

+ +
+ +
+
+ Apply +
+
+ +
+
+ Apply +
+
+ +
+ +
+ +
Blast Radius
+
% of window size
+
1-100
+
+
+
+
+ +
Particles
+
Explosion elements
+
1-200
+
+
+
+
+ +
Circles
+
..per explosion
+
1-8
+
+
+
+
+ +
Burst Type
+
(Base colour)
+
1-7
+
+
+
+
+ +
+ +
+ +
Start X
+
% of window
+
1-100
+
+
+
+
+ +
Start Y
+
% of window
+
1-100
+
+
+
+
+ +
Explode X
+
% of window
+
1-100
+
+
+
+
+ +
Explode Y
+
% of window
+
1-100
+
+
+
+
+ +
+ +
+ +

Additional Options

+ +

+ +

+ +
+ +
+
Randomize explosion pattern
+ +
+
Obey window boundaries
+ +
+ +
+ +
+ +
+ +
+
+ Fire! +
+ +

+ Hide content (may increase performance) +

+ +

API call for current parameters

+ + + createFirework(nRadius,nParticles,nCircles,burstType,startX,startY,burstX,burstY)); + + +

Note: Random values will be substituted for null arguments and options that are not applied.

+ +

Demo Presets

+ +

Don't want to play with sliders? Here are a few canned effects that I thought were neat. Refer to the code for the parameters used to make the effect.

+ + + +

Features

+ +

Fireworks does the following nifty things:

+ +
    +
  • Random explosion patterns and colours
  • +
  • Customizable API allows for additional firework types and effects
  • +
  • Optional script-driven sound effects provided by SoundManager API
  • +
  • Nifty queue-based animation (easily set up your own firework sequences)
  • +
  • Sound panning effect based on firework location (left/right) on screen
  • +
  • Single-image, tile-based animation for efficiency
  • +
  • Standard DOM calls work under XML doctypes (ie. application/xhtml+xml)
  • +
  • Extensible (ideally), object-oriented, memory-leak-tested code*
  • +
+ +

* (I tried, but no guarantees. May drip a bit.)

+ +

Known Bugs ("Unintended features")

+ +
    +
  • Initial object creation can temporariliy freeze active animations (depending on CPU load)
  • +
  • Risk of browser crash on IE/Mozilla under Win32 from many simultaneous sound calls due to sketchy JS->ActiveX (Flash) bridge
  • +
+ + +

Use

+ +

Download, extract and view. Some basic examples are given that show the minimal requirements (Javascript/CSS references etc.) for the script to work. The code base also includes SoundManager, a Javascript API which allows ECMAscript (Javascript)-controlled sound effects reliably on IE and Mozilla across the Windows and Linux platforms.

+ +

Download

+ +
+ +
Fireworks v0.9.1.20110703
+
+
    +
  • Upgraded audio to SoundManager 2, now works in more places
  • +
  • Basic code clean-up, appease the JSLINT gods
  • +
  • Also on Github
  • +
+
+ +
Fireworks v0.9.20050609
+
+
    +
  • Initial build
  • +
  • Public release
  • +
  • Likely the first and last, but hey!
  • +
+
+ +
+ +

Related reading

+ + + +
+ + + +
+ + + \ No newline at end of file diff --git a/js/fireworks/loadfireworks.js b/js/fireworks/loadfireworks.js new file mode 100644 index 00000000..ff458cd5 --- /dev/null +++ b/js/fireworks/loadfireworks.js @@ -0,0 +1,11 @@ + $(document).on("ready", function() { + function cycle() { + setTimeout(function() { + createFirework(100,200,8,7,null,null,null,null,true,true); + cycle(); + }, 1000 + Math.floor(Math.random() * 8000)); + } +cycle(); + } +); + diff --git a/js/fireworks/soundmanager2-nodebug-jsmin.js b/js/fireworks/soundmanager2-nodebug-jsmin.js new file mode 100644 index 00000000..9f76f725 --- /dev/null +++ b/js/fireworks/soundmanager2-nodebug-jsmin.js @@ -0,0 +1,75 @@ +/** @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.20110424+DEV +*/ +(function(X){function L(L,W){function i(b){return function(a){return!this._t||!this._t._a?null:b.call(this,a)}}function oa(){if(b.debugURLParam.test(M))b.debugMode=!0}this.flashVersion=8;this.debugFlash=this.debugMode=!1;this.useConsole=!0;this.waitForWindowLoad=this.consoleOnly=!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.useHTML5Audio=this.useFlashBlock=!1;this.html5Test=/^probably$/i;this.preferFlash=this.useGlobalHTML5Audio=!0;this.requireFlash=!1;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:!0},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.20110424+DEV";this.movieURL=null;this.url=L||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.o=null;this.movieID="sm2-container";this.id=W||"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.didFlashBlock=this.specialWmodeCase=!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=RegExp("\\.("+this.netStreamTypes.join("|")+")(\\?.*)?$","i");this.mimePattern=this.baseMimeTypes;this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.hasHTML5=null;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=!1;var Y,b=this,x,n=navigator.userAgent,h=X,M=h.location.href.toString(),k=this.flashVersion,g=document,Z,N,q=[],D=!1,E=!1, +m=!1,s=!1,pa=!1,F,o,$,t,y,aa,O,qa,ba,u,ra,G,z,ca,da,P,ea,sa,ta,Q,ua,H=null,fa=null,v,ga,A,R,S,ha,j,T=!1,ia=!1,va,wa,w=null,xa,U,I,r,ja,ya,l,Da=Array.prototype.slice,J=!1,ka,B,za,Aa=n.match(/pre\//i),Ea=n.match(/(ipad|iphone|ipod)/i);n.match(/mobile/i);var p=n.match(/msie/i),Fa=n.match(/webkit/i),K=n.match(/safari/i)&&!n.match(/chrome/i),Ga=n.match(/opera/i),la=!M.match(/usehtml5audio/i)&&!M.match(/sm2\-ignorebadua/i)&&K&&n.match(/OS X 10_6_([3-7])/i),ma=typeof g.hasFocus!=="undefined"?g.hasFocus(): +null,C=typeof g.hasFocus==="undefined"&&K,Ba=!C,Ca=/(mp3|mp4|mpa)/i;this.html5Only=!1;this._use_maybe=M.match(/sm2\-useHTML5Maybe\=1/i);this._overHTTP=g.location?g.location.protocol.match(/http/i):null;this._http=!this._overHTTP?"http:":"";this.useAltURL=!this._overHTTP;this._global_a=null;if(Ea||Aa)b.useHTML5Audio=!0,b.ignoreFlash=!0,J=b.useGlobalHTML5Audio=!0;if(Aa||this._use_maybe)b.html5Test=/^(probably|maybe)$/i;this.supported=this.ok=function(){return w?m&&!s:b.useHTML5Audio&&b.hasHTML5};this.getMovie= +function(b){return p?h[b]:K?x(b)||g[b]:x(b)};this.createSound=function(c){function a(){e=R(e);b.sounds[d.id]=new Y(d);b.soundIDs.push(d.id);return b.sounds[d.id]}var e=null,f=null,d=null;if(!m||!b.ok())return ha("soundManager.createSound(): "+v(!m?"notReady":"notOK")),!1;arguments.length===2&&(c={id:arguments[0],url:arguments[1]});d=e=o(c);if(j(d.id,!0))return b.sounds[d.id];if(U(d))f=a(),f._setup_html5(d);else{if(k>8&&b.useMovieStar){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||d.type&&d.type.match(b.netStreamPattern)|| +d.url.match(b.netStreamPattern)?!0:!1;if(d.isMovieStar&&d.usePeakData)d.usePeakData=!1}d=S(d,"soundManager.createSound(): ");f=a();if(k===8)b.o._createSound(d.id,d.onjustbeforefinishtime,d.loops||1,d.usePolicyFile);else if(b.o._createSound(d.id,d.url,d.onjustbeforefinishtime,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:!1,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,!0,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=!0,d.onconnect&&d.onconnect.apply(f); +(d.autoLoad||d.autoPlay)&&!d.serverURL&&f.load(d)}d.autoPlay&&!d.serverURL&&f.play();return f};this.destroySound=function(c,a){if(!j(c))return!1;var e=b.sounds[c],f;e._iO={};e.stop();e.unload();for(f=0;f0)a.resume();else{a.playState=1;a.paused=!1;(!a.instanceCount||a._iO.multiShotEvents||k>8&&!a.isHTML5&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=S(R(a._iO));if(a._iO.onplay&&V)a._iO.onplay.apply(a),a._onplay_called=!0;a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(d(),e=a._setup_html5(),a.setPosition(a.position), +e.play()):b.o._start(a.sID,a._iO.loops||1,k===9?a.position:a.position/1E3)}return a};this.stop=function(c){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);if(!a.isHTML5)a.playState=0;a.paused=!1;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f(),a.unload()}else b.o._stop(a.sID,c),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(c){a._iO.autoPlay=c;a.isHTML5?a._a&&c&&a.play(): +b.o._setAutoPlay(a.sID,c);c&&!a.instanceCount&&a.readyState===1&&a.instanceCount++};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(c){c===void 0&&(c=0);var d=a.isHTML5?Math.max(c,0):Math.min(a.duration||a._iO.duration,Math.max(c,0));a.position=d;c=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==c)try{a._a.currentTime=c,(a.playState===0||a.paused)&&a._a.pause()}catch(e){}}else c=k===9?a.position: +c,a.readyState&&a.readyState!==2&&b.o._setPosition(a.sID,c,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(c){if(a.paused||a.playState===0&&a.readyState!==1)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(),f()):(c||c===void 0)&&b.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position), +b.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=!0):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){if(a.playState===0)return a.play({position:k===9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(c,d){typeof c==="undefined"&&(c=0);typeof d==="undefined"&&(d=!1);a.isHTML5||b.o._setPan(a.sID,c);a._iO.pan=c;if(!d)a.pan=c,a.options.pan=c;return a};this.setVolume=function(c, +d){typeof c==="undefined"&&(c=100);typeof d==="undefined"&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,c/100))}else b.o._setVolume(a.sID,b.muted&&!a.muted||a.muted?0:c);a._iO.volume=c;if(!d)a.volume=c,a.options.volume=c;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted=!0}else b.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=!1;var c=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=!1}else b.o._setVolume(a.sID,c?a._iO.volume: +a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(b,c,d){a._onPositionItems.push({position:b,method:c,scope:typeof d!=="undefined"?d:a,fired:!1});return a};this.processOnPosition=function(){var c,d;c=a._onPositionItems.length;if(!c||!a.playState||a._onPositionFired>=c)return!1;for(;c--;)if(d=a._onPositionItems[c],!d.fired&&a.position>=d.position)d.method.apply(d.scope,[d.position]),d.fired=!0,b._onPositionFired++;return!0};this.resetOnPosition= +function(c){var d,e;d=a._onPositionItems.length;if(!d)return!1;for(;d--;)if(e=a._onPositionItems[d],e.fired&&c<=e.position)e.fired=!1,b._onPositionFired--;return!0};this._onTimer=function(b){var c={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,c,c,c,c),!0):!1};this._get_html5_duration=function(){var b=a._a?a._a.duration*1E3:a._iO?a._iO.duration: +void 0;return b&&!isNaN(b)&&b!==Infinity?b:a._iO?a._iO.duration:null};d=function(){a.isHTML5&&va(a)};f=function(){a.isHTML5&&wa(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=!1;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=!1;a.playState=0;a.paused=!1;a.readyState=0;a.muted=!1;a.didBeforeFinish=!1;a.didJustBeforeFinish= +!1;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};e();this._setup_html5=function(c){var c=o(a._iO,c),d=J?b._global_a:a._a;decodeURI(c.url);var f=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&f.url===c.url&&(!a._lastURL||a._lastURL===f.url))return d;J&&d._t&&d._t.playState&&c.url!==f.url&&d._t.stop();e();d.src=c.url;a.url=c.url;a._lastURL=c.url;d._called_load=!1}else if(d=new Audio(c.url), +d._called_load=!1,J)b._global_a=d;a.isHTML5=!0;a._a=d;d._t=a;a._add_html5_events();d.loop=c.loops>1?"loop":"";c.autoLoad||c.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=!0):(d.autobuffer=!1,d.preload="none");d.loop=c.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return!1;var c;a._a._added_events=!0;for(c in b._html5_events)b._html5_events.hasOwnProperty(c)&&a._a&&a._a.addEventListener(c,b._html5_events[c],!1);return!0};this._remove_html5_events= +function(){a._a._added_events=!1;for(var c in b._html5_events)b._html5_events.hasOwnProperty(c)&&a._a&&a._a.removeEventListener(c,b._html5_events[c],!1)};this._whileloading=function(b,c,d,e){a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),a.durationEstimate===void 0)a.durationEstimate= +a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._onid3=function(b,c){var d=[],e,f;e=0;for(f=b.length;e0&&(c=0);a.position=c;a.processOnPosition();if(k>8&&!a.isHTML5){if(a._iO.usePeakData&&typeof d!=="undefined"&&d)a.peakData={left:d.leftPeak,right:d.rightPeak};if(a._iO.useWaveformData&&typeof e!=="undefined"&& +e)a.waveformData={left:e.split(","),right:f.split(",")};if(a._iO.useEQData&&typeof g!=="undefined"&&g&&g.leftEQ&&(c=g.leftEQ.split(","),a.eqData=c,a.eqData.left=c,typeof g.rightEQ!=="undefined"&&g.rightEQ))a.eqData.right=g.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&b.flashVersion===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a),(a.loaded||!a.loaded&&a._iO.isMovieStar)&&a._iO.onbeforefinish&&a._iO.onbeforefinishtime&&!a.didBeforeFinish&&a.duration- +a.position<=a._iO.onbeforefinishtime&&a._onbeforefinish());return!0};this._onconnect=function(b){b=b===1;if(a.connected=b)a.failures=0,j(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._onload=function(b){b=b?!0:!1;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onfailure=function(b,c,d){a.failures++;if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b, +c,d)};this._onbeforefinish=function(){if(!a.didBeforeFinish)a.didBeforeFinish=!0,a._iO.onbeforefinish&&a._iO.onbeforefinish.apply(a)};this._onjustbeforefinish=function(){if(!a.didJustBeforeFinish)a.didJustBeforeFinish=!0,a._iO.onjustbeforefinish&&a._iO.onjustbeforefinish.apply(a)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);a._iO.onbeforefinishcomplete&&a._iO.onbeforefinishcomplete.apply(a);a.didBeforeFinish=!1;a.didJustBeforeFinish=!1;if(a.instanceCount){a.instanceCount--; +if(!a.instanceCount)a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},f();(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a)}};this._onbufferchange=function(b){if(a.playState===0)return!1;if(b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=b===1;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._ondataerror=function(){a.playState>0&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};da=function(){return g.body?g.body:g._docElement?g.documentElement: +g.getElementsByTagName("div")[0]};x=function(b){return g.getElementById(b)};o=function(c,a){var e={},f,d;for(f in c)c.hasOwnProperty(f)&&(e[f]=c[f]);f=typeof a==="undefined"?b.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};l=function(){function b(a){var a=Da.call(a),c=a.length;e?(a[1]="on"+a[1],c>3&&a.pop()):c===3&&a.push(!1);return a}function a(a,b){var c=a.shift(),g=[f[b]];if(e)c[g](a[0],a[1]);else c[g].apply(c,a)}var e=h.attachEvent,f={add:e?"attachEvent": +"addEventListener",remove:e?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();U=function(c){return!c.serverURL&&(c.type?I({type:c.type}):I({url:c.url})||b.html5Only)};I=function(c){function a(a){return b.preferFlash&&!b.ignoreFlash&&typeof b.flash[a]!=="undefined"&&b.flash[a]}if(!b.useHTML5Audio||!b.hasHTML5)return!1;var e=c.url||null,c=c.type||null,f=b.audioFormats,d;if(c&&b.html5[c]!=="undefined")return b.html5[c]&& +!a(c);if(!r){r=[];for(d in f)f.hasOwnProperty(d)&&(r.push(d),f[d].related&&(r=r.concat(f[d].related)));r=RegExp("\\.("+r.join("|")+")","i")}d=e?e.toLowerCase().match(r):null;if(!d||!d.length)if(c)e=c.indexOf(";"),d=(e!==-1?c.substr(0,e):c).substr(6);else return!1;else d=d[0].substr(1);return d&&typeof b.html5[d]!=="undefined"?b.html5[d]&&!a(d):(c="audio/"+d,e=b.html5.canPlayType({type:c}),(b.html5[d]=e)&&b.html5[c]&&!a(c))};ya=function(){function c(c){var d,e,f=!1;if(!a||typeof a.canPlayType!=="function")return!1; +if(c instanceof Array){d=0;for(e=c.length;d1&&b.stream)b.stream=!1;return b};S=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};ha=function(b){typeof console!== +"undefined"&&typeof console.warn!=="undefined"&&console.warn(b)};Z=function(){return!1};ta=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=Z)};Q=function(c){typeof c==="undefined"&&(c=!1);(s||c)&&b.disable(c)};ua=function(c){var a=null;if(c)if(c.match(/\.swf(\?.*)?$/i)){if(a=c.substr(c.toLowerCase().lastIndexOf(".swf?")+4))return c}else c.lastIndexOf("/")!==c.length-1&&(c+="/");return(c&&c.lastIndexOf("/")!==-1?c.substr(0,c.lastIndexOf("/")+1):"./")+b.movieURL};ba= +function(){if(k!==8&&k!==9)b.flashVersion=8;var c=b.debugMode||b.debugFlash?"_debug.swf":".swf";if(b.useHTML5Audio&&!b.html5Only&&b.audioFormats.mp4.required&&b.flashVersion<9)b.flashVersion=9;k=b.flashVersion;b.version=b.versionNumber+(b.html5Only?" (HTML5-only mode)":k===9?" (AS3/Flash 9)":" (AS2/Flash 8)");if(k>8)b.defaultOptions=o(b.defaultOptions,b.flash9Options),b.features.buffering=!0;k>8&&b.useMovieStar?(b.defaultOptions=o(b.defaultOptions,b.movieStarOptions),b.filePatterns.flash9=RegExp("\\.(mp3|"+ +b.netStreamTypes.join("|")+")(\\?.*)?$","i"),b.mimePattern=b.netStreamMimeTypes,b.features.movieStar=!0):(b.useMovieStar=!1,b.features.movieStar=!1);b.filePattern=b.filePatterns[k!==8?"flash9":"flash8"];b.movieURL=(k===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",c);b.features.peakData=b.features.waveformData=b.features.eqData=k>8};sa=function(c,a){if(!b.o||!b.allowPolling)return!1;b.o._setPolling(c,a)};P=function(c,a){var e=a?a:b.url,f=b.altURL?b.altURL:e,d;d=da();var h,k,i=A(), +j,l=null,l=(l=g.getElementsByTagName("html")[0])&&l.dir&&l.dir.match(/rtl/i),c=typeof c==="undefined"?b.id:c;if(D&&E)return!1;if(b.html5Only)return ba(),b.oMC=x(b.movieID),N(),E=D=!0,!1;D=!0;ba();b.url=ua(b._overHTTP?e:f);a=b.url;b.wmode=!b.wmode&&b.useHighPerformance&&!b.useMovieStar?"transparent":b.wmode;if(b.wmode!==null&&(n.match(/msie 8/i)||!p&&!b.useHighPerformance)&&navigator.platform.match(/win32|win64/i))b.specialWmodeCase=!0,b.wmode=null;d={name:c,id:c,src:a,width:"auto",height:"auto",quality:"high", +allowScriptAccess:b.allowScriptAccess,bgcolor:b.bgColor,pluginspage:b._http+"//www.macromedia.com/go/getflashplayer",type:"application/x-shockwave-flash",wmode:b.wmode,hasPriority:"true"};if(b.debugFlash)d.FlashVars="debug=1";b.wmode||delete d.wmode;if(p)e=g.createElement("div"),k=''+(b.wmode?' ':"")+''+(b.debugFlash?'':"")+"";else for(h in e=g.createElement("embed"),d)d.hasOwnProperty(h)&&e.setAttribute(h,d[h]);oa();i=A();if(d=da())if(b.oMC=x(b.movieID)?x(b.movieID): +g.createElement("div"),b.oMC.id){j=b.oMC.className;b.oMC.className=(j?j+" ":b.swfCSS.swfDefault)+(i?" "+i:"");b.oMC.appendChild(e);if(p)h=b.oMC.appendChild(g.createElement("div")),h.className=b.swfCSS.swfBox,h.innerHTML=k;E=!0}else{b.oMC.id=b.movieID;b.oMC.className=b.swfCSS.swfDefault+" "+i;h=i=null;if(!b.useFlashBlock)if(b.useHighPerformance)i={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(i={position:"absolute",width:"6px",height:"6px",top:"-9999px", +left:"-9999px"},l)i.left=Math.abs(parseInt(i.left,10))+"px";if(Fa)b.oMC.style.zIndex=1E4;if(!b.debugFlash)for(j in i)i.hasOwnProperty(j)&&(b.oMC.style[j]=i[j]);try{p||b.oMC.appendChild(e);d.appendChild(b.oMC);if(p)h=b.oMC.appendChild(g.createElement("div")),h.className=b.swfCSS.swfBox,h.innerHTML=k;E=!0}catch(m){throw Error(v("appXHTML"));}}return!0};j=this.getSoundById;G=function(){if(b.html5Only)return P(),!1;if(b.o)return!1;b.o=b.getMovie(b.id);if(!b.o)H?(p?b.oMC.innerHTML=fa:b.oMC.appendChild(H), +H=null,D=!0):P(b.id,b.url),b.o=b.getMovie(b.id);b.oninitmovie instanceof Function&&setTimeout(b.oninitmovie,1);return!0};aa=function(c){if(c)b.url=c;G()};O=function(){setTimeout(qa,1E3)};qa=function(){if(T)return!1;T=!0;l.remove(h,"load",O);if(C&&!ma)return!1;var c;m||(c=b.getMoviePercent());setTimeout(function(){c=b.getMoviePercent();!m&&Ba&&(c===null?b.useFlashBlock||b.flashLoadTimeout===0?b.useFlashBlock&&ga():Q(!0):b.flashLoadTimeout!==0&&Q(!0))},b.flashLoadTimeout)};aa=function(c){if(c)b.url= +c;G()};A=function(){var c=[];b.debugMode&&c.push(b.swfCSS.sm2Debug);b.debugFlash&&c.push(b.swfCSS.flashDebug);b.useHighPerformance&&c.push(b.swfCSS.highPerf);return c.join(" ")};ga=function(){v("fbHandler");var c=b.getMoviePercent(),a=b.swfCSS;if(b.ok()){if(b.oMC)b.oMC.className=[A(),a.swfDefault,a.swfLoaded+(b.didFlashBlock?" "+a.swfUnblocked:"")].join(" ")}else{if(w)b.oMC.className=A()+" "+a.swfDefault+" "+(c===null?a.swfTimedout:a.swfError);b.didFlashBlock=!0;t({type:"ontimeout",ignoreInit:!0}); +b.onerror instanceof Function&&b.onerror.apply(h)}};u=function(){function b(){l.remove(h,"focus",u);l.remove(h,"load",u)}if(ma||!C)return b(),!0;ma=Ba=!0;K&&C&&l.remove(h,"mousemove",u);T=!1;b();return!0};F=function(c){if(m)return!1;if(b.html5Only)return m=!0,t(),y(),!0;b.useFlashBlock&&b.flashLoadTimeout&&!b.getMoviePercent()||(m=!0);if(s||c){if(b.useFlashBlock)b.oMC.className=A()+" "+(b.getMoviePercent()===null?b.swfCSS.swfTimedout:b.swfCSS.swfError);t({type:"ontimeout"});b.onerror instanceof Function&& +b.onerror.apply(h);return!1}l.add(h,"unload",Z);if(b.waitForWindowLoad&&!pa)return l.add(h,"load",y),!1;else y();return!0};$=function(b,a,e){typeof q[b]==="undefined"&&(q[b]=[]);q[b].push({method:a,scope:e||null,fired:!1})};t=function(c){c||(c={type:"onready"});if(!m&&c&&!c.ignoreInit)return!1;if(c.type==="ontimeout"&&b.ok())return!1;var a={success:c&&c.ignoreInit?b.ok():!s},e=c&&c.type?q[c.type]||[]:[],c=[],f,d=w&&b.useFlashBlock&&!b.ok();for(f=0;f