PageSourceSearch

http://forever.fm/static/assets/spin.min-1405144591_soundmanager2-…-0.3.min-1405144591_async.min-1405144591.js

js forever.fm collected 2026-10-05 07:43:32 UTC 195,825 bytes, 2,190 lines download raw bytes

1//fgnass.github.com/spin.js#v1.2.7
2!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"},v=function m(e){if(!this.spin)return new m(e);this.opts=h(e||{},m.defaults,d)};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document);
3
4window.__spinner = new Spinner({
5  lines: 9, // The number of lines to draw
6  length: 0, // The length of each line
7  width: 7, // The line thickness
8  radius: 38, // The radius of the inner circle
9  corners: 1, // Corner roundness (0..1)
10  rotate: 0, // The rotation offset
11  color: '#000', // #rgb or #rrggbb
12  speed: 0.9, // Rounds per second
13  trail: 25, // Afterglow percentage
14  shadow: false, // Whether to render a shadow
15  hwaccel: true, // Whether to use hardware acceleration
16  className: 'spinner', // The CSS class to assign to the spinner
17  zIndex: 2e9, // The z-index (defaults to 2000000000)
18  top: 'auto', // Top position relative to parent in px
19  left: 'auto' // Left position relative to parent in px
20});
21
22/** @license
23 *
24 * SoundManager 2: JavaScript Sound for the Web
25 * ----------------------------------------------
26 * http://schillmania.com/projects/soundmanager2/
27 *
28 * Copyright (c) 2007, Scott Schiller. All rights reserved.
29 * Code provided under the BSD License:
30 * http://schillmania.com/projects/soundmanager2/license.txt
31 *
32 * V2.97a.20131201
33 */
34(function(g,k){function U(U,ka){function V(b){return c.preferFlash&&v&&!c.ignoreFlash&&c.flash[b]!==k&&c.flash[b]}function q(b){return function(c){var d=this._s;
34return!d||!d._a?null:b.call(this,c)}}this.setupOptions={url:U||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,
35html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"};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,
36ondataerror: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},
37wav:{type:['audio/wav; codecs\x3d"1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID="sm2-container";this.id=ka||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20131201";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=
38{buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var Ja,c=this,Ka=null,l=null,W,s=navigator.userAgent,La=g.location.href.toString(),n=document,la,Ma,ma,m,x=[],K=!1,L=!1,p=!1,y=!1,na=!1,M,w,oa,X,pa,D,E,F,Na,qa,ra,Y,sa,Z,ta,G,ua,N,va,$,H,Oa,wa,Pa,xa,Qa,O=null,ya=null,P,za,I,aa,ba,r,Q=!1,Aa=!1,Ra,Sa,Ta,ca=0,R=null,da,Ua=[],S,u=null,Va,ea,T,z,fa,Ba,Wa,t,fb=Array.prototype.slice,A=!1,Ca,v,Da,
39Xa,B,ga,Ya=0,ha=s.match(/(ipad|iphone|ipod)/i),Za=s.match(/android/i),C=s.match(/msie/i),gb=s.match(/webkit/i),ia=s.match(/safari/i)&&!s.match(/chrome/i),Ea=s.match(/opera/i),Fa=s.match(/(mobile|pre\/|xoom)/i)||ha||Za,$a=!La.match(/usehtml5audio/i)&&!La.match(/sm2\-ignorebadua/i)&&ia&&!s.match(/silk/i)&&s.match(/OS X 10_6_([3-7])/i),Ga=n.hasFocus!==k?n.hasFocus():null,ja=ia&&(n.hasFocus===k||!n.hasFocus()),ab=!ja,bb=/(mp3|mp4|mpa|m4a|m4b)/i,Ha=n.location?n.location.protocol.match(/http/i):null,cb=
40!Ha?"http://":"",db=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,eb="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),hb=RegExp("\\.("+eb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!Ha;var Ia;try{Ia=Audio!==k&&(Ea&&opera!==k&&10>opera.version()?new Audio(null):new Audio).canPlayType!==k}catch(ib){Ia=!1}this.hasHTML5=Ia;this.setup=function(b){var e=!c.url;b!==k&&p&&u&&c.ok();oa(b);b&&
41(e&&(N&&b.url!==k)&&c.beginDelayedInit(),!N&&(b.url!==k&&"complete"===n.readyState)&&setTimeout(G,1));return c};this.supported=this.ok=function(){return u?p&&!y:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(b){return W(b)||n[b]||g[b]};this.createSound=function(b,e){function d(){a=aa(a);c.sounds[a.id]=new Ja(a);c.soundIDs.push(a.id);return c.sounds[a.id]}var a,f=null;if(!p||!c.ok())return!1;e!==k&&(b={id:b,url:e});a=w(b);a.url=da(a.url);void 0===a.id&&(a.id=c.setupOptions.idPrefix+Ya++);if(r(a.id,
42!0))return c.sounds[a.id];if(ea(a))f=d(),f._setup_html5(a);else{if(c.html5Only||c.html5.usingFlash&&a.url&&a.url.match(/data\:/i))return d();8<m&&null===a.isMovieStar&&(a.isMovieStar=!(!a.serverURL&&!(a.type&&a.type.match(db)||a.url&&a.url.match(hb))));a=ba(a,void 0);f=d();8===m?l._createSound(a.id,a.loops||1,a.usePolicyFile):(l._createSound(a.id,a.url,a.usePeakData,a.useWaveformData,a.useEQData,a.isMovieStar,a.isMovieStar?a.bufferTime:!1,a.loops||1,a.serverURL,a.duration||null,a.autoPlay,!0,a.autoLoad,
43a.usePolicyFile),a.serverURL||(f.connected=!0,a.onconnect&&a.onconnect.apply(f)));!a.serverURL&&(a.autoLoad||a.autoPlay)&&f.load(a)}!a.serverURL&&a.autoPlay&&f.play();return f};this.destroySound=function(b,e){if(!r(b))return!1;var d=c.sounds[b],a;d._iO={};d.stop();d.unload();for(a=0;a<c.soundIDs.length;a++)if(c.soundIDs[a]===b){c.soundIDs.splice(a,1);break}e||d.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,e){return!r(b)?!1:c.sounds[b].load(e)};this.unload=function(b){return!r(b)?
44!1:c.sounds[b].unload()};this.onposition=this.onPosition=function(b,e,d,a){return!r(b)?!1:c.sounds[b].onposition(e,d,a)};this.clearOnPosition=function(b,e,d){return!r(b)?!1:c.sounds[b].clearOnPosition(e,d)};this.start=this.play=function(b,e){var d=null,a=e&&!(e instanceof Object);if(!p||!c.ok())return!1;if(r(b,a))a&&(e={url:e});else{if(!a)return!1;a&&(e={url:e});e&&e.url&&(e.id=b,d=c.createSound(e).play())}null===d&&(d=c.sounds[b].play(e));return d};this.setPosition=function(b,e){return!r(b)?!1:c.sounds[b].setPosition(e)};
45this.stop=function(b){return!r(b)?!1:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!r(b)?!1:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!r(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!r(b)?
46!1:c.sounds[b].togglePause()};this.setPan=function(b,e){return!r(b)?!1:c.sounds[b].setPan(e)};this.setVolume=function(b,e){return!r(b)?!1:c.sounds[b].setVolume(e)};this.mute=function(b){var e=0;b instanceof String&&(b=null);if(b)return!r(b)?!1:c.sounds[b].mute();for(e=c.soundIDs.length-1;0<=e;e--)c.sounds[c.soundIDs[e]].mute();return c.muted=!0}
46;this.muteAll=function(){c.mute()};this.unmute=function(b){b instanceof String&&(b=null);if(b)return!r(b)?!1:c.sounds[b].unmute();for(b=c.soundIDs.length-
471;0<=b;b--)c.sounds[c.soundIDs[b]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!r(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;l&&8!==m&&(b=parseInt(l._getMemoryUse(),10));return b};this.disable=function(b){var e;b===k&&(b=!1);if(y)return!1;y=!0;for(e=c.soundIDs.length-1;0<=e;e--)Pa(c.sounds[c.soundIDs[e]]);M(b);t.remove(g,"load",E);return!0};this.canPlayMIME=function(b){var e;c.hasHTML5&&(e=T({type:b}));!e&&u&&(e=b&&
48c.ok()?!!(8<m&&b.match(db)||b.match(c.mimePattern)):null);return e};this.canPlayURL=function(b){var e;c.hasHTML5&&(e=T({url:b}));!e&&u&&(e=b&&c.ok()?!!b.match(c.filePattern):null);return e};this.canPlayLink=function(b){return b.type!==k&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b,e){return!b?null:c.sounds[b]};this.onready=function(b,c){if("function"===typeof b)c||(c=g),pa("onready",b,c),D();else throw P("needFunction","onready");return!0};this.ontimeout=function(b,
49c){if("function"===typeof b)c||(c=g),pa("ontimeout",b,c),D({type:"ontimeout"});else throw P("needFunction","ontimeout");return!0};this._wD=this._writeDebug=function(b,c){return!0};this._debug=function(){};this.reboot=function(b,e){var d,a,f;for(d=c.soundIDs.length-1;0<=d;d--)c.sounds[c.soundIDs[d]].destruct();if(l)try{C&&(ya=l.innerHTML),O=l.parentNode.removeChild(l)}catch(k){}ya=O=u=l=null;c.enabled=N=p=Q=Aa=K=L=y=A=c.swfLoaded=!1;c.soundIDs=[];c.sounds={};Ya=0;if(b)x=[];else for(d in x)if(x.hasOwnProperty(d)){a=
500;for(f=x[d].length;a<f;a++)x[d][a].fired=!1}c.html5={usingFlash:null};c.flash={};c.html5Only=!1;c.ignoreFlash=!1;g.setTimeout(function(){ta();e||c.beginDelayedInit()},20);return c};this.reset=function(){return c.reboot(!0,!0)};this.getMoviePercent=function(){return l&&"PercentLoaded"in l?l.PercentLoaded():null};this.beginDelayedInit=function(){na=!0;G();setTimeout(function(){if(Aa)return!1;$();Z();return Aa=!0},20);F()};this.destruct=function(){c.disable(!0)};Ja=function(b){var e,d,a=this,f,h,J,
51g,n,q,s=!1,p=[],u=0,x,y,v=null,z;d=e=null;this.sID=this.id=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=w(b);this.pan=this.options.pan;this.volume=this.options.volume;this.isHTML5=!1;this._a=null;z=this.url?!1:!0;this.id3={};this._debug=function(){};this.load=function(b){var e=null,d;b!==k?a._iO=w(b,a.options):(b=a.options,a._iO=b,v&&v!==a.url&&(a._iO.url=a.url,a.url=null));a._iO.url||(a._iO.url=a.url);a._iO.url=da(a._iO.url);d=a.instanceOptions=a._iO;if(!d.url&&!a.url)return a;
52if(d.url===a.url&&0!==a.readyState&&2!==a.readyState)return 3===a.readyState&&d.onload&&ga(a,function(){d.onload.apply(a,[!!a.duration])}),a;a.loaded=!1;a.readyState=1;a.playState=0;a.id3={};if(ea(d))e=a._setup_html5(d),e._called_load||(a._html5_canplay=!1,a.url!==d.url&&(a._a.src=d.url,a.setPosition(0)),a._a.autobuffer="auto",a._a.preload="auto",a._a._called_load=!0);else{if(c.html5Only||a._iO.url&&a._iO.url.match(/data\:/i))return a;try{a.isHTML5=!1,a._iO=ba(aa(d)),d=a._iO,8===m?l._load(a.id,d.url,
53d.stream,d.autoPlay,d.usePolicyFile):l._load(a.id,d.url,!!d.stream,!!d.autoPlay,d.loops||1,!!d.autoLoad,d.usePolicyFile)}catch(f){H({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}a.url=d.url;return a};this.unload=function(){0!==a.readyState&&(a.isHTML5?(g(),a._a&&(a._a.pause(),v=fa(a._a))):8===m?l._unload(a.id,"about:blank"):l._unload(a.id),f());return a};this.destruct=function(b){a.isHTML5?(g(),a._a&&(a._a.pause(),fa(a._a),A||J(),a._a._s=null,a._a=null)):(a._iO.onfailure=null,l._destroySound(a.id));
54b||c.destroySound(a.id,!0)};this.start=this.play=function(b,e){var d,f,h,g,J;f=!0;f=null;e=e===k?!0:e;b||(b={});a.url&&(a._iO.url=a.url);a._iO=w(a._iO,a.options);a._iO=w(b,a._iO);a._iO.url=da(a._iO.url);a.instanceOptions=a._iO;if(!a.isHTML5&&a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),a;ea(a._iO)&&(a._setup_html5(a._iO),n());
541===a.playState&&!a.paused&&(d=a._iO.multiShot,d||(a.isHTML5&&a.setPosition(a._iO.position),f=a));if(null!==f)return f;b.url&&b.url!==a.url&&(!a.readyState&&
55!a.isHTML5&&8===m&&z?z=!1:a.load(a._iO));a.loaded||(0===a.readyState?(!a.isHTML5&&!c.html5Only?(a._iO.autoPlay=!0,a.load(a._iO)):a.isHTML5?a.load(a._iO):f=a,a.instanceOptions=a._iO):2===a.readyState&&(f=a));if(null!==f)return f;!a.isHTML5&&(9===m&&0<a.position&&a.position===a.duration)&&(b.position=0);if(a.paused&&0<=a.position&&(!a._iO.serverURL||0<a.position))a.resume();else{a._iO=w(b,a._iO);if(null!==a._iO.from&&null!==a._iO.to&&0===a.instanceCount&&0===a.playState&&!a._iO.serverURL){d=function(){a._iO=
56w(b,a._iO);a.play(a._iO)};if(a.isHTML5&&!a._html5_canplay)a.load({_oncanplay:d}),f=!1;else if(!a.isHTML5&&!a.loaded&&(!a.readyState||2!==a.readyState))a.load({onload:d}),f=!1;if(null!==f)return f;a._iO=y()}(!a.instanceCount||a._iO.multiShotEvents||a.isHTML5&&a._iO.multiShot&&!A||!a.isHTML5&&8<m&&!a.getAutoPlay())&&a.instanceCount++;a._iO.onposition&&0===a.playState&&q(a);a.playState=1;a.paused=!1;a.position=a._iO.position!==k&&!isNaN(a._iO.position)?a._iO.position:0;a.isHTML5||(a._iO=ba(aa(a._iO)));
57a._iO.onplay&&e&&(a._iO.onplay.apply(a),s=!0);a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?2>a.instanceCount?(n(),f=a._setup_html5(),a.setPosition(a._iO.position),f.play()):(h=new Audio(a._iO.url),g=function(){t.remove(h,"ended",g);a._onfinish(a);fa(h);h=null},J=function(){t.remove(h,"canplay",J);try{h.currentTime=a._iO.position/1E3}catch(b){}h.play()},t.add(h,"ended",g),void 0!==a._iO.volume&&(h.volume=Math.max(0,Math.min(1,a._iO.volume/100))),a.muted&&(h.muted=!0),a._iO.position?
58t.add(h,"canplay",J):h.play()):(f=l._start(a.id,a._iO.loops||1,9===m?a.position:a.position/1E3,a._iO.multiShot||!1),9===m&&!f&&a._iO.onplayerror&&a._iO.onplayerror.apply(a))}return a};this.stop=function(b){var c=a._iO;1===a.playState&&(a._onbufferchange(0),a._resetOnPosition(0),a.paused=!1,a.isHTML5||(a.playState=0),x(),c.to&&a.clearOnPosition(c.to),a.isHTML5?a._a&&(b=a.position,a.setPosition(0),a.position=b,a._a.pause(),a.playState=0,a._onTimer(),g()):(l._stop(a.id,b),c.serverURL&&a.unload()),a.instanceCount=
590,a._iO={},c.onstop&&c.onstop.apply(a));return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(l._setAutoPlay(a.id,b),b&&!a.instanceCount&&1===a.readyState&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===k&&(b=0);var c=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=c;b=a.position/1E3;a._resetOnPosition(a.position);a._iO.position=c;if(a.isHTML5){if(a._a){if(a._html5_canplay){if(a._a.currentTime!==
60b)try{a._a.currentTime=b,(0===a.playState||a.paused)&&a._a.pause()}catch(e){}}else if(b)return a;a.paused&&a._onTimer(!0)}}else b=9===m?a.position:b,a.readyState&&2!==a.readyState&&l._setPosition(a.id,b,a.paused||!a.playState,a._iO.multiShot);return a};this.pause=function(b){if(a.paused||0===a.playState&&1!==a.readyState)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(),g()):(b||b===k)&&l._pause(a.id,a._iO.multiShot);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){var b=
61a._iO;if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),n()):(b.isMovieStar&&!b.serverURL&&a.setPosition(a.position),l._pause(a.id,b.multiShot));!s&&b.onplay?(b.onplay.apply(a),s=!0):b.onresume&&b.onresume.apply(a);return a};this.togglePause=function(){if(0===a.playState)return a.play({position:9===m&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,c){b===k&&(b=0);c===k&&(c=!1);a.isHTML5||l._setPan(a.id,b);a._iO.pan=
62b;c||(a.pan=b,a.options.pan=b);return a};this.setVolume=function(b,e){b===k&&(b=100);e===k&&(e=!1);a.isHTML5?a._a&&(c.muted&&!a.muted&&(a.muted=!0,a._a.muted=!0),a._a.volume=Math.max(0,Math.min(1,b/100))):l._setVolume(a.id,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;e||(a.volume=b,a.options.volume=b);return a};this.mute=function(){a.muted=!0;a.isHTML5?a._a&&(a._a.muted=!0):l._setVolume(a.id,0);return a};this.unmute=function(){a.muted=!1;var b=a._iO.volume!==k;a.isHTML5?a._a&&(a._a.muted=!1):l._setVolume(a.id,
63b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=this.onPosition=function(b,c,e){p.push({position:parseInt(b,10),method:c,scope:e!==k?e:a,fired:!1});return a};this.clearOnPosition=function(a,b){var c;a=parseInt(a,10);if(isNaN(a))return!1;for(c=0;c<p.length;c++)if(a===p[c].position&&(!b||b===p[c].method))p[c].fired&&u--,p.splice(c,1)};this._processOnPosition=function(){var b,c;b=p.length;if(!b||!a.playState||u>=b)return!1;for(b-=
641;0<=b;b--)c=p[b],!c.fired&&a.position>=c.position&&(c.fired=!0,u++,c.method.apply(c.scope,[c.position]));return!0};this._resetOnPosition=function(a){var b,c;b=p.length;if(!b)return!1;for(b-=1;0<=b;b--)c=p[b],c.fired&&a<=c.position&&(c.fired=!1,u--);return!0};y=function(){var b=a._iO,c=b.from,e=b.to,d,f;f=function(){a.clearOnPosition(e,f);a.stop()};d=function(){if(null!==e&&!isNaN(e))a.onPosition(e,f)};null!==c&&!isNaN(c)&&(b.position=c,b.multiShot=!1,d());return b};q=function(){var b,c=a._iO.onposition;
65if(c)for(b in c)if(c.hasOwnProperty(b))a.onPosition(parseInt(b,10),c[b])};
65x=function(){var b,c=a._iO.onposition;if(c)for(b in c)c.hasOwnProperty(b)&&a.clearOnPosition(parseInt(b,10))};n=function(){a.isHTML5&&Ra(a)};g=function(){a.isHTML5&&Sa(a)};f=function(b){b||(p=[],u=0);s=!1;a._hasTimer=null;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.buffered=[];a.eqData=[];a.eqData.left=[];a.eqData.right=[];
66a.failures=0;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.loaded=!1;a.metadata={};a.readyState=0;a.muted=!1;a.paused=!1;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.playState=0;a.position=null;a.id3={}};f();this._onTimer=function(b){var c,f=!1,h={};if(a._hasTimer||b){if(a._a&&(b||(0<a.playState||1===a.readyState)&&!a.paused))c=a._get_html5_duration(),c!==e&&(e=c,a.duration=c,f=!0),a.durationEstimate=a.duration,c=1E3*a._a.currentTime||0,c!==d&&(d=c,f=!0),(f||b)&&a._whileplaying(c,
67h,h,h,h);return f}};this._get_html5_duration=function(){var b=a._iO;return(b=a._a&&a._a.duration?1E3*a._a.duration:b&&b.duration?b.duration:null)&&!isNaN(b)&&Infinity!==b?b:null};this._apply_loop=function(a,b){a.loop=1<b?"loop":""};this._setup_html5=function(b){b=w(a._iO,b);var c=A?Ka:a._a,e=decodeURI(b.url),d;A?e===decodeURI(Ca)&&(d=!0):e===decodeURI(v)&&(d=!0);if(c){if(c._s)if(A)c._s&&(c._s.playState&&!d)&&c._s.stop();else if(!A&&e===decodeURI(v))return a._apply_loop(c,b.loops),c;d||(v&&f(!1),c.src=
68b.url,Ca=v=a.url=b.url,c._called_load=!1)}else b.autoLoad||b.autoPlay?(a._a=new Audio(b.url),a._a.load()):a._a=Ea&&10>opera.version()?new Audio(null):new Audio,c=a._a,c._called_load=!1,A&&(Ka=c);a.isHTML5=!0;a._a=c;c._s=a;h();a._apply_loop(c,b.loops);b.autoLoad||b.autoPlay?a.load():(c.autobuffer=!1,c.preload="auto");return c};h=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in B)B.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,B[b],!1);return!0};J=function(){var b;a._a._added_events=
69!1;for(b in B)B.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,B[b],!1)};this._onload=function(b){var c=!!b||!a.isHTML5&&8===m&&a.duration;a.loaded=c;a.readyState=c?3:2;a._onbufferchange(0);a._iO.onload&&ga(a,function(){a._iO.onload.apply(a,[c])});return!0};this._onbufferchange=function(b){if(0===a.playState||b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=1===b;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);
70return!0};this._onfailure=function(b,c,e){a.failures++;if(a._iO.onfailure&&1===a.failures)a._iO.onfailure(a,b,c,e)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a._resetOnPosition(0);a.instanceCount&&(a.instanceCount--,a.instanceCount||(x(),a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},g(),a.isHTML5&&(a.position=0)),(!a.instanceCount||a._iO.multiShotEvents)&&b&&ga(a,function(){b.apply(a)}))};this._whileloading=function(b,c,e,d){var f=a._iO;a.bytesLoaded=
71b;a.bytesTotal=c;a.duration=Math.floor(e);a.bufferLength=d;a.durationEstimate=!a.isHTML5&&!f.isMovieStar?f.duration?a.duration>f.duration?a.duration:f.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10):a.duration;a.isHTML5||(a.buffered=[{start:0,end:a.duration}]);(3!==a.readyState||a.isHTML5)&&f.whileloading&&f.whileloading.apply(a)};this._whileplaying=function(b,c,e,d,f){var h=a._iO;if(isNaN(b)||null===b)return!1;a.position=Math.max(0,b);a._processOnPosition();!a.isHTML5&&8<m&&(h.usePeakData&&
72(c!==k&&c)&&(a.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&(e!==k&&e)&&(a.waveformData={left:e.split(","),right:d.split(",")}),h.useEQData&&(f!==k&&f&&f.leftEQ)&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,f.rightEQ!==k&&f.rightEQ&&(a.eqData.right=f.rightEQ.split(","))));1===a.playState&&(!a.isHTML5&&(8===m&&!a.position&&a.isBuffering)&&a._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(a));return!0};this._oncaptiondata=function(b){a.captiondata=b;a._iO.oncaptiondata&&
73a._iO.oncaptiondata.apply(a,[b])};this._onmetadata=function(b,c){var e={},d,f;d=0;for(f=b.length;d<f;d++)e[b[d]]=c[d];a.metadata=e;a._iO.onmetadata&&a._iO.onmetadata.apply(a)};this._onid3=function(b,c){var e=[],d,f;d=0;for(f=b.length;d<f;d++)e[b[d]]=c[d];a.id3=w(a.id3,e);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=1===b;if(a.connected=b)a.failures=0,r(a.id)&&(a.getAutoPlay()?a.play(k,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=
74function(b){0<a.playState&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};va=function(){return n.body||n.getElementsByTagName("div")[0]};W=function(b){return n.getElementById(b)};w=function(b,e){var d=b||{},a,f;a=e===k?c.defaultOptions:e;for(f in a)a.hasOwnProperty(f)&&d[f]===k&&(d[f]="object"!==typeof a[f]||null===a[f]?a[f]:w(d[f],a[f]));return d};ga=function(b,c){!b.isHTML5&&8===m?g.setTimeout(c,0):c()};X={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1};oa=function(b,
75e){var d,a=!0,f=e!==k,h=c.setupOptions;for(d in b)if(b.hasOwnProperty(d))if("object"!==typeof b[d]||null===b[d]||b[d]instanceof Array||b[d]instanceof RegExp)f&&X[e]!==k?c[e][d]=b[d]:h[d]!==k?(c.setupOptions[d]=b[d],c[d]=b[d]):X[d]===k?a=!1:c[d]instanceof Function?c[d].apply(c,b[d]instanceof Array?b[d]:[b[d]]):c[d]=b[d];else if(X[d]===k)a=!1;else return oa(b[d],d);return a};t=function(){function b(a){a=fb.call(a);var b=a.length;d?(a[1]="on"+a[1],3<b&&a.pop()):3===b&&a.push(!1);return a}function c(b,
76e){var k=b.shift(),g=[a[e]];if(d)k[g](b[0],b[1]);else k[g].apply(k,b)}var d=g.attachEvent,a={add:d?"attachEvent":"addEventListener",remove:d?"detachEvent":"removeEventListener"};return{add:function(){c(b(arguments),"add")},remove:function(){c(b(arguments),"remove")}}}();B={abort:q(function(){}),canplay:q(function(){var b=this._s,c;if(b._html5_canplay)return!0;b._html5_canplay=!0;b._onbufferchange(0);
76c=b._iO.position!==k&&!isNaN(b._iO.position)?b._iO.position/1E3:null;if(b.position&&this.currentTime!==
77c)try{this.currentTime=c}catch(d){}b._iO._oncanplay&&b._iO._oncanplay()}),canplaythrough:q(function(){var b=this._s;b.loaded||(b._onbufferchange(0),b._whileloading(b.bytesLoaded,b.bytesTotal,b._get_html5_duration()),b._onload(!0))}),ended:q(function(){this._s._onfinish()}),error:q(function(){this._s._onload(!1)}),loadeddata:q(function(){var b=this._s;!b._loaded&&!ia&&(b.duration=b._get_html5_duration())}),loadedmetadata:q(function(){}),loadstart:q(function(){this._s._onbufferchange(1)}),play:q(function(){this._s._onbufferchange(0)}),
78playing:q(function(){this._s._onbufferchange(0)}),progress:q(function(b){var c=this._s,d,a,f=0,f=b.target.buffered;d=b.loaded||0;var h=b.total||1;c.buffered=[];if(f&&f.length){d=0;for(a=f.length;d<a;d++)c.buffered.push({start:1E3*f.start(d),end:1E3*f.end(d)});f=1E3*(f.end(0)-f.start(0));d=Math.min(1,f/(1E3*b.target.duration))}isNaN(d)||(c._onbufferchange(0),c._whileloading(d,h,c._get_html5_duration()),d&&(h&&d===h)&&B.canplaythrough.call(this,b))}),ratechange:q(function(){}),suspend:q(function(b){var c=
79this._s;B.progress.call(this,b);c._onsuspend()}),stalled:q(function(){}),timeupdate:q(function(){this._s._onTimer()}),waiting:q(function(){this._s._onbufferchange(1)})};ea=function(b){return!b||!b.type&&!b.url&&!b.serverURL?!1:b.serverURL||b.type&&V(b.type)?!1:b.type?T({type:b.type}):T({url:b.url})||c.html5Only||b.url.match(/data\:/i)};fa=function(b){var e;b&&(e=ia?"about:blank":c.html5.canPlayType("audio/wav")?"data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w\x3d\x3d":
80"about:blank",b.src=e,void 0!==b._called_unload&&(b._called_load=!1));A&&(Ca=null);return e};T=function(b){if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=b.url||null;b=b.type||null;var d=c.audioFormats,a;if(b&&c.html5[b]!==k)return c.html5[b]&&!V(b);if(!z){z=[];for(a in d)d.hasOwnProperty(a)&&(z.push(a),d[a].related&&(z=z.concat(d[a].related)));z=RegExp("\\.("+z.join("|")+")(\\?.*)?$","i")}a=e?e.toLowerCase().match(z):null;!a||!a.length?b&&(e=b.indexOf(";"),a=(-1!==e?b.substr(0,e):b).substr(6)):
81a=a[1];a&&c.html5[a]!==k?e=c.html5[a]&&!V(a):(b="audio/"+a,e=c.html5.canPlayType({type:b}),e=(c.html5[a]=e)&&c.html5[b]&&!V(b));return e};Wa=function(){function b(a){var b,d=b=!1;if(!e||"function"!==typeof e.canPlayType)return b;if(a instanceof Array){g=0;for(b=a.length;g<b;g++)if(c.html5[a[g]]||e.canPlayType(a[g]).match(c.html5Test))d=!0,c.html5[a[g]]=!0,c.flash[a[g]]=!!a[g].match(bb);b=d}else a=e&&"function"===typeof e.canPlayType?e.canPlayType(a):!1,b=!(!a||!a.match(c.html5Test));return b}if(!c.useHTML5Audio||
82!c.hasHTML5)return u=c.html5.usingFlash=!0,!1;var e=Audio!==k?Ea&&10>opera.version()?new Audio(null):new Audio:null,d,a,f={},h,g;h=c.audioFormats;for(d in h)if(h.hasOwnProperty(d)&&(a="audio/"+d,f[d]=b(h[d].type),f[a]=f[d],d.match(bb)?(c.flash[d]=!0,c.flash[a]=!0):(c.flash[d]=!1,c.flash[a]=!1),h[d]&&h[d].related))for(g=h[d].related.length-1;0<=g;g--)f["audio/"+h[d].related[g]]=f[d],c.html5[h[d].related[g]]=f[d],c.flash[h[d].related[g]]=f[d];f.canPlayType=e?b:null;c.html5=w(c.html5,f);c.html5.usingFlash=
83Va();u=c.html5.usingFlash;return!0};sa={};P=function(){};aa=function(b){8===m&&(1<b.loops&&b.stream)&&(b.stream=!1);return b};ba=function(b,c){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};la=function(){return!1};Pa=function(b){for(var c in b)b.hasOwnProperty(c)&&"function"===typeof b[c]&&(b[c]=la)};xa=function(b){b===k&&(b=!1);(y||b)&&c.disable(b)};Qa=function(b){var e=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(e=b.substr(b.toLowerCase().lastIndexOf(".swf?")+
844))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&-1!==b.lastIndexOf("/")?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts\x3d"+(new Date).getTime());return b};ra=function(){m=parseInt(c.flashVersion,10);8!==m&&9!==m&&(c.flashVersion=m=8);var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";c.useHTML5Audio&&(!c.html5Only&&c.audioFormats.mp4.required&&9>m)&&(c.flashVersion=m=9);c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":9===m?" (AS3/Flash 9)":
85" (AS2/Flash 8)");8<m?(c.defaultOptions=w(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=w(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+eb.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[8!==m?"flash9":"flash8"];c.movieURL=(8===m?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=8<m};Oa=function(b,c){if(!l)return!1;
86l._setPolling(b,c)};wa=function(){};r=this.getSoundById;I=function(){var b=[];c.debugMode&&b.push("sm2_debug");c.debugFlash&&b.push("flash_debug");c.useHighPerformance&&b.push("high_performance");return b.join(" ")};za=function(){P("fbHandler");var b=c.getMoviePercent(),e={type:"FLASHBLOCK"};if(c.html5Only)return!1;c.ok()?c.oMC&&(c.oMC.className=[I(),"movieContainer","swf_loaded"+(c.didFlashBlock?" swf_unblocked":"")].join(" ")):(u&&(c.oMC.className=I()+" movieContainer "+(null===b?"swf_timedout":
87"swf_error")),c.didFlashBlock=!0,D({type:"ontimeout",ignoreInit:!0,error:e}),H(e))};pa=function(b,c,d){x[b]===k&&(x[b]=[]);x[b].push({method:c,scope:d||null,fired:!1})};D=function(b){b||(b={type:c.ok()?"onready":"ontimeout"});if(!p&&b&&!b.ignoreInit||"ontimeout"===b.type&&(c.ok()||y&&!b.ignoreInit))return!1;var e={success:b&&b.ignoreInit?c.ok():!y},d=b&&b.type?x[b.type]||[]:[],a=[],f,e=[e],h=u&&!c.ok();b.error&&(e[0].error=b.error);b=0;for(f=d.length;b<f;b++)!0!==d[b].fired&&a.push(d[b]);if(a.length){b=
880;for(f=a.length;b<f;b++)a[b].scope?a[b].method.apply(a[b].scope,e):a[b].method.apply(this,e),h||(a[b].fired=!0)}return!0};E=function(){g.setTimeout(function(){c.useFlashBlock&&za();D();"function"===typeof c.onload&&c.onload.apply(g);c.waitForWindowLoad&&t.add(g,"load",E)},1)};Da=function(){if(v!==k)return v;var b=!1,c=navigator,d=c.plugins,a,f=g.ActiveXObject;if(d&&d.length)(c=c.mimeTypes)&&(c["application/x-shockwave-flash"]&&c["application/x-shockwave-flash"].enabledPlugin&&c["application/x-shockwave-flash"].enabledPlugin.description)&&
89(b=!0);else if(f!==k&&!s.match(/MSAppHost/i)){try{a=new f("ShockwaveFlash.ShockwaveFlash")}catch(h){a=null}b=!!a}return v=b};Va=function(){var b,e,d=c.audioFormats;if(ha&&s.match(/os (1|2|3_0|3_1)/i))c.hasHTML5=!1,c.html5Only=!0,c.oMC&&(c.oMC.style.display="none");else if(c.useHTML5Audio&&(!c.html5||!c.html5.canPlayType))c.hasHTML5=!1;if(c.useHTML5Audio&&c.hasHTML5)for(e in S=!0,d)if(d.hasOwnProperty(e)&&d[e].required)if(c.html5.canPlayType(d[e].type)){if(c.preferFlash&&(c.flash[e]||c.flash[d[e].type]))b=
90!0}else S=!1,b=!0;c.ignoreFlash&&(b=!1,S=!0);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};da=function(b){var e,d,a=0;if(b instanceof Array){e=0;for(d=b.length;e<d;e++)if(b[e]instanceof Object){if(c.canPlayMIME(b[e].type)){a=e;break}}else if(c.canPlayURL(b[e])){a=e;break}
90b[a].url&&(b[a]=b[a].url);b=b[a]}return b};Ra=function(b){b._hasTimer||(b._hasTimer=!0,!Fa&&c.html5PollingInterval&&(null===R&&0===ca&&(R=setInterval(Ta,c.html5PollingInterval)),ca++))};Sa=function(b){b._hasTimer&&
91(b._hasTimer=!1,!Fa&&c.html5PollingInterval&&ca--)};Ta=function(){var b;if(null!==R&&!ca)return clearInterval(R),R=null,!1;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].isHTML5&&c.sounds[c.soundIDs[b]]._hasTimer&&c.sounds[c.soundIDs[b]]._onTimer()};H=function(b){b=b!==k?b:{};"function"===typeof c.onerror&&c.onerror.apply(g,[{type:b.type!==k?b.type:null}]);b.fatal!==k&&b.fatal&&c.disable()};Xa=function(){if(!$a||!Da())return!1;var b=c.audioFormats,e,d;for(d in b)if(b.hasOwnProperty(d)&&
92("mp3"===d||"mp4"===d))if(c.html5[d]=!1,b[d]&&b[d].related)for(e=b[d].related.length-1;0<=e;e--)c.html5[b[d].related[e]]=!1};this._setSandboxType=function(b){};this._externalInterfaceOK=function(b){if(c.swfLoaded)return!1;c.swfLoaded=!0;ja=!1;$a&&Xa();setTimeout(ma,C?100:1)};$=function(b,e){function d(a,b){return'\x3cparam name\x3d"'+a+'" value\x3d"'+b+'" /\x3e'}if(K&&L)return!1;if(c.html5Only)return ra(),c.oMC=W(c.movieID),ma(),L=K=!0,!1;var a=e||c.url,f=c.altURL||a,h=va(),g=I(),l=null,l=n.getElementsByTagName("html")[0],
93m,p,q,l=l&&l.dir&&l.dir.match(/rtl/i);b=b===k?c.id:b;ra();c.url=Qa(Ha?a:f);e=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(null!==c.wmode&&(s.match(/msie 8/i)||!C&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))Ua.push(sa.spcWmode),c.wmode=null;h={name:b,id:b,src:e,quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:cb+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",
94wmode:c.wmode,hasPriority:"true"};c.debugFlash&&(h.FlashVars="debug\x3d1");c.wmode||delete h.wmode;if(C)a=n.createElement("div"),p=['\x3cobject id\x3d"'+b+'" data\x3d"'+e+'" type\x3d"'+h.type+'" title\x3d"'+h.title+'" classid\x3d"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase\x3d"'+cb+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\x3d6,0,40,0"\x3e',d("movie",e),d("AllowScriptAccess",c.allowScriptAccess),d("quality",h.quality),c.wmode?d("wmode",c.wmode):"",d("bgcolor",
95c.bgColor),d("hasPriority","true"),c.debugFlash?d("FlashVars",h.FlashVars):"","\x3c/object\x3e"].join("");else for(m in a=n.createElement("embed"),h)h.hasOwnProperty(m)&&a.setAttribute(m,h[m]);wa();g=I();if(h=va())if(c.oMC=W(c.movieID)||n.createElement("div"),c.oMC.id)q=c.oMC.className,c.oMC.className=(q?q+" ":"movieContainer")+(g?" "+g:""),c.oMC.appendChild(a),C&&(m=c.oMC.appendChild(n.createElement("div")),m.className="sm2-object-box",m.innerHTML=p),L=!0;else{c.oMC.id=c.movieID;c.oMC.className=
96"movieContainer "+g;m=g=null;c.useFlashBlock||(c.useHighPerformance?g={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(g={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},l&&(g.left=Math.abs(parseInt(g.left,10))+"px")));gb&&(c.oMC.style.zIndex=1E4);if(!c.debugFlash)for(q in g)g.hasOwnProperty(q)&&(c.oMC.style[q]=g[q]);try{C||c.oMC.appendChild(a),h.appendChild(c.oMC),C&&(m=c.oMC.appendChild(n.createElement("div")),m.className="sm2-object-box",
97m.innerHTML=p),L=!0}catch(r){throw Error(P("domError")+" \n"+r.toString());}}return K=!0};Z=function(){if(c.html5Only)return $(),!1;if(l||!c.url)return!1;l=c.getMovie(c.id);l||(O?(C?c.oMC.innerHTML=ya:c.oMC.appendChild(O),O=null,K=!0):$(c.id,c.url),l=c.getMovie(c.id));"function"===typeof c.oninitmovie&&setTimeout(c.oninitmovie,1);return!0};F=function(){setTimeout(Na,1E3)};qa=function(){g.setTimeout(function(){c.setup({preferFlash:!1}).reboot();c.didFlashBlock=!0;c.beginDelayedInit()},1)};Na=function(){var b,
98e=!1;if(!c.url||Q)return!1;Q=!0;t.remove(g,"load",F);if(v&&ja&&!Ga)return!1;p||(b=c.getMoviePercent(),0<b&&100>b&&(e=!0));setTimeout(function(){b=c.getMoviePercent();if(e)return Q=!1,g.setTimeout(F,1),!1;!p&&ab&&(null===b?c.useFlashBlock||0===c.flashLoadTimeout?c.useFlashBlock&&za():!c.useFlashBlock&&S?qa():D({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}}):0!==c.flashLoadTimeout&&(!c.useFlashBlock&&S?qa():xa(!0)))},c.flashLoadTimeout)};Y=function(){if(Ga||!ja)return t.remove(g,"focus",
99Y),!0;Ga=ab=!0;Q=!1;F();t.remove(g,"focus",Y);return!0};M=function(b){if(p)return!1;if(c.html5Only)return p=!0,E(),!0;var e=!0,d;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())p=!0;d={type:!v&&u?"NO_FLASH":"INIT_TIMEOUT"};
99if(y||b)c.useFlashBlock&&c.oMC&&(c.oMC.className=I()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error")),D({type:"ontimeout",error:d,ignoreInit:!0}),H(d),e=!1;y||(c.waitForWindowLoad&&!na?t.add(g,"load",E):E());return e};Ma=function(){var b,e=c.setupOptions;
100for(b in e)e.hasOwnProperty(b)&&(c[b]===k?c[b]=e[b]:c[b]!==e[b]&&(c.setupOptions[b]=c[b]))};ma=function(){if(p)return!1;if(c.html5Only)return p||(t.remove(g,"load",c.beginDelayedInit),c.enabled=!0,M()),!0;Z();try{l._externalInterfaceTest(!1),Oa(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||l._disableDebug(),c.enabled=!0,c.html5Only||t.add(g,"unload",la)}catch(b){return H({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),xa(!0),M(),!1}M();t.remove(g,"load",c.beginDelayedInit);return!0};
101G=function(){if(N)return!1;N=!0;Ma();wa();!v&&c.hasHTML5&&c.setup({useHTML5Audio:!0,preferFlash:!1});Wa();!v&&u&&(Ua.push(sa.needFlash),c.setup({flashLoadTimeout:1}));n.removeEventListener&&n.removeEventListener("DOMContentLoaded",G,!1);Z();return!0};Ba=function(){"complete"===n.readyState&&(G(),n.detachEvent("onreadystatechange",Ba));return!0};ua=function(){na=!0;t.remove(g,"load",ua)};ta=function(){if(Fa&&(c.setupOptions.useHTML5Audio=!0,c.setupOptions.preferFlash=!1,ha||Za&&!s.match(/android\s2\.3/i)))ha&&
102(c.ignoreFlash=!0),A=!0};ta();Da();t.add(g,"focus",Y);t.add(g,"load",F);t.add(g,"load",ua);n.addEventListener?n.addEventListener("DOMContentLoaded",G,!1):n.attachEvent?n.attachEvent("onreadystatechange",Ba):H({type:"NO_DOM2_EVENTS",fatal:!0})}var ka=null;if(void 0===g.SM2_DEFER||!SM2_DEFER)ka=new U;g.SoundManager=U;g.soundManager=ka})(window);
103/** @license
104	Animator.js 1.1.9
105	
106	This library is released under the BSD license:
107
108	Copyright (c) 2006, Bernard Sumption. All rights reserved.
109	
110	Redistribution and use in source and binary forms, with or without
111	modification, are permitted provided that the following conditions are met:
112	
113	Redistributions of source code must retain the above copyright notice, this
114	list of conditions and the following disclaimer. Redistributions in binary
115	form must reproduce the above copyright notice, this list of conditions and
116	the following disclaimer in the documentation and/or other materials
117	provided with the distribution. Neither the name BernieCode nor
118	the names of its contributors may be used to endorse or promote products
119	derived from this software without specific prior written permission. 
120	
121	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
122	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
123	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
124	ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
125	ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
126	DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
127	SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
128	CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
129	LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
130	OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
131	DAMAGE.
132
133*/
134
135// http://www.berniecode.com/writing/animator.html
136
137// Applies a sequence of numbers between 0 and 1 to a number of subjects
138// construct - see setOptions for parameters
139function Animator(options) {
140	this.setOptions(options);
141	var _this = this;
142	this.timerDelegate = function(){_this.onTimerEvent()};
143	this.subjects = [];
144	this.subjectScopes = [];
145	this.target = 0;
146	this.state = 0;
147	this.lastTime = null;
148};
149Animator.prototype = {
150	// apply defaults
151	setOptions: function(options) {
152		this.options = Animator.applyDefaults({
153			interval: 20,  // time between animation frames
154			duration: 400, // length of animation
155			onComplete: function(){},
156			onStep: function(){},
157			transition: Animator.tx.easeInOut
158		}, options);
159	},
160	// animate from the current state to provided value
161	seekTo: function(to) {
162		this.seekFromTo(this.state, to);
163	},
164	// animate from the current state to provided value
165	seekFromTo: function(from, to) {
166		this.target = Math.max(0, Math.min(1, to));
167		this.state = Math.max(0, Math.min(1, from));
168		this.lastTime = new Date().getTime();
169		if (!this.intervalId) {
170			this.intervalId = window.setInterval(this.timerDelegate, this.options.interval);
171		}
172	},
173	// animate from the current state to provided value
174	jumpTo: function(to) {
175		this.target = this.state = Math.max(0, Math.min(1, to));
176		this.propagate();
177	},
178	// seek to the opposite of the current target
179	toggle: function() {
180		this.seekTo(1 - this.target);
181	},
182	// add a function or an object with a method setState(state) that will be called with a number
183	// between 0 and 1 on each frame of the animation
184	addSubject: function(subject,scope) {
185		this.subjects[this.subjects.length] = subject;
186		this.subjectScopes[this.subjectScopes.length] = scope;
187		return this;
188	},
189	// remove all subjects
190	clearSubjects: function() {
191		this.subjects = [];
192		this.subjectScopes = [];
193	},
194	// forward the current state to the animation subjects
195	propagate: function() {
196		var value = this.options.transition(this.state);
197		for (var i=0; i<this.subjects.length; i++) {
198			if (this.subjects[i].setState) {
199				this.subjects[i].setState(value);
200			} else {
201				this.subjects[i].apply(this.subjectScopes[i],[value]);
202			}
203		}
204	},
205	// called once per frame to update the current state
206	onTimerEvent: function() {
207		var now = new Date().getTime();
208		var timePassed = now - this.lastTime;
209		this.lastTime = now;
210		var movement = (timePassed / this.options.duration) * (this.state < this.target ? 1 : -1);
211		if (Math.abs(movement) >= Math.abs(this.state - this.target)) {
212			this.state = this.target;
213		} else {
214			this.state += movement;
215		}
216		
217		try {
218			this.propagate();
219		} finally {
220			this.options.onStep.call(this);
221			if (this.target == this.state) {
222				window.clearInterval(this.intervalId);
223				this.intervalId = null;
224				this.options.onComplete.call(this);
225			}
226		}
227	},
228	// shortcuts
229	play: function() {this.seekFromTo(0, 1)},
230	reverse: function() {this.seekFromTo(1, 0)},
231	// return a string describing this Animator, for debugging
232	inspect: function() {
233		var str = "#<Animator:\n";
234		for (var i=0; i<this.subjects.length; i++) {
235			str += this.subjects[i].inspect();
236		}
237		str += ">";
238		return str;
239	}
240}
241// merge the properties of two objects
242Animator.applyDefaults = function(defaults, prefs) {
243	prefs = prefs || {};
244	var prop, result = {};
245	for (prop in defaults) result[prop] = prefs[prop] !== undefined ? prefs[prop] : defaults[prop];
246	return result;
247}
248// make an array from any object
249Animator.makeArray = function(o) {
250	if (o == null) return [];
251	if (!o.length) return [o];
252	var result = [];
253	for (var i=0; i<o.length; i++) result[i] = o[i];
254	return result;
255}
256// convert a dash-delimited-property to a camelCaseProperty (c/o Prototype, thanks Sam!)
257Animator.camelize = function(string) {
258	var oStringList = string.split('-');
259	if (oStringList.length == 1) return oStringList[0];
260	
261	var camelizedString = string.indexOf('-') == 0
262		? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
263		: oStringList[0];
264	
265	for (var i = 1, len = oStringList.length; i < len; i++) {
266		var s = oStringList[i];
267		camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
268	}
269	return camelizedString;
270}
271// syntactic sugar for creating CSSStyleSubjects
272Animator.apply = function(el, style, options) {
273	if (style instanceof Array) {
274		return new Animator(options).addSubject(new CSSStyleSubject(el, style[0], style[1]));
275	}
276	return new Animator(options).addSubject(new CSSStyleSubject(el, style));
277}
278// make a transition function that gradually accelerates. pass a=1 for smooth
279// gravitational acceleration, higher values for an exaggerated effect
280Animator.makeEaseIn = function(a) {
281	return function(state) {
282		return Math.pow(state, a*2); 
283	}
284}
285// as makeEaseIn but for deceleration
286Animator.makeEaseOut = function(a) {
287	return function(state) {
288		return 1 - Math.pow(1 - state, a*2); 
289	}
290}
291// make a transition function that, like an object with momentum being attracted to a point,
292// goes past the target then returns
293Animator.makeElastic = function(bounces) {
294	return function(state) {
295		state = Animator.tx.easeInOut(state);
296		return ((1-Math.cos(state * Math.PI * bounces)) * (1 - state)) + state; 
297	}
298}
299// make an Attack Decay Sustain Release envelope that starts and finishes on the same level
300// 
301Animator.makeADSR = function(attackEnd, decayEnd, sustainEnd, sustainLevel) {
302	if (sustainLevel == null) sustainLevel = 0.5;
303	return function(state) {
304		if (state < attackEnd) {
305			return state / attackEnd;
306		}
307		if (state < decayEnd) {
308			return 1 - ((state - attackEnd) / (decayEnd - attackEnd) * (1 - sustainLevel));
309		}
310		if (state < sustainEnd) {
311			return sustainLevel;
312		}
313		return sustainLevel * (1 - ((state - sustainEnd) / (1 - sustainEnd)));
314	}
315}
316// make a transition function that, like a ball falling to floor, reaches the target and/
317// bounces back again
318Animator.makeBounce = function(bounces) {
319	var fn = Animator.makeElastic(bounces);
320	return function(state) {
321		state = fn(state); 
322		return state <= 1 ? state : 2-state;
323	}
324}
325 
326// pre-made transition functions to use with the 'transition' option
327Animator.tx = {
328	easeInOut: function(pos){
329		return ((-Math.cos(pos*Math.PI)/2) + 0.5);
330	},
331	linear: function(x) {
332		return x;
333	},
334	easeIn: Animator.makeEaseIn(1.5),
335	easeOut: Animator.makeEaseOut(1.5),
336	strongEaseIn: Animator.makeEaseIn(2.5),
337	strongEaseOut: Animator.makeEaseOut(2.5),
338	elastic: Animator.makeElastic(1),
339	veryElastic: Animator.makeElastic(3),
340	bouncy: Animator.makeBounce(1),
341	veryBouncy: Animator.makeBounce(3)
342}
343
344// animates a pixel-based style property between two integer values
345function NumericalStyleSubject(els, property, from, to, units) {
346	this.els = Animator.makeArray(els);
347	if (property == 'opacity' && window.ActiveXObject) {
348		this.property = 'filter';
349	} else {
350		this.property = Animator.camelize(property);
351	}
352	this.from = parseFloat(from);
353	this.to = parseFloat(to);
354	this.units = units != null ? units : 'px';
355}
356NumericalStyleSubject.prototype = {
357	setState: function(state) {
358		var style = this.getStyle(state);
359		var visibility = (this.property == 'opacity' && state == 0) ? 'hidden' : '';
360		var j=0;
361		for (var i=0; i<this.els.length; i++) {
362			try {
363				this.els[i].style[this.property] = style;
364			} catch (e) {
365				// ignore fontWeight - intermediate numerical values cause exeptions in firefox
366				if (this.property != 'fontWeight') throw e;
367			}
368			if (j++ > 20) return;
369		}
370	},
371	getStyle: function(state) {
372		state = this.from + ((this.to - this.from) * state);
373		if (this.property == 'filter') return "alpha(opacity=" + Math.round(state*100) + ")";
374		if (this.property == 'opacity') return state;
375		return Math.round(state) + this.units;
376	},
377	inspect: function() {
378		return "\t" + this.property + "(" + this.from + this.units + " to " + this.to + this.units + ")\n";
379	}
380}
381
382// animates a colour based style property between two hex values
383function ColorStyleSubject(els, property, from, to) {
384	this.els = Animator.makeArray(els);
385	this.property = Animator.camelize(property);
386	this.to = this.expandColor(to);
387	this.from = this.expandColor(from);
388	this.origFrom = from;
389	this.origTo = to;
390}
391
392ColorStyleSubject.prototype = {
393	// parse "#FFFF00" to [256, 256, 0]
394	expandColor: function(color) {
395		var hexColor, red, green, blue;
396		hexColor = ColorStyleSubject.parseColor(color);
397		if (hexColor) {
398			red = parseInt(hexColor.slice(1, 3), 16);
399			green = parseInt(hexColor.slice(3, 5), 16);
400			blue = parseInt(hexColor.slice(5, 7), 16);
401			return [red,green,blue]
402		}
403		if (window.DEBUG) {
404			alert("Invalid colour: '" + color + "'");
405		}
406	},
407	getValueForState: function(color, state) {
408		return Math.round(this.from[color] + ((this.to[color] - this.from[color]) * state));
409	},
410	setState: function(state) {
411		var color = '#'
412				+ ColorStyleSubject.toColorPart(this.getValueForState(0, state))
413				+ ColorStyleSubject.toColorPart(this.getValueForState(1, state))
414				+ ColorStyleSubject.toColorPart(this.getValueForState(2, state));
415		for (var i=0; i<this.els.length; i++) {
416			this.els[i].style[this.property] = color;
417		}
418	},
419	inspect: function() {
420		return "\t" + this.property + "(" + this.origFrom + " to " + this.origTo + ")\n";
421	}
422}
423
424// return a properly formatted 6-digit hex colour spec, or false
425ColorStyleSubject.parseColor = function(string) {
426	var color = '#', match;
427	if(match = ColorStyleSubject.parseColor.rgbRe.exec(string)) {
428		var part;
429		for (var i=1; i<=3; i++) {
430			part = Math.max(0, Math.min(255, parseInt(match[i])));
431			color += ColorStyleSubject.toColorPart(part);
432		}
433		return color;
434	}
435	if (match = ColorStyleSubject.parseColor.hexRe.exec(string)) {
436		if(match[1].length == 3) {
437			for (var i=0; i<3; i++) {
438				color += match[1].charAt(i) + match[1].charAt(i);
439			}
440			return color;
441		}
442		return '#' + match[1];
443	}
444	return false;
445}
446// convert a number to a 2 digit hex string
447ColorStyleSubject.toColorPart = function(number) {
448	if (number > 255) number = 255;
449	var digits = number.toString(16);
450	if (number < 16) return '0' + digits;
451	return digits;
452}
453ColorStyleSubject.parseColor.rgbRe = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;
454ColorStyleSubject.parseColor.hexRe = /^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
455
456// Animates discrete styles, i.e. ones that do not scale but have discrete values
457// that can't be interpolated
458function DiscreteStyleSubject(els, property, from, to, threshold) {
459	this.els = Animator.makeArray(els);
460	this.property = Animator.camelize(property);
461	this.from = from;
462	this.to = to;
463	this.threshold = threshold || 0.5;
464}
465
466DiscreteStyleSubject.prototype = {
467	setState: function(state) {
468		var j=0;
469		for (var i=0; i<this.els.length; i++) {
470			this.els[i].style[this.property] = state <= this.threshold ? this.from : this.to; 
471		}
472	},
473	inspect: function() {
474		return "\t" + this.property + "(" + this.from + " to " + this.to + " @ " + this.threshold + ")\n";
475	}
476}
477
478// animates between two styles defined using CSS.
479// if style1 and style2 are present, animate between them, if only style1
480// is present, animate between the element's current style and style1
481function CSSStyleSubject(els, style1, style2) {
482	els = Animator.makeArray(els);
483	this.subjects = [];
484	if (els.length == 0) return;
485	var prop, toStyle, fromStyle;
486	if (style2) {
487		fromStyle = this.parseStyle(style1, els[0]);
488		toStyle = this.parseStyle(style2, els[0]);
489	} else {
490		toStyle = this.parseStyle(style1, els[0]);
491		fromStyle = {};
492		for (prop in toStyle) {
493			fromStyle[prop] = CSSStyleSubject.getStyle(els[0], prop);
494		}
495	}
496	// remove unchanging properties
497	var prop;
498	for (prop in fromStyle) {
499		if (fromStyle[prop] == toStyle[prop]) {
500			delete fromStyle[prop];
501			delete toStyle[prop];
502		}
503	}
504	// discover the type (numerical or colour) of each style
505	var prop, units, match, type, from, to;
506	for (prop in fromStyle) {
507		var fromProp = String(fromStyle[prop]);
508		var toProp = String(toStyle[prop]);
509		if (toStyle[prop] == null) {
510			if (window.DEBUG) alert("No to style provided for '" + prop + '"');
511			continue;
512		}
513		
514		if (from = ColorStyleSubject.parseColor(fromProp)) {
515			to = ColorStyleSubject.parseColor(toProp);
516			type = ColorStyleSubject;
517		} else if (fromProp.match(CSSStyleSubject.numericalRe)
518				&& toProp.match(CSSStyleSubject.numericalRe)) {
519			from = parseFloat(fromProp);
520			to = parseFloat(toProp);
521			type = NumericalStyleSubject;
522			match = CSSStyleSubject.numericalRe.exec(fromProp);
523			var reResult = CSSStyleSubject.numericalRe.exec(toProp);
524			if (match[1] != null) {
525				units = match[1];
526			} else if (reResult[1] != null) {
527				units = reResult[1];
528			} else {
529				units = reResult;
530			}
531		} else if (fromProp.match(CSSStyleSubject.discreteRe)
532				&& toProp.match(CSSStyleSubject.discreteRe)) {
533			from = fromProp;
534			to = toProp;
535			type = DiscreteStyleSubject;
536			units = 0;   // hack - how to get an animator option down to here
537		} else {
538			if (window.DEBUG) {
539				alert("Unrecognised format for value of "
540					+ prop + ": '" + fromStyle[prop] + "'");
541			}
542			continue;
543		}
544		this.subjects[this.subjects.length] = new type(els, prop, from, to, units);
545	}
546}
547
548CSSStyleSubject.prototype = {
549	// parses "width: 400px; color: #FFBB2E" to {width: "400px", color: "#FFBB2E"}
550	parseStyle: function(style, el) {
551		var rtn = {};
552		// if style is a rule set
553		if (style.indexOf(":") != -1) {
554			var styles = style.split(";");
555			for (var i=0; i<styles.length; i++) {
556				var parts = CSSStyleSubject.ruleRe.exec(styles[i]);
557				if (parts) {
558					rtn[parts[1]] = parts[2];
559				}
560			}
561		}
562		// else assume style is a class name
563		else {
564			var prop, value, oldClass;
565			oldClass = el.className;
566			el.className = style;
567			for (var i=0; i<CSSStyleSubject.cssProperties.length; i++) {
568				prop = CSSStyleSubject.cssProperties[i];
569				value = CSSStyleSubject.getStyle(el, prop);
570				if (value != null) {
571					rtn[prop] = value;
572				}
573			}
574			el.className = oldClass;
575		}
576		return rtn;
577		
578	},
579	setState: function(state) {
580		for (var i=0; i<this.subjects.length; i++) {
581			this.subjects[i].setState(state);
582		}
583	},
584	inspect: function() {
585		var str = "";
586		for (var i=0; i<this.subjects.length; i++) {
587			str += this.subjects[i].inspect();
588		}
589		return str;
590	}
591}
592// get the current value of a css property, 
593CSSStyleSubject.getStyle = function(el, property){
594	var style;
595	if(document.defaultView && document.defaultView.getComputedStyle){
596		style = document.defaultView.getComputedStyle(el, "").getPropertyValue(property);
597		if (style) {
598			return style;
599		}
600	}
601	property = Animator.camelize(property);
602	if(el.currentStyle){
603		style = el.currentStyle[property];
604	}
605	return style || el.style[property]
606}
607
608
609CSSStyleSubject.ruleRe = /^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;
610CSSStyleSubject.numericalRe = /^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;
611CSSStyleSubject.discreteRe = /^\w+$/;
612
613// required because the style object of elements isn't enumerable in Safari
614/*
615CSSStyleSubject.cssProperties = ['background-color','border','border-color','border-spacing',
616'border-style','border-top','border-right','border-bottom','border-left','border-top-color',
617'border-right-color','border-bottom-color','border-left-color','border-top-width','border-right-width',
618'border-bottom-width','border-left-width','border-width','bottom','color','font-size','font-size-adjust',
619'font-stretch','font-style','height','left','letter-spacing','line-height','margin','margin-top',
620'margin-right','margin-bottom','margin-left','marker-offset','max-height','max-width','min-height',
621'min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding',
622'padding-top','padding-right','padding-bottom','padding-left','quotes','right','size','text-indent',
623'top','width','word-spacing','z-index','opacity','outline-offset'];*/
624
625
626CSSStyleSubject.cssProperties = ['azimuth','background','background-attachment','background-color','background-image','background-position','background-repeat','border-collapse','border-color','border-spacing','border-style','border-top','border-top-color','border-right-color','border-bottom-color','border-left-color','border-top-style','border-right-style','border-bottom-style','border-left-style','border-top-width','border-right-width','border-bottom-width','border-left-width','border-width','bottom','clear','clip','color','content','cursor','direction','display','elevation','empty-cells','css-float','font','font-family','font-size','font-size-adjust','font-stretch','font-style','font-variant','font-weight','height','left','letter-spacing','line-height','list-style','list-style-image','list-style-position','list-style-type','margin','margin-top','margin-right','margin-bottom','margin-left','max-height','max-width','min-height','min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding','padding-top','padding-right','padding-bottom','padding-left','pause','position','right','size','table-layout','text-align','text-decoration','text-indent','text-shadow','text-transform','top','vertical-align','visibility','white-space','width','word-spacing','z-index','o
626pacity','outline-offset','overflow-x','overflow-y'];
627
628
629// chains several Animator objects together
630function AnimatorChain(animators, options) {
631	this.animators = animators;
632	this.setOptions(options);
633	for (var i=0; i<this.animators.length; i++) {
634		this.listenTo(this.animators[i]);
635	}
636	this.forwards = false;
637	this.current = 0;
638}
639
640AnimatorChain.prototype = {
641	// apply defaults
642	setOptions: function(options) {
643		this.options = Animator.applyDefaults({
644			// by default, each call to AnimatorChain.play() calls jumpTo(0) of each animator
645			// before playing, which can cause flickering if you have multiple animators all
646			// targeting the same element. Set this to false to avoid this.
647			resetOnPlay: true
648		}, options);
649	},
650	// play each animator in turn
651	play: function() {
652		this.forwards = true;
653		this.current = -1;
654		if (this.options.resetOnPlay) {
655			for (var i=0; i<this.animators.length; i++) {
656				this.animators[i].jumpTo(0);
657			}
658		}
659		this.advance();
660	},
661	// play all animators backwards
662	reverse: function() {
663		this.forwards = false;
664		this.current = this.animators.length;
665		if (this.options.resetOnPlay) {
666			for (var i=0; i<this.animators.length; i++) {
667				this.animators[i].jumpTo(1);
668			}
669		}
670		this.advance();
671	},
672	// if we have just play()'d, then call reverse(), and vice versa
673	toggle: function() {
674		if (this.forwards) {
675			this.seekTo(0);
676		} else {
677			this.seekTo(1);
678		}
679	},
680	// internal: install an event listener on an animator's onComplete option
681	// to trigger the next animator
682	listenTo: function(animator) {
683		var oldOnComplete = animator.options.onComplete;
684		var _this = this;
685		animator.options.onComplete = function() {
686			if (oldOnComplete) oldOnComplete.call(animator);
687			_this.advance();
688		}
689	},
690	// play the next animator
691	advance: function() {
692		if (this.forwards) {
693			if (this.animators[this.current + 1] == null) return;
694			this.current++;
695			this.animators[this.current].play();
696		} else {
697			if (this.animators[this.current - 1] == null) return;
698			this.current--;
699			this.animators[this.current].reverse();
700		}
701	},
702	// this function is provided for drop-in compatibility with Animator objects,
703	// but only accepts 0 and 1 as target values
704	seekTo: function(target) {
705		if (target <= 0) {
706			this.forwards = false;
707			this.animators[this.current].seekTo(0);
708		} else {
709			this.forwards = true;
710			this.animators[this.current].seekTo(1);
711		}
712	}
713}
714
715// an Accordion is a class that creates and controls a number of Animators. An array of elements is passed in,
716// and for each element an Animator and a activator button is created. When an Animator's activator button is
717// clicked, the Animator and all before it seek to 0, and all Animators after it seek to 1. This can be used to
718// create the classic Accordion effect, hence the name.
719// see setOptions for arguments
720function Accordion(options) {
721	this.setOptions(options);
722	var selected = this.options.initialSection, current;
723	if (this.options.rememberance) {
724		current = document.location.hash.substring(1);
725	}
726	this.rememberanceTexts = [];
727	this.ans = [];
728	var _this = this;
729	for (var i=0; i<this.options.sections.length; i++) {
730		var el = this.options.sections[i];
731		var an = new Animator(this.options.animatorOptions);
732		var from = this.options.from + (this.options.shift * i);
733		var to = this.options.to + (this.options.shift * i);
734		an.addSubject(new NumericalStyleSubject(el, this.options.property, from, to, this.options.units));
735		an.jumpTo(0);
736		var activator = this.options.getActivator(el);
737		activator.index = i;
738		activator.onclick = function(){_this.show(this.index)};
739		this.ans[this.ans.length] = an;
740		this.rememberanceTexts[i] = activator.innerHTML.replace(/\s/g, "");
741		if (this.rememberanceTexts[i] === current) {
742			selected = i;
743		}
744	}
745	this.show(selected);
746}
747
748Accordion.prototype = {
749	// apply defaults
750	setOptions: function(options) {
751		this.options = Object.extend({
752			// REQUIRED: an array of elements to use as the accordion sections
753			sections: null,
754			// a function that locates an activator button element given a section element.
755			// by default it takes a button id from the section's "activator" attibute
756			getActivator: function(el) {return document.getElementById(el.getAttribute("activator"))},
757			// shifts each animator's range, for example with options {from:0,to:100,shift:20}
758			// the animators' ranges will be 0-100, 20-120, 40-140 etc.
759			shift: 0,
760			// the first page to show
761			initialSection: 0,
762			// if set to true, document.location.hash will be used to preserve the open section across page reloads 
763			rememberance: true,
764			// constructor arguments to the Animator objects
765			animatorOptions: {}
766		}, options || {});
767	},
768	show: function(section) {
769		for (var i=0; i<this.ans.length; i++) {
770			this.ans[i].seekTo(i > section ? 1 : 0);
771		}
772		if (this.options.rememberance) {
773			document.location.hash = this.rememberanceTexts[section];
774		}
775	}
776}
777
778/**
779 *
780 * SoundManager 2 Demo: 360-degree / "donut player"
781 * ------------------------------------------------
782 * http://schillmania.com/projects/soundmanager2/
783 *
784 * An inline player with a circular UI.
785 * Based on the original SM2 inline player.
786 * Inspired by Apple's preview feature in the
787 * iTunes music store (iPhone), among others.
788 *
789 * Requires SoundManager 2 Javascript API.
790 * Also uses Bernie's Better Animation Class (BSD):
791 * http://www.berniecode.com/writing/animator.html
792 *
793*/
794
795/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: false, newcap: true, immed: true */
796/*global document, window, soundManager, navigator */
797
798var threeSixtyPlayer, // instance
799    ThreeSixtyPlayer; // constructor
800
801(function(window) {
802
803function ThreeSixtyPlayer() {
804
805  var self = this,
806      pl = this,
807      sm = soundManager, // soundManager instance
808      uA = navigator.userAgent,
809      isIE = (uA.match(/msie/i)),
810      isOpera = (uA.match(/opera/i)),
811      isSafari = (uA.match(/safari/i)),
812      isChrome = (uA.match(/chrome/i)),
813      isFirefox = (uA.match(/firefox/i)),
814      isTouchDevice = (uA.match(/ipad|iphone/i)),
815      hasRealCanvas = (typeof window.G_vmlCanvasManager === 'undefined' && typeof document.createElement('canvas').getContext('2d') !== 'undefined'),
816      // I dunno what Opera doesn't like about this. I'm probably doing it wrong.
817      fullCircle = (isOpera?359.9:360);
818
819  // CSS class for ignoring MP3 links
820  this.excludeClass = 'threesixty-exclude';
821  this.links = [];
822  this.sounds = [];
823  this.soundsByURL = [];
824  this.indexByURL = [];
825  this.lastSound = null;
826  this.lastTouchedSound = null;
827  this.soundCount = 0;
828  this.oUITemplate = null;
829  this.oUIImageMap = null;
830  this.vuMeter = null;
831  this.callbackCount = 0;
832  this.peakDataHistory = [];
833  this.firstBuffering = true;
834  this.firstPlayTime = null;
835  this.bufferDelay = 0;
836
837  // 360player configuration options
838  this.config = {
839
840    playNext: false,   // stop after one sound, or play through list until end
841    autoPlay: false,   // start playing the first sound right away
842    allowMultiple: false,  // let many sounds play at once (false = only one sound playing at a time)
843    loadRingColor: '#d5d5d5', // how much has loaded
844    playRingColor: '#d5d5d5', // how much has played
845    backgroundRingColor: '#d5d5d5', // color shown underneath load + play ("not yet loaded" color)
846
847    // optional segment/annotation (metadata) stuff..
848    segmentRingColor: '#d5d5d5', // metadata/annotation (segment) colors
849    segmentRingColorAlt: '#d5d5d5',
850    loadRingColorMetadata: '#d5d5d5', // "annotations" load color
851    playRingColorMetadata: '#d5d5d5', // how much has played when metadata is present
852
853    circleDiameter: 256, // set dynamically according to values from CSS
854    circleRadius: 128,
855    animDuration: 500,
856    animTransition: window.Animator.tx.bouncy, // http://www.berniecode.com/writing/animator.html
857    showHMSTime: false, // hours:minutes:seconds vs. seconds-only
858    scaleFont: true,  // also set the font size (if possible) while animating the circle
859
860    // optional: spectrum or EQ graph in canvas (not supported in IE <9, too slow via ExCanvas)
861    useWaveformData: false,
862    waveformDataColor: '#d5d5d5',
863    waveformDataDownsample: 3, // use only one in X (of a set of 256 values) - 1 means all 256
864    waveformDataOutside: false,
865    waveformDataConstrain: false, // if true, +ve values only - keep within inside circle
866    waveformDataLineRatio: 1.44,
867
868    // "spectrum frequency" option
869    useEQData: true,
870    eqDataColor: '#d5d5d5',
871    eqDataDownsample: 1, // use only one in X (of 256 values)
872    eqDataOutside: true,
873    eqDataLineRatio: 1,
874
875    // enable "amplifier" (canvas pulses like a speaker) effect
876    usePeakData: true,
877    peakDataColor: '#d5d5d5',
878    peakDataOutside: true,
879    peakDataLineRatio: 0.5,
880
881    useAmplifier: true, // "pulse" like a speaker
882
883    fontSizeMax: null, // set according to CSS
884
885    scaleArcWidth: 1.6,  // thickness factor of playback progress ring
886
887    useFavIcon: false // Experimental (also requires usePeakData: true).. Try to draw a "VU Meter" in the favicon area, if browser supports it (Firefox + Opera as of 2009)
888
889  };
890
891  this.css = {
892
893    // CSS class names appended to link during various states
894    sDefault: 'sm2_link', // default state
895    sBuffering: 'sm2_buffering',
896    sPlaying: 'sm2_playing',
897    sPaused: 'sm2_paused'
898
899  };
900
901  this.addEventHandler = (typeof window.addEventListener !== 'undefined' ? function(o, evtName, evtHandler) {
902    return o.addEventListener(evtName,evtHandler,false);
903  } : function(o, evtName, evtHandler) {
904    o.attachEvent('on'+evtName,evtHandler);
905  });
906
907  this.removeEventHandler = (typeof window.removeEventListener !== 'undefined' ? function(o, evtName, evtHandler) {
908    return o.removeEventListener(evtName,evtHandler,false);
909  } : function(o, evtName, evtHandler) {
910    return o.detachEvent('on'+evtName,evtHandler);
911  });
912
913  this.hasClass = function(o,cStr) {
914    return typeof(o.className)!=='undefined'?o.className.match(new RegExp('(\\s|^)'+cStr+'(\\s|$)')):false;
915  };
916
917  this.addClass = function(o,cStr) {
918
919    if (!o || !cStr || self.hasClass(o,cStr)) {
920      return false;
921    }
922    o.className = (o.className?o.className+' ':'')+cStr;
923
924  };
925
926  this.removeClass = function(o,cStr) {
927
928    if (!o || !cStr || !self.hasClass(o,cStr)) {
929      return false;
930    }
931    o.className = o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),'');
932
933  };
934
935  this.getElementsByClassName = function(className,tagNames,oParent) {
936
937    var doc = (oParent||document),
938        matches = [], i,j, nodes = [];
939    if (typeof tagNames !== 'undefined' && typeof tagNames !== 'string') {
940      for (i=tagNames.length; i--;) {
941        if (!nodes || !nodes[tagNames[i]]) {
942          nodes[tagNames[i]] = doc.getElementsByTagName(tagNames[i]);
943        }
944      }
945    } else if (tagNames) {
946      nodes = doc.getElementsByTagName(tagNames);
947    } else {
948      nodes = doc.all||doc.getElementsByTagName('*');
949    }
950    if (typeof(tagNames)!=='string') {
951      for (i=tagNames.length; i--;) {
952        for (j=nodes[tagNames[i]].length; j--;) {
953          if (self.hasClass(nodes[tagNames[i]][j],className)) {
954            matches.push(nodes[tagNames[i]][j]);
955          }
956        }
957      }
958    } else {
959      for (i=0; i<nodes.length; i++) {
960        if (self.hasClass(nodes[i],className)) {
961          matches.push(nodes[i]);
962        }
963      }
964    }
965    return matches;
966
967  };
968
969  this.getParentByNodeName = function(oChild,sParentNodeName) {
970
971    if (!oChild || !sParentNodeName) {
972      return false;
973    }
974    sParentNodeName = sParentNodeName.toLowerCase();
975    while (oChild.parentNode && sParentNodeName !== oChild.parentNode.nodeName.toLowerCase()) {
976      oChild = oChild.parentNode;
977    }
978    return (oChild.parentNode && sParentNodeName === oChild.parentNode.nodeName.toLowerCase()?oChild.parentNode:null);
979
980  };
981
982  this.getParentByClassName = function(oChild,sParentClassName) {
983
984    if (!oChild || !sParentClassName) {
985      return false;
986    }
987    while (oChild.parentNode && !self.hasClass(oChild.parentNode,sParentClassName)) {
988      oChild = oChild.parentNode;
989    }
990    return (oChild.parentNode && self.hasClass(oChild.parentNode,sParentClassName)?oChild.parentNode:null);
991
992  };
993
994  this.getSoundByURL = function(sURL) {
995    return (typeof self.soundsByURL[sURL] !== 'undefined'?self.soundsByURL[sURL]:null);
996  };
997
998  this.isChildOfNode = function(o,sNodeName) {
999
1000    if (!o || !o.parentNode) {
1001      return false;
1002    }
1003    sNodeName = sNodeName.toLowerCase();
1004    do {
1005      o = o.parentNode;
1006    } while (o && o.parentNode && o.nodeName.toLowerCase() !== sNodeName);
1007    return (o && o.nodeName.toLowerCase() === sNodeName?o:null);
1008
1009  };
1010
1011  this.isChildOfClass = function(oChild,oClass) {
1012
1013    if (!oChild || !oClass) {
1014      return false;
1015    }
1016    while (oChild.parentNode && !self.hasClass(oChild,oClass)) {
1017      oChild = self.findParent(oChild);
1018    }
1019    return (self.hasClass(oChild,oClass));
1020
1021  };
1022
1023  this.findParent = function(o) {
1024
1025    if (!o || !o.parentNode) {
1026      return false;
1027    }
1028    o = o.parentNode;
1029    if (o.nodeType === 2) {
1030      while (o && o.parentNode && o.parentNode.nodeType === 2) {
1031        o = o.parentNode;
1032      }
1033    }
1034    return o;
1035
1036  };
1037
1038  this.getStyle = function(o,sProp) {
1039
1040    // http://www.quirksmode.org/dom/getstyles.html
1041    try {
1042      if (o.currentStyle) {
1043        return o.currentStyle[sProp];
1044      } else if (window.getComputedStyle) {
1045        return document.defaultView.getComputedStyle(o,null).getPropertyValue(sProp);
1046      }
1047    } catch(e) {
1048      // oh well
1049    }
1050    return null;
1051
1052  };
1053
1054  this.findXY = function(obj) {
1055
1056    var curleft = 0, curtop = 0;
1057    do {
1058      curleft += obj.offsetLeft;
1059      curtop += obj.offsetTop;
1060    } while (!!(obj = obj.offsetParent));
1061    return [curleft,curtop];
1062
1063  };
1064
1065  this.getMouseXY = function(e) {
1066
1067    // http://www.quirksmode.org/js/events_properties.html
1068    e = e?e:window.event;
1069    if (isTouchDevice && e.touches) {
1070      e = e.touches[0];
1071    }
1072    if (e.pageX || e.pageY) {
1073      return [e.pageX,e.pageY];
1074    } else if (e.clientX || e.clientY) {
1075      return [e.clientX+self.getScrollLeft(),e.clientY+self.getScrollTop()];
1076    }
1077
1078  };
1079
1080  this.getScrollLeft = function() {
1081    return (document.body.scrollLeft+document.documentElement.scrollLeft);
1082  };
1083
1084  this.getScrollTop = function() {
1085    return (document.body.scrollTop+document.documentElement.scrollTop);
1086  };
1087
1088  this.events = {
1089
1090    // handlers for sound events as they're started/stopped/played
1091
1092    play: function() {
1093      if (self.firstBuffering) {
1094        self.firstPlayTime = +new Date();
1095      }
1096      pl.removeClass(this._360data.oUIBox,this._360data.className);
1097      this._360data.className = pl.css.sPlaying;
1098      pl.addClass(this._360data.oUIBox,this._360data.className);
1099      self.fanOut(this);
1100    },
1101
1102    stop: function() {
1103      pl.removeClass(this._360data.oUIBox,this._360data.className);
1104      this._360data.className = '';
1105      self.fanIn(this);
1106    },
1107
1108    pause: function() {
1109      pl.removeClass(this._360data.oUIBox,this._360data.className);
1110      this._360data.className = pl.css.sPaused;
1111      pl.addClass(this._360data.oUIBox,this._360data.className);
1112    },
1113
1114    resume: function() {
1115      pl.removeClass(this._360data.oUIBox,this._360data.className);
1116      this._360data.className = pl.css.sPlaying;
1117      pl.addClass(this._360data.oUIBox,this._360data.className);      
1118    },
1119
1120    finish: function() {
1121      var nextLink;
1122      pl.removeClass(this._360data.oUIBox,this._360data.className);
1123      this._360data.className = '';
1124      // self.clearCanvas(this._360data.oCanvas);
1125      this._360data.didFinish = true; // so fan draws full circle
1126      self.fanIn(this);
1127      if (pl.config.playNext) {
1128        nextLink = (pl.indexByURL[this._360data.oLink.href]+1);
1129        if (nextLink<pl.links.length) {
1130          pl.handleClick({'target':pl.links[nextLink]});
1131        }
1132      }
1133    },
1134
1135    whileloading: function() {
1136      if (this.paused) {
1137        self.updatePlaying.apply(this);
1138      }
1139    },
1140
1141    whileplaying: function() {
1142      self.updatePlaying.apply(this);
1143      this._360data.fps++;
1144    },
1145
1146    bufferchange: function() {
1147      if (this.isBuffering) {
1148        pl.addClass(this._360data.oUIBox,pl.css.sBuffering);
1149      } else {
1150        self.events.donebuffering();
1151        pl.removeClass(this._360data.oUIBox,pl.css.sBuffering);
1152      }
1153    },
1154
1155    donebuffering: function() {
1156      if (self.firstBuffering) {
1157        self.events.donefirstbuffering();
1158        self.firstBuffering = false;
1159      }
1160    },
1161
1162    donefirstbuffering: function() {
1163      self.bufferDelay = (+new Date() - self.firstPlayTime);
1164    }
1165  };
1166
1167  this.stopEvent = function(e) {
1168
1169   if (typeof e !== 'undefined' && typeof e.preventDefault !== 'undefined') {
1170      e.preventDefault();
1171    } else if (typeof window.event !== 'undefined' && typeof window.event.returnValue !== 'undefined') {
1172      window.event.returnValue = false;
1173    }
1174    return false;
1175
1176  };
1177
1178  this.getTheDamnLink = (isIE)?function(e) {
1179    // I really didn't want to have to do this.
1180    return (e && e.target?e.target:window.event.srcElement);
1181  }:function(e) {
1182    return e.target;
1183  };
1184
1185  this.handleClick = function(e) {
1186
1187    // a sound link was clicked
1188    if (e.button > 1) {
1189      // only catch left-clicks
1190      return true;
1191    }
1192
1193    var o = self.getTheDamnLink(e),
1194        sURL, soundURL, thisSound, oContainer, has_vis, diameter;
1195
1196    if (o.nodeName.toLowerCase() !== 'a') {
1197      o = self.isChildOfNode(o,'a');
1198      if (!o) {
1199        return true;
1200      }
1201    }
1202
1203    if (!self.isChildOfClass(o,'ui360')) {
1204      // not a link we're interested in
1205      return true;
1206    }
1207
1208    sURL = o.getAttribute('href');
1209
1210    if (!o.href || !sm.canPlayLink(o) || self.hasClass(o,self.excludeClass)) {
1211      return true; // pass-thru for non-MP3/non-links
1212    }
1213
1214    sm._writeDebug('handleClick()');
1215    soundURL = (o.href);
1216    thisSound = self.getSoundByURL(soundURL);
1217
1218    if (thisSound) {
1219
1220      // already exists
1221      if (thisSound === self.lastSound) {
1222        // and was playing (or paused)
1223        thisSound.togglePause();
1224      } else {
1225        // different sound
1226        thisSound.togglePause(); // start playing current
1227        sm._writeDebug('sound different than last sound: '+self.lastSound.id);
1228        if (!self.config.allowMultiple && self.lastSound) {
1229          self.stopSound(self.lastSound);
1230        }
1231      }
1232
1233    } else {
1234
1235      // append some dom shiz, make noise
1236
1237      oContainer = o.parentNode;
1238      has_vis = (self.getElementsByClassName('ui360-vis','div',oContainer.parentNode).length);
1239
1240      // create sound
1241      thisSound = sm.createSound({
1242       id:'ui360Sound'+(self.soundCount++),
1243       url:soundURL,
1244       onplay:self.events.play,
1245       onstop:self.events.stop,
1246       onpause:self.events.pause,
1247       onresume:self.events.resume,
1248       onfinish:self.events.finish,
1249       onbufferchange:self.events.bufferchange,
1250       whileloading:self.events.whileloading,
1251       whileplaying:self.events.whileplaying,
1252       useWaveformData:(has_vis && self.config.useWaveformData),
1253       useEQData:(has_vis && self.config.useEQData),
1254       usePeakData:(has_vis && self.config.usePeakData)
1255      });
1256
1257      // tack on some custom data
1258
1259      diameter = parseInt(self.getElementsByClassName('sm2-360ui','div',oContainer)[0].offsetWidth, 10);
1260
1261      thisSound._360data = {
1262        oUI360: self.getParentByClassName(o,'ui360'), // the (whole) entire container
1263        oLink: o, // DOM node for reference within SM2 object event handlers
1264        className: self.css.sPlaying,
1265        oUIBox: self.getElementsByClassName('sm2-360ui','div',oContainer)[0],
1266        oCanvas: self.getElementsByClassName('sm2-canvas','canvas',oContainer)[0],
1267        oButton: self.getElementsByClassName('sm2-360btn','span',oContainer)[0],
1268        oTiming: self.getElementsByClassName('sm2-timing','div',oContainer)[0],
1269        oCover: self.getElementsByClassName('sm2-cover','div',oContainer)[0],
1270        circleDiameter: diameter,
1271        circleRadius: diameter/2,
1272        lastTime: null,
1273        didFinish: null,
1274        pauseCount:0,
1275        radius:0,
1276        fontSize: 1,
1277        fontSizeMax: self.config.fontSizeMax,
1278        scaleFont: (has_vis && self.config.scaleFont),
1279        showHMSTime: has_vis,
1280        amplifier: (has_vis && self.config.usePeakData?0.9:1), // TODO: x1 if not being used, else use dynamic "how much to amplify by" value
1281        radiusMax: diameter*0.175, // circle radius
1282        width:0,
1283        widthMax: diameter*0.4, // width of the outer ring
1284        lastValues: {
1285          bytesLoaded: 0,
1286          bytesTotal: 0,
1287          position: 0,
1288          durationEstimate: 0
1289        }, // used to track "last good known" values before sound finish/reset for anim
1290        animating: false,
1291        oAnim: new window.Animator({
1292          duration: self.config.animDuration,
1293          transition:self.config.animTransition,
1294          onComplete: function() {
1295            // var thisSound = this;
1296            // thisSound._360data.didFinish = false; // reset full circle
1297          }
1298        }),
1299        oAnimProgress: function(nProgress) {
1300          var thisSound = this;
1301          thisSound._360data.radius = parseInt(thisSound._360data.radiusMax*thisSound._360data.amplifier*nProgress, 10);
1302          thisSound._360data.width = parseInt(thisSound._360data.widthMax*thisSound._360data.amplifier*nProgress, 10);
1303          if (thisSound._360data.scaleFont && thisSound._360data.fontSizeMax !== null) {
1304            thisSound._360data.oTiming.style.fontSize = parseInt(Math.max(1,thisSound._360data.fontSizeMax*nProgress), 10)+'px';
1305            thisSound._360data.oTiming.style.opacity = nProgress;
1306          }
1307          if (thisSound.paused || thisSound.playState === 0 || thisSound._360data.lastValues.bytesLoaded === 0 || thisSound._360data.lastValues.position === 0) {
1308            self.updatePlaying.apply(thisSound);
1309          }
1310        },
1311        fps: 0
1312      };
1313
1314      // "Metadata" (annotations)
1315      if (typeof self.Metadata !== 'undefined' && self.getElementsByClassName('metadata','div',thisSound._360data.oUI360).length) {
1316        thisSound._360data.metadata = new self.Metadata(thisSound,self);
1317      }
1318
1319      // minimize ze font
1320      if (thisSound._360data.scaleFont && thisSound._360data.fontSizeMax !== null) {
1321        thisSound._360data.oTiming.style.fontSize = '1px';
1322      }
1323
1324      // set up ze animation
1325      thisSound._360data.oAnim.addSubject(thisSound._360data.oAnimProgress,thisSound);
1326
1327      // animate the radius out nice
1328      self.refreshCoords(thisSound);
1329
1330      self.updatePlaying.apply(thisSound);
1331
1332      self.soundsByURL[soundURL] = thisSound;
1333      self.sounds.push(thisSound);
1334      if (!self.config.allowMultiple && self.lastSound) {
1335        self.stopSound(self.lastSound);
1336      }
1337      thisSound.play();
1338
1339    }
1340
1341    self.lastSound = thisSound; // reference for next call
1342
1343    if (typeof e !== 'undefined' && typeof e.preventDefault !== 'undefined') {
1344      e.preventDefault();
1345    } else if (typeof window.event !== 'undefined') {
1346      window.event.returnValue = false;
1347    }
1348    return false;
1349
1350  };
1351
1352  this.fanOut = function(oSound) {
1353
1354     var thisSound = oSound;
1355     if (thisSound._360data.animating === 1) {
1356       return false;
1357     }
1358     thisSound._360data.animating = 0;
1359     soundManager._writeDebug('fanOut: '+thisSound.id+': '+thisSound._360data.oLink.href);
1360     thisSound._360data.oAnim.seekTo(1); // play to end
1361     window.setTimeout(function() {
1362       // oncomplete hack
1363       thisSound._360data.animating = 0;
1364     },self.config.animDuration+20);
1365
1366  };
1367
1368  this.fanIn = function(oSound) {
1369
1370     var thisSound = oSound;
1371     if (thisSound._360data.animating === -1) {
1372       return false;
1373     }
1374     thisSound._360data.animating = -1;
1375     soundManager._writeDebug('fanIn: '+thisSound.id+': '+thisSound._360data.oLink.href);
1376     // massive hack
1377     thisSound._360data.oAnim.seekTo(0); // play to end
1378     window.setTimeout(function() {
1379       // reset full 360 fill after animation has completed (oncomplete hack)
1380       thisSound._360data.didFinish = false;
1381       thisSound._360data.animating = 0;
1382       self.resetLastValues(thisSound);
1383     }, self.config.animDuration+20);
1384
1385  };
1386
1387  this.resetLastValues = function(oSound) {
1388    oSound._360data.lastValues.position = 0;
1389  };
1390
1391  this.refreshCoords = function(thisSound) {
1392
1393    thisSound._360data.canvasXY = self.findXY(thisSound._360data.oCanvas);
1394    thisSound._360data.canvasMid = [thisSound._360data.circleRadius,thisSound._360data.circleRadius];
1395    thisSound._360data.canvasMidXY = [thisSound._360data.canvasXY[0]+thisSound._360data.canvasMid[0], thisSound._360data.canvasXY[1]+thisSound._360data.canvasMid[1]];
1396
1397  };
1398
1399  this.stopSound = function(oSound) {
1400
1401    soundManager._writeDebug('stopSound: '+oSound.id);
1402    soundManager.stop(oSound.id);
1403    if (!isTouchDevice) { // iOS 4.2+ security blocks onfinish() -> playNext() if we set a .src in-between(?)
1404      soundManager.unload(oSound.id);
1405    }
1406
1407  };
1408
1409  this.buttonClick = function(e) {
1410
1411    var o = e?(e.target?e.target:e.srcElement):window.event.srcElement;
1412    self.handleClick({target:self.getParentByClassName(o,'sm2-360ui').nextSibling}); // link next to the nodes we inserted
1413    return false;
1414
1415  };
1416
1417  this.drawSolidArc = function(oCanvas, color, radius, width, radians, startAngle, noClear) {
1418
1419    // thank you, http://www.snipersystems.co.nz/community/polarclock/tutorial.html
1420
1421    var x = radius,
1422        y = radius,
1423        canvas = oCanvas,
1424        ctx, innerRadius, doesntLikeZero, endPoint;
1425
1426    if (canvas.getContext){
1427      // use getContext to use the canvas for drawing
1428      ctx = canvas.getContext('2d');
1429    }
1430
1431    // re-assign canvas as the actual context
1432    oCanvas = ctx;
1433
1434    if (!noClear) {
1435      self.clearCanvas(canvas);
1436    }
1437    // ctx.restore();
1438
1439    if (color) {
1440      ctx.fillStyle = color;
1441    }
1442
1443    oCanvas.beginPath();
1444
1445    if (isNaN(radians)) {
1446      radians = 0;
1447    }
1448
1449    innerRadius = radius-width;
1450    doesntLikeZero = (isOpera || isSafari); // safari 4 doesn't actually seem to mind.
1451
1452    if (!doesntLikeZero || (doesntLikeZero && radius > 0)) {
1453      oCanvas.arc(0, 0, radius, startAngle, radians, false);
1454      endPoint = self.getArcEndpointCoords(innerRadius, radians);
1455      oCanvas.lineTo(endPoint.x, endPoint.y);
1456      oCanvas.arc(0, 0, innerRadius, radians, startAngle, true);
1457      oCanvas.closePath();
1458      oCanvas.fill();
1459    }
1460
1461  };
1462
1463  this.getArcEndpointCoords = function(radius, radians) {
1464
1465    return {
1466      x: radius * Math.cos(radians), 
1467      y: radius * Math.sin(radians)
1468    };
1469
1470  };
1471
1472  this.deg2rad = function(nDeg) {
1473    return (nDeg * Math.PI/180);
1474  };
1475
1476  this.rad2deg = function(nRad) {
1477    return (nRad * 180/Math.PI);
1478  };
1479
1480  this.getTime = function(nMSec,bAsString) {
1481
1482    // convert milliseconds to mm:ss, return as object literal or string
1483    var nSec = Math.floor(nMSec/1000),
1484        min = Math.floor(nSec/60),
1485        sec = nSec-(min*60);
1486    // if (min === 0 && sec === 0) return null; // return 0:00 as null
1487    return (bAsString?(min+':'+(sec<10?'0'+sec:sec)):{'min':min,'sec':sec});
1488
1489  };
1490
1491  this.clearCanvas = function(oCanvas) {
1492
1493    var canvas = oCanvas,
1494        ctx = null,
1495        width, height;
1496    if (canvas.getContext){
1497      // use getContext to use the canvas for drawing
1498      ctx = canvas.getContext('2d');
1499    }
1500    width = canvas.offsetWidth;
1501    height = canvas.offsetHeight;
1502    ctx.clearRect(-(width/2), -(height/2), width, height);
1503
1504  };
1505
1506  this.updatePlaying = function() {
1507
1508    var timeNow = (this._360data.showHMSTime?self.getTime(this.position,true):parseInt(this.position/1000, 10));
1509    var ringScaleFactor = self.config.scaleArcWidth;
1510
1511    if (this.bytesLoaded) {
1512      this._360data.lastValues.bytesLoaded = this.bytesLoaded;
1513      this._360data.lastValues.bytesTotal = this.bytesTotal;
1514    }
1515
1516    if (this.position) {
1517      this._360data.lastValues.position = this.position;
1518    }
1519
1520    if (this.durationEstimate) {
1521      this._360data.lastValues.durationEstimate = this.durationEstimate;
1522    }
1523
1524    // background ring
1525    self.drawSolidArc(this._360data.oCanvas,self.config.backgroundRingColor,this._360data.width,this._360data.radius * ringScaleFactor,self.deg2rad(fullCircle),false);
1526
1527    /*
1528    // loaded ring
1529    self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.loadRingColorMetadata:self.config.loadRingColor),this._360data.width,this._360data.radius * ringScaleFactor,self.deg2rad(fullCircle*(this._360data.lastValues.bytesLoaded/this._360data.lastValues.bytesTotal)),0,true);
1530
1531    // don't draw if 0 (full black circle in Opera)
1532    if (this._360data.lastValues.position !== 0) {
1533      self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.playRingColorMetadata:self.config.playRingColor),this._360data.width,this._360data.radius * ringScaleFactor,self.deg2rad((this._360data.didFinish===1?fullCircle:fullCircle*(this._360data.lastValues.position/this._360data.lastValues.durationEstimate))),0,true);
1534    }*/
1535
1536    // metadata goes here
1537    if (this._360data.metadata) {
1538      this._360data.metadata.events.whileplaying();
1539    }
1540
1541    if (timeNow !== this._360data.lastTime) {
1542      this._360data.lastTime = timeNow;
1543      this._360data.oTiming.innerHTML = timeNow;
1544    }
1545
1546    // draw spectrum, if applicable
1547    if ((this.instanceOptions.useWaveformData || this.instanceOptions.useEQData) && hasRealCanvas) { // IE <9 can render maybe 3 or 4 FPS when including the wave/EQ, so don't bother.
1548      self.updateWaveform(this);
1549    }
1550
1551    if (self.config.useFavIcon && self.vuMeter) {
1552      self.vuMeter.updateVU(this);
1553    }
1554
1555  };
1556
1557  this.updateWaveform = function(oSound) {
1558
1559    if ((!self.config.useWaveformData && !self.config.useEQData) || (!sm.features.waveformData && !sm.features.eqData)) {
1560      // feature not enabled..
1561      return false;
1562    }
1563
1564    if (!oSound.waveformData.left.length && !oSound.eqData.length && !oSound.peakData.left) {
1565      // no data (or errored out/paused/unavailable?)
1566      return false;
1567    }
1568
1569    /* use for testing the data */
1570    /*
1571     for (i=0; i<256; i++) {
1572       oSound.eqData[i] = 1-(i/256);
1573     }
1574    */
1575
1576    var oCanvas = oSound._360data.oCanvas.getContext('2d'),
1577        offX = 0,
1578        offY = parseInt(oSound._360data.circleDiameter/2, 10),
1579        scale = offY/2, // Y axis (+/- this distance from 0)
1580        // lineWidth = Math.floor(oSound._360data.circleDiameter-(oSound._360data.circleDiameter*0.175)/(oSound._360data.circleDiameter/255)); // width for each line
1581        lineWidth = 1,
1582        lineHeight = 1,
1583        thisY = 0,
1584        offset = offY,
1585        i, j, direction, downSample, dataLength, sampleCount, startAngle, endAngle, waveData, innerRadius, perItemAngle, yDiff, eqSamples, playedAngle, iAvg, nPeak;
1586
1587    if (self.config.useWaveformData) {
1588      // raw waveform
1589      downSample = self.config.waveformDataDownsample; // only sample X in 256 (greater number = less sample points)
1590      downSample = Math.max(1,downSample); // make sure it's at least 1
1591      dataLength = 256;
1592      sampleCount = (dataLength/downSample);
1593      startAngle = 0;
1594      endAngle = 0;
1595      waveData = null;
1596      innerRadius = (self.config.waveformDataOutside?1:(self.config.waveformDataConstrain?0.5:0.565));
1597      scale = (self.config.waveformDataOutside?0.7:0.75);
1598      perItemAngle = self.deg2rad((360/sampleCount)*self.config.waveformDataLineRatio); // 0.85 = clean pixel lines at 150? // self.deg2rad(360*(Math.max(1,downSample-1))/sampleCount);
1599      for (i=0; i<dataLength; i+=downSample) {
1600        startAngle = self.deg2rad(360*(i/(sampleCount)*1/downSample)); // +0.67 - counter for spacing
1601        endAngle = startAngle+perItemAngle;
1602        waveData = oSound.waveformData.left[i];
1603        if (waveData<0 && self.config.waveformDataConstrain) {
1604          waveData = Math.abs(waveData);
1605        }
1606        self.drawSolidArc(oSound._360data.oCanvas,self.config.waveformDataColor,oSound._360data.width*innerRadius*(2-self.config.scaleArcWidth),oSound._360data.radius*scale*1.25*waveData,endAngle,startAngle,true);
1607      }
1608    }
1609
1610    if (self.config.useEQData) {
1611      // EQ spectrum
1612      downSample = self.config.eqDataDownsample; // only sample N in 256
1613      yDiff = 0;
1614      downSample = Math.max(1,downSample); // make sure it's at least 1
1615      eqSamples = 192; // drop the last 25% of the spectrum (>16500 Hz), most stuff won't actually use it.
1616      sampleCount = (eqSamples/downSample);
1617      innerRadius = (self.config.eqDataOutside?1:0.565);
1618      direction = (self.config.eqDataOutside?-1:1);
1619      scale = (self.config.eqDataOutside?0.5:0.75);
1620      startAngle = 0;
1621      endAngle = 0;
1622      perItemAngle = self.deg2rad((360/sampleCount)*self.config.eqDataLineRatio); // self.deg2rad(360/(sampleCount+1));
1623      playedAngle = self.deg2rad((oSound._360data.didFinish===1?360:360*(oSound._360data.lastValues.position/oSound._360data.lastValues.durationEstimate)));
1624      j=0;
1625      iAvg = 0;
1626      for (i=0; i<eqSamples; i+=downSample) {
1627        startAngle = self.deg2rad(360*(i/eqSamples));
1628        endAngle = startAngle+perItemAngle;
1629        self.drawSolidArc(oSound._360data.oCanvas,self.config.playRingColor,oSound._360data.width*innerRadius,oSound._360data.radius*scale*(oSound.eqData.left[i]*direction),endAngle,startAngle,true);
1630      }
1631    }
1632
1633    if (self.config.usePeakData) {
1634      if (!oSound._360data.animating) {
1635        nPeak = (oSound.peakData.left||oSound.peakData.right);
1636        // GIANT HACK: use EQ spectrum data for bass frequencies
1637        eqSamples = 3;
1638        for (i=0; i<eqSamples; i++) {
1639          nPeak = (nPeak||oSound.eqData[i]);
1640        }
1641        oSound._360data.amplifier = (self.config.useAmplifier?(0.9+(nPeak*0.1)):1);
1642        oSound._360data.radiusMax = oSound._360data.circleDiameter*0.175*oSound._360data.amplifier;
1643        oSound._360data.widthMax = oSound._360data.circleDiameter*0.4*oSound._360data.amplifier;
1644        oSound._360data.radius = parseInt(oSound._360data.radiusMax*oSound._360data.amplifier, 10);
1645        oSound._360data.width = parseInt(oSound._360data.widthMax*oSound._360data.amplifier, 10);
1646      }
1647    }
1648
1649  };
1650
1651  this.getUIHTML = function(diameter) {
1652
1653    return [
1654     '<canvas class="sm2-canvas" width="'+diameter+'" height="'+diameter+'"></canvas>',
1655     ' <span class="sm2-360btn sm2-360btn-default"></span>', // note use of imageMap, edit or remove if you use a different-size image.
1656     ' <div class="sm2-timing'+(navigator.userAgent.match(/safari/i)?' alignTweak':'')+'"></div>', // + Ever-so-slight Safari horizontal alignment tweak
1657     ' <div class="sm2-cover"></div>'
1658    ];
1659
1660  };
1661
1662  this.uiTest = function(sClass) {
1663
1664    // fake a 360 UI so we can get some numbers from CSS, etc.
1665
1666    var oTemplate = document.createElement('div'),
1667        oFakeUI, oFakeUIBox, oTemp, fakeDiameter, uiHTML, circleDiameter, circleRadius, fontSizeMax, oTiming;
1668
1669    oTemplate.className = 'sm2-360ui';
1670
1671    oFakeUI = document.createElement('div');
1672    oFakeUI.className = 'ui360'+(sClass?' '+sClass:''); // ui360 ui360-vis
1673
1674    oFakeUIBox = oFakeUI.appendChild(oTemplate.cloneNode(true));
1675
1676    oFakeUI.style.position = 'absolute';
1677    oFakeUI.style.left = '-9999px';
1678
1679    oTemp = document.body.appendChild(oFakeUI);
1680
1681    fakeDiameter = oFakeUIBox.offsetWidth;
1682
1683    uiHTML = self.getUIHTML(fakeDiameter);
1684
1685    oFakeUIBox.innerHTML = uiHTML[1]+uiHTML[2]+uiHTML[3];
1686
1687    circleDiameter = parseInt(oFakeUIBox.offsetWidth, 10);
1688    circleRadius = parseInt(circleDiameter/2, 10);
1689
1690    oTiming = self.getElementsByClassName('sm2-timing','div',oTemp)[0];
1691    fontSizeMax = parseInt(self.getStyle(oTiming,'font-size'), 10);
1692    if (isNaN(fontSizeMax)) {
1693      // getStyle() etc. didn't work.
1694      fontSizeMax = null;
1695    }
1696
1697    // soundManager._writeDebug('diameter, font size: '+circleDiameter+','+fontSizeMax);
1698
1699    oFakeUI.parentNode.removeChild(oFakeUI);
1700
1701    uiHTML = oFakeUI = oFakeUIBox = oTemp = null;
1702
1703    return {
1704      circleDiameter: circleDiameter,
1705      circleRadius: circleRadius,
1706      fontSizeMax: fontSizeMax
1707    };
1708
1709  };
1710
1711  this.init = function() {
1712
1713    sm._writeDebug('threeSixtyPlayer.init()');
1714
1715    var oItems = self.getElementsByClassName('ui360','div'),
1716        i, j, oLinks = [], is_vis = false, foundItems = 0, oCanvas, oCanvasCTX, oCover, diameter, radius, uiData, uiDataVis, oUI, oBtn, o, o2, oID;
1717
1718    for (i=0,j=oItems.length; i<j; i++) {
1719      oLinks.push(oItems[i].getElementsByTagName('a')[0]);
1720      // remove "fake" play button (unsupported case)
1721      oItems[i].style.backgroundImage = 'none';
1722    }
1723    // grab all links, look for .mp3
1724
1725    self.oUITemplate = document.createElement('div');
1726    self.oUITemplate.className = 'sm2-360ui';
1727
1728    self.oUITemplateVis = document.createElement('div');
1729    self.oUITemplateVis.className = 'sm2-360ui';
1730
1731    uiData = self.uiTest();
1732
1733    self.config.circleDiameter = uiData.circleDiameter;
1734    self.config.circleRadius = uiData.circleRadius;
1735    // self.config.fontSizeMax = uiData.fontSizeMax;
1736
1737    uiDataVis = self.uiTest('ui360-vis');
1738
1739    self.config.fontSizeMax = uiDataVis.fontSizeMax;
1740
1741    // canvas needs inline width and height, doesn't quite work otherwise
1742    self.oUITemplate.innerHTML = self.getUIHTML(self.config.circleDiameter).join('');
1743
1744    self.oUITemplateVis.innerHTML = self.getUIHTML(uiDataVis.circleDiameter).join('');
1745
1746    for (i=0,j=oLinks.length; i<j; i++) {
1747      if (sm.canPlayLink(oLinks[i]) && !self.hasClass(oLinks[i],self.excludeClass) && !self.hasClass(oLinks[i],self.css.sDefault)) {
1748        self.addClass(oLinks[i],self.css.sDefault); // add default CSS decoration
1749        self.links[foundItems] = (oLinks[i]);
1750        self.indexByURL[oLinks[i].href] = foundItems; // hack for indexing
1751        foundItems++;
1752
1753        is_vis = self.hasClass(oLinks[i].parentNode, 'ui360-vis');
1754
1755        diameter = (is_vis ? uiDataVis : uiData).circleDiameter;
1756        radius = (is_vis ? uiDataVis : uiData).circleRadius;
1757
1758        // add canvas shiz
1759        oUI = oLinks[i].parentNode.insertBefore((is_vis?self.oUITemplateVis:self.oUITemplate).cloneNode(true),oLinks[i]);
1760
1761        if (isIE && typeof window.G_vmlCanvasManager !== 'undefined') { // IE only
1762          o = oLinks[i].parentNode;
1763          o2 = document.createElement('canvas');
1764          o2.className = 'sm2-canvas';
1765          oID = 'sm2_canvas_'+parseInt(Math.random()*1048576, 10);
1766          o2.id = oID;
1767          o2.width = diameter;
1768          o2.height = diameter;
1769          oUI.appendChild(o2);
1770          window.G_vmlCanvasManager.initElement(o2); // Apply ExCanvas compatibility magic
1771          oCanvas = document.getElementById(oID);
1772        } else { 
1773          // add a handler for the button
1774          oCanvas = oLinks[i].parentNode.getElementsByTagName('canvas')[0];
1775        }
1776        oCover = self.getElementsByClassName('sm2-cover','div',oLinks[i].parentNode)[0];
1777        oBtn = oLinks[i].parentNode.getElementsByTagName('span')[0];
1778        self.addEventHandler(oBtn,'click',self.buttonClick);
1779        oCanvasCTX = oCanvas.getContext('2d');
1780        oCanvasCTX.translate(radius, radius);
1781        oCanvasCTX.rotate(self.deg2rad(-90)); // compensate for arc starting at EAST // http://stackoverflow.com/questions/319267/tutorial-for-html-canvass-arc-function
1782      }
1783    }
1784    if (foundItems>0) {
1785      self.addEventHandler(document,'click',self.handleClick);
1786      if (self.config.autoPlay) {
1787        self.handleClick({target:self.links[0],preventDefault:function(){}});
1788      }
1789    }
1790    sm._writeDebug('threeSixtyPlayer.init(): Found '+foundItems+' relevant items.');
1791
1792    if (self.config.useFavIcon && typeof this.VUMeter !== 'undefined') {
1793      this.vuMeter = new this.VUMeter(this);
1794    }
1795
1796  };
1797
1798}
1799
1800// Optional: VU Meter component
1801
1802ThreeSixtyPlayer.prototype.VUMeter = function(oParent) {
1803
1804  var self = oParent,
1805      me = this,
1806      _head = document.getElementsByTagName('head')[0],
1807      isOpera = (navigator.userAgent.match(/opera/i)),
1808      isFirefox = (navigator.userAgent.match(/firefox/i));
1809
1810  this.vuMeterData = [];
1811  this.vuDataCanvas = null;
1812
1813  this.setPageIcon = function(sDataURL) {
1814
1815    if (!self.config.useFavIcon || !self.config.usePeakData || !sDataURL) {
1816      return false;
1817    }
1818
1819    var link = document.getElementById('sm2-favicon');
1820    if (link) {
1821      _head.removeChild(link);
1822      link = null;
1823    }
1824    if (!link) {
1825      link = document.createElement('link');
1826      link.id = 'sm2-favicon';
1827      link.rel = 'shortcut icon';
1828      link.type = 'image/png';
1829      link.href = sDataURL;
1830      document.getElementsByTagName('head')[0].appendChild(link);
1831    }
1832
1833  };
1834
1835  this.resetPageIcon = function() {
1836
1837    if (!self.config.useFavIcon) {
1838      return false;
1839    }
1840    var link = document.getElementById('favicon');
1841    if (link) {
1842      link.href = '/favicon.ico';
1843    }
1844
1845  };
1846
1847  this.updateVU = function(oSound) {
1848
1849    if (soundManager.flashVersion >= 9 && self.config.useFavIcon && self.config.usePeakData) {
1850      me.setPageIcon(me.vuMeterData[parseInt(16*oSound.peakData.left, 10)][parseInt(16*oSound.peakData.right, 10)]);
1851    }
1852
1853  };
1854
1855  this.createVUData = function() {
1856
1857    var i=0, j=0,
1858        canvas = me.vuDataCanvas.getContext('2d'),
1859        vuGrad = canvas.createLinearGradient(0, 16, 0, 0),
1860        bgGrad = canvas.createLinearGradient(0, 16, 0, 0),
1861        outline = 'rgba(0,0,0,0.2)';
1862
1863    vuGrad.addColorStop(0,'rgb(0,192,0)');
1864    vuGrad.addColorStop(0.30,'rgb(0,255,0)');
1865    vuGrad.addColorStop(0.625,'rgb(255,255,0)');
1866    vuGrad.addColorStop(0.85,'rgb(255,0,0)');
1867    bgGrad.addColorStop(0,outline);
1868    bgGrad.addColorStop(1,'rgba(0,0,0,0.5)');
1869    for (i=0; i<16; i++) {
1870      me.vuMeterData[i] = [];
1871    }
1872    for (i=0; i<16; i++) {
1873      for (j=0; j<16; j++) {
1874        // reset/erase canvas
1875        me.vuDataCanvas.setAttribute('width',16);
1876        me.vuDataCanvas.setAttribute('height',16);
1877        // draw new stuffs
1878        canvas.fillStyle = bgGrad;
1879        canvas.fillRect(0,0,7,15);
1880        canvas.fillRect(8,0,7,15);
1881        /*
1882        // shadow
1883        canvas.fillStyle = 'rgba(0,0,0,0.1)';
1884        canvas.fillRect(1,15-i,7,17-(17-i));
1885        canvas.fillRect(9,15-j,7,17-(17-j));
1886        */
1887        canvas.fillStyle = vuGrad;
1888        canvas.fillRect(0,15-i,7,16-(16-i));
1889        canvas.fillRect(8,15-j,7,16-(16-j));
1890        // and now, clear out some bits.
1891        canvas.clearRect(0,3,16,1);
1892        canvas.clearRect(0,7,16,1);
1893        canvas.clearRect(0,11,16,1);
1894        me.vuMeterData[i][j] = me.vuDataCanvas.toDataURL('image/png');
1895        // for debugging VU images
1896        /*
1897        var o = document.createElement('img');
1898        o.style.marginRight = '5px'; 
1899        o.src = vuMeterData[i][j];
1900        document.documentElement.appendChild(o);
1901        */
1902      }
1903    }
1904
1905  };
1906
1907  this.testCanvas = function() {
1908
1909    // canvas + toDataURL();
1910    var c = document.createElement('canvas'),
1911        ctx = null, ok;
1912    if (!c || typeof c.getContext === 'undefined') {
1913      return null;
1914    }
1915    ctx = c.getContext('2d');
1916    if (!ctx || typeof c.toDataURL !== 'function') {
1917      return null;
1918    }
1919    // just in case..
1920    try {
1921      ok = c.toDataURL('image/png');
1922    } catch(e) {
1923      // no canvas or no toDataURL()
1924      return null;
1925    }
1926    // assume we're all good.
1927    return c;
1928
1929  };
1930
1931  this.init = function() {
1932
1933    if (self.config.useFavIcon) {
1934      me.vuDataCanvas = me.testCanvas();
1935      if (me.vuDataCanvas && (isFirefox || isOpera)) {
1936        // these browsers support dynamically-updating the favicon
1937        me.createVUData();
1938      } else {
1939        // browser doesn't support doing this
1940        self.config.useFavIcon = false;
1941      }
1942    }
1943
1944  };
1945
1946  this.init();
1947
1948};
1949
1950// completely optional: Metadata/annotations/segments code
1951
1952ThreeSixtyPlayer.prototype.Metadata = function(oSound, oParent) {
1953
1954  soundManager._wD('Metadata()');
1955
1956  var me = this,
1957      oBox = oSound._360data.oUI360,
1958      o = oBox.getElementsByTagName('ul')[0],
1959      oItems = o.getElementsByTagName('li'),
1960      isFirefox = (navigator.userAgent.match(/firefox/i)),
1961      isAlt = false, i, oDuration;
1962
1963  this.lastWPExec = 0;
1964  this.refreshInterval = 250;
1965  this.totalTime = 0;
1966
1967  this.events = {
1968
1969    whileplaying: function() {
1970
1971      var width = oSound._360data.width,
1972          radius = oSound._360data.radius,
1973          fullDuration = (oSound.durationEstimate||(me.totalTime*1000)),
1974          isAlt = null, i, j, d;
1975
1976      for (i=0,j=me.data.length; i<j; i++) {
1977        isAlt = (i%2===0);
1978        oParent.drawSolidArc(oSound._360data.oCanvas,(isAlt?oParent.config.segmentRingColorAlt:oParent.config.segmentRingColor),isAlt?width:width, isAlt?radius/2:radius/2, oParent.deg2rad(360*(me.data[i].endTimeMS/fullDuration)), oParent.deg2rad(360*((me.data[i].startTimeMS||1)/fullDuration)), true);
1979      }
1980      d = new Date();
1981      if (d-me.lastWPExec>me.refreshInterval) {
1982        me.refresh();
1983        me.lastWPExec = d;
1984      }
1985
1986    }
1987
1988  };
1989
1990  this.refresh = function() {
1991
1992    // Display info as appropriate
1993    var i, j, index = null,
1994        now = oSound.position,
1995        metadata = oSound._360data.metadata.data;
1996
1997    for (i=0, j=metadata.length; i<j; i++) {
1998      if (now >= metadata[i].startTimeMS && now <= metadata[i].endTimeMS) {
1999        index = i;
2000        break;
2001      }
2002    }
2003    if (index !== metadata.currentItem && index < metadata.length) {
2004      // update
2005      oSound._360data.oLink.innerHTML = metadata.mainTitle+' <span class="metadata"><span class="sm2_divider"> | </span><span class="sm2_metadata">'+metadata[index].title+'</span></span>';
2006      // self.setPageTitle(metadata[index].title+' | '+metadata.mainTitle);
2007      metadata.currentItem = index;
2008    }
2009
2010  };
2011
2012  this.strToTime = function(sTime) {
2013    var segments = sTime.split(':'),
2014        seconds = 0, i;
2015    for (i=segments.length; i--;) {
2016      seconds += parseInt(segments[i], 10)*Math.pow(60,segments.length-1-i); // hours, minutes
2017    }
2018    return seconds;
2019  };
2020
2021  this.data = [];
2022  this.data.givenDuration = null;
2023  this.data.currentItem = null;
2024  this.data.mainTitle = oSound._360data.oLink.innerHTML;
2025
2026  for (i=0; i<oItems.length; i++) {
2027    this.data[i] = {
2028      o: null,
2029      title: oItems[i].getElementsByTagName('p')[0].innerHTML,
2030      startTime: oItems[i].getElementsByTagName('span')[0].innerHTML,
2031      startSeconds: me.strToTime(oItems[i].getElementsByTagName('span')[0].innerHTML.replace(/[()]/g,'')),
2032      duration: 0,
2033      durationMS: null,
2034      startTimeMS: null,
2035      endTimeMS: null,
2036      oNote: null
2037    };
2038  }
2039  oDuration = oParent.getElementsByClassName('duration','div',oBox);
2040  this.data.givenDuration = (oDuration.length?me.strToTime(oDuration[0].innerHTML)*1000:0);
2041  for (i=0; i<this.data.length; i++) {
2042    this.data[i].duration = parseInt(this.data[i+1]?this.data[i+1].startSeconds:(me.data.givenDuration?me.data.givenDuration:oSound.durationEstimate)/1000, 10)-this.data[i].startSeconds;
2043    this.data[i].startTimeMS = this.data[i].startSeconds*1000;
2044    this.data[i].durationMS = this.data[i].duration*1000;
2045    this.data[i].endTimeMS = this.data[i].startTimeMS+this.data[i].durationMS;
2046    this.totalTime += this.data[i].duration;
2047  }
2048
2049};
2050
2051if (navigator.userAgent.match(/webkit/i) && navigator.userAgent.match(/mobile/i)) {
2052  // iPad, iPhone etc.
2053  soundManager.setup({
2054    useHTML5Audio: true
2055  });
2056}
2057
2058soundManager.setup({
2059  html5PollingInterval: 50, // increased framerate for whileplaying() etc.
2060  debugMode: true, // disable or enable debug output
2061  consoleOnly: true,
2062  flashVersion: 9,
2063  useHighPerformance: true,
2064  useFlashBlock: true
2065});
2066
2067// FPS data, testing/debug only
2068if (soundManager.debugMode) {
2069  window.setInterval(function() {
2070    var p = window.threeSixtyPlayer;
2071    if (p && p.lastSound && p.lastSound._360data.fps && typeof window.isHome === 'undefined') {
2072      soundManager._writeDebug('fps: ~'+p.lastSound._360data.fps);
2073      p.lastSound._360data.fps = 0;
2074    }
2075  },1000);
2076}
2077
2078window.ThreeSixtyPlayer = ThreeSixtyPlayer; // constructor
2079
2080}(window));
2081
2082threeSixtyPlayer = new ThreeSixtyPlayer();
2083
2084// hook into SM2 init
2085soundManager.onready(threeSixtyPlayer.init);
2086
2087var Recorder={swfObject:null,_callbacks:{},_events:{},_initialized:false,options:{},initialize:function(options){this.options=options||{};if(!this.options.flashContainer){this._setupFlashContainer()}this.bind("initialized",function(){Recorder._initialized=true;options.initialized()});this.bind("showFlash",this.options.onFlashSecurity||this._defaultOnShowFlash);this._loadFlash()},clear:function(){Recorder._events={}},record:function(options){options=options||{};this.clearBindings("recordingStart");this.clearBindings("recordingProgress");this.clearBindings("recordingCancel");this.bind("recordingStart",this._defaultOnHideFlash);this.bind("recordingCancel",this._defaultOnHideFlash);this.bind("recordingCancel",this._loadFlash);this.bind("recordingStart",options["start"]);this.bind("recordingProgress",options["progress"]);this.bind("recordingCancel",options["cancel"]);this.flashInterface().record()},stop:function(){return this.flashInterface()._stop()},play:function(options){options=options||{};this.clearBindings("playingProgress");this.bind("playingProgress",options["progress"]);this.bind("playingStop",options["finished"]);this.flashInterface()._play()},upload:function(options){options.audioParam=options.audioParam||"audio";options.params=options.params||{};this.clearBindings("uploadSuccess");this.bind("uploadSuccess",function(responseText){options.success(Recorder._externalInterfaceDecode(responseText))});this.flashInterface().upload(options.url,options.audioParam,options.params)},audioData:function(){return this.flashInterface().audioData().split(";")},request:function(method,uri,contentType,data,callback){var callbackName=this.registerCallback(callback);this.flashInterface().request(method,uri,contentType,data,callbackName)},clearBindings:function(eventName){Recorder._events[eventName]=[]},bind:function(eventName,fn){if(!Recorder._events[eventName]){Recorder._events[eventName]=[]}Recorder._events[eventName].push(fn)},triggerEvent:function(eventName,arg0,arg1){Recorder._executeInWindowContext(function(){for(var cb in Recorder._events[eventName]){if(Recorder._events[eventName][cb]){Recorder._events[eventName][cb].apply(Recorder,[arg0,arg1])}}})},triggerCallback:function(name,args){Recorder._executeInWindowContext(function(){Recorder._callbacks[name].apply(null,args)})},registerCallback:function(fn){var name="CB"+parseInt(Math.random()*999999,10);Recorder._callbacks[name]=fn;return name},flashInterface:function(){if(!this.swfObject){return null}else if(this.swfObject.record){return this.swfObject}else if(this.swfObject.children[3].record){return this.swfObject.children[3]}},_executeInWindowContext:function(fn){window.setTimeout(fn,1)},_setupFlashContainer:function(){this.options.flashContainer=document.createElement("div");this.options.flashContainer.setAttribute("id","recorderFlashContainer");this.options.flashContainer.setAttribute("style","position: fixed; left: -9999px; top: -9999px; width: 230px; height: 140px; margin-left: 10px; border-top: 6px solid rgba(128, 128, 128, 0.6); border-bottom: 6px solid rgba(128, 128, 128, 0.6); border-radius: 5px 5px; padding-bottom: 1px; padding-right: 1px;");document.body.appendChild(this.options.flashContainer)},_clearFlash:function(){var flashElement=this.options.flashContainer.children[0];if(flashElement){this.options.flashContainer.removeChild(flashElement)}},_loadFlash:function(){this._clearFlash();var flashElement=document.createElement("div");flashElement.setAttribute("id","recorderFlashObject");this.options.flashContainer.appendChild(flashElement);swfobject.embedSWF(this.options.swfSrc,"recorderFlashObject","231","141","10.1.0",undefined,undefined,{allowscriptaccess:"always"},undefined,function(e){if(e.success){Recorder.swfObject=e.ref;Recorder._checkForFlashBlock()}else{Recorder._showFlashRequiredDialog()}})},_defaultOnShowFlash:function(){var flashContainer=Recorder.options.flashContainer;flashContainer.style.left=(window.innerWidth||document.body.offsetWidth)/2-115+"px";flashContainer.style.top=(window.innerHeight||document.body.offsetHeight)/2-70+"px"},_defaultOnHideFlash:function(){var flashContainer=Recorder.options.flashContainer;flashContainer.style.left="-9999px";flashContainer.style.top="-9999px"},_checkForFlashBlock:function(){window.setTimeout(function(){if(!Recorder._initialized){Recorder.triggerEvent("showFlash")}},500)},_showFlashRequiredDialog:function(){Recorder.options.flashContainer.innerHTML="<p>
2087Adobe Flash Player 10.1 or newer is required to use this feature.</p><p><a href='http://get.adobe.com/flashplayer' target='_top'>Get it on Adobe.com.</a></p>";Recorder.options.flashContainer.style.color="white";Recorder.options.flashContainer.style.backgroundColor="#777";Recorder.options.flashContainer.style.textAlign="center";Recorder.triggerEvent("showFlash")},_externalInterfaceDecode:function(data){return data.replace(/%22/g,'"').replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%")}};if(swfobject==undefined){var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"�1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if(typeof j.readyState!=D&&j.readyState=="complete"||typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body)){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){!function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()}()}}if(M.wk){!function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()}()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;!function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()}()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||!/%$/.test(aa.width)&&parseInt(aa.width,10)<310){aa.width="310"}if(typeof aa.height==D||!/%$/.test(aa.height)&&parseInt(aa.height,10)<137){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+encodeURI(O.location).toString().replace(/&/g,"%26")+"&MMplayerType="+
2087ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";!function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}}()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";!function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}}()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";!function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}}()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return Y[0]>X[0]||Y[0]==X[0]&&Y[1]>X[1]||Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=ad&&typeof ad=="string"?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring(Y[X].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}()}var __hasProp=Object.prototype.hasOwnProperty;window.SC=window.SC||{};window.SC.URI=function(uri,options){var AUTHORITY_REGEXP,URI_REGEXP;if(uri==null){uri=""}if(options==null){options={}}URI_REGEXP=/^(?:([^:\/?\#]+):)?(?:\/\/([^\/?\#]*))?([^?\#]*)(?:\?([^\#]*))?(?:\#(.*))?/;AUTHORITY_REGEXP=/^(?:([^@]*)@)?([^:]*)(?::(\d*))?/;this.scheme=this.user=this.password=this.host=this.port=this.path=this.query=this.fragment=null;this.toString=function(){var str;str="";
2087if(this.isAbsolute()){str+=this.scheme;str+="://";if(this.user!=null){str+=this.user+":"+this.password+"@"}str+=this.host;if(this.port!=null){str+=":"+this.port}}str+=this.path;if(this.path===""&&(this.query!=null||this.fragment!=null)){str+="/"}if(this.query!=null){str+=this.encodeParamsWithPrepend(this.query,"?")}if(this.fragment!=null){str+=this.encodeParamsWithPrepend(this.fragment,"#")}return str};this.isRelative=function(){return!this.isAbsolute()};this.isAbsolute=function(){return this.host!=null};this.decodeParams=function(string){var key,params,part,splitted,value,_i,_len,_ref;if(string==null){string=""}params={};_ref=string.split("&");for(_i=0,_len=_ref.length;_i<_len;_i++){part=_ref[_i];if(part!==""){splitted=part.split("=");key=decodeURIComponent(splitted[0]);value=decodeURIComponent(splitted[1]||"").replace(/\+/g," ");this.normalizeParams(params,key,value)}}return params};this.normalizeParams=function(params,name,v){var after,child_key,k,lastP,result,result_i;if(v==null){v=NULL}result=name.match(/^[\[\]]*([^\[\]]+)\]*(.*)/);k=result[1]||"";after=result[2]||"";if(after===""){params[k]=v}else if(after==="[]"){params[k]||(params[k]=[]);params[k].push(v)}else if(result_i=after.match(/^\[\]\[([^\[\]]+)\]$/)||(result_i=after.match(/^\[\](.+)$/))){child_key=result_i[1];params[k]||(params[k]=[]);lastP=params[k][params[k].length-1];if(lastP!=null&&lastP.constructor===Object&&!(lastP[child_key]!=null)){this.normalizeParams(lastP,child_key,v)}else{params[k].push(this.normalizeParams({},child_key,v))}}else{params[k]||(params[k]={});params[k]=this.normalizeParams(params[k],after,v)}return params};this.encodeParamsWithPrepend=function(params,prepend){var encoded;encoded=this.encodeParams(params);if(encoded!==""){return prepend+encoded}else{return""}};this.encodeParams=function(params){var flattened,key,keyValueStrings,kv,paramString,value,_i,_len;paramString="";if(params.constructor===String){return paramString=params}else{flattened=this.flattenParams(params);keyValueStrings=[];for(_i=0,_len=flattened.length;_i<_len;_i++){kv=flattened[_i];key=kv[0];value=kv[1];if(value===null){keyValueStrings.push(key)}else{keyValueStrings.push(key+"="+encodeURIComponent(value))}}return paramString=keyValueStrings.join("&")}};this.flattenParams=function(params,prefix,paramsArray){var key,prefixedKey,value,_i,_len;if(prefix==null){prefix=""}if(paramsArray==null){paramsArray=[]}if(!(params!=null)){if(prefix!=null){paramsArray.push([prefix,null])}}else if(params.constructor===Object){for(key in params){if(!__hasProp.call(params,key))continue;value=params[key];if(prefix!==""){prefixedKey=prefix+"["+key+"]"}else{prefixedKey=key}this.flattenParams(value,prefixedKey,paramsArray)}}else if(params.constructor===Array){for(_i=0,_len=params.length;_i<_len;_i++){value=params[_i];this.flattenParams(value,prefix+"[]",paramsArray)}}else if(prefix!==""){paramsArray.push([prefix,params])}return paramsArray};this.parse=function(uri,options){var authority,authority_result,nullIfBlank,result,userinfo;if(uri==null){uri=""}if(options==null){options={}}nullIfBlank=function(str){if(str===""){return null}else{return str}};result=uri.match(URI_REGEXP);this.scheme=nullIfBlank(result[1]);authority=result[2];if(authority!=null){authority_result=authority.match(AUTHORITY_REGEXP);userinfo=nullIfBlank(authority_result[1]);if(userinfo!=null){this.user=userinfo.split(":")[0];this.password=userinfo.split(":")[1]}this.host=nullIfBlank(authority_result[2]);this.port=parseInt(authority_result[3],10)||null}this.path=result[3];this.query=nullIfBlank(result[4]);if(options.decodeQuery){this.query=this.decodeParams(this.query)}this.fragment=nullIfBlank(result[5]);if(options.decodeFragment){return this.fragment=this.decodeParams(this.fragment)}};this.parse(uri.toString(),options);return this};!function(){var AbstractDialog,ConnectDialog,EchoDialog,PickerDialog,_ref,_ref1,_ref2,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};window.SC||(window.SC={});SC.Helper={merge:function(a,b){var k,newObj,v,_i,_len;if(a.constructor===Array){newObj=Array.apply(null,a);for(_i=0,_len=b.length;_i<_len;_i++){v=b[_i];newObj.push(v)}return newObj}else{newObj={};
2087for(k in a){if(!__hasProp.call(a,k))continue;v=a[k];newObj[k]=v}for(k in b){if(!__hasProp.call(b,k))continue;v=b[k];newObj[k]=v}return newObj}},groupBy:function(collection,attribute){var group,object,value,_i,_len,_name;group={};for(_i=0,_len=collection.length;_i<_len;_i++){object=collection[_i];if(value=object[attribute]){group[_name=object[attribute]]||(group[_name]=[]);group[object[attribute]].push(object)}}return group},loadJavascript:function(src,callback){var elem;elem=document.createElement("script");elem.async=true;elem.src=src;SC.Helper.attachLoadEvent(elem,callback);document.body.appendChild(elem);return elem},extractOptionsAndCallbackArguments:function(optionsOrCallback,callback){var args;args={};if(callback!=null){args.callback=callback;args.options=optionsOrCallback}else if(typeof optionsOrCallback==="function"){args.callback=optionsOrCallback;args.options={}}else{args.options=optionsOrCallback||{}}return args},openCenteredPopup:function(url,width,height){var options;options={};if(height!=null){options.width=width;options.height=height}else{options=width}options=SC.Helper.merge(options,{location:1,left:window.screenX+(window.outerWidth-options.width)/2,top:window.screenY+(window.outerHeight-options.height)/2,toolbar:"no",scrollbars:"yes"});return window.open(url,options.name,this._optionsToString(options))},_optionsToString:function(options){var k,optionsArray,v;optionsArray=[];for(k in options){if(!__hasProp.call(options,k))continue;v=options[k];optionsArray.push(k+"="+v)}return optionsArray.join(", ")},attachLoadEvent:function(element,func){if(element.addEventListener){return element.addEventListener("load",func,false)}else{return element.onreadystatechange=function(){if(this.readyState==="complete"){return func()}}}},millisecondsToHMS:function(ms){var hms,m,mPrefix,sPrefix,tc;hms={h:Math.floor(ms/(60*60*1e3)),m:Math.floor(ms/6e4%60),s:Math.floor(ms/1e3%60)};tc=[];if(hms.h>0){tc.push(hms.h)}m=hms.m;mPrefix="";sPrefix="";if(hms.m<10&&hms.h>0){mPrefix="0"}if(hms.s<10){sPrefix="0"}tc.push(mPrefix+hms.m);tc.push(sPrefix+hms.s);return tc.join(".")},setFlashStatusCodeMaps:function(query){query["_status_code_map[400]"]=200;query["_status_code_map[401]"]=200;query["_status_code_map[403]"]=200;query["_status_code_map[404]"]=200;query["_status_code_map[422]"]=200;query["_status_code_map[500]"]=200;query["_status_code_map[503]"]=200;return query["_status_code_map[504]"]=200},responseHandler:function(responseText,xhr){var error,json;json=SC.Helper.JSON.parse(responseText);error=null;if(!json){if(xhr){error={message:"HTTP Error: "+xhr.status}}else{error={message:"Unknown error"}}}else if(json.errors){error={message:json.errors&&json.errors[0].error_message}}return{json:json,error:error}},FakeStorage:function(){return{_store:{},getItem:function(key){return this._store[key]||null},setItem:function(key,value){return this._store[key]=value.toString()},removeItem:function(key){return delete this._store[key]}}},JSON:{parse:function(string){if(string[0]!=="{"&&string[0]!=="["){return null}else if(window.JSON!=null){return window.JSON.parse(string)}else{return eval(string)}}}};window.SC=SC.Helper.merge(SC||{},{_version:"1.1.5",_baseUrl:"//connect.soundcloud.com",options:{site:"soundcloud.com",baseUrl:"//connect.soundcloud.com"},connectCallbacks:{},_popupWindow:void 0,initialize:function(options){var key,value,_base;if(options==null){options={}}this.accessToken(options["access_token"]);for(key in options){if(!__hasProp.call(options,key))continue;value=options[key];this.options[key]=value}(_base=this.options).flashXHR||(_base.flashXHR=(new XMLHttpRequest).withCredentials===void 0);return this},hostname:function(subdomain){var str;str="";if(subdomain!=null){str+=subdomain+"."}str+=this.options.site;return str}});window.SC=SC.Helper.merge(SC||{},{_apiRequest:function(method,path,query,callback){var data,uri;if(callback==null){callback=query;query=void 0}query||(query={});uri=SC.prepareRequestURI(path,query);uri.query.format="json";if(SC.options.flashXHR){SC.Helper.setFlashStatusCodeMaps(uri.query)}else{uri.query["_status_code_map[302]"]=200}if(method==="PUT"||method==="DELETE"){uri.query._method=method;method="POST"}
2087if(method!=="GET"){data=uri.encodeParams(uri.query);uri.query={}}return this._request(method,uri,"application/x-www-form-urlencoded",data,function(responseText,xhr){var response;response=SC.Helper.responseHandler(responseText,xhr);if(response.json&&response.json.status==="302 - Found"){return SC._apiRequest("GET",response.json.location,callback)}else{return callback(response.json,response.error)}})},_request:function(method,uri,contentType,data,callback){if(SC.options.flashXHR){return this._flashRequest(method,uri,contentType,data,callback)}else{return this._xhrRequest(method,uri,contentType,data,callback)}},_xhrRequest:function(method,uri,contentType,data,callback){var request;request=new XMLHttpRequest;request.open(method,uri.toString(),true);request.setRequestHeader("Content-Type",contentType);request.onreadystatechange=function(e){if(e.target.readyState===4){return callback(e.target.responseText,e.target)}};return request.send(data)},_flashRequest:function(method,uri,contentType,data,callback){return this.whenRecordingReady(function(){return Recorder.request(method,uri.toString(),contentType,data,function(data,xhr){return callback(Recorder._externalInterfaceDecode(data),xhr)})})},post:function(path,query,callback){return this._apiRequest("POST",path,query,callback)},put:function(path,query,callback){return this._apiRequest("PUT",path,query,callback)},get:function(path,query,callback){return this._apiRequest("GET",path,query,callback)},"delete":function(path,callback){return this._apiRequest("DELETE",path,{},callback)},prepareRequestURI:function(path,query){var k,uri,v;if(query==null){query={}}uri=new SC.URI(path,{decodeQuery:true});for(k in query){if(!__hasProp.call(query,k))continue;v=query[k];
2087uri.query[k]=v}if(uri.isRelative()){uri.host=this.hostname("api");uri.scheme=window.location.protocol.slice(0,-1)}if(this.accessToken()!=null){uri.query.oauth_token=this.accessToken();uri.scheme="https"}else{uri.query.client_id=this.options.client_id}return uri},_getAll:function(path,query,callback,collection){if(collection==null){collection=[]}if(callback==null){callback=query;query=void 0}query||(query={});query.offset||(query.offset=0);query.limit||(query.limit=50);return this.get(path,query,function(objects,error){if(objects.constructor===Array&&objects.length>0){collection=SC.Helper.merge(collection,objects);query.offset+=query.limit;return SC._getAll(path,query,callback,collection)}else{return callback(collection,null)}})}});window.SC=SC.Helper.merge(SC||{},{_connectWindow:null,connect:function(optionsOrCallback){var dialog,dialogOptions,options;if(typeof optionsOrCallback==="function"){options={connected:optionsOrCallback}}else{options=optionsOrCallback}dialogOptions={client_id:options.client_id||SC.options.client_id,redirect_uri:options.redirect_uri||SC.options.redirect_uri,response_type:"code_and_token",scope:options.scope||"non-expiring",display:"popup",window:options.window,retainWindow:options.retainWindow};if(dialogOptions.client_id&&dialogOptions.redirect_uri){dialog=SC.dialog(SC.Dialog.CONNECT,dialogOptions,function(params){if(params.error!=null){throw new Error("SC OAuth2 Error: "+params.error_description)}else{SC.accessToken(params.access_token);if(options.connected!=null){options.connected()}}if(options.callback!=null){return options.callback()}});this._connectWindow=dialog.options.window;return dialog}else{throw"Options client_id and redirect_uri must be passed"}},connectCallback:function(){return SC.Dialog._handleDialogReturn(SC._connectWindow)},disconnect:function(){return this.accessToken(null)},_trigger:function(eventName,argument){if(this.connectCallbacks[eventName]!=null){return this.connectCallbacks[eventName](argument)}},accessToken:function(value){var storage,storageKey;storageKey="SC.accessToken";storage=this.storage();if(value===void 0){return storage.getItem(storageKey)}else if(value===null){return storage.removeItem(storageKey)}else{return storage.setItem(storageKey,value)}},isConnected:function(){return this.accessToken()!=null}});window.SC=SC.Helper.merge(SC||{},{_dialogsPath:"/dialogs",dialog:function(dialogName,optionsOrCallback,callback){var a,dialog,options;a=SC.Helper.extractOptionsAndCallbackArguments(optionsOrCallback,callback);options=a.options;callback=a.callback;options.callback=callback;options.redirect_uri=this.options.redirect_uri;dialog=new SC.Dialog[dialogName+"Dialog"](options);SC.Dialog._dialogs[dialog.id]=dialog;dialog.open();return dialog},Dialog:{ECHO:"Echo",CONNECT:"Connect",PICKER:"Picker",ID_PREFIX:"SoundCloud_Dialog",_dialogs:{},_isDialogId:function(id){return(id||"").match(new RegExp("^"+this.ID_PREFIX))},_getDialogIdFromWindow:function(window){var id,loc;loc=new SC.URI(window.location,{decodeQuery:true,decodeFragment:true});id=loc.query.state||loc.fragment.state;if(this._isDialogId(id)){return id}else{return null}},_handleDialogReturn:function(window){var dialog,dialogId;dialogId=this._getDialogIdFromWindow(window);dialog=this._dialogs[dialogId];if(dialog!=null){if(dialog.handleReturn()){return delete this._dialogs[dialogId]}}},_handleInPopupContext:function(){var isiOS5;if(this._getDialogIdFromWindow(window)&&!window.location.pathname.match(/\/dialogs\//)){isiOS5=navigator.userAgent.match(/OS 5(_\d)+ like Mac OS X/i);if(isiOS5){return window.opener.SC.Dialog._handleDialogReturn(window)}else if(window.opener){return window.opener.setTimeout(function(){return window.opener.SC.Dialog._handleDialogReturn(window)},1)}else if(window.top){return window.top.setTimeout(function(){return window.top.SC.Dialog._handleDialogReturn(window)},1)}}},AbstractDialog:AbstractDialog=function(){AbstractDialog.prototype.WIDTH=456;AbstractDialog.prototype.HEIGHT=510;AbstractDialog.prototype.ID_PREFIX="SoundCloud_Dialog";AbstractDialog.prototype.PARAM_KEYS=["redirect_uri"];AbstractDialog.prototype.requiresAuthentication=false;AbstractDialog.prototype.generateId=function(){return[this.ID_PREFIX,Math.ceil(Math.random()*1e6).toString(16)].join("_")};function AbstractDialog(options){this.options=options!=null?options:{};this.id=this.generateId()}AbstractDialog.prototype.buildURI=function(uri){var paramKey,_i,_len,_ref;if(uri==null){uri=new SC.URI(SC._baseUrl)}uri.scheme=window.location.protocol.slice(0,-1);uri.path+=SC._dialogsPath+"/"+this.name+"/";uri.fragment={state:this.id};if(this.requiresAuthentication){uri.fragment.access_token=SC.accessToken()}_ref=this.PARAM_KEYS;for(_i=0,_len=_ref.length;_i<_len;_i++){paramKey=_ref[_i];if(this.options[paramKey]!=null){uri.fragment[paramKey]=this.options[paramKey]}}return uri};AbstractDialog.prototype.open=function(){var url;if(this.requiresAuthentication&&SC.accessToken()==null){return this.authenticateAndOpen()}else{url=this.buildURI();if(this.options.window!=null){return this.options.window.location=url}else{return this.options.window=SC.Helper.openCenteredPopup(url,{width:this.WIDTH,height:this.HEIGHT})}}};AbstractDialog.prototype.authenticateAndOpen=function(){var connectDialog,_this=this;return connectDialog=SC.connect({retainWindow:true,window:this.options.window,connected:function(){_this.options.window=connectDialog.options.window;return _this.open()}})};AbstractDialog.prototype.paramsFromWindow=function(){var params,url;url=new SC.URI(this.options.window.location,{decodeFragment:true,decodeQuery:true});return params=SC.Helper.merge(url.query,url.fragment)};AbstractDialog.prototype.handleReturn=function(){var params;params=this.paramsFromWindow();if(!this.options.retainWindow){this.options.window.close()}return this.options.callback(params)};return AbstractDialog}(),EchoDialog:EchoDialog=function(_super){__extends(EchoDialog,_super);function EchoDialog(){_ref=EchoDialog.__super__.constructor.apply(this,arguments);return _ref}EchoDialog.prototype.PARAM_KEYS=["client_id","redirect_uri","hello"];EchoDialog.prototype.name="echo";return EchoDialog}(AbstractDialog),PickerDialog:PickerDialog=function(_super){__extends(PickerDialog,_super);
2088function PickerDialog(){_ref1=PickerDialog.__super__.constructor.apply(this,arguments);return _ref1}PickerDialog.prototype.PARAM_KEYS=["client_id","redirect_uri"];
2088PickerDialog.prototype.name="picker";PickerDialog.prototype.requiresAuthentication=true;PickerDialog.prototype.handleReturn=function(){var params,_this=this;params=this.paramsFromWindow();if(params.action==="logout"){SC.accessToken(null);this.open();return false}else if(params.track_uri!=null){if(!this.options.retainWindow){this.options.window.close()}SC.get(params.track_uri,function(track){return _this.options.callback({track:track})});return true}};return PickerDialog}(AbstractDialog),ConnectDialog:ConnectDialog=function(_super){__extends(ConnectDialog,_super);function ConnectDialog(){_ref2=ConnectDialog.__super__.constructor.apply(this,arguments);return _ref2}ConnectDialog.prototype.PARAM_KEYS=["client_id","redirect_uri","client_secret","response_type","scope","display"];ConnectDialog.prototype.name="connect";ConnectDialog.prototype.buildURI=function(){var uri;uri=ConnectDialog.__super__.buildURI.apply(this,arguments);uri.scheme="https";uri.host="soundcloud.com";uri.path="/connect";uri.query=uri.fragment;uri.fragment={};return uri};return ConnectDialog}(AbstractDialog)}});SC.Dialog._handleInPopupContext();window.SC=SC.Helper.merge(SC||{},{Loader:{States:{UNLOADED:1,LOADING:2,READY:3},Package:function(name,loadFunction){return{name:name,callbacks:[],loadFunction:loadFunction,state:SC.Loader.States.UNLOADED,addCallback:function(fn){return this.callbacks.push(fn)},runCallbacks:function(){var callback,_i,_len,_ref3;_ref3=this.callbacks;for(_i=0,_len=_ref3.length;_i<_len;_i++){callback=_ref3[_i];callback.apply(this)}return this.callbacks=[]},setReady:function(){this.state=SC.Loader.States.READY;return this.runCallbacks()},load:function(){this.state=SC.Loader.States.LOADING;return this.loadFunction.apply(this)},whenReady:function(callback){switch(this.state){case SC.Loader.States.UNLOADED:this.addCallback(callback);return this.load();case SC.Loader.States.LOADING:return this.addCallback(callback);case SC.Loader.States.READY:return callback()}}}},packages:{},registerPackage:function(pkg){return this.packages[pkg.name]=pkg}}});window.SC=SC.Helper.merge(SC||{},{oEmbed:function(trackUrl,query,callback){var element,uri,_this=this;if(callback==null){callback=query;query=void 0}query||(query={});query.url=trackUrl;uri=new SC.URI(window.location.protocol+"//"+SC.hostname()+"/oembed.json");uri.query=query;if(callback.nodeType!==void 0&&callback.nodeType===1){element=callback;callback=function(oembed){return element.innerHTML=oembed.html}}return this._request("GET",uri.toString(),null,null,function(responseText,xhr){var response;response=SC.Helper.responseHandler(responseText,xhr);return callback(response.json,response.error)})}});window.SC=SC.Helper.merge(SC||{},{_recorderSwfPath:"/recorder.js/recorder-0.9.0.swf",whenRecordingReady:function(callback){return SC.Loader.packages.recording.whenReady(callback)},record:function(options){if(options==null){options={}}return this.whenRecordingReady(function(){return Recorder.record(options)})},recordStop:function(options){if(options==null){options={}}return Recorder.stop()},recordPlay:function(options){if(options==null){options={}}return Recorder.play(options)},recordUpload:function(query,callback){var flattenedParams,uri;if(query==null){query={}}uri=SC.prepareRequestURI("/tracks",query);uri.query.format="json";SC.Helper.setFlashStatusCodeMaps(uri.query);
2088flattenedParams=uri.flattenParams(uri.query);return Recorder.upload({method:"POST",url:"https://"+this.hostname("api")+"/tracks",audioParam:"track[asset_data]",params:flattenedParams,success:function(responseText){var response;response=SC.Helper.responseHandler(responseText);return callback(response.json,response.error)}})}});SC.Loader.registerPackage(new SC.Loader.Package("recording",function(){if(Recorder.flashInterface()){return SC.Loader.packages.recording.setReady()}else{return Recorder.initialize({swfSrc:SC._baseUrl+SC._recorderSwfPath+"?"+SC._version,initialized:function(){return SC.Loader.packages.recording.setReady()}})}}));window.SC=SC.Helper.merge(SC||{},{storage:function(){return this._fakeStorage||(this._fakeStorage=new SC.Helper.FakeStorage)}});window.SC=SC.Helper.merge(SC||{},{_soundmanagerPath:"/soundmanager2",_soundmanagerScriptPath:"/soundmanager2.js",whenStreamingReady:function(callback){return SC.Loader.packages.streaming.whenReady(callback)},_prepareStreamUrl:function(idOrUrl){var preparedUrl,url;if(idOrUrl.toString().match(/^\d.*$/)){url="/tracks/"+idOrUrl}else{url=idOrUrl}preparedUrl=SC.prepareRequestURI(url);if(!preparedUrl.path.match(/\/stream/)){preparedUrl.path+="/stream"}return preparedUrl.toString()},_setOnPositionListenersForComments:function(sound,comments,callback){var commentBatch,group,timestamp,_results;group=SC.Helper.groupBy(comments,"timestamp");_results=[];for(timestamp in group){commentBatch=group[timestamp];_results.push(function(timestamp,commentBatch,callback){return sound.onposition(parseInt(timestamp,10),function(){return callback(commentBatch)})}(timestamp,commentBatch,callback))}return _results},stream:function(idOrUrl,optionsOrCallback,callback){var a,options,_this=this;a=SC.Helper.extractOptionsAndCallbackArguments(optionsOrCallback,callback);options=a.options;callback=a.callback;return SC.whenStreamingReady(function(){var createAndCallback,ontimedcommentsCallback;options.id="T"+idOrUrl+"-"+Math.random();options.url=_this._prepareStreamUrl(idOrUrl);createAndCallback=function(options){var sound;sound=soundManager.createSound(options);if(callback!=null){callback(sound)}return sound};if(ontimedcommentsCallback=options.ontimedcomments){delete options.ontimedcomments;return SC._getAll(options.url.replace("/stream","/comments"),function(comments){var sound;sound=createAndCallback(options);return _this._setOnPositionListenersForComments(sound,comments,ontimedcommentsCallback)})}else{return createAndCallback(options)}})},streamStopAll:function(){if(window.soundManager!=null){return window.soundManager.stopAll()}}});SC.Loader.registerPackage(new SC.Loader.Package("streaming",function(){var soundManagerURL;if(window.soundManager!=null){return SC.Loader.packages.streaming.setReady()}else{soundManagerURL=SC._baseUrl+SC._soundmanagerPath;window.SM2_DEFER=true;return SC.Helper.loadJavascript(soundManagerURL+SC._soundmanagerScriptPath,function(){window.soundManager=new SoundManager;soundManager.url=soundManagerURL;soundManager.flashVersion=9;soundManager.useFlashBlock=false;soundManager.useHTML5Audio=false;soundManager.beginDelayedInit();return soundManager.onready(function(){return SC.Loader.packages.streaming.setReady()})})}}))}.call(this);
2089/* SockJS client, version 0.3.4
vendor: 4,101 bytes, lines 2089-2114
2089, http://sockjs.org, MIT License
2090
2091Copyright (c) 2011-2012 VMware, Inc.
2092
2093Permission is hereby granted, free of charge, to any person obtaining a copy
2094of this software and associated documentation files (the "Software"), to deal
2095in the Software without restriction, including without limitation the rights
2096to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2097copies of the Software, and to permit persons to whom the Software is
2098furnished to do so, subject to the following conditions:
2099
2100The above copyright notice and this permission notice shall be included in
2101all copies or substantial portions of the Software.
2102
2103THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2104IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2105FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2106AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2107LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2108OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2109THE SOFTWARE.
2110*/
2111
2112// JSON2 by Douglas Crockford (minified).
2113var JSON;JSON||(JSON={}),function(){function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g;return e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)typeof rep[c]=="string"&&(d=rep[c],e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g;return e}}function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function f(a){return a<10?"0"+a:a}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver=="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")})}()
2114
2115SockJS=function(){var a=document,b=window,c={},d=function(){};d.prototype.addEventListener=function(a,b){this._listeners||(this._listeners={}),a in this._listeners||(this._listeners[a]=[]);var d=this._listeners[a];c.arrIndexOf(d,b)===-1&&d.push(b);return},d.prototype.removeEventListener=function(a,b){if(!(this._listeners&&a in this._listeners))return;var d=this._listeners[a],e=c.arrIndexOf(d,b);if(e!==-1){d.length>1?this._listeners[a]=d.slice(0,e).concat(d.slice(e+1)):delete this._listeners[a];return}return},d.prototype.dispatchEvent=function(a){var b=a.type,c=Array.prototype.slice.call(arguments,0);this["on"+b]&&this["on"+b].apply(this,c);if(this._listeners&&b in this._listeners)for(var d=0;d<this._listeners[b].length;d++)this._listeners[b][d].apply(this,c)};var e=function(a,b){this.type=a;if(typeof b!="undefined")for(var c in b){if(!b.hasOwnProperty(c))continue;this[c]=b[c]}};e.prototype.toString=function(){var a=[];for(var b in this){if(!this.hasOwnProperty(b))continue;var c=this[b];typeof c=="function"&&(c="[function]"),a.push(b+"="+c)}return"SimpleEvent("+a.join(", ")+")"};var f=function(a){var b=this;b._events=a||[],b._listeners={}};f.prototype.emit=function(a){var b=this;b._verifyType(a);if(b._nuked)return;var c=Array.prototype.slice.call(arguments,1);b["on"+a]&&b["on"+a].apply(b,c);if(a in b._listeners)for(var d=0;d<b._listeners[a].length;d++)b._listeners[a][d].apply(b,c)},f.prototype.on=function(a,b){var c=this;c._verifyType(a);if(c._nuked)return;a in c._listeners||(c._listeners[a]=[]),c._listeners[a].push(b)},f.prototype._verifyType=function(a){var b=this;c.arrIndexOf(b._events,a)===-1&&c.log("Event "+JSON.stringify(a)+" not listed "+JSON.stringify(b._events)+" in "+b)},f.prototype.nuke=function(){var a=this;a._nuked=!0;for(var b=0;b<a._events.length;b++)delete a[a._events[b]];a._listeners={}};var g="abcdefghijklmnopqrstuvwxyz0123456789_";c.random_string=function(a,b){b=b||g.length;var c,d=[];for(c=0;c<a;c++)d.push(g.substr(Math.floor(Math.random()*b),1));return d.join("")},c.random_number=function(a){return Math.floor(Math.random()*a)},c.random_number_string=function(a){var b=(""+(a-1)).length,d=Array(b+1).join("0");return(d+c.random_number(a)).slice(-b)},c.getOrigin=function(a){a+="/";var b=a.split("/").slice(0,3);return b.join("/")},c.isSameOriginUrl=function(a,c){return c||(c=b.location.href),a.split("/").slice(0,3).join("/")===c.split("/").slice(0,3).join("/")},c.getParentDomain=function(a){if(/^[0-9.]*$/.test(a))return a;if(/^\[/.test(a))return a;if(!/[.]/.test(a))return a;var b=a.split(".").slice(1);return b.join(".")},c.objectExtend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a};var h="_jp";c.polluteGlobalNamespace=function(){h in b||(b[h]={})},c.closeFrame=function(a,b){return"c"+JSON.stringify([a,b])},c.userSetCode=function(a){return a===1e3||a>=3e3&&a<=4999},c.countRTO=function(a){var b;return a>100?b=3*a:b=a+200,b},c.log=function(){b.console&&console.log&&console.log.apply&&console.log.apply(console,arguments)},c.bind=function(a,b){return a.bind?a.bind(b):function(){return a.apply(b,arguments)}},c.flatUrl=function(a){return a.indexOf("?")===-1&&a.indexOf("#")===-1},c.amendUrl=function(b){var d=a.location;if(!b)throw new Error("Wrong url for SockJS");if(!c.flatUrl(b))throw new Error("Only basic urls are supported in SockJS");return b.indexOf("//")===0&&(b=d.protocol+b),b.indexOf("/")===0&&(b=d.protocol+"//"+d.host+b),b=b.replace(/[/]+$/,""),b},c.arrIndexOf=function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1},c.arrSkip=function(a,b){var d=c.arrIndexOf(a,b);if(d===-1)return a.slice();var e=a.slice(0,d);return e.concat(a.slice(d+1))},c.isArray=Array.isArray||function(a){return{}.toString.call(a).indexOf("Array")>=0},c.delay=function(a,b){return typeof a=="function"&&(b=a,a=0),setTimeout(b,a)};var i=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,j={"\0":"\\u0000","\x01":"\\u0001","\x02":"\\u0002","\x03":"\\u0003","\x04":"\\u0004","\x05":"\\u0005","\x06":"\\u0006","\x07":"\\u0007","\b":"\\b","\t":"\\t","\n":"\\n","\x0b":"\\u000b","\f":"\\f","\r":"\\r","\x0e":"\\u000e","\x0f":"\\u000f","\x10":"\\u0010","\x11":"\\u0011","\x12":"\\u0012","\x13":"\\u0013","\x14":"\\u0014","\x15":"\\u0015","\x16":"\\u0016","\x17":"\\u0017","\x18":"\\u0018","\x19":"\\u0019","\x1a":"\\u001a","\x1b":"\\u001b","\x1c":"\\u001c","\x1d":"\\u001d","\x1e":"\\u001e","\x1f":"\\u001f",'"':'\\"',"\\":"\\\\","\x7f":"\\u007f","\x80":"\\u0080","\x81":"\\u0081","\x82":"\\u0082","\x83":"\\u0083","\x84":"\\u0084","\x85":"\\u0085","\x86":"\\u0086","\x87":"\\u0087","\x88":"\\u0088","\x89":"\\u0089","\x8a":"\\u008a","\x8b":"\\u008b","\x8c":"\\u008c","\x8d":"\\u008d","\x8e":"\\u008e","\x8f":"\\u008f","\x90":"\\u0090","\x91":"\\u0091","\x92"
2115:"\\u0092","\x93":"\\u0093","\x94":"\\u0094","\x95":"\\u0095","\x96":"\\u0096","\x97":"\\u0097","\x98":"\\u0098","\x99":"\\u0099","\x9a":"\\u009a","\x9b":"\\u009b","\x9c":"\\u009c","\x9d":"\\u009d","\x9e":"\\u009e","\x9f":"\\u009f","\xad":"\\u00ad","\u0600":"\\u0600","\u0601":"\\u0601","\u0602":"\\u0602","\u0603":"\\u0603","\u0604":"\\u0604","\u070f":"\\u070f","\u17b4":"\\u17b4","\u17b5":"\\u17b5","\u200c":"\\u200c","\u200d":"\\u200d","\u200e":"\\u200e","\u200f":"\\u200f","\u2028":"\\u2028","\u2029":"\\u2029","\u202a":"\\u202a","\u202b":"\\u202b","\u202c":"\\u202c","\u202d":"\\u202d","\u202e":"\\u202e","\u202f":"\\u202f","\u2060":"\\u2060","\u2061":"\\u2061","\u2062":"\\u2062","\u2063":"\\u2063","\u2064":"\\u2064","\u2065":"\\u2065","\u2066":"\\u2066","\u2067":"\\u2067","\u2068":"\\u2068","\u2069":"\\u2069","\u206a":"\\u206a","\u206b":"\\u206b","\u206c":"\\u206c","\u206d":"\\u206d","\u206e":"\\u206e","\u206f":"\\u206f","\ufeff":"\\ufeff","\ufff0":"\\ufff0","\ufff1":"\\ufff1","\ufff2":"\\ufff2","\ufff3":"\\ufff3","\ufff4":"\\ufff4","\ufff5":"\\ufff5","\ufff6":"\\ufff6","\ufff7":"\\ufff7","\ufff8":"\\ufff8","\ufff9":"\\ufff9","\ufffa":"\\ufffa","\ufffb":"\\ufffb","\ufffc":"\\ufffc","\ufffd":"\\ufffd","\ufffe":"\\ufffe","\uffff":"\\uffff"},k=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,l,m=JSON&&JSON.stringify||function(a){return i.lastIndex=0,i.test(a)&&(a=a.replace(i,function(a){return j[a]})),'"'+a+'"'},n=function(a){var b,c={},d=[];for(b=0;b<65536;b++)d.push(String.fromCharCode(b));return a.lastIndex=0,d.join("").replace(a,function(a){return c[a]="\\u"+("0000"+a.charCo
2115deAt(0).toString(16)).slice(-4),""}),a.lastIndex=0,c};c.quote=function(a){var b=m(a);return k.lastIndex=0,k.test(b)?(l||(l=n(k)),b.replace(k,function(a){return l[a]})):b};var o=["websocket","xdr-streaming","xhr-streaming","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"];c.probeProtocols=function(){var a={};for(var b=0;b<o.length;b++){var c=o[b];a[c]=y[c]&&y[c].enabled()}return a},c.detectProtocols=function(a,b,c){var d={},e=[];b||(b=o);for(var f=0;f<b.length;f++){var g=b[f];d[g]=a[g]}var h=function(a){var b=a.shift();d[b]?e.push(b):a.length>0&&h(a)};return c.websocket!==!1&&h(["websocket"]),d["xhr-streaming"]&&!c.null_origin?e.push("xhr-streaming"):d["xdr-streaming"]&&!c.cookie_needed&&!c.null_origin?e.push("xdr-streaming"):h(["iframe-eventsource","iframe-htmlfile"]),d["xhr-polling"]&&!c.null_origin?e.push("xhr-polling"):d["xdr-polling"]&&!c.cookie_needed&&!c.null_origin?e.push("xdr-polling"):h(["iframe-xhr-polling","jsonp-polling"]),e};var p="_sockjs_global";c.createHook=function(){var a="a"+c.random_string(8);if(!(p in b)){var d={};b[p]=function(a){return a in d||(d[a]={id:a,del:function(){delete d[a]}}),d[a]}}return b[p](a)},c.attachMessage=function(a){c.attachEvent("message",a)},c.attachEvent=function(c,d){typeof b.addEventListener!="undefined"?b.addEventListener(c,d,!1):(a.attachEvent("on"+c,d),b.attachEvent("on"+c,d))},c.detachMessage=function(a){c.detachEvent("message",a)},c.detachEvent=function(c,d){typeof b.addEventListener!="undefined"?b.removeEventListener(c,d,!1):(a.detachEvent("on"+c,d),b.detachEvent("on"+c,d))};var q={},r=!1,s=function(){for(var a in q)q[a](),delete q[a]},t=function(){if(r)return;r=!0,s()};c.attachEvent("unload",t),c.unload_add=function(a){var b=c.random_string(8);return q[b]=a,r&&c.delay(s),b},c.unload_del=function(a){a in q&&delete q[a]},c.createIframe=function(b,d){var e=a.createElement("iframe"),f,g,h=function(){clearTimeout(f);try{e.onload=null}catch(a){}e.onerror=null},i=function(){e&&(h(),setTimeout(function(){e&&e.parentNode.removeChild(e),e=null},0),c.unload_del(g))},j=function(a){e&&(i(),d(a))},k=function(a,b){try{e&&e.contentWindow&&e.contentWindow.postMessage(a,b)}catch(c){}};return e.src=b,e.style.display="none",e.style.position="absolute",e.onerror=function(){j("onerror")},e.onload=function(){clearTimeout(f),f=setTimeout(function(){j("onload timeout")},2e3)},a.body.appendChild(e),f=setTimeout(function(){j("timeout")},15e3),g=c.unload_add(i),{post:k,cleanup:i,loaded:h}},c.createHtmlfile=function(a,d){var e=new ActiveXObject("htmlfile"),f,g,i,j=function(){clearTimeout(f)},k=function(){e&&(j(),c.unload_del(g),i.parentNode.removeChild(i),i=e=null,CollectGarbage())},l=function(a){e&&(k(),d(a))},m=function(a,b){try{i&&i.contentWindow&&i.contentWindow.postMessage(a,b)}catch(c){}};e.open(),e.write('<html><script>document.domain="'+document.domain+'";'+"</s"+"cript></html>"),e.close(),e.parentWindow[h]=b[h];var n=e.createElement("div");return e.body.appendChild(n),i=e.createElement("iframe"),n.appendChild(i),i.src=a,f=setTimeout(function(){l("timeout")},15e3),g=c.unload_add(k),{post:m,cleanup:k,loaded:j}};var u=function(){};u.prototype=new f(["chunk","finish"]),u.prototype._start=function(a,d,e,f){var g=this;try{g.xhr=new XMLHttpRequest}catch(h){}if(!g.xhr)try{g.xhr=new b.ActiveXObject("Microsoft.XMLHTTP")}catch(h){}if(b.ActiveXObject||b.XDomainRequest)d+=(d.indexOf("?")===-1?"?":"&")+"t="+ +(new Date);g.unload_ref=c.unload_add(function(){g._cleanup(!0)});try{g.xhr.open(a,d,!0)}catch(i){g.emit("finish",0,""),g._cleanup();return}if(!f||!f.no_credentials)g.xhr.withCredentials="true";if(f&&f.headers)for(var j in f.headers)g.xhr.setRequestHeader(j,f.headers[j]);g.xhr.onreadystatechange=function(){if(g.xhr){var a=g.xhr;switch(a.readyState){case 3:try{var b=a.status,c=a.responseText}catch(a){}b===1223&&(b=204),c&&c.length>0&&g.emit("chunk",b,c);break;case 4:var b=a.status;b===1223&&(b=204),g.emit("finish",b,a.responseText),g._cleanup(!1)}}},g.xhr.send(e)},u.prototype._cleanup=function(a){var b=this;if(!b.xhr)return;c.unload_del(b.unload_ref),b.xhr.onreadystatechange=function(){};if(a)try{b.xhr.abort()}catch(d){}b.unload_ref=b.xhr=null},u.prototype.close=function(){var a=this;a.nuke(),a._cleanup(!0)};var v=c.XHRCorsObject=function(){var a=this,b=arguments;c.delay(function(){a._start.apply(a,b)})};v.prototype=new u;var w=c.XHRLocalObject=function(a,b,d){var e=this;c.delay(function(){e._start(a,b,d,{no_credentials:!0})})};w.prototype=new u;var x=c.XDRObject=function(a,b,d){var e=this;c.delay(function(){e._start(a,b,d)})};x.prototype=new f(["chunk","finish"]),x.prototype._start=function(a,b,d){var e=this,f=new XDomainRequest;b+=(b.indexOf("?")===-1?"?":"&")+"t="+ +(new Date);var g=f.ontimeout=f.onerror=function(){e.emit("finish",0,""),e._cleanup(!1)};f.onprogress=function(){e.emit("chunk",200,f.responseText)},f.onload=function(){e.emit("finish",200,f.responseText),e._cleanup(!1)},e.xdr=f,e.unload_ref=c.unload_add(function(){e._cleanup(!0)});try{e.xdr.open(a,b),e.xdr.send(d)}catch(h){g()}},x.prototype._cleanup=function(a){var b=this;if(!b.xdr)return;
2115c.unload_del(b.unload_ref),b.xdr.ontimeout=b.xdr.onerror=b.xdr.onprogress=b.xdr.onload=null;if(a)try{b.xdr.abort()}catch(d){}b.unload_ref=b.xdr=null},x.prototype.close=function(){var a=this;a.nuke(),a._cleanup(!0)},c.isXHRCorsCapable=function(){return b.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?1:b.XDomainRequest&&a.domain?2:L.enabled()?3:4};var y=function(a,d,e){if(this===b)return new y(a,d,e);var f=this,g;f._options={devel:!1,debug:!1,protocols_whitelist:[],info:undefined,rtt:undefined},e&&c.objectExtend(f._options,e),f._base_url=c.amendUrl(a),f._server=f._options.server||c.random_number_string(1e3),f._options.protocols_whitelist&&f._options.protocols_whitelist.length?g=f._options.protocols_whitelist:(typeof d=="string"&&d.length>0?g=[d]:c.isArray(d)?g=d:g=null,g&&f._debug('Deprecated API: Use "protocols_whitelist" option instead of supplying protocol list as a second parameter to SockJS constructor.')),f._protocols=[],f.protocol=null,f.readyState=y.CONNECTING,f._ir=S(f._base_url),f._ir.onfinish=function(a,b){f._ir=null,a?(f._options.info&&(a=c.objectExtend(a,f._options.info)),f._options.rtt&&(b=f._options.rtt),f._applyInfo(a,b,g),f._didClose()):f._didClose(1002,"Can't connect to server",!0)}};y.prototype=new d,y.version="0.3.4",y.CONNECTING=0,y.OPEN=1,y.CLOSING=2,y.CLOSED=3,y.prototype._debug=function(){this._options.debug&&c.log.apply(c,arguments)},y.prototype._dispatchOpen=function(){var a=this;a.readyState===y.CONNECTING?(a._transport_tref&&(clearTimeout(a._transport_tref),a._transport_tref=null),a.readyState=y.OPEN,a.dispatchEvent(new e("open"))):a._didClose(1006,"Server lost session")},y.prototype._dispatchMessage=function(a){var b=this;if(b.readyState!==y.OPEN)return;b.dispatchEvent(new e("message",{data:a}))},y.prototype._dispatchHeartbeat=function(a){var b=this;if(b.readyState!==y.OPEN)return;b.dispatchEvent(new e("heartbeat",{}))},y.prototype._didClose=function(a,b,d){var f=this;if(f.readyState!==y.CONNECTING&&f.readyState!==y.OPEN&&f.readyState!==y.CLOSING)throw new Error("INVALID_STATE_ERR");f._ir&&(f._ir.nuke(),f._ir=null),f._transport&&(f._transport.doCleanup(),f._transport=null);var g=new e("close",{code:a,reason:b,wasClean:c.userSetCode(a)});if(!c.userSetCode(a)&&f.readyState===y.CONNECTING&&!d){if(f._try_next_protocol(g))return;g=new e("close",{code:2e3,reason:"All transports failed",wasClean:!1,last_event:g})}f.readyState=y.CLOSED,c.delay(function(){f.dispatchEvent(g)})},y.prototype._didMessage=function(a){var b=this,c=a.slice(0,1);switch(c){case"o":b._dispatchOpen();break;case"a":var d=JSON.parse(a.slice(1)||"[]");for(var e=0;e<d.length;e++)b._dispatchMessage(d[e]);break;case"m":var d=JSON.parse(a.slice(1)||"null");b._dispatchMessage(d);break;case"c":var d=JSON.parse(a.slice(1)||"[]");b._didClose(d[0],d[1]);break;case"h":b._dispatchHeartbeat()}},y.prototype._try_next_protocol=function(b){var d=this;d.protocol&&(d._debug("Closed transport:",d.protocol,""+b),d.protocol=null),d._transport_tref&&(clearTimeout(d._transport_tref),d._transport_tref=null);for(;;){var e=d.protocol=d._protocols.shift();if(!e)return!1;if(y[e]&&y[e].need_body===!0&&(!a.body||typeof a.readyState!="undefined"&&a.readyState!=="complete"))return d._protocols.unshift(e),d.protocol="waiting-for-load",c.attachEvent("load",function(){d._try_next_protocol()}),!0;if(!!y[e]&&!!y[e].enabled(d._options)){var f=y[e].roundTrips||1,g=(d._options.rto||0)*f||5e3;d._transport_tref=c.delay(g,function(){d.readyState===y.CONNECTING&&d._didClose(2007,"Transport timeouted")});var h=c.random_string(8),i=d._base_url+"/"+d._server+"/"+h;return d._debug("Opening transport:",e," url:"+i," RTO:"+d._options.rto),d._transport=new y[e](d,i,d._base_url),!0}d._debug("Skipping transport:",e)}},y.prototype.close=function(a,b){var d=this;if(a&&!c.userSetCode(a))throw new Error("INVALID_ACCESS_ERR");return d.readyState!==y.CONNECTING&&d.readyState!==y.OPEN?!1:(d.readyState=y.CLOSING,d._didClose(a||1e3,b||"Normal closure"),!0)},y.prototype.send=function(a){var b=this;if(b.readyState===y.CONNECTING)throw new Error("INVALID_STATE_ERR");return b.readyState===y.OPEN&&b._transport.doSend(c.quote(""+a)),!0},y.prototype._applyInfo=function(b,d,e){var f=this;f._options.info=b,f._options.rtt=d,f._options.rto=c.countRTO(d),f._options.info.null_origin=!a.domain;var g=c.probeProtocols();f._protocols=c.detectProtocols(g,e,b)};var z=y.websocket=function(a,d){var e=this,f=d+"/websocket";f.slice(0,5)==="https"?f="wss"+f.slice(5):f="ws"+f.slice(4),e.ri=a,e.url=f;var g=b.WebSocket||b.MozWebSocket;e.ws=new g(e.url),e.ws.onmessage=function(a){e.ri._didMessage(a.data)},e.unload_ref=c.unload_add(function(){e.ws.close()}
2115),e.ws.onclose=function(){e.ri._didMessage(c.closeFrame(1006,"WebSocket connection broken"))}};z.prototype.doSend=function(a){this.ws.send("["+a+"]")},z.prototype.doCleanup=function(){var a=this,b=a.ws;b&&(b.onmessage=b.onclose=null,b.close(),c.unload_del(a.unload_ref),a.unload_ref=a.ri=a.ws=null)},z.enabled=function(){return!!b.WebSocket||!!b.MozWebSocket},z.roundTrips=2;var A=function(){};A.prototype.send_constructor=function(a){var b=this;b.send_buffer=[],b.sender=a},A.prototype.doSend=function(a){var b=this;b.send_buffer.push(a),b.send_stop||b.send_schedule()},A.prototype.send_schedule_wait=function(){var a=this,b;a.send_stop=function(){a.send_stop=null,clearTimeout(b)},b=c.delay(25,function(){a.send_stop=null,a.send_schedule()})},A.prototype.send_schedule=function(){var a=this;if(a.send_buffer.length>0){var b="["+a.send_buffer.join(",")+"]";a.send_stop=a.sender(a.trans_url,b,function(b,c){a.send_stop=null,b===!1?a.ri._didClose(1006,"Sending error "+c):a.send_schedule_wait()}),a.send_buffer=[]}},A.prototype.send_destructor=function(){var a=this;a._send_stop&&a._send_stop(),a._send_stop=null};var B=function(b,d,e){var f=this;if(!("_send_form"in f)){var g=f._send_form=a.createElement("form"),h=f._send_area=a.createElement("textarea");h.name="d",g.style.display="none",g.style.position="absolute",g.method="POST",g.enctype="application/x-www-form-urlencoded",g.acceptCharset="UTF-8",g.appendChild(h),a.body.appendChild(g)}var g=f._send_form,h=f._send_area,i="a"+c.random_string(8);g.target=i,g.action=b+"/jsonp_send?i="+i;var j;try{j=a.createElement('<iframe name="'+i+'">')}catch(k){j=a.createElement("iframe"),j.name=i}j.id=i,g.appendChild(j),j.style.display="none";try{h.value=d}catch(l){c.log("Your browser is seriously broken. Go home! "+l.message)}g.submit();var m=function(a){if(!j.onerror)return;j.onreadystatechange=j.onerror=j.onload=null,c.delay(500,function(){j.parentNode.removeChild(j),j=null}),h.value="",e(!0)};return j.onerror=j.onload=m,j.onreadystatechange=function(a){j.readyState=="complete"&&m()},m},C=function(a){return function(b,c,d){var e=new a("POST",b+"/xhr_send",c);return e.onfinish=function(a,b){d(a===200||a===204,"http status "+a)},function(a){d(!1,a)}}},D=function(b,d){var e,f=a.createElement("script"),g,h=function(a){g&&(g.parentNode.removeChild(g),g=null),f&&(clearTimeout(e),f.parentNode.removeChild(f),f.onreadystatechange=f.onerror=f.onload=f.onclick=null,f=null,d(a),d=null)},i=!1,j=null;f.id="a"+c.random_string(8),f.src=b,f.type="text/javascript",f.charset="UTF-8",f.onerror=function(a){j||(j=setTimeout(function(){i||h(c.closeFrame(1006,"JSONP script loaded abnormally (onerror)"))},1e3))},f.onload=function(a){h(c.closeFrame(1006,"JSONP script loaded abnormally (onload)"))},f.onreadystatechange=function(a){if(/loaded|closed/.test(f.readyState)){if(f&&f.htmlFor&&f.onclick){i=!0;try{f.onclick()}catch(b){}}f&&h(c.closeFrame(1006,"JSONP script loaded abnormally (onreadystatechange)"))}};if(typeof f.async=="undefined"&&a.attachEvent)if(!/opera/i.test(navigator.userAgent)){try{f.htmlFor=f.id,f.event="onclick"}catch(k){}f.async=!0}else g=a.createElement("script"),g.text="try{var a = document.getElementById('"+f.id+"'); if(a)a.onerror();}catch(x){};",f.async=g.async=!1;typeof f.async!="undefined"&&(f.async=!0),e=setTimeout(function(){h(c.closeFrame(1006,"JSONP script loaded abnormally (timeout)"))},35e3);var l=a.getElementsByTagName("head")[0];return l.insertBefore(f,l.firstChild),g&&l.insertBefore(g,l.firstChild),h},E=y["jsonp-polling"]=function(a,b){c.polluteGlobalNamespace();var d=this;d.ri=a,d.trans_url=b,d.send_constructor(B),d._schedule_recv()};E.prototype=new A,E.prototype._schedule_recv=function(){var a=this,b=function(b){a._recv_stop=null,b&&(a._is_closing||a.ri._didMessage(b)),a._is_closing||a._schedule_recv()};a._recv_stop=F(a.trans_url+"/jsonp",D,b)},E.enabled=function(){return!0},E.need_body=!0,E.prototype.doCleanup=function(){var a=this;a._is_closing=!0,a._recv_stop&&a._recv_stop(),a.ri=a._recv_stop=null,a.send_destructor()};var F=function(a,d,e){var f="a"+c.random_string(6),g=a+"?c="+escape(h+"."+f),i=0,j=function(a){switch(i){case 0:delete b[h][f],e(a);break;case 1:e(a),i=2;break;case 2:delete b[h][f]}},k=d(g,j);b[h][f]=k;
2115var l=function(){b[h][f]&&(i=1,b[h][f](c.closeFrame(1e3,"JSONP user aborted read")))};return l},G=function(){};G.prototype=new A,G.prototype.run=function(a,b,c,d,e){var f=this;f.ri=a,f.trans_url=b,f.send_constructor(C(e)),f.poll=new $(a,d,b+c,e)},G.prototype.doCleanup=function(){var a=this;a.poll&&(a.poll.abort(),a.poll=null)};var H=y["xhr-streaming"]=function(a,b){this.run(a,b,"/xhr_streaming",bd,c.XHRCorsObject)};H.prototype=new G,H.enabled=function(){return b.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest&&!/opera/i.test(navigator.userAgent)},H.roundTrips=2,H.need_body=!0;var I=y["xdr-streaming"]=function(a,b){this.run(a,b,"/xhr_streaming",bd,c.XDRObject)};I.prototype=new G,I.enabled=function(){return!!b.XDomainRequest},I.roundTrips=2;var J=y["xhr-polling"]=function(a,b){this.run(a,b,"/xhr",bd,c.XHRCorsObject)};J.prototype=new G,J.enabled=H.enabled,J.roundTrips=2;var K=y["xdr-polling"]=function(a,b){this.run(a,b,"/xhr",bd,c.XDRObject)};K.prototype=new G,K.enabled=I.enabled,K.roundTrips=2;var L=function(){};L.prototype.i_constructor=function(a,b,d){var e=this;e.ri=a,e.origin=c.getOrigin(d),e.base_url=d,e.trans_url=b;var f=d+"/iframe.html";e.ri._options.devel&&(f+="?t="+ +(new Date)),e.window_id=c.random_string(8),f+="#"+e.window_id,e.iframeObj=c.createIframe(f,function(a){e.ri._didClose(1006,"Unable to load an iframe ("+a+")")}),e.onmessage_cb=c.bind(e.onmessage,e),c.attachMessage(e.onmessage_cb)},L.prototype.doCleanup=function(){var a=this;if(a.iframeObj){c.detachMessage(a.onmessage_cb);try{a.iframeObj.iframe.contentWindow&&a.postMessage("c")}catch(b){}a.iframeObj.cleanup(),a.iframeObj=null,a.onmessage_cb=a.iframeObj=null}},L.prototype.onmessage=function(a){var b=this;if(a.origin!==b.origin)return;var c=a.data.slice(0,8),d=a.data.slice(8,9),e=a.data.slice(9);if(c!==b.window_id)return;switch(d){case"s":b.iframeObj.loaded(),b.postMessage("s",JSON.stringify([y.version,b.protocol,b.trans_url,b.base_url]));break;case"t":b.ri._didMessage(e)}},L.prototype.postMessage=function(a,b){var c=this;c.iframeObj.post(c.window_id+a+(b||""),c.origin)},L.prototype.doSend=function(a){this.postMessage("m",a)},L.enabled=function(){var a=navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Konqueror")!==-1;return(typeof b.postMessage=="function"||typeof b.postMessage=="object")&&!a};var M,N=function(a,d){parent!==b?parent.postMessage(M+a+(d||""),"*"):c.log("Can't postMessage, no parent window.",a,d)},O=function(){};
2115O.prototype._didClose=function(a,b){N("t",c.closeFrame(a,b))},O.prototype._didMessage=function(a){N("t",a)},O.prototype._doSend=function(a){this._transport.doSend(a)},O.prototype._doCleanup=function(){this._transport.doCleanup()},c.parent_origin=undefined,y.bootstrap_iframe=function(){var d;M=a.location.hash.slice(1);var e=function(a){if(a.source!==parent)return;typeof c.parent_origin=="undefined"&&(c.parent_origin=a.origin);if(a.origin!==c.parent_origin)return;var e=a.data.slice(0,8),f=a.data.slice(8,9),g=a.data.slice(9);if(e!==M)return;switch(f){case"s":var h=JSON.parse(g),i=h[0],j=h[1],k=h[2],l=h[3];i!==y.version&&c.log('Incompatibile SockJS! Main site uses: "'+i+'", the iframe:'+' "'+y.version+'".');if(!c.flatUrl(k)||!c.flatUrl(l)){c.log("Only basic urls are supported in SockJS");return}if(!c.isSameOriginUrl(k)||!c.isSameOriginUrl(l)){c.log("Can't connect to different domain from within an iframe. ("+JSON.stringify([b.location.href,k,l])+")");return}d=new O,d._transport=new O[j](d,k,l);break;case"m":d._doSend(g);break;case"c":d&&d._doCleanup(),d=null}};c.attachMessage(e),N("s")};var P=function(a,b){var d=this;c.delay(function(){d.doXhr(a,b)})};P.prototype=new f(["finish"]),P.prototype.doXhr=function(a,b){var d=this,e=(new Date).getTime(),f=new b("GET",a+"/info"),g=c.delay(8e3,function(){f.ontimeout()});f.onfinish=function(a,b){clearTimeout(g),g=null;if(a===200){var c=(new Date).getTime()-e,f=JSON.parse(b);typeof f!="object"&&(f={}),d.emit("finish",f,c)}else d.emit("finish")},f.ontimeout=function(){f.close(),d.emit("finish")}};var Q=function(b){var d=this,e=function(){var a=new L;a.protocol="w-iframe-info-receiver";var c=function(b){if(typeof b=="string"&&b.substr(0,1)==="m"){var c=JSON.parse(b.substr(1)),e=c[0],f=c[1];d.emit("finish",e,f)}else d.emit("finish");a.doCleanup(),a=null},e={_options:{},_didClose:c,_didMessage:c};a.i_constructor(e,b,b)};a.body?e():c.attachEvent("load",e)};Q.prototype=new f(["finish"]);var R=function(){var a=this;c.delay(function(){a.emit("finish",{},2e3)})};R.prototype=new f(["finish"]);var S=function(a){if(c.isSameOriginUrl(a))return new P(a,c.XHRLocalObject);switch(c.isXHRCorsCapable()){case 1:return new P(a,c.XHRLocalObject);case 2:return new P(a,c.XDRObject);case 3:return new Q(a);default:return new R}},T=O["w-iframe-info-receiver"]=function(a,b,d){var e=new P(d,c.XHRLocalObject);e.onfinish=function(b,c){a._didMessage("m"+JSON.stringify([b,c])),a._didClose()}};T.prototype.doCleanup=function(){};var U=y["iframe-eventsource"]=function(){var a=this;a.protocol="w-iframe-eventsource",a.i_constructor.apply(a,arguments)};U.prototype=new L,U.enabled=function(){return"EventSource"in b&&L.enabled()},U.need_body=!0,U.roundTrips=3;var V=O["w-iframe-eventsource"]=function(a,b){this.run(a,b,"/eventsource",_,c.XHRLocalObject)};V.prototype=new G;var W=y["iframe-xhr-polling"]=function(){var a=this;a.protocol="w-iframe-xhr-polling",a.i_constructor.apply(a,arguments)};W.prototype=new L,W.enabled=function(){return b.XMLHttpRequest&&L.enabled()},W.need_body=!0,W.roundTrips=3;var X=O["w-iframe-xhr-polling"]=function(a,b){this.run(a,b,"/xhr",bd,c.XHRLocalObject)};X.prototype=new G;var Y=y["iframe-htmlfile"]=function(){var a=this;a.protocol="w-iframe-htmlfile",a.i_constructor.apply(a,arguments)};Y.prototype=new L,Y.enabled=function(){return L.enabled()},Y.need_body=!0,Y.roundTrips=3;var Z=O["w-iframe-htmlfile"]=function(a,b){this.run(a,b,"/htmlfile",bc,c.XHRLocalObject)};Z.prototype=new G;var $=function(a,b,c,d){var e=this;e.ri=a,e.Receiver=b,e.recv_url=c,e.AjaxObject=d,e._scheduleRecv()};$.prototype._scheduleRecv=function(){var a=this,b=a.poll=new a.Receiver(a.recv_url,a.AjaxObject),c=0;b.onmessage=function(b){c+=1,a.ri._didMessage(b.data)},b.onclose=function(c){a.poll=b=b.onmessage=b.onclose=null,a.poll_is_closing||(c.reason==="permanent"?a.ri._didClose(1006,"Polling error ("+c.reason+")"):a._scheduleRecv())}},$.prototype.abort=function(){var a=this;a.poll_is_closing=!0,a.poll&&a.poll.abort()};var _=function(a){var b=this,d=new EventSource(a);d.onmessage=function(a){b.dispatchEvent(new e("message",{data:unescape(a.data)}))},b.es_close=d.onerror=function(a,f){var g=f?"user":d.readyState!==2?"network":"permanent";b.es_close=d.onmessage=d.onerror=null,d.close(),d=null,c.delay(200,function(){b.dispatchEvent(new e("close",{reason:g}))})}};_.prototype=new d,_.prototype.abort=function(){var a=this;a.es_close&&a.es_close({},!0)};var ba,bb=function(){if(ba===undefined)if("ActiveXObject"in b)try{ba=!!(new ActiveXObject("htmlfile"))}catch(a){}else ba=!1;return ba},bc=function(a){var d=this;c.polluteGlobalNamespace(),d.id="a"+c.random_string(6,26),a+=(a.indexOf("?")===-1?"?":"&")+"c="+escape(h+"."+d.id);var f=bb()?c.createHtmlfile:c.createIframe,g;b[h][d.id]={start:function(){g.loaded()},message:function(a){d.dispatchEvent(new e("message",{data:a}))},stop:function(){d.iframe_close({},"network")}},d.iframe_close=function(a,c){g.cleanup(),d.iframe_close=g=null,delete b[h][d.id],d.dispatchEvent(new e("close",{reason:c}))},g=f(a,function(a){d.iframe_close({},"permanent")})};bc.prototype=new d,bc.prototype.abort=function(){var a=this;a.iframe_close&&a.iframe_close({},"user")};var bd=function(a,b){var c=this,d=0;
2115c.xo=new b("POST",a,null),c.xo.onchunk=function(a,b){if(a!==200)return;for(;;){var f=b.slice(d),g=f.indexOf("\n");if(g===-1)break;d+=g+1;var h=f.slice(0,g);c.dispatchEvent(new e("message",{data:h}))}},c.xo.onfinish=function(a,b){c.xo.onchunk(a,b),c.xo=null;var d=a===200?"network":"permanent";c.dispatchEvent(new e("close",{reason:d}))}};return bd.prototype=new d,bd.prototype.abort=function(){var a=this;a.xo&&(a.xo.close(),a.dispatchEvent(new e("close",{reason:"user"})),a.xo=null)},y.getUtils=function(){return c},y.getIframeTransport=function(){return L},y}(),"_sockjs_onload"in window&&setTimeout(_sockjs_onload,1),typeof define=="function"&&define.amd&&define("sockjs",[],function(){return SockJS});
2116
2117
2118(function(){var async={};var root,previous_async;root=this;if(root!=null){previous_async=root.async;}
2119async.noConflict=function(){root.async=previous_async;return async;};function only_once(fn){var called=false;return function(){if(called)throw new Error("Callback was already called.");called=true;fn.apply(root,arguments);}}
2120var _each=function(arr,iterator){if(arr.forEach){return arr.forEach(iterator);}
2121for(var i=0;i<arr.length;i+=1){iterator(arr[i],i,arr);}};var _map=function(arr,iterator){if(arr.map){return arr.map(iterator);}
2122var results=[];_each(arr,function(x,i,a){results.push(iterator(x,i,a));});return results;};var _reduce=function(arr,iterator,memo){if(arr.reduce){return arr.reduce(iterator,memo);}
2123_each(arr,function(x,i,a){memo=iterator(memo,x,i,a);});return memo;};var _keys=function(obj){if(Object.keys){return Object.keys(obj);}
2124var keys=[];for(var k in obj){if(obj.hasOwnProperty(k)){keys.push(k);}}
2125return keys;};if(typeof process==='undefined'||!(process.nextTick)){if(typeof setImmediate==='function'){async.nextTick=function(fn){setImmediate(fn);};async.setImmediate=async.nextTick;}
2126else{async.nextTick=function(fn){setTimeout(fn,0);};async.setImmediate=async.nextTick;}}
2127else{async.nextTick=process.nextTick;if(typeof setImmediate!=='undefined'){async.setImmediate=setImmediate;}
2128else{async.setImmediate=async.nextTick;}}
2129async.each=function(arr,iterator,callback){callback=callback||function(){};if(!arr.length){return callback();}
2130var completed=0;_each(arr,function(x){iterator(x,only_once(function(err){if(err){callback(err);callback=function(){};}
2131else{completed+=1;if(completed>=arr.length){callback(null);}}}));});};async.forEach=async.each;async.eachSeries=function(arr,iterator,callback){callback=callback||function(){};if(!arr.length){return callback();}
2132var completed=0;var iterate=function(){iterator(arr[completed],function(err){if(err){callback(err);callback=function(){};}
2133else{completed+=1;if(completed>=arr.length){callback(null);}
2134else{iterate();}}});};iterate();};async.forEachSeries=async.eachSeries;async.eachLimit=function(arr,limit,iterator,callback){var fn=_eachLimit(limit);fn.apply(null,[arr,iterator,callback]);};async.forEachLimit=async.eachLimit;var _eachLimit=function(limit){return function(arr,iterator,callback){callback=callback||function(){};if(!arr.length||limit<=0){return callback();}
2135var completed=0;var started=0;var running=0;(function replenish(){if(completed>=arr.length){return callback();}
2136while(running<limit&&started<arr.length){started+=1;running+=1;iterator(arr[started-1],function(err){if(err){callback(err);callback=function(){};}
2137else{completed+=1;running-=1;if(completed>=arr.length){callback();}
2138else{replenish();}}});}})();};};var doParallel=function(fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[async.each].concat(args));};};var doParallelLimit=function(limit,fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[_eachLimit(limit)].concat(args));};};var doSeries=function(fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[async.eachSeries].concat(args));};};var _asyncMap=function(eachfn,arr,iterator,callback){var results=[];arr=_map(arr,function(x,i){return{index:i,value:x};});eachfn(arr,function(x,callback){iterator(x.value,function(err,v){results[x.index]=v;callback(err);});},function(err){callback(err,results);});};async.map=doParallel(_asyncMap);async.mapSeries=doSeries(_asyncMap);async.mapLimit=function(arr,limit,iterator,callback){return _mapLimit(limit)(arr,iterator,callback);};var _mapLimit=function(limit){return doParallelLimit(limit,_asyncMap);};async.reduce=function(arr,memo,iterator,callback){async.eachSeries(arr,function(x,callback){iterator(memo,x,function(err,v){memo=v;callback(err);});},function(err){callback(err,memo);});};async.inject=async.reduce;async.foldl=async.reduce;async.reduceRight=function(arr,memo,iterator,callback){var reversed=_map(arr,function(x){return x;}).reverse();async.reduce(reversed,memo,iterator,callback);};async.foldr=async.reduceRight;var _filter=function(eachfn,arr,iterator,callback){var results=[];arr=_map(arr,function(x,i){return{index:i,value:x};});eachfn(arr,function(x,callback){iterator(x.value,function(v){if(v){results.push(x);}
2139callback();});},function(err){callback(_map(results.sort(function(a,b){return a.index-b.index;}),function(x){return x.value;}));});};async.filter=doParallel(_filter);async.filterSeries=doSeries(_filter);async.select=async.filter;async.selectSeries=async.filterSeries;var _reject=function(eachfn,arr,iterator,callback){var results=[];arr=_map(arr,function(x,i){return{index:i,value:x};});eachfn(arr,function(x,callback){iterator(x.value,function(v){if(!v){results.push(x);}
2140callback();});},function(err){callback(_map(results.sort(function(a,b){return a.index-b.index;}),function(x){return x.value;}));});};async.reject=doParallel(_reject);async.rejectSeries=doSeries(_reject);var _detect=function(eachfn,arr,iterator,main_callback){eachfn(arr,function(x,callback){iterator(x,function(result){if(result){main_callback(x);main_callback=function(){};}
2141else{callback();}});},function(err){main_callback();});};async.detect=doParallel(_detect);async.detectSeries=doSeries(_detect);async.some=function(arr,iterator,main_callback){async.each(arr,function(x,callback){iterator(x,function(v){if(v){main_callback(true);main_callback=function(){};}
2142callback();});},function(err){main_callback(false);});};async.any=async.some;async.every=function(arr,iterator,main_callback){async.each(arr,function(x,callback){iterator(x,function(v){if(!v){main_callback(false);main_callback=function(){};}
2143callback();});},function(err){main_callback(true);});};async.all=async.every;async.sortBy=function(arr,iterator,callback){async.map(arr,function(x,callback){iterator(x,function(err,criteria){if(err){callback(err);}
2144else{callback(null,{value:x,criteria:criteria});}}
2144);},function(err,results){if(err){return callback(err);}
2145else{var fn=function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;};callback(null,_map(results.sort(fn),function(x){return x.value;}));}});};async.auto=function(tasks,callback){callback=callback||function(){};var keys=_keys(tasks);if(!keys.length){return callback(null);}
2146var results={};var listeners=[];var addListener=function(fn){listeners.unshift(fn);};var removeListener=function(fn){for(var i=0;i<listeners.length;i+=1){if(listeners[i]===fn){listeners.splice(i,1);return;}}};var taskComplete=function(){_each(listeners.slice(0),function(fn){fn();});};addListener(function(){if(_keys(results).length===keys.length){callback(null,results);callback=function(){};}});_each(keys,function(k){var task=(tasks[k]instanceof Function)?[tasks[k]]:tasks[k];var taskCallback=function(err){var args=Array.prototype.slice.call(arguments,1);if(args.length<=1){args=args[0];}
2147if(err){var safeResults={};_each(_keys(results),function(rkey){safeResults[rkey]=results[rkey];});safeResults[k]=args;callback(err,safeResults);callback=function(){};}
2148else{results[k]=args;async.setImmediate(taskComplete);}};var requires=task.slice(0,Math.abs(task.length-1))||[];var ready=function(){return _reduce(requires,function(a,x){return(a&&results.hasOwnProperty(x));},true)&&!results.hasOwnProperty(k);};if(ready()){task[task.length-1](taskCallback,results);}
2149else{var listener=function(){if(ready()){removeListener(listener);task[task.length-1](taskCallback,results);}};addListener(listener);}});};async.waterfall=function(tasks,callback){callback=callback||function(){};if(tasks.constructor!==Array){var err=new Error('First argument to waterfall must be an array of functions');return callback(err);}
2150if(!tasks.length){return callback();}
2151var wrapIterator=function(iterator){return function(err){if(err){callback.apply(null,arguments);callback=function(){};}
2152else{var args=Array.prototype.slice.call(arguments,1);var next=iterator.next();if(next){args.push(wrapIterator(next));}
2153else{args.push(callback);}
2154async.setImmediate(function(){iterator.apply(null,args);});}};};wrapIterator(async.iterator(tasks))();};var _parallel=function(eachfn,tasks,callback){callback=callback||function(){};if(tasks.constructor===Array){eachfn.map(tasks,function(fn,callback){if(fn){fn(function(err){var args=Array.prototype.slice.call(arguments,1);if(args.length<=1){args=args[0];}
2155callback.call(null,err,args);});}},callback);}
2156else{var results={};eachfn.each(_keys(tasks),function(k,callback){tasks[k](function(err){var args=Array.prototype.slice.call(arguments,1);if(args.length<=1){args=args[0];}
2157results[k]=args;callback(err);});},function(err){callback(err,results);});}};async.parallel=function(tasks,callback){_parallel({map:async.map,each:async.each},tasks,callback);};async.parallelLimit=function(tasks,limit,callback){_parallel({map:_mapLimit(limit),each:_eachLimit(limit)},tasks,callback);};async.series=function(tasks,callback){callback=callback||function(){};if(tasks.constructor===Array){async.mapSeries(tasks,function(fn,callback){if(fn){fn(function(err){var args=Array.prototype.slice.call(arguments,1);if(args.length<=1){args=args[0];}
2158callback.call(null,err,args);});}},callback);}
2159else{var results={};async.eachSeries(_keys(tasks),function(k,callback){tasks[k](function(err){var args=Array.prototype.slice.call(arguments,1);if(args.length<=1){args=args[0];}
2160results[k]=args;callback(err);});},function(err){callback(err,results);});}};async.iterator=function(tasks){var makeCallback=function(index){var fn=function(){if(tasks.length){tasks[index].apply(null,arguments);}
2161return fn.next();};fn.next=function(){return(index<tasks.length-1)?makeCallback(index+1):null;};return fn;};return makeCallback(0);};async.apply=function(fn){var args=Array.prototype.slice.call(arguments,1);return function(){return fn.apply(null,args.concat(Array.prototype.slice.call(arguments)));};};var _concat=function(eachfn,arr,fn,callback){var r=[];eachfn(arr,function(x,cb){fn(x,function(err,y){r=r.concat(y||[]);cb(err);});},function(err){callback(err,r);});};async.concat=doParallel(_concat);async.concatSeries=doSeries(_concat);async.whilst=function(test,iterator,callback){if(test()){iterator(function(err){if(err){return callback(err);}
2162async.whilst(test,iterator,callback);});}
2163else{callback();}};async.doWhilst=function(iterator,test,callback){iterator(function(err){if(err){return callback(err);}
2164if(test()){async.doWhilst(iterator,test,callback);}
2165else{callback();}});};async.until=function(test,iterator,callback){if(!test()){iterator(function(err){if(err){return callback(err);}
2166async.until(test,iterator,callback);});}
2167else{callback();}};async.doUntil=function(iterator,test,callback){iterator(function(err){if(err){return callback(err);}
2168if(!test()){async.doUntil(iterator,test,callback);}
2169else{callback();}});};async.queue=function(worker,concurrency){if(concurrency===undefined){concurrency=1;}
2170function _insert(q,data,pos,callback){if(data.constructor!==Array){data=[data];}
2171_each(data,function(task){var item={data:task,callback:typeof callback==='function'?callback:null};if(pos){q.tasks.unshift(item);}else{q.tasks.push(item);}
2172if(q.saturated&&q.tasks.length===concurrency){q.saturated();}
2173async.setImmediate(q.process);});}
2174var workers=0;var q={tasks:[],concurrency:concurrency,saturated:null,empty:null,drain:null,push:function(data,callback){_insert(q,data,false,callback);},unshift:function(data,callback){_insert(q,data,true,callback);},process:function(){if(workers<q.concurrency&&q.tasks.length){var task=q.tasks.shift();if(q.empty&&q.tasks.length===0){q.empty();}
2175workers+=1;var next=function(){workers-=1;if(task.callback){task.callback.apply(task,arguments);}
2176if(q.drain&&q.tasks.length+workers===0){q.drain();}
2177q.process();};var cb=only_once(next);worker(task.data,cb);}},length:function(){return q.tasks.length;},running:function(){return workers;}};return q;};async.cargo=function(worker,payload){var working=false,tasks=[];var cargo={tasks:tasks,payload:payload,saturated:null,empty:null,drain:null,push:function(data,callback){if(data.constructor!==Array){data=[data];}
2178_each(data,function(task){tasks.push({data:task,callback:typeof callback==='function'?callback:null});if(cargo.saturated&&tasks.length===payload){cargo.saturated();}});async.setImmediate(cargo.process);},process:function process(){if(working)return;if(tasks.length===0){if(cargo.drain)cargo.drain();return;}
2179var ts=typeof payload==='number'?tasks.splice(0,payload):tasks.splice(0);var ds=_map(ts,function(task){return task.data;});if(cargo.empty)cargo.empty();working=true;worker(ds,function(){working=false;var args=arguments;_each(ts,function(data){if(data.callback){data.callback.apply(null,args);}});process();});},length:function(){return tasks.length;},running:function(){return working;}};return cargo;};var _console_fn=function(name){return function(fn){var args=Array.prototype.slice.call(arguments,1);fn.apply(null,args.concat([function(err){var args=Array.prototype.slice.call(arguments,1);if(typeof console!=='undefined'){if(err){if(console.error){console.error(err);}}
2180else if(console[name]){_each(args,function(x){console[name](x);});}}}]));};};async.log=_console_fn('log');async.dir=_console_fn('dir');async.memoize=function(fn,hasher){var memo={};var queues={};hasher=hasher||function(x){return x;};var memoized=function(){var args=Array.prototype.slice.call(arguments);var callback=args.pop();var key=hasher.apply(null,args);if(key in memo){callback.apply(null,memo[key]);}
2181else if(key in queues){queues[key].push(callback);}
2182else{queues[key]=[callback];fn.apply(null,args.concat([function(){memo[key]=arguments;var q=queues[key];delete queues[key];for(var i=0,l=q.length;i<l;i++){q[i].apply(null,arguments);}}]));}};memoized.memo=memo;memoized.unmemoized=fn;return memoized;};async.unmemoize=function(fn){return function(){return(fn.unmemoized||fn).apply(null,arguments);};};async.times=function(count,iterator,callback){var counter=[];for(var i=0;i<count;i++){counter.push(i);}
2183return async.map(counter,iterator,callback);};async.timesSeries=function(count,iterator,callback){var counter=[];for(var i=0;i<count;i++){counter.push(i);}
2184return async.mapSeries(counter,iterator,callback);};async.compose=function(){var fns=Array.prototype.reverse.call(arguments);return function(){var that=this;var args=Array.prototype.slice.call(arguments);var callback=args.pop();async.reduce(fns,args,function(newargs,fn,cb){fn.apply(that,newargs.concat([function(){var err=arguments[0];var nextargs=Array.prototype.slice.call(arguments,1);cb(err,nextargs);}]))},function(err,results){callback.apply(that,[err].concat(results));});};};var _applyEach=function(eachfn,fns){var go=function(){var that=this;var args=Array.prototype.slice.call(arguments);var callback=args.pop();return eachfn(fns,function(fn,cb){fn.apply(that,args.concat([cb]));},callback);};if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);return go.apply(this,args);}
2185else{return go;}};async.applyEach=doParallel(_applyEach);async.applyEachSeries=doSeries(_applyEach);async.forever=function(fn,callback){function next(err){if(err){if(callback){return callback(err);}
2186throw err;}
2187fn(next);}
2188next();};if(typeof define!=='undefined'&&define.amd){define([],function(){return async;});}
2189else if(typeof module!=='undefined'&&module.exports){module.exports=async;}
2190else{root.async=async;}}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.