﻿
function Animator(options){this.setOptions(options);var _this=this;this.timerDelegate=function(){_this.onTimerEvent()};this.subjects=[];this.subjectScopes=[];this.target=0;this.state=0;this.lastTime=null;};Animator.prototype={setOptions:function(options){this.options=Animator.applyDefaults({interval:20,duration:400,onComplete:function(){},onStep:function(){},transition:Animator.tx.easeInOut},options);},seekTo:function(to){this.seekFromTo(this.state,to);},seekFromTo:function(from,to){this.target=Math.max(0,Math.min(1,to));this.state=Math.max(0,Math.min(1,from));this.lastTime=new Date().getTime();if(!this.intervalId){this.intervalId=window.setInterval(this.timerDelegate,this.options.interval);}},jumpTo:function(to){this.target=this.state=Math.max(0,Math.min(1,to));this.propagate();},toggle:function(){this.seekTo(1-this.target);},addSubject:function(subject,scope){this.subjects[this.subjects.length]=subject;this.subjectScopes[this.subjectScopes.length]=scope;return this;},clearSubjects:function(){this.subjects=[];this.subjectScopes=[];},propagate:function(){var value=this.options.transition(this.state);for(var i=0;i<this.subjects.length;i++){if(this.subjects[i].setState){this.subjects[i].setState(value);}else{this.subjects[i].apply(this.subjectScopes[i],[value]);}}},onTimerEvent:function(){var now=new Date().getTime();var timePassed=now-this.lastTime;this.lastTime=now;var movement=(timePassed/this.options.duration)*(this.state<this.target?1:-1);if(Math.abs(movement)>=Math.abs(this.state-this.target)){this.state=this.target;}else{this.state+=movement;}
try{this.propagate();}finally{this.options.onStep.call(this);if(this.target==this.state){window.clearInterval(this.intervalId);this.intervalId=null;this.options.onComplete.call(this);}}},play:function(){this.seekFromTo(0,1)},reverse:function(){this.seekFromTo(1,0)},inspect:function(){var str="#<Animator:\n";for(var i=0;i<this.subjects.length;i++){str+=this.subjects[i].inspect();}
str+=">";return str;}}
Animator.applyDefaults=function(defaults,prefs){prefs=prefs||{};var prop,result={};for(prop in defaults)result[prop]=prefs[prop]!==undefined?prefs[prop]:defaults[prop];return result;}
Animator.makeArray=function(o){if(o==null)return[];if(!o.length)return[o];var result=[];for(var i=0;i<o.length;i++)result[i]=o[i];return result;}
Animator.camelize=function(string){var oStringList=string.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=string.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;}
Animator.apply=function(el,style,options){if(style instanceof Array){return new Animator(options).addSubject(new CSSStyleSubject(el,style[0],style[1]));}
return new Animator(options).addSubject(new CSSStyleSubject(el,style));}
Animator.makeEaseIn=function(a){return function(state){return Math.pow(state,a*2);}}
Animator.makeEaseOut=function(a){return function(state){return 1-Math.pow(1-state,a*2);}}
Animator.makeElastic=function(bounces){return function(state){state=Animator.tx.easeInOut(state);return((1-Math.cos(state*Math.PI*bounces))*(1-state))+state;}}
Animator.makeADSR=function(attackEnd,decayEnd,sustainEnd,sustainLevel){if(sustainLevel==null)sustainLevel=0.5;return function(state){if(state<attackEnd){return state/attackEnd;}
if(state<decayEnd){return 1-((state-attackEnd)/(decayEnd-attackEnd)*(1-sustainLevel));}
if(state<sustainEnd){return sustainLevel;}
return sustainLevel*(1-((state-sustainEnd)/(1-sustainEnd)));}}
Animator.makeBounce=function(bounces){var fn=Animator.makeElastic(bounces);return function(state){state=fn(state);return state<=1?state:2-state;}}
Animator.tx={easeInOut:function(pos){return((-Math.cos(pos*Math.PI)/2)+0.5);},linear:function(x){return x;},easeIn:Animator.makeEaseIn(1.5),easeOut:Animator.makeEaseOut(1.5),strongEaseIn:Animator.makeEaseIn(2.5),strongEaseOut:Animator.makeEaseOut(2.5),elastic:Animator.makeElastic(1),veryElastic:Animator.makeElastic(3),bouncy:Animator.makeBounce(1),veryBouncy:Animator.makeBounce(3)}
function NumericalStyleSubject(els,property,from,to,units){this.els=Animator.makeArray(els);if(property=='opacity'&&window.ActiveXObject){this.property='filter';}else{this.property=Animator.camelize(property);}
this.from=parseFloat(from);this.to=parseFloat(to);this.units=units!=null?units:'px';}
NumericalStyleSubject.prototype={setState:function(state){var style=this.getStyle(state);var visibility=(this.property=='opacity'&&state==0)?'hidden':'';var j=0;for(var i=0;i<this.els.length;i++){try{this.els[i].style[this.property]=style;}catch(e){if(this.property!='fontWeight')throw e;}
if(j++>20)return;}},getStyle:function(state){state=this.from+((this.to-this.from)*state);if(this.property=='filter')return"alpha(opacity="+Math.round(state*100)+")";if(this.property=='opacity')return state;return Math.round(state)+this.units;},inspect:function(){return"\t"+this.property+"("+this.from+this.units+" to "+this.to+this.units+")\n";}}
function ColorStyleSubject(els,property,from,to){this.els=Animator.makeArray(els);this.property=Animator.camelize(property);this.to=this.expandColor(to);this.from=this.expandColor(from);this.origFrom=from;this.origTo=to;}
ColorStyleSubject.prototype={expandColor:function(color){var hexColor,red,green,blue;hexColor=ColorStyleSubject.parseColor(color);if(hexColor){red=parseInt(hexColor.slice(1,3),16);green=parseInt(hexColor.slice(3,5),16);blue=parseInt(hexColor.slice(5,7),16);return[red,green,blue]}
if(window.DEBUG){alert("Invalid colour: '"+color+"'");}},getValueForState:function(color,state){return Math.round(this.from[color]+((this.to[color]-this.from[color])*state));},setState:function(state){var color='#'
+ColorStyleSubject.toColorPart(this.getValueForState(0,state))
+ColorStyleSubject.toColorPart(this.getValueForState(1,state))
+ColorStyleSubject.toColorPart(this.getValueForState(2,state));for(var i=0;i<this.els.length;i++){this.els[i].style[this.property]=color;}},inspect:function(){return"\t"+this.property+"("+this.origFrom+" to "+this.origTo+")\n";}}
ColorStyleSubject.parseColor=function(string){var color='#',match;if(match=ColorStyleSubject.parseColor.rgbRe.exec(string)){var part;for(var i=1;i<=3;i++){part=Math.max(0,Math.min(255,parseInt(match[i])));color+=ColorStyleSubject.toColorPart(part);}
return color;}
if(match=ColorStyleSubject.parseColor.hexRe.exec(string)){if(match[1].length==3){for(var i=0;i<3;i++){color+=match[1].charAt(i)+match[1].charAt(i);}
return color;}
return'#'+match[1];}
return false;}
ColorStyleSubject.toColorPart=function(number){if(number>255)number=255;var digits=number.toString(16);if(number<16)return'0'+digits;return digits;}
ColorStyleSubject.parseColor.rgbRe=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;ColorStyleSubject.parseColor.hexRe=/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function DiscreteStyleSubject(els,property,from,to,threshold){this.els=Animator.makeArray(els);this.property=Animator.camelize(property);this.from=from;this.to=to;this.threshold=threshold||0.5;}
DiscreteStyleSubject.prototype={setState:function(state){var j=0;for(var i=0;i<this.els.length;i++){this.els[i].style[this.property]=state<=this.threshold?this.from:this.to;}},inspect:function(){return"\t"+this.property+"("+this.from+" to "+this.to+" @ "+this.threshold+")\n";}}
function CSSStyleSubject(els,style1,style2){els=Animator.makeArray(els);this.subjects=[];if(els.length==0)return;var prop,toStyle,fromStyle;if(style2){fromStyle=this.parseStyle(style1,els[0]);toStyle=this.parseStyle(style2,els[0]);}else{toStyle=this.parseStyle(style1,els[0]);fromStyle={};for(prop in toStyle){fromStyle[prop]=CSSStyleSubject.getStyle(els[0],prop);}}
var prop;for(prop in fromStyle){if(fromStyle[prop]==toStyle[prop]){delete fromStyle[prop];delete toStyle[prop];}}
var prop,units,match,type,from,to;for(prop in fromStyle){var fromProp=String(fromStyle[prop]);var toProp=String(toStyle[prop]);if(toStyle[prop]==null){if(window.DEBUG)alert("No to style provided for '"+prop+'"');continue;}
if(from=ColorStyleSubject.parseColor(fromProp)){to=ColorStyleSubject.parseColor(toProp);type=ColorStyleSubject;}else if(fromProp.match(CSSStyleSubject.numericalRe)&&toProp.match(CSSStyleSubject.numericalRe)){from=parseFloat(fromProp);to=parseFloat(toProp);type=NumericalStyleSubject;match=CSSStyleSubject.numericalRe.exec(fromProp);var reResult=CSSStyleSubject.numericalRe.exec(toProp);if(match[1]!=null){units=match[1];}else if(reResult[1]!=null){units=reResult[1];}else{units=reResult;}}else if(fromProp.match(CSSStyleSubject.discreteRe)&&toProp.match(CSSStyleSubject.discreteRe)){from=fromProp;to=toProp;type=DiscreteStyleSubject;units=0;}else{if(window.DEBUG){alert("Unrecognised format for value of "
+prop+": '"+fromStyle[prop]+"'");}
continue;}
this.subjects[this.subjects.length]=new type(els,prop,from,to,units);}}
CSSStyleSubject.prototype={parseStyle:function(style,el){var rtn={};if(style.indexOf(":")!=-1){var styles=style.split(";");for(var i=0;i<styles.length;i++){var parts=CSSStyleSubject.ruleRe.exec(styles[i]);if(parts){rtn[parts[1]]=parts[2];}}}
else{var prop,value,oldClass;oldClass=el.className;el.className=style;for(var i=0;i<CSSStyleSubject.cssProperties.length;i++){prop=CSSStyleSubject.cssProperties[i];value=CSSStyleSubject.getStyle(el,prop);if(value!=null){rtn[prop]=value;}}
el.className=oldClass;}
return rtn;},setState:function(state){for(var i=0;i<this.subjects.length;i++){this.subjects[i].setState(state);}},inspect:function(){var str="";for(var i=0;i<this.subjects.length;i++){str+=this.subjects[i].inspect();}
return str;}}
CSSStyleSubject.getStyle=function(el,property){var style;if(document.defaultView&&document.defaultView.getComputedStyle){style=document.defaultView.getComputedStyle(el,"").getPropertyValue(property);if(style){return style;}}
property=Animator.camelize(property);if(el.currentStyle){style=el.currentStyle[property];}
return style||el.style[property]}
CSSStyleSubject.ruleRe=/^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;CSSStyleSubject.numericalRe=/^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;CSSStyleSubject.discreteRe=/^\w+$/;CSSStyleSubject.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','opacity','outline-offset','overflow-x','overflow-y'];function AnimatorChain(animators,options){this.animators=animators;this.setOptions(options);for(var i=0;i<this.animators.length;i++){this.listenTo(this.animators[i]);}
this.forwards=false;this.current=0;}
AnimatorChain.prototype={setOptions:function(options){this.options=Animator.applyDefaults({resetOnPlay:true},options);},play:function(){this.forwards=true;this.current=-1;if(this.options.resetOnPlay){for(var i=0;i<this.animators.length;i++){this.animators[i].jumpTo(0);}}
this.advance();},reverse:function(){this.forwards=false;this.current=this.animators.length;if(this.options.resetOnPlay){for(var i=0;i<this.animators.length;i++){this.animators[i].jumpTo(1);}}
this.advance();},toggle:function(){if(this.forwards){this.seekTo(0);}else{this.seekTo(1);}},listenTo:function(animator){var oldOnComplete=animator.options.onComplete;var _this=this;animator.options.onComplete=function(){if(oldOnComplete)oldOnComplete.call(animator);_this.advance();}},advance:function(){if(this.forwards){if(this.animators[this.current+1]==null)return;this.current++;this.animators[this.current].play();}else{if(this.animators[this.current-1]==null)return;this.current--;this.animators[this.current].reverse();}},seekTo:function(target){if(target<=0){this.forwards=false;this.animators[this.current].seekTo(0);}else{this.forwards=true;this.animators[this.current].seekTo(1);}}}
function Accordion(options){this.setOptions(options);var selected=this.options.initialSection,current;if(this.options.rememberance){current=document.location.hash.substring(1);}
this.rememberanceTexts=[];this.ans=[];var _this=this;for(var i=0;i<this.options.sections.length;i++){var el=this.options.sections[i];var an=new Animator(this.options.animatorOptions);var from=this.options.from+(this.options.shift*i);var to=this.options.to+(this.options.shift*i);an.addSubject(new NumericalStyleSubject(el,this.options.property,from,to,this.options.units));an.jumpTo(0);var activator=this.options.getActivator(el);activator.index=i;activator.onclick=function(){_this.show(this.index)};this.ans[this.ans.length]=an;this.rememberanceTexts[i]=activator.innerHTML.replace(/\s/g,"");if(this.rememberanceTexts[i]===current){selected=i;}}
this.show(selected);}
Accordion.prototype={setOptions:function(options){this.options=Object.extend({sections:null,getActivator:function(el){return document.getElementById(el.getAttribute("activator"))},shift:0,initialSection:0,rememberance:true,animatorOptions:{}},options||{});},show:function(section){for(var i=0;i<this.ans.length;i++){this.ans[i].seekTo(i>section?1:0);}
if(this.options.rememberance){document.location.hash=this.rememberanceTexts[section];}}}
var soundManager=null;function SoundManager(smURL,smID){this.flashVersion=8;this.debugMode=true;this.debugFlash=false;this.useConsole=true;this.consoleOnly=false;this.waitForWindowLoad=false;this.nullURL='null.mp3';this.allowPolling=true;this.useFastPolling=false;this.useMovieStar=false;this.bgColor='#ffffff';this.useHighPerformance=false;this.flashLoadTimeout=1000;this.wmode=null;this.allowFullScreen=true;this.allowScriptAccess='always';this.defaultOptions={'autoLoad':false,'stream':true,'autoPlay':false,'onid3':null,'onload':null,'whileloading':null,'onplay':null,'onpause':null,'onresume':null,'whileplaying':null,'onstop':null,'onfinish':null,'onbeforefinish':null,'onbeforefinishtime':5000,'onbeforefinishcomplete':null,'onjustbeforefinish':null,'onjustbeforefinishtime':200,'multiShot':true,'multiShotEvents':false,'position':null,'pan':0,'volume':100};this.flash9Options={'isMovieStar':null,'usePeakData':false,'useWaveformData':false,'useEQData':false,'onbufferchange':null,'ondataerror':null};this.movieStarOptions={'onmetadata':null,'useVideo':false,'bufferTime':null};var SMSound=null;var _s=this;var _sm='soundManager';this.version=null;this.versionNumber='V2.95b.20100101';this.movieURL=null;this.url=null;this.altURL=null;this.swfLoaded=false;this.enabled=false;this.o=null;this.id=(smID||'sm2movie');this.oMC=null;this.sounds={};this.soundIDs=[];this.muted=false;this.isFullScreen=false;this.isIE=(navigator.userAgent.match(/MSIE/i));this.isSafari=(navigator.userAgent.match(/safari/i));this.debugID='soundmanager-debug';this.debugURLParam=/([#?&])debug=1/i;this.specialWmodeCase=false;this._onready=[];this._debugOpen=true;this._didAppend=false;this._appendSuccess=false;this._didInit=false;this._disabled=false;this._windowLoaded=false;this._hasConsole=(typeof console!='undefined'&&typeof console.log!='undefined');this._debugLevels=['log','info','warn','error'];this._defaultFlashVersion=8;this._oRemoved=null;this._oRemovedHTML=null;var _$=function(sID){return document.getElementById(sID);};this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.netStreamTypes=['aac','flv','mov','mp4','m4v','f4v','m4a','mp4v','3gp','3g2'];this.netStreamPattern=new RegExp('\\.('+this.netStreamTypes.join('|')+')(\\?.*)?$','i');this.filePattern=null;this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={'type':null,'types':{'remote':'remote (domain-based) rules','localWithFile':'local with file access (no internet access)','localWithNetwork':'local with network (internet access only, no local access)','localTrusted':'local, trusted (local+internet access)'},'description':null,'noRemote':null,'noLocal':null};this._setVersionInfo=function(){if(_s.flashVersion!=8&&_s.flashVersion!=9){alert(_s._str('badFV',_s.flashVersion,_s._defaultFlashVersion));_s.flashVersion=_s._defaultFlashVersion;}
_s.version=_s.versionNumber+(_s.flashVersion==9?' (AS3/Flash 9)':' (AS2/Flash 8)');if(_s.flashVersion>8){_s.defaultOptions=_s._mergeObjects(_s.defaultOptions,_s.flash9Options);_s.features.buffering=true;}
if(_s.flashVersion>8&&_s.useMovieStar){_s.defaultOptions=_s._mergeObjects(_s.defaultOptions,_s.movieStarOptions);_s.filePatterns.flash9=new RegExp('\\.(mp3|'+_s.netStreamTypes.join('|')+')(\\?.*)?$','i');_s.features.movieStar=true;}else{_s.useMovieStar=false;_s.features.movieStar=false;}
_s.filePattern=_s.filePatterns[(_s.flashVersion!=8?'flash9':'flash8')];_s.movieURL=(_s.flashVersion==8?'soundmanager2.swf':'soundmanager2_flash9.swf');_s.features.peakData=_s.features.waveformData=_s.features.eqData=(_s.flashVersion>8);};this._overHTTP=(document.location?document.location.protocol.match(/http/i):null);this._waitingforEI=false;this._initPending=false;this._tryInitOnFocus=(this.isSafari&&typeof document.hasFocus=='undefined');this._isFocused=(typeof document.hasFocus!='undefined'?document.hasFocus():null);this._okToDisable=!this._tryInitOnFocus;this.useAltURL=!this._overHTTP;var flashCPLink='http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html';this.strings={notReady:'Not loaded yet - wait for soundManager.onload() before calling sound-related methods',appXHTML:_sm+'_createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.',swf404:_sm+': Verify that %s is a valid path.',tryDebug:'Try '+_sm+'.debugFlash = true for more security details (output goes to SWF.)',checkSWF:'See SWF output for more debug info.',localFail:_sm+': Non-HTTP page ('+document.location.protocol+' URL?) Review Flash player security settings for this special case:\n'+flashCPLink+'\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',waitFocus:_sm+': Special case: Waiting for focus-related event..',waitImpatient:_sm+': Getting impatient, still waiting for Flash%s...',waitForever:_sm+': Waiting indefinitely for Flash...',needFunction:_sm+'.onready(): Function object expected',badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',fl9Vid:'flash 9 required for video. Exiting.',noMS:'MovieStar mode not enabled. Exiting.',spcWmode:_sm+'._createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue',currentObj:'--- '+_sm+'._debug(): Current sound objects ---',waitEI:_sm+'._initMovie(): Waiting for ExternalInterface call from Flash..',waitOnload:_sm+': Waiting for window.onload()',docLoaded:_sm+': Document already loaded',onload:_sm+'.initComplete(): calling soundManager.onload()',onloadOK:_sm+'.onload() complete',init:'-- '+_sm+'.init() --',didInit:_sm+'.init(): Already called?',flashJS:_sm+': Attempting to call Flash from JS..',noPolling:_sm+': Polling (whileloading()/whileplaying() support) is disabled.',secNote:'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',badRemove:'Warning: Failed to remove flash movie.',peakWave:'Warning: peak/waveform/eqData features unsupported for non-MP3 formats',shutdown:_sm+'.disable(): Shutting down',queue:_sm+'.onready(): Queueing handler',smFail:_sm+': Failed to initialise.',smError:'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',manURL:'SMSound.load(): Using manually-assigned URL',onURL:_sm+'.load(): current URL already assigned.',badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.'};this._str=function(){var params=Array.prototype.slice.call(arguments);var o=params.shift();var str=_s.strings&&_s.strings[o]?_s.strings[o]:'';if(str&&params&&params.length){for(var i=0,j=params.length;i<j;i++){str=str.replace('%s',params[i]);}}
return str;};this.supported=function(){return(_s._didInit&&!_s._disabled);};this.getMovie=function(smID){return _s.isIE?window[smID]:(_s.isSafari?_$(smID)||document[smID]:_$(smID));};this.loadFromXML=function(sXmlUrl){try{_s.o._loadFromXML(sXmlUrl);}catch(e){_s._failSafely();return true;}};this.createSound=function(oOptions){var _cs='soundManager.createSound(): ';if(!_s._didInit){throw _s._complain(_cs+_s._str('notReady'),arguments.callee.caller);}
if(arguments.length==2){oOptions={'id':arguments[0],'url':arguments[1]};}
var thisOptions=_s._mergeObjects(oOptions);var _tO=thisOptions;if(_tO.id.toString().charAt(0).match(/^[0-9]$/)){_s._wD(_cs+_s._str('badID',_tO.id),2);}
_s._wD(_cs+_tO.id+' ('+_tO.url+')',1);if(_s._idCheck(_tO.id,true)){_s._wD(_cs+_tO.id+' exists',1);return _s.sounds[_tO.id];}
if(_s.flashVersion>8&&_s.useMovieStar){if(_tO.isMovieStar===null){_tO.isMovieStar=(_tO.url.match(_s.netStreamPattern)?true:false);}
if(_tO.isMovieStar){_s._wD(_cs+'using MovieStar handling');}
if(_tO.isMovieStar&&(_tO.usePeakData||_tO.useWaveformData||_tO.useEQData)){_s._wDS('peakWave');_tO.usePeakData=false;_tO.useWaveformData=false;_tO.useEQData=false;}}
_s.sounds[_tO.id]=new SMSound(_tO);_s.soundIDs[_s.soundIDs.length]=_tO.id;if(_s.flashVersion==8){_s.o._createSound(_tO.id,_tO.onjustbeforefinishtime);}else{_s.o._createSound(_tO.id,_tO.url,_tO.onjustbeforefinishtime,_tO.usePeakData,_tO.useWaveformData,_tO.useEQData,_tO.isMovieStar,(_tO.isMovieStar?_tO.useVideo:false),(_tO.isMovieStar?_tO.bufferTime:false));}
if(_tO.autoLoad||_tO.autoPlay){if(_s.sounds[_tO.id]){_s.sounds[_tO.id].load(_tO);}}
if(_tO.autoPlay){_s.sounds[_tO.id].play();}
return _s.sounds[_tO.id];};this.createVideo=function(oOptions){var fN='soundManager.createVideo(): ';if(arguments.length==2){oOptions={'id':arguments[0],'url':arguments[1]};}
if(_s.flashVersion>=9){oOptions.isMovieStar=true;oOptions.useVideo=true;}else{_s._wD(fN+_s._str('f9Vid'),2);return false;}
if(!_s.useMovieStar){_s._wD(fN+_s._str('noMS'),2);}
return _s.createSound(oOptions);};this.destroySound=function(sID,bFromSound){if(!_s._idCheck(sID)){return false;}
for(var i=0;i<_s.soundIDs.length;i++){if(_s.soundIDs[i]==sID){_s.soundIDs.splice(i,1);continue;}}
_s.sounds[sID].unload();if(!bFromSound){_s.sounds[sID].destruct();}
delete _s.sounds[sID];};this.destroyVideo=this.destroySound;this.load=function(sID,oOptions){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].load(oOptions);};this.unload=function(sID){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].unload();};this.play=function(sID,oOptions){var fN='soundManager.play(): ';if(!_s._didInit){throw _s._complain(fN+_s._str('notReady'),arguments.callee.caller);}
if(!_s._idCheck(sID)){if(typeof oOptions!='Object'){oOptions={url:oOptions};}
if(oOptions&&oOptions.url){_s._wD(fN+'attempting to create "'+sID+'"',1);oOptions.id=sID;_s.createSound(oOptions);}else{return false;}}
_s.sounds[sID].play(oOptions);};this.start=this.play;this.setPosition=function(sID,nMsecOffset){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].setPosition(nMsecOffset);};this.stop=function(sID){if(!_s._idCheck(sID)){return false;}
_s._wD('soundManager.stop('+sID+')',1);_s.sounds[sID].stop();};this.stopAll=function(){_s._wD('soundManager.stopAll()',1);for(var oSound in _s.sounds){if(_s.sounds[oSound]instanceof SMSound){_s.sounds[oSound].stop();}}};this.pause=function(sID){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].pause();};this.pauseAll=function(){for(var i=_s.soundIDs.length;i--;){_s.sounds[_s.soundIDs[i]].pause();}};this.resume=function(sID){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].resume();};this.resumeAll=function(){for(var i=_s.soundIDs.length;i--;){_s.sounds[_s.soundIDs[i]].resume();}};this.togglePause=function(sID){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].togglePause();};this.setPan=function(sID,nPan){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].setPan(nPan);};this.setVolume=function(sID,nVol){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].setVolume(nVol);};this.mute=function(sID){var fN='soundManager.mute(): ';if(typeof sID!='string'){sID=null;}
if(!sID){_s._wD(fN+'Muting all sounds');for(var i=_s.soundIDs.length;i--;){_s.sounds[_s.soundIDs[i]].mute();}
_s.muted=true;}else{if(!_s._idCheck(sID)){return false;}
_s._wD(fN+'Muting "'+sID+'"');_s.sounds[sID].mute();}};this.muteAll=function(){_s.mute();};this.unmute=function(sID){var fN='soundManager.unmute(): ';if(typeof sID!='string'){sID=null;}
if(!sID){_s._wD(fN+'Unmuting all sounds');for(var i=_s.soundIDs.length;i--;){_s.sounds[_s.soundIDs[i]].unmute();}
_s.muted=false;}else{if(!_s._idCheck(sID)){return false;}
_s._wD(fN+'Unmuting "'+sID+'"');_s.sounds[sID].unmute();}};this.unmuteAll=function(){_s.unmute();};this.toggleMute=function(sID){if(!_s._idCheck(sID)){return false;}
_s.sounds[sID].toggleMute();};this.getMemoryUse=function(){if(_s.flashVersion==8){return 0;}
if(_s.o){return parseInt(_s.o._getMemoryUse(),10);}};this.disable=function(bNoDisable){if(typeof bNoDisable=='undefined'){bNoDisable=false;}
if(_s._disabled){return false;}
_s._disabled=true;_s._wDS('shutdown',1);for(var i=_s.soundIDs.length;i--;){_s._disableObject(_s.sounds[_s.soundIDs[i]]);}
_s.initComplete(bNoDisable);};this.canPlayURL=function(sURL){return(sURL?(sURL.match(_s.filePattern)?true:false):null);};this.getSoundById=function(sID,suppressDebug){if(!sID){throw new Error('SoundManager.getSoundById(): sID is null/undefined');}
var result=_s.sounds[sID];if(!result&&!suppressDebug){_s._wD('"'+sID+'" is an invalid sound ID.',2);}
return result;};this.onready=function(oMethod,oScope){if(oMethod&&oMethod instanceof Function){if(_s._didInit){_s._wDS('queue');}
if(!oScope){oScope=window;}
_s._addOnReady(oMethod,oScope);_s._processOnReady();return true;}else{throw _s._str('needFunction');}};this.oninitmovie=function(){};this.onload=function(){soundManager._wD('soundManager.onload()',1);};this.onerror=function(){};this._idCheck=this.getSoundById;this._complain=function(sMsg,oCaller){var sPre='Error: ';if(!oCaller){return new Error(sPre+sMsg);}
var e=new Error('');var stackMsg=null;if(e.stack){try{var splitChar='@';var stackTmp=e.stack.split(splitChar);stackMsg=stackTmp[4];}catch(ee){stackMsg=e.stack;}}
if(typeof console!='undefined'&&typeof console.trace!='undefined'){console.trace();}
var errorDesc=sPre+sMsg+'. \nCaller: '+oCaller.toString()+(e.stack?' \nTop of stacktrace: '+stackMsg:(e.message?' \nMessage: '+e.message:''));return new Error(errorDesc);};var _doNothing=function(){return false;};_doNothing._protected=true;this._disableObject=function(o){for(var oProp in o){if(typeof o[oProp]=='function'&&typeof o[oProp]._protected=='undefined'){o[oProp]=_doNothing;}}
oProp=null;};this._failSafely=function(bNoDisable){if(typeof bNoDisable=='undefined'){bNoDisable=false;}
if(!_s._disabled||bNoDisable){_s._wDS('smFail',2);_s.disable(bNoDisable);}};this._normalizeMovieURL=function(smURL){var urlParams=null;if(smURL){if(smURL.match(/\.swf(\?.*)?$/i)){urlParams=smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?')+4);if(urlParams){return smURL;}}else if(smURL.lastIndexOf('/')!=smURL.length-1){smURL=smURL+'/';}}
return(smURL&&smURL.lastIndexOf('/')!=-1?smURL.substr(0,smURL.lastIndexOf('/')+1):'./')+_s.movieURL;};this._getDocument=function(){return(document.body?document.body:(document.documentElement?document.documentElement:document.getElementsByTagName('div')[0]));};this._getDocument._protected=true;this._setPolling=function(bPolling,bHighPerformance){if(!_s.o||!_s.allowPolling){return false;}
_s.o._setPolling(bPolling,bHighPerformance);};this._createMovie=function(smID,smURL){var specialCase=null;var remoteURL=(smURL?smURL:_s.url);var localURL=(_s.altURL?_s.altURL:remoteURL);if(_s.debugURLParam.test(window.location.href.toString())){_s.debugMode=true;}
if(_s._didAppend&&_s._appendSuccess){return false;}
_s._didAppend=true;_s._setVersionInfo();_s.url=_s._normalizeMovieURL(_s._overHTTP?remoteURL:localURL);smURL=_s.url;if(_s.useHighPerformance&&_s.useMovieStar&&_s.defaultOptions.useVideo===true){specialCase='soundManager note: disabling highPerformance, not applicable with movieStar mode+useVideo';_s.useHighPerformance=false;}
_s.wmode=(!_s.wmode&&_s.useHighPerformance&&!_s.useMovieStar?'transparent':_s.wmode);if(_s.wmode!==null&&_s.flashLoadTimeout!==0&&(!_s.useHighPerformance||_s.debugFlash)&&!_s.isIE&&navigator.platform.match(/win32/i)){_s.specialWmodeCase=true;_s._wDS('spcWmode');_s.wmode=null;}
if(_s.flashVersion==8){_s.allowFullScreen=false;}
var oEmbed={name:smID,id:smID,src:smURL,width:'100%',height:'100%',quality:'high',allowScriptAccess:_s.allowScriptAccess,bgcolor:_s.bgColor,pluginspage:'http://www.macromedia.com/go/getflashplayer',type:'application/x-shockwave-flash',wmode:_s.wmode,allowfullscreen:(_s.allowFullScreen?'true':'false')};if(_s.debugFlash){oEmbed.FlashVars='debug=1';}
if(!_s.wmode){delete oEmbed.wmode;}
var oMovie=null;var tmp=null;var movieHTML=null;var oEl=null;if(_s.isIE){oMovie=document.createElement('div');movieHTML='<object id="'+smID+'" data="'+smURL+'" type="'+oEmbed.type+'" width="'+oEmbed.width+'" height="'+oEmbed.height+'"><param name="movie" value="'+smURL+'" /><param name="AllowScriptAccess" value="'+_s.allowScriptAccess+'" /><param name="quality" value="'+oEmbed.quality+'" />'+(_s.wmode?'<param name="wmode" value="'+_s.wmode+'" /> ':'')+'<param name="bgcolor" value="'+_s.bgColor+'" /><param name="allowFullScreen" value="'+oEmbed.allowFullScreen+'" />'+(_s.debugFlash?'<param name="FlashVars" value="'+oEmbed.FlashVars+'" />':'')+'<!-- --></object>';}else{oMovie=document.createElement('embed');for(tmp in oEmbed){if(oEmbed.hasOwnProperty(tmp)){oMovie.setAttribute(tmp,oEmbed[tmp]);}}}
var oD=null;var oToggle=null;if(_s.debugMode){oD=document.createElement('div');oD.id=_s.debugID+'-toggle';oToggle={position:'fixed',bottom:'0px',right:'0px',width:'1.2em',height:'1.2em',lineHeight:'1.2em',margin:'2px',textAlign:'center',border:'1px solid #999',cursor:'pointer',background:'#fff',color:'#333',zIndex:10001};oD.appendChild(document.createTextNode('-'));oD.onclick=_s._toggleDebug;oD.title='Toggle SM2 debug console';if(navigator.userAgent.match(/msie 6/i)){oD.style.position='absolute';oD.style.cursor='hand';}
for(tmp in oToggle){if(oToggle.hasOwnProperty(tmp)){oD.style[tmp]=oToggle[tmp];}}}
var oTarget=_s._getDocument();if(oTarget){_s.oMC=_$('sm2-container')?_$('sm2-container'):document.createElement('div');var extraClass=(_s.debugMode?' sm2-debug':'')+(_s.debugFlash?' flash-debug':'');if(!_s.oMC.id){_s.oMC.id='sm2-container';_s.oMC.className='movieContainer'+extraClass;var s=null;oEl=null;if(_s.useHighPerformance){s={position:'fixed',width:'8px',height:'8px',bottom:'0px',left:'0px',overflow:'hidden'};}else{s={position:'absolute',width:'8px',height:'8px',top:'-9999px',left:'-9999px'};}
var x=null;if(!_s.debugFlash){for(x in s){if(s.hasOwnProperty(x)){_s.oMC.style[x]=s[x];}}}
try{if(!_s.isIE){_s.oMC.appendChild(oMovie);}
oTarget.appendChild(_s.oMC);if(_s.isIE){oEl=_s.oMC.appendChild(document.createElement('div'));oEl.className='sm2-object-box';oEl.innerHTML=movieHTML;}
_s._appendSuccess=true;}catch(e){throw new Error(_s._str('appXHTML'));}}else{if(_s.debugMode||_s.debugFlash){_s.oMC.className+=extraClass;}
_s.oMC.appendChild(oMovie);if(_s.isIE){oEl=_s.oMC.appendChild(document.createElement('div'));oEl.className='sm2-object-box';oEl.innerHTML=movieHTML;}
_s._appendSuccess=true;}
if(_s.debugMode&&!_$(_s.debugID)&&((!_s._hasConsole||!_s.useConsole)||(_s.useConsole&&_s._hasConsole&&!_s.consoleOnly))){var oDebug=document.createElement('div');oDebug.id=_s.debugID;oDebug.style.display=(_s.debugMode?'block':'none');if(_s.debugMode&&!_$(oD.id)){try{oTarget.appendChild(oD);}catch(e2){throw new Error(_s._str('appXHTML'));}
oTarget.appendChild(oDebug);}}
oTarget=null;}
if(specialCase){_s._wD(specialCase);}
_s._wD('-- SoundManager 2 '+_s.version+(_s.useMovieStar?', MovieStar mode':'')+(_s.useHighPerformance?', high performance mode, ':', ')+((_s.useFastPolling?'fast':'normal')+' polling')+(_s.wmode?', wmode: '+_s.wmode:'')+(_s.debugFlash?', flash debug mode':'')+' --',1);_s._wD('soundManager._createMovie(): Trying to load '+smURL+(!_s._overHTTP&&_s.altURL?' (alternate URL)':''),1);};this._writeDebug=function(sText,sType,bTimestamp){if(!_s.debugMode){return false;}
if(typeof bTimestamp!='undefined'&&bTimestamp){sText=sText+' | '+new Date().getTime();}
if(_s._hasConsole&&_s.useConsole){var sMethod=_s._debugLevels[sType];if(typeof console[sMethod]!='undefined'){console[sMethod](sText);}else{console.log(sText);}
if(_s.useConsoleOnly){return true;}}
var sDID='soundmanager-debug';var o=null;try{o=_$(sDID);if(!o){return false;}
var oItem=document.createElement('div');if(++_s._wdCount%2===0){oItem.className='sm2-alt';}
if(typeof sType=='undefined'){sType=0;}else{sType=parseInt(sType,10);}
oItem.appendChild(document.createTextNode(sText));if(sType){if(sType>=2){oItem.style.fontWeight='bold';}
if(sType==3){oItem.style.color='#ff3333';}}
o.insertBefore(oItem,o.firstChild);}catch(e){}
o=null;};this._writeDebug._protected=true;this._wdCount=0;this._wdCount._protected=true;this._wD=this._writeDebug;this._wDS=function(o,errorLevel){if(!o){return'';}else{return _s._wD(_s._str(o),errorLevel);}};this._wDS._protected=true;this._wDAlert=function(sText){alert(sText);};if(window.location.href.indexOf('debug=alert')+1&&_s.debugMode){_s._wD=_s._wDAlert;}
this._toggleDebug=function(){var o=_$(_s.debugID);var oT=_$(_s.debugID+'-toggle');if(!o){return false;}
if(_s._debugOpen){oT.innerHTML='+';o.style.display='none';}else{oT.innerHTML='-';o.style.display='block';}
_s._debugOpen=!_s._debugOpen;};this._toggleDebug._protected=true;this._debug=function(){_s._wDS('currentObj',1);for(var i=0,j=_s.soundIDs.length;i<j;i++){_s.sounds[_s.soundIDs[i]]._debug();}};this._debugTS=function(sEventType,bSuccess,sMessage){if(typeof sm2Debugger!='undefined'){try{sm2Debugger.handleEvent(sEventType,bSuccess,sMessage);}catch(e){}}};this._debugTS._protected=true;this._mergeObjects=function(oMain,oAdd){var o1={};for(var i in oMain){if(oMain.hasOwnProperty(i)){o1[i]=oMain[i];}}
var o2=(typeof oAdd=='undefined'?_s.defaultOptions:oAdd);for(var o in o2){if(o2.hasOwnProperty(o)&&typeof o1[o]=='undefined'){o1[o]=o2[o];}}
return o1;};this.createMovie=function(sURL){if(sURL){_s.url=sURL;}
_s._initMovie();};this.go=this.createMovie;this._initMovie=function(){if(_s.o){return false;}
_s.o=_s.getMovie(_s.id);if(!_s.o){if(!_s.oRemoved){_s._createMovie(_s.id,_s.url);}else{if(!_s.isIE){_s.oMC.appendChild(_s.oRemoved);}else{_s.oMC.innerHTML=_s.oRemovedHTML;}
_s.oRemoved=null;_s._didAppend=true;}
_s.o=_s.getMovie(_s.id);}
if(_s.o){if(_s.flashLoadTimeout>0){_s._wDS('waitEI');}}
if(typeof _s.oninitmovie=='function'){setTimeout(_s.oninitmovie,1);}};this.waitForExternalInterface=function(){if(_s._waitingForEI){return false;}
_s._waitingForEI=true;if(_s._tryInitOnFocus&&!_s._isFocused){_s._wDS('waitFocus');return false;}
if(_s.flashLoadTimeout>0){if(!_s._didInit){var p=_s.getMoviePercent();_s._wD(_s._str('waitImpatient',(p==100?' (SWF loaded)':(p>0?' (SWF '+p+'% loaded)':''))));}
setTimeout(function(){var p=_s.getMoviePercent();if(!_s._didInit){_s._wD(_sm+': No Flash response within reasonable time after document load.\nLikely causes: '+(p===null||p===0?'Loading '+_s.movieURL+' may have failed (and/or Flash '+_s.flashVersion+'+ not present?), ':'')+'Flash blocked or JS-Flash security error.'+(_s.debugFlash?' '+_s._str('checkSWF'):''),2);if(!_s._overHTTP){_s._wDS('localFail',2);if(!_s.debugFlash){_s._wDS('tryDebug',2);}}
if(p===0){_s._wD(_s._str('swf404',_s.url));}
_s._debugTS('flashtojs',false,': Timed out'+(_s._overHTTP)?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)');}
if(!_s._didInit&&_s._okToDisable){_s._failSafely(true);}},_s.flashLoadTimeout);}else if(!_s._didInit){_s._wDS('waitForever');}};this.getMoviePercent=function(){return(_s.o&&typeof _s.o.PercentLoaded!='undefined'?_s.o.PercentLoaded():null);};this.handleFocus=function(){if(_s._isFocused||!_s._tryInitOnFocus){return true;}
_s._okToDisable=true;_s._isFocused=true;_s._wD('soundManager.handleFocus()');if(_s._tryInitOnFocus){window.removeEventListener('mousemove',_s.handleFocus,false);}
_s._waitingForEI=false;setTimeout(_s.waitForExternalInterface,500);if(window.removeEventListener){window.removeEventListener('focus',_s.handleFocus,false);}else if(window.detachEvent){window.detachEvent('onfocus',_s.handleFocus);}};this.initComplete=function(bNoDisable){if(_s._didInit){return false;}
_s._didInit=true;_s._wD('-- SoundManager 2 '+(_s._disabled?'failed to load':'loaded')+' ('+(_s._disabled?'security/load error':'OK')+') --',1);if(_s._disabled||bNoDisable){_s._processOnReady();_s._debugTS('onload',false);_s.onerror.apply(window);return false;}else{_s._debugTS('onload',true);}
if(_s.waitForWindowLoad&&!_s._windowLoaded){_s._wDS('waitOnload');if(window.addEventListener){window.addEventListener('load',_s._initUserOnload,false);}else if(window.attachEvent){window.attachEvent('onload',_s._initUserOnload);}
return false;}else{if(_s.waitForWindowLoad&&_s._windowLoaded){_s._wDS('docLoaded');}
_s._initUserOnload();}};this._addOnReady=function(oMethod,oScope){_s._onready.push({'method':oMethod,'scope':(oScope||null),'fired':false});};this._processOnReady=function(){if(!_s._didInit){return false;}
var status={success:(!_s._disabled)};var queue=[];for(var i=0,j=_s._onready.length;i<j;i++){if(_s._onready[i].fired!==true){queue.push(_s._onready[i]);}}
if(queue.length){_s._wD(_sm+': Firing '+queue.length+' onready() item'+(queue.length>1?'s':''));for(i=0,j=queue.length;i<j;i++){if(queue[i].scope){queue[i].method.apply(queue[i].scope,[status]);}else{queue[i].method(status);}
queue[i].fired=true;}}};this._initUserOnload=function(){window.setTimeout(function(){_s._processOnReady();_s._wDS('onload',1);_s.onload.apply(window);_s._wDS('onloadOK',1);});};this.init=function(){_s._wDS('init');_s._initMovie();if(_s._didInit){_s._wDS('didInit');return false;}
if(window.removeEventListener){window.removeEventListener('load',_s.beginDelayedInit,false);}else if(window.detachEvent){window.detachEvent('onload',_s.beginDelayedInit);}
try{_s._wDS('flashJS');_s.o._externalInterfaceTest(false);if(!_s.allowPolling){_s._wDS('noPolling',1);}else{_s._setPolling(true,_s.useFastPolling?true:false);}
if(!_s.debugMode){_s.o._disableDebug();}
_s.enabled=true;_s._debugTS('jstoflash',true);}catch(e){_s._wD('js/flash exception: '+e.toString());_s._debugTS('jstoflash',false);_s._failSafely(true);_s.initComplete();return false;}
_s.initComplete();};this.beginDelayedInit=function(){_s._windowLoaded=true;setTimeout(_s.waitForExternalInterface,500);setTimeout(_s.beginInit,20);};this.beginInit=function(){if(_s._initPending){return false;}
_s.createMovie();_s._initMovie();_s._initPending=true;return true;};this.domContentLoaded=function(){if(document.removeEventListener){document.removeEventListener('DOMContentLoaded',_s.domContentLoaded,false);}
_s.go();};this._externalInterfaceOK=function(flashDate){if(_s.swfLoaded){return false;}
var eiTime=new Date().getTime();_s._wD('soundManager._externalInterfaceOK()'+(flashDate?' (~'+(eiTime-flashDate)+' ms)':''));_s._debugTS('swf',true);_s._debugTS('flashtojs',true);_s.swfLoaded=true;_s._tryInitOnFocus=false;if(_s.isIE){setTimeout(_s.init,100);}else{_s.init();}};this._setSandboxType=function(sandboxType){var sb=_s.sandbox;sb.type=sandboxType;sb.description=sb.types[(typeof sb.types[sandboxType]!='undefined'?sandboxType:'unknown')];_s._wD('Flash security sandbox type: '+sb.type);if(sb.type=='localWithFile'){sb.noRemote=true;sb.noLocal=false;_s._wDS('secNote',2);}else if(sb.type=='localWithNetwork'){sb.noRemote=false;sb.noLocal=true;}else if(sb.type=='localTrusted'){sb.noRemote=false;sb.noLocal=false;}};this.reboot=function(){_s._wD('soundManager.reboot()');if(_s.soundIDs.length){_s._wD('Destroying '+_s.soundIDs.length+' SMSound objects...');}
for(var i=_s.soundIDs.length;i--;){_s.sounds[_s.soundIDs[i]].destruct();}
try{if(_s.isIE){_s.oRemovedHTML=_s.o.innerHTML;}
_s.oRemoved=_s.o.parentNode.removeChild(_s.o);_s._wD('Flash movie removed.');}catch(e){_s._wDS('badRemove',2);}
_s.oRemovedHTML=null;_s.oRemoved=null;_s.enabled=false;_s._didInit=false;_s._waitingForEI=false;_s._initPending=false;_s._didAppend=false;_s._appendSuccess=false;_s._disabled=false;_s._waitingforEI=true;_s.swfLoaded=false;_s.soundIDs={};_s.sounds=[];_s.o=null;for(i=_s._onready.length;i--;){_s._onready[i].fired=false;}
_s._wD(_sm+': Rebooting...');window.setTimeout(soundManager.beginDelayedInit,20);};this.destruct=function(){_s._wD('soundManager.destruct()');_s.disable(true);};SMSound=function(oOptions){var _t=this;this.sID=oOptions.id;this.url=oOptions.url;this.options=_s._mergeObjects(oOptions);this.instanceOptions=this.options;this._iO=this.instanceOptions;this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this._debug=function(){if(_s.debugMode){var stuff=null;var msg=[];var sF=null;var sfBracket=null;var maxLength=64;for(stuff in _t.options){if(_t.options[stuff]!==null){if(_t.options[stuff]instanceof Function){sF=_t.options[stuff].toString();sF=sF.replace(/\s\s+/g,' ');sfBracket=sF.indexOf('{');msg[msg.length]=' '+stuff+': {'+sF.substr(sfBracket+1,(Math.min(Math.max(sF.indexOf('\n')-1,maxLength),maxLength))).replace(/\n/g,'')+'... }';}else{msg[msg.length]=' '+stuff+': '+_t.options[stuff];}}}
_s._wD('SMSound() merged options: {\n'+msg.join(', \n')+'\n}');}};this._debug();this.id3={};this.resetProperties=function(bLoaded){_t.bytesLoaded=null;_t.bytesTotal=null;_t.position=null;_t.duration=null;_t.durationEstimate=null;_t.loaded=false;_t.playState=0;_t.paused=false;_t.readyState=0;_t.muted=false;_t.didBeforeFinish=false;_t.didJustBeforeFinish=false;_t.isBuffering=false;_t.instanceOptions={};_t.instanceCount=0;_t.peakData={left:0,right:0};_t.waveformData={left:[],right:[]};_t.eqData=[];_t.eqData.left=[];_t.eqData.right=[];};_t.resetProperties();this.load=function(oOptions){if(typeof oOptions!='undefined'){_t._iO=_s._mergeObjects(oOptions);_t.instanceOptions=_t._iO;}else{oOptions=_t.options;_t._iO=oOptions;_t.instanceOptions=_t._iO;if(_t._lastURL&&_t._lastURL!=_t.url){_s._wDS('manURL');_t._iO.url=_t.url;_t.url=null;}}
if(typeof _t._iO.url=='undefined'){_t._iO.url=_t.url;}
_s._wD('soundManager.load(): '+_t._iO.url,1);if(_t._iO.url==_t.url&&_t.readyState!==0&&_t.readyState!=2){_s._wDS('onURL',1);return false;}
_t.url=_t._iO.url;_t._lastURL=_t._iO.url;_t.loaded=false;_t.readyState=1;_t.playState=0;try{if(_s.flashVersion==8){_s.o._load(_t.sID,_t._iO.url,_t._iO.stream,_t._iO.autoPlay,(_t._iO.whileloading?1:0));}else{_s.o._load(_t.sID,_t._iO.url,_t._iO.stream?true:false,_t._iO.autoPlay?true:false);if(_t._iO.isMovieStar&&_t._iO.autoLoad&&!_t._iO.autoPlay){_t.pause();}}}catch(e){_s._wDS('smError',2);_s._debugTS('onload',false);_s.onerror();_s.disable();}};this.unload=function(){if(_t.readyState!==0){_s._wD('SMSound.unload(): "'+_t.sID+'"');if(_t.readyState!=2){_t.setPosition(0,true);}
_s.o._unload(_t.sID,_s.nullURL);_t.resetProperties();}};this.destruct=function(){_s._wD('SMSound.destruct(): "'+_t.sID+'"');_s.o._destroySound(_t.sID);_s.destroySound(_t.sID,true);};this.play=function(oOptions){var fN='SMSound.play(): ';if(!oOptions){oOptions={};}
_t._iO=_s._mergeObjects(oOptions,_t._iO);_t._iO=_s._mergeObjects(_t._iO,_t.options);_t.instanceOptions=_t._iO;if(_t.playState==1){var allowMulti=_t._iO.multiShot;if(!allowMulti){_s._wD(fN+'"'+_t.sID+'" already playing (one-shot)',1);return false;}else{_s._wD(fN+'"'+_t.sID+'" already playing (multi-shot)',1);}}
if(!_t.loaded){if(_t.readyState===0){_s._wD(fN+'Attempting to load "'+_t.sID+'"',1);_t._iO.autoPlay=true;_t.load(_t._iO);}else if(_t.readyState==2){_s._wD(fN+'Could not load "'+_t.sID+'" - exiting',2);return false;}else{_s._wD(fN+'"'+_t.sID+'" is loading - attempting to play..',1);}}else{_s._wD(fN+'"'+_t.sID+'"');}
if(_t.paused){_t.resume();}else{_t.playState=1;if(!_t.instanceCount||_s.flashVersion>8){_t.instanceCount++;}
_t.position=(typeof _t._iO.position!='undefined'&&!isNaN(_t._iO.position)?_t._iO.position:0);if(_t._iO.onplay){_t._iO.onplay.apply(_t);}
_t.setVolume(_t._iO.volume,true);_t.setPan(_t._iO.pan,true);_s.o._start(_t.sID,_t._iO.loop||1,(_s.flashVersion==9?_t.position:_t.position/1000));}};this.start=this.play;this.stop=function(bAll){if(_t.playState==1){_t.playState=0;_t.paused=false;if(_t._iO.onstop){_t._iO.onstop.apply(_t);}
_s.o._stop(_t.sID,bAll);_t.instanceCount=0;_t._iO={};}};this.setPosition=function(nMsecOffset,bNoDebug){if(typeof nMsecOffset=='undefined'){nMsecOffset=0;}
var offset=Math.min(_t.duration,Math.max(nMsecOffset,0));_t._iO.position=offset;if(!bNoDebug){}
_s.o._setPosition(_t.sID,(_s.flashVersion==9?_t._iO.position:_t._iO.position/1000),(_t.paused||!_t.playState));};this.pause=function(){if(_t.paused||_t.playState===0){return false;}
_s._wD('SMSound.pause()');_t.paused=true;_s.o._pause(_t.sID);if(_t._iO.onpause){_t._iO.onpause.apply(_t);}};this.resume=function(){if(!_t.paused||_t.playState===0){return false;}
_s._wD('SMSound.resume()');_t.paused=false;_s.o._pause(_t.sID);if(_t._iO.onresume){_t._iO.onresume.apply(_t);}};this.togglePause=function(){_s._wD('SMSound.togglePause()');if(_t.playState===0){_t.play({position:(_s.flashVersion==9?_t.position:_t.position/1000)});return false;}
if(_t.paused){_t.resume();}else{_t.pause();}};this.setPan=function(nPan,bInstanceOnly){if(typeof nPan=='undefined'){nPan=0;}
if(typeof bInstanceOnly=='undefined'){bInstanceOnly=false;}
_s.o._setPan(_t.sID,nPan);_t._iO.pan=nPan;if(!bInstanceOnly){_t.pan=nPan;}};this.setVolume=function(nVol,bInstanceOnly){if(typeof nVol=='undefined'){nVol=100;}
if(typeof bInstanceOnly=='undefined'){bInstanceOnly=false;}
_s.o._setVolume(_t.sID,(_s.muted&&!_t.muted)||_t.muted?0:nVol);_t._iO.volume=nVol;if(!bInstanceOnly){_t.volume=nVol;}};this.mute=function(){_t.muted=true;_s.o._setVolume(_t.sID,0);};this.unmute=function(){_t.muted=false;var hasIO=typeof _t._iO.volume!='undefined';_s.o._setVolume(_t.sID,hasIO?_t._iO.volume:_t.options.volume);};this.toggleMute=function(){if(_t.muted){_t.unmute();}else{_t.mute();}};this._whileloading=function(nBytesLoaded,nBytesTotal,nDuration){if(!_t._iO.isMovieStar){_t.bytesLoaded=nBytesLoaded;_t.bytesTotal=nBytesTotal;_t.duration=Math.floor(nDuration);_t.durationEstimate=parseInt((_t.bytesTotal/_t.bytesLoaded)*_t.duration,10);if(_t.durationEstimate===undefined){_t.durationEstimate=_t.duration;}
if(_t.readyState!=3&&_t._iO.whileloading){_t._iO.whileloading.apply(_t);}}else{_t.bytesLoaded=nBytesLoaded;_t.bytesTotal=nBytesTotal;_t.duration=Math.floor(nDuration);_t.durationEstimate=_t.duration;if(_t.readyState!=3&&_t._iO.whileloading){_t._iO.whileloading.apply(_t);}}};this._onid3=function(oID3PropNames,oID3Data){_s._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var oData=[];for(var i=0,j=oID3PropNames.length;i<j;i++){oData[oID3PropNames[i]]=oID3Data[i];}
_t.id3=_s._mergeObjects(_t.id3,oData);if(_t._iO.onid3){_t._iO.onid3.apply(_t);}};this._whileplaying=function(nPosition,oPeakData,oWaveformDataLeft,oWaveformDataRight,oEQData){if(isNaN(nPosition)||nPosition===null){return false;}
if(_t.playState===0&&nPosition>0){nPosition=0;}
_t.position=nPosition;if(_s.flashVersion>8){if(_t._iO.usePeakData&&typeof oPeakData!='undefined'&&oPeakData){_t.peakData={left:oPeakData.leftPeak,right:oPeakData.rightPeak};}
if(_t._iO.useWaveformData&&typeof oWaveformDataLeft!='undefined'&&oWaveformDataLeft){_t.waveformData={left:oWaveformDataLeft.split(','),right:oWaveformDataRight.split(',')};}
if(_t._iO.useEQData){if(typeof oEQData!='undefined'&&oEQData.leftEQ){var eqLeft=oEQData.leftEQ.split(',');_t.eqData=eqLeft;_t.eqData.left=eqLeft;if(typeof oEQData.rightEQ!='undefined'&&oEQData.rightEQ){_t.eqData.right=oEQData.rightEQ.split(',');}}}}
if(_t.playState==1){if(_t.isBuffering){_t._onbufferchange(0);}
if(_t._iO.whileplaying){_t._iO.whileplaying.apply(_t);}
if(_t.loaded&&_t._iO.onbeforefinish&&_t._iO.onbeforefinishtime&&!_t.didBeforeFinish&&_t.duration-_t.position<=_t._iO.onbeforefinishtime){_s._wD('duration-position &lt;= onbeforefinishtime: '+_t.duration+' - '+_t.position+' &lt= '+_t._iO.onbeforefinishtime+' ('+(_t.duration-_t.position)+')');_t._onbeforefinish();}}};this._onload=function(bSuccess){var fN='SMSound._onload(): ';bSuccess=(bSuccess==1?true:false);_s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' loaded.':' failed to load? - '+_t.url),(bSuccess?1:2));if(!bSuccess){if(_s.sandbox.noRemote===true){_s._wD(fN+_s._str('noNet'),1);}
if(_s.sandbox.noLocal===true){_s._wD(fN+_s._str('noLocal'),1);}}
_t.loaded=bSuccess;_t.readyState=bSuccess?3:2;if(_t._iO.onload){_t._iO.onload.apply(_t);}};this._onbeforefinish=function(){if(!_t.didBeforeFinish){_t.didBeforeFinish=true;if(_t._iO.onbeforefinish){_s._wD('SMSound._onbeforefinish(): "'+_t.sID+'"');_t._iO.onbeforefinish.apply(_t);}}};this._onjustbeforefinish=function(msOffset){if(!_t.didJustBeforeFinish){_t.didJustBeforeFinish=true;if(_t._iO.onjustbeforefinish){_s._wD('SMSound._onjustbeforefinish(): "'+_t.sID+'"');_t._iO.onjustbeforefinish.apply(_t);}}};this._onfinish=function(){if(_t._iO.onbeforefinishcomplete){_t._iO.onbeforefinishcomplete.apply(_t);}
_t.didBeforeFinish=false;_t.didJustBeforeFinish=false;if(_t.instanceCount){_t.instanceCount--;if(!_t.instanceCount){_t.playState=0;_t.paused=false;_t.instanceCount=0;_t.instanceOptions={};}
if(!_t.instanceCount||_t._iO.multiShotEvents){if(_t._iO.onfinish){_s._wD('SMSound._onfinish(): "'+_t.sID+'"');_t._iO.onfinish.apply(_t);}}}else{if(_t.useVideo){}}};this._onmetadata=function(oMetaData){var fN='SMSound.onmetadata()';_s._wD(fN);if(!oMetaData.width&&!oMetaData.height){_s._wDS('noWH');oMetaData.width=320;oMetaData.height=240;}
_t.metadata=oMetaData;_t.width=oMetaData.width;_t.height=oMetaData.height;if(_t._iO.onmetadata){_s._wD(fN+': "'+_t.sID+'"');_t._iO.onmetadata.apply(_t);}
_s._wD(fN+' complete');};this._onbufferchange=function(bIsBuffering){var fN='SMSound._onbufferchange()';if(_t.playState===0){return false;}
if(bIsBuffering==_t.isBuffering){_s._wD(fN+': ignoring false default / loaded sound');return false;}
_t.isBuffering=(bIsBuffering==1?true:false);if(_t._iO.onbufferchange){_s._wD(fN+': '+bIsBuffering);_t._iO.onbufferchange.apply(_t);}};this._ondataerror=function(sError){if(_t.playState>0){_s._wD('SMSound._ondataerror(): '+sError);if(_t._iO.ondataerror){_t._iO.ondataerror.apply(_t);}}else{}};};this._onfullscreenchange=function(bFullScreen){_s._wD('onfullscreenchange(): '+bFullScreen);_s.isFullScreen=(bFullScreen==1?true:false);if(!_s.isFullScreen){try{window.focus();_s._wD('window.focus()');}catch(e){}}};if(window.addEventListener){window.addEventListener('focus',_s.handleFocus,false);window.addEventListener('load',_s.beginDelayedInit,false);window.addEventListener('unload',_s.destruct,false);if(_s._tryInitOnFocus){window.addEventListener('mousemove',_s.handleFocus,false);}}else if(window.attachEvent){window.attachEvent('onfocus',_s.handleFocus);window.attachEvent('onload',_s.beginDelayedInit);window.attachEvent('unload',_s.destruct);}else{_s._debugTS('onload',false);soundManager.onerror();soundManager.disable();}
if(document.addEventListener){document.addEventListener('DOMContentLoaded',_s.domContentLoaded,false);}}
if(typeof SM2_DEFER=='undefined'||!SM2_DEFER){soundManager=new SoundManager();}
function ThreeSixtyPlayer(){var self=this;var pl=this;var sm=soundManager;var isIE=(navigator.userAgent.match(/msie/i));var isOpera=(navigator.userAgent.match(/opera/i));var isSafari=(navigator.userAgent.match(/safari/i));var isChrome=(navigator.userAgent.match(/chrome/i));this.excludeClass='360-exclude';this.links=[];this.sounds=[];this.soundsByURL=[];this.indexByURL=[];this.lastSound=null;this.soundCount=0;this.oUITemplate=null;this.oUIImageMap=null;this.vuMeter=null;this.config={playNext:false,autoPlay:false,loadRingColor:'#ccc',playRingColor:'#000',backgroundRingColor:'#eee',segmentRingColor:'rgba(255,255,255,0.33)',segmentRingColorAlt:'rgba(0,0,0,0.1)',loadRingColorMetadata:'#ddd',playRingColorMetadata:'rgba(96,160,224,0.99)',playRingColorMetadata:'rgba(128,192,256,0.9)',circleDiameter:null,circleRadius:null,imageRoot:'/static/soundmanager2/360-player/',animDuration:500,animTransition:Animator.tx.bouncy,showHMSTime:false,scaleFont:false,useWaveformData:false,waveformDataColor:'#0099ff',waveformDataDownsample:3,waveformDataOutside:false,waveformDataConstrain:false,waveformDataLineRatio:0.64,useEQData:false,eqDataColor:'#339933',eqDataDownsample:4,eqDataOutside:true,eqDataLineRatio:0.54,usePeakData:true,peakDataColor:'#ff33ff',peakDataOutside:true,peakDataLineRatio:0.5,useAmplifier:true,fontSizeMax:null,useFavIcon:false}
this.css={sDefault:'sm2_link',sBuffering:'sm2_buffering',sPlaying:'sm2_playing',sPaused:'sm2_paused'}
this.addEventHandler=function(o,evtName,evtHandler){typeof(attachEvent)=='undefined'?o.addEventListener(evtName,evtHandler,false):o.attachEvent('on'+evtName,evtHandler);}
this.removeEventHandler=function(o,evtName,evtHandler){typeof(attachEvent)=='undefined'?o.removeEventListener(evtName,evtHandler,false):o.detachEvent('on'+evtName,evtHandler);}
this.hasClass=function(o,cStr){return(typeof(o.className)!='undefined'?o.className.match(new RegExp('(\\s|^)'+cStr+'(\\s|$)')):false);}
this.addClass=function(o,cStr){if(!o||!cStr||self.hasClass(o,cStr))return false;o.className=(o.className?o.className+' ':'')+cStr;}
this.removeClass=function(o,cStr){if(!o||!cStr||!self.hasClass(o,cStr))return false;o.className=o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),'');}
this.getElementsByClassName=function(className,tagNames,oParent){var doc=(oParent||document);var matches=[];var i,j;var nodes=[];if(typeof tagNames!='undefined'&&typeof tagNames!='string'){for(i=tagNames.length;i--;){if(!nodes||!nodes[tagNames[i]]){nodes[tagNames[i]]=doc.getElementsByTagName(tagNames[i]);}}}else if(tagNames){nodes=doc.getElementsByTagName(tagNames);}else{nodes=doc.all||doc.getElementsByTagName('*');}
if(typeof(tagNames)!='string'){for(i=tagNames.length;i--;){for(j=nodes[tagNames[i]].length;j--;){if(self.hasClass(nodes[tagNames[i]][j],className)){matches.push(nodes[tagNames[i]][j]);}}}}else{for(i=0;i<nodes.length;i++){if(self.hasClass(nodes[i],className)){matches.push(nodes[i]);}}}
return matches;}
this.getParentByNodeName=function(oChild,sParentNodeName){if(!oChild||!sParentNodeName)return false;sParentNodeName=sParentNodeName.toLowerCase();while(oChild.parentNode&&sParentNodeName!=oChild.parentNode.nodeName.toLowerCase()){oChild=oChild.parentNode;}
return(oChild.parentNode&&sParentNodeName==oChild.parentNode.nodeName.toLowerCase()?oChild.parentNode:null);}
this.getParentByClassName=function(oChild,sParentClassName){if(!oChild||!sParentClassName)return false;while(oChild.parentNode&&!self.hasClass(oChild.parentNode,sParentClassName)){oChild=oChild.parentNode;}
return(oChild.parentNode&&self.hasClass(oChild.parentNode,sParentClassName)?oChild.parentNode:null);}
this.getSoundByURL=function(sURL){return(typeof self.soundsByURL[sURL]!='undefined'?self.soundsByURL[sURL]:null);}
this.isChildOfNode=function(o,sNodeName){if(!o||!o.parentNode){return false;}
sNodeName=sNodeName.toLowerCase();do{o=o.parentNode;}while(o&&o.parentNode&&o.nodeName.toLowerCase()!=sNodeName);return(o&&o.nodeName.toLowerCase()==sNodeName?o:null);}
this.isChildOfClass=function(oChild,oClass){if(!oChild||!oClass)return false;while(oChild.parentNode&&!self.hasClass(oChild,oClass)){oChild=self.findParent(oChild);}
return(self.hasClass(oChild,oClass));}
this.findParent=function(o){if(!o||!o.parentNode)return false;o=o.parentNode;if(o.nodeType==2){while(o&&o.parentNode&&o.parentNode.nodeType==2){o=o.parentNode;}}
return o;}
this.getStyle=function(o,sProp){try{if(o.currentStyle){return o.currentStyle[sProp];}else if(window.getComputedStyle){return document.defaultView.getComputedStyle(o,null).getPropertyValue(sProp);}}catch(e){}
return null;}
this.findXY=function(obj){var curleft=0;var curtop=0;do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);return[curleft,curtop];}
this.getMouseXY=function(e){e=e?e:event;if(e.pageX||e.pageY){return[e.pageX,e.pageY];}else if(e.clientX||e.clientY){return[e.clientX+self.getScrollLeft(),e.clientY+self.getScrollTop()];}}
this.getScrollLeft=function(){return(document.body.scrollLeft+document.documentElement.scrollLeft);}
this.getScrollTop=function(){return(document.body.scrollTop+document.documentElement.scrollTop);}
this.events={play:function(){pl.removeClass(this._360data.oUIBox,this._360data.className);this._360data.className=pl.css.sPlaying;pl.addClass(this._360data.oUIBox,this._360data.className);self.fanOut(this);},stop:function(){pl.removeClass(this._360data.oUIBox,this._360data.className);this._360data.className='';self.fanIn(this);},pause:function(){pl.removeClass(this._360data.oUIBox,this._360data.className);this._360data.className=pl.css.sPaused;pl.addClass(this._360data.oUIBox,this._360data.className);},resume:function(){pl.removeClass(this._360data.oUIBox,this._360data.className);this._360data.className=pl.css.sPlaying;pl.addClass(this._360data.oUIBox,this._360data.className);},finish:function(){pl.removeClass(this._360data.oUIBox,this._360data.className);this._360data.className='';this._360data.didFinish=true;self.fanIn(this);if(pl.config.playNext){var nextLink=(pl.indexByURL[this._360data.oLink.href]+1);if(nextLink<pl.links.length){pl.handleClick({'target':pl.links[nextLink]});}}},whileloading:function(){if(this.paused){self.updatePlaying.apply(this);}},whileplaying:function(){self.updatePlaying.apply(this);this._360data.fps++;},bufferchange:function(){if(this.isBuffering){pl.addClass(this._360data.oUIBox,pl.css.sBuffering);}else{pl.removeClass(this._360data.oUIBox,pl.css.sBuffering);}}}
this.stopEvent=function(e){if(typeof e!='undefined'&&typeof e.preventDefault!='undefined'){e.preventDefault();}else if(typeof event!='undefined'&&typeof event.returnValue!='undefined'){event.returnValue=false;}
return false;}
this.getTheDamnLink=(isIE)?function(e){return(e&&e.target?e.target:window.event.srcElement);}:function(e){return e.target;}
this.handleClick=function(e){if(e.button>1){return true;}
var o=self.getTheDamnLink(e);if(o.nodeName.toLowerCase()!='a'){o=self.isChildOfNode(o,'a');if(!o)return true;}
if(!self.isChildOfClass(o,'ui360')){return true;}
var sURL=o.getAttribute('href');if(!o.href||!sm.canPlayURL(o.href)||self.hasClass(o,self.excludeClass)){if(isIE&&o.onclick){return false;}
return true;}
sm._writeDebug('handleClick()');var soundURL=(o.href);var thisSound=self.getSoundByURL(soundURL);if(thisSound){if(thisSound==self.lastSound){thisSound.togglePause();}else{thisSound.togglePause();sm._writeDebug('sound different than last sound: '+self.lastSound.sID);if(self.lastSound){self.stopSound(self.lastSound);}}}else{thisSound=sm.createSound({id:'ui360Sound'+(self.soundCount++),url:soundURL,onplay:self.events.play,onstop:self.events.stop,onpause:self.events.pause,onresume:self.events.resume,onfinish:self.events.finish,onbufferchange:self.events.bufferchange,whileloading:self.events.whileloading,whileplaying:self.events.whileplaying});var oContainer=o.parentNode;thisSound._360data={oUI360:self.getParentByClassName(o,'ui360'),oLink:o,className:self.css.sPlaying,oUIBox:self.getElementsByClassName('sm2-360ui','div',oContainer)[0],oCanvas:self.getElementsByClassName('sm2-canvas','canvas',oContainer)[0],oButton:self.getElementsByClassName('sm2-360btn','img',oContainer)[0],oTiming:self.getElementsByClassName('sm2-timing','div',oContainer)[0],oCover:self.getElementsByClassName('sm2-cover','div',oContainer)[0],lastTime:null,didFinish:null,pauseCount:0,radius:0,amplifier:(self.config.usePeakData?0.9:1),radiusMax:self.config.circleDiameter*0.175,width:0,widthMax:self.config.circleDiameter*0.4,lastValues:{bytesLoaded:0,bytesTotal:0,position:0,durationEstimate:0},animating:false,oAnim:new Animator({duration:self.config.animDuration,transition:self.config.animTransition,onComplete:function(){}}),oAnimProgress:function(nProgress){var thisSound=this;thisSound._360data.radius=parseInt(thisSound._360data.radiusMax*thisSound._360data.amplifier*nProgress);thisSound._360data.width=parseInt(thisSound._360data.widthMax*thisSound._360data.amplifier*nProgress);if(self.config.scaleFont&&self.config.fontSizeMax!=null){thisSound._360data.oTiming.style.fontSize=parseInt(Math.max(1,self.config.fontSizeMax*nProgress))+'px';thisSound._360data.oTiming.style.opacity=nProgress;}
if(thisSound.paused||thisSound.playState==0||thisSound._360data.lastValues.bytesLoaded==0||thisSound._360data.lastValues.position==0){self.updatePlaying.apply(thisSound);}},fps:0};if(typeof self.Metadata!='undefined'&&self.getElementsByClassName('metadata','div',thisSound._360data.oUI360).length){thisSound._360data.metadata=new self.Metadata(thisSound,self);}
thisSound._360data.oCover.style.width=self.config.circleDiameter+'px';thisSound._360data.oCover.style.height=self.config.circleDiameter+'px';if(self.config.scaleFont&&self.config.fontSizeMax!=null){thisSound._360data.oTiming.style.fontSize='1px';}
thisSound._360data.oAnim.addSubject(thisSound._360data.oAnimProgress,thisSound);self.refreshCoords(thisSound);self.updatePlaying.apply(thisSound);self.soundsByURL[soundURL]=thisSound;self.sounds.push(thisSound);if(self.lastSound){self.stopSound(self.lastSound);}
thisSound.play();}
self.lastSound=thisSound;if(typeof e!='undefined'&&typeof e.preventDefault!='undefined'){e.preventDefault();}else if(typeof event!='undefined'){event.returnValue=false;}
return false;}
this.fanOut=function(oSound){var thisSound=oSound;if(thisSound._360data.animating==1){return false;}
thisSound._360data.animating=0;soundManager._writeDebug('fanOut: '+thisSound.sID+': '+thisSound._360data.oLink.href);thisSound._360data.oAnim.seekTo(1);window.setTimeout(function(){thisSound._360data.animating=0;},self.config.animDuration+20);}
this.fanIn=function(oSound){var thisSound=oSound;if(thisSound._360data.animating==-1){return false;}
thisSound._360data.animating=-1;soundManager._writeDebug('fanIn: '+thisSound.sID+': '+thisSound._360data.oLink.href);thisSound._360data.oAnim.seekTo(0);window.setTimeout(function(){thisSound._360data.didFinish=false;thisSound._360data.animating=0;self.resetLastValues(thisSound);},self.config.animDuration+20);}
this.resetLastValues=function(oSound){var oData=oSound._360data;oData.lastValues.position=0;}
this.refreshCoords=function(thisSound){thisSound._360data.canvasXY=self.findXY(thisSound._360data.oCanvas);thisSound._360data.canvasMid=[self.config.circleRadius,self.config.circleRadius];thisSound._360data.canvasMidXY=[thisSound._360data.canvasXY[0]+thisSound._360data.canvasMid[0],thisSound._360data.canvasXY[1]+thisSound._360data.canvasMid[1]];}
this.stopSound=function(oSound){soundManager._writeDebug('stopSound: '+oSound.sID);soundManager.stop(oSound.sID);soundManager.unload(oSound.sID);}
this.buttonClick=function(e){var o=e?(e.target?e.target:e.srcElement):event.srcElement;self.handleClick({target:self.getParentByClassName(o,'sm2-360ui').nextSibling});return false;}
this.buttonMouseDown=function(e){document.onmousemove=function(e){self.mouseDown(e);}
self.stopEvent(e);return false;}
this.mouseDown=function(e){if(!self.lastSound){self.stopEvent(e);return false;}
var thisSound=self.lastSound;self.refreshCoords(thisSound);var oData=self.lastSound._360data;self.addClass(oData.oUIBox,'sm2_dragging');oData.pauseCount=(self.lastSound.paused?1:0);self.mmh(e?e:event);document.onmousemove=self.mmh;document.onmouseup=self.mouseUp;self.stopEvent(e);return false;}
this.mouseUp=function(e){var oData=self.lastSound._360data;self.removeClass(oData.oUIBox,'sm2_dragging');if(oData.pauseCount==0){self.lastSound.resume();}
document.onmousemove=null;document.onmouseup=null;}
var fullCircle=360;this.mmh=function(e){if(typeof e=='undefined'){var e=event;}
var oSound=self.lastSound;var coords=self.getMouseXY(e);var x=coords[0];var y=coords[1];var deltaX=x-oSound._360data.canvasMidXY[0];var deltaY=y-oSound._360data.canvasMidXY[1];var angle=Math.floor(fullCircle-(self.rad2deg(Math.atan2(deltaX,deltaY))+180));oSound.setPosition(oSound.durationEstimate*(angle/fullCircle));self.stopEvent(e);return false;}
this.drawSolidArc=function(oCanvas,color,radius,width,radians,startAngle,noClear){var x=radius;var y=radius;var canvas=oCanvas;if(canvas.getContext){var ctx=canvas.getContext('2d');}
var oCanvas=ctx;if(!noClear){self.clearCanvas(canvas);}
if(color){ctx.fillStyle=color;}else{}
oCanvas.beginPath();if(isNaN(radians)){radians=0;}
var innerRadius=radius-width;var doesntLikeZero=(isOpera||isSafari);if(!doesntLikeZero||(doesntLikeZero&&radius>0)){oCanvas.arc(0,0,radius,startAngle,radians,false);var endPoint=self.getArcEndpointCoords(innerRadius,radians);oCanvas.lineTo(endPoint.x,endPoint.y);oCanvas.arc(0,0,innerRadius,radians,startAngle,true);oCanvas.closePath();oCanvas.fill();}}
this.getArcEndpointCoords=function(radius,radians){return{x:radius*Math.cos(radians),y:radius*Math.sin(radians)};}
this.deg2rad=function(nDeg){return(nDeg*Math.PI/180);}
this.rad2deg=function(nRad){return(nRad*180/Math.PI);}
this.getTime=function(nMSec,bAsString){var nSec=Math.floor(nMSec/1000);var min=Math.floor(nSec/60);var sec=nSec-(min*60);return(bAsString?(min+':'+(sec<10?'0'+sec:sec)):{'min':min,'sec':sec});}
this.clearCanvas=function(oCanvas){var canvas=oCanvas;var ctx=null;if(canvas.getContext){ctx=canvas.getContext('2d');}
var width=canvas.offsetWidth;var height=canvas.offsetHeight;ctx.clearRect(-(width/2),-(height/2),width,height);}
var fullCircle=(isOpera||isChrome?359.9:360);this.updatePlaying=function(){if(this.bytesLoaded){this._360data.lastValues.bytesLoaded=this.bytesLoaded;this._360data.lastValues.bytesTotal=this.bytesTotal;}
if(this.position){this._360data.lastValues.position=this.position;}
if(this.durationEstimate){this._360data.lastValues.durationEstimate=this.durationEstimate;}
self.drawSolidArc(this._360data.oCanvas,self.config.backgroundRingColor,this._360data.width,this._360data.radius,self.deg2rad(fullCircle),false);self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.loadRingColorMetadata:self.config.loadRingColor),this._360data.width,this._360data.radius,self.deg2rad(fullCircle*(this._360data.lastValues.bytesLoaded/this._360data.lastValues.bytesTotal)),0,true);if(this._360data.lastValues.position!=0){self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.playRingColorMetadata:self.config.playRingColor),this._360data.width,this._360data.radius,self.deg2rad((this._360data.didFinish==1?fullCircle:fullCircle*(this._360data.lastValues.position/this._360data.lastValues.durationEstimate))),0,true);}
if(this._360data.metadata){this._360data.metadata.events.whileplaying();}
var timeNow=(self.config.showHMSTime?self.getTime(this.position,true):parseInt(this.position/1000));if(timeNow!=this._360data.lastTime){this._360data.lastTime=timeNow;this._360data.oTiming.innerHTML=timeNow;}
if(!isIE){self.updateWaveform(this);}
if(self.config.useFavIcon&&self.vuMeter){self.vuMeter.updateVU(this);}}
this.updateWaveform=function(oSound){if((!self.config.useWaveformData&&!self.config.useEQData)||(!sm.features.waveformData&&!sm.features.eqData)){return false;}
if(!oSound.waveformData.left.length&&!oSound.eqData.length&&!oSound.peakData.left){return false;}
var oCanvas=oSound._360data.oCanvas.getContext('2d');var offX=0;var offY=parseInt(self.config.circleDiameter/2);var scale=offY/2;var lineWidth=Math.floor(self.config.circleDiameter-(self.config.circleDiameter*0.175)/(self.config.circleDiameter/255));lineWidth=1;var lineHeight=1;var thisY=0;var offset=offY;if(self.config.useWaveformData){var downSample=self.config.waveformDataDownsample;downSample=Math.max(1,downSample);var dataLength=256;var sampleCount=(dataLength/downSample);var startAngle=0;var endAngle=0;var waveData=null;var innerRadius=(self.config.waveformDataOutside?1:(self.config.waveformDataConstrain?0.5:0.565));var scale=(self.config.waveformDataOutside?0.7:0.75);var perItemAngle=self.deg2rad((360/sampleCount)*self.config.waveformDataLineRatio);for(var i=0;i<dataLength;i+=downSample){startAngle=self.deg2rad(360*(i/(sampleCount)*1/downSample));endAngle=startAngle+perItemAngle;waveData=oSound.waveformData.left[i];if(waveData<0&&self.config.waveformDataConstrain){waveData=Math.abs(waveData);}
self.drawSolidArc(oSound._360data.oCanvas,self.config.waveformDataColor,oSound._360data.width*innerRadius,oSound._360data.radius*scale*1.25*waveData,endAngle,startAngle,true);}}
if(self.config.useEQData){var downSample=self.config.eqDataDownsample;var yDiff=0;downSample=Math.max(1,downSample);var eqSamples=192;var sampleCount=(eqSamples/downSample);var innerRadius=(self.config.eqDataOutside?1:0.565);var direction=(self.config.eqDataOutside?-1:1);var scale=(self.config.eqDataOutside?0.5:0.75);var startAngle=0;var endAngle=0;var perItemAngle=self.deg2rad((360/sampleCount)*self.config.eqDataLineRatio);var playedAngle=self.deg2rad((oSound._360data.didFinish==1?360:360*(oSound._360data.lastValues.position/oSound._360data.lastValues.durationEstimate)));var j=0;var iAvg=0;for(var i=0;i<eqSamples;i+=downSample){startAngle=self.deg2rad(360*(i/eqSamples));endAngle=startAngle+perItemAngle;self.drawSolidArc(oSound._360data.oCanvas,(endAngle>playedAngle?self.config.eqDataColor:self.config.playRingColor),oSound._360data.width*innerRadius,oSound._360data.radius*scale*(oSound.eqData.left[i]*direction),endAngle,startAngle,true);}}
if(self.config.usePeakData){if(!oSound._360data.animating){var nPeak=(oSound.peakData.left||oSound.peakData.right);var eqSamples=3;for(var i=0;i<eqSamples;i++){nPeak=(nPeak||oSound.eqData[i]);}
oSound._360data.amplifier=(self.config.useAmplifier?(0.9+(nPeak*0.1)):1);oSound._360data.radiusMax=self.config.circleDiameter*0.175*oSound._360data.amplifier;oSound._360data.widthMax=self.config.circleDiameter*0.4*oSound._360data.amplifier;oSound._360data.radius=parseInt(oSound._360data.radiusMax*oSound._360data.amplifier);oSound._360data.width=parseInt(oSound._360data.widthMax*oSound._360data.amplifier);}}}
this.updateWaveformOld=function(oSound){if((!self.config.useWaveformData&&!self.config.useEQData&&!self.config.usePeakData)||(!sm.features.waveformData&&!sm.features.eqData&&!sm.features.peakData)){return false;}
if(!oSound.waveformData.left.length&&!oSound.eqData.length&&!oSound.peakData.left.length){return false;}
var oCanvas=oSound._360data.oCanvas.getContext('2d');var offX=0;var offY=parseInt(self.config.circleDiameter*2/3);var scale=offY*1/3;var downSample=1;downSample=Math.max(1,downSample);var j=oSound.waveformData.left.length;var lineWidth=Math.max(1,((j*1/downSample)/self.config.circleDiameter));var lineHeight=scale*2.5;var thisY=0;var offset=offY;var rotateDeg=-90;oCanvas.rotate(self.deg2rad(rotateDeg*-1));oCanvas.translate(-self.config.circleRadius,-self.config.circleRadius);if(self.config.useWaveformData){for(var i=0;i<j;i+=downSample){thisY=offY+(oSound.waveformData.left[i]*scale);oCanvas.fillRect((i/j*(self.config.circleDiameter-lineWidth)+1),thisY,lineWidth,lineHeight);}}else{var offset=9;var yDiff=0;for(var i=0;i<128;i+=4){yDiff=oSound.eqData[i]*scale;oCanvas.fillRect(i/128*(self.config.circleDiameter-4),self.config.circleDiameter-yDiff,lineWidth*3,yDiff);}}
oCanvas.translate(self.config.circleRadius,self.config.circleRadius);oCanvas.rotate(self.deg2rad(rotateDeg));}
this.callbackCount=0;this.peakDataHistory=[];this.getUIHTML=function(){return['<canvas class="sm2-canvas" width="'+self.config.circleDiameter+'" height="'+self.config.circleDiameter+'"></canvas>',' <img src="'+self.config.imageRoot+'empty.gif" class="sm2-360btn sm2-360btn-default" style="border:none" />',' <div class="sm2-timing'+(navigator.userAgent.match(/safari/i)?' alignTweak':'')+'"></div>',' <div class="sm2-cover"></div>'];}
this.init=function(){sm._writeDebug('threeSixtyPlayer.init()');var oItems=self.getElementsByClassName('ui360','div');var oLinks=[];for(var i=0,j=oItems.length;i<j;i++){oLinks.push(oItems[i].getElementsByTagName('a')[0]);}
var foundItems=0;var oCanvas=null;var oCanvasCTX=null;var oCover=null;self.oUITemplate=document.createElement('div');self.oUITemplate.className='sm2-360ui';var oFakeUI=document.createElement('div');oFakeUI.className='ui360';var oFakeUIBox=oFakeUI.appendChild(self.oUITemplate.cloneNode(true));oFakeUI.style.position='absolute';oFakeUI.style.left='-9999px';var uiHTML=self.getUIHTML();oFakeUIBox.innerHTML=uiHTML[1]+uiHTML[2]+uiHTML[3];delete uiHTML;var oTemp=document.body.appendChild(oFakeUI);self.config.circleDiameter=parseInt(oFakeUIBox.offsetWidth);self.config.circleRadius=parseInt(self.config.circleDiameter/2);var oTiming=self.getElementsByClassName('sm2-timing','div',oTemp)[0];self.config.fontSizeMax=parseInt(self.getStyle(oTiming,'font-size'));if(isNaN(self.config.fontSizeMax)){self.config.fontSizeMax=null;}
oFakeUI.parentNode.removeChild(oFakeUI);delete oFakeUI;delete oFakeUIBox;delete oTemp;self.oUITemplate.innerHTML=self.getUIHTML().join('');for(i=0,j=oLinks.length;i<j;i++){if(sm.canPlayURL(oLinks[i].href)&&!self.hasClass(oLinks[i],self.excludeClass)){self.addClass(oLinks[i],self.css.sDefault);self.links[foundItems]=(oLinks[i]);self.indexByURL[oLinks[i].href]=foundItems;foundItems++;var oUI=oLinks[i].parentNode.insertBefore(self.oUITemplate.cloneNode(true),oLinks[i]);if(isIE&&typeof G_vmlCanvasManager!='undefined'){var o=oLinks[i].parentNode;var o2=document.createElement('canvas');o2.className='sm2-canvas';var oID='sm2_canvas_'+parseInt(Math.random()*1048576);o2.id=oID;o2.width=self.config.circleDiameter;o2.height=self.config.circleDiameter;oUI.appendChild(o2);G_vmlCanvasManager.initElement(o2);oCanvas=document.getElementById(oID);}else{oCanvas=oLinks[i].parentNode.getElementsByTagName('canvas')[0];}
oCover=self.getElementsByClassName('sm2-cover','div',oLinks[i].parentNode)[0];var oBtn=oLinks[i].parentNode.getElementsByTagName('img')[0];var oBtn=oLinks[i].parentNode.getElementsByTagName('img')[0]
self.addEventHandler(oBtn,'click',self.buttonClick);self.addEventHandler(oCover,'mousedown',self.mouseDown);oCanvasCTX=oCanvas.getContext('2d');oCanvasCTX.translate(self.config.circleRadius,self.config.circleRadius);oCanvasCTX.rotate(self.deg2rad(-90));}}
if(foundItems>0){self.addEventHandler(document,'click',self.handleClick);if(self.config.autoPlay){self.handleClick({target:self.links[0],preventDefault:function(){}});}}
sm._writeDebug('threeSixtyPlayer.init(): Found '+foundItems+' relevant items.');if(self.config.useFavIcon&&typeof this.VUMeter!='undefined'){this.vuMeter=new this.VUMeter(this);}}}
ThreeSixtyPlayer.prototype.VUMeter=function(oParent){var self=oParent;var me=this;this.vuMeterData=[];this.vuDataCanvas=null;var _head=document.getElementsByTagName('head')[0];this.setPageIcon=function(sDataURL){if(!self.config.useFavIcon||!self.config.usePeakData||!sDataURL){return false;}
var link=document.getElementById('sm2-favicon');if(link){_head.removeChild(link);link=null;}
if(!link){link=document.createElement('link');link.id='sm2-favicon';link.rel='shortcut icon';link.type='image/png';link.href=sDataURL;document.getElementsByTagName('head')[0].appendChild(link);}}
this.resetPageIcon=function(){if(!self.config.useFavIcon){return false;}
var link=document.getElementById('favicon');if(link){link.href='/favicon.ico';}}
this.updateVU=function(oSound){if(soundManager.flashVersion>=9&&self.config.useFavIcon&&self.config.usePeakData){me.setPageIcon(me.vuMeterData[parseInt(16*oSound.peakData.left)][parseInt(16*oSound.peakData.right)]);}}
this.createVUData=function(){var i=0;var j=0;var canvas=me.vuDataCanvas.getContext('2d');var vuGrad=canvas.createLinearGradient(0,16,0,0);vuGrad.addColorStop(0,'rgb(0,192,0)');vuGrad.addColorStop(0.30,'rgb(0,255,0)');vuGrad.addColorStop(0.625,'rgb(255,255,0)');vuGrad.addColorStop(0.85,'rgb(255,0,0)');var bgGrad=canvas.createLinearGradient(0,16,0,0);var outline='rgba(0,0,0,0.2)';bgGrad.addColorStop(0,outline);bgGrad.addColorStop(1,'rgba(0,0,0,0.5)');for(i=0;i<16;i++){me.vuMeterData[i]=[];}
for(var i=0;i<16;i++){for(j=0;j<16;j++){me.vuDataCanvas.setAttribute('width',16);me.vuDataCanvas.setAttribute('height',16);canvas.fillStyle=bgGrad;canvas.fillRect(0,0,7,15);canvas.fillRect(8,0,7,15);canvas.fillStyle=vuGrad;canvas.fillRect(0,15-i,7,16-(16-i));canvas.fillRect(8,15-j,7,16-(16-j));canvas.clearRect(0,3,16,1);canvas.clearRect(0,7,16,1);canvas.clearRect(0,11,16,1);me.vuMeterData[i][j]=me.vuDataCanvas.toDataURL('image/png');}}};this.testCanvas=function(){var c=document.createElement('canvas');var ctx=null;if(!c||typeof c.getContext=='undefined'){return null;}
ctx=c.getContext('2d');if(!ctx||typeof c.toDataURL!='function'){return null;}
try{var ok=c.toDataURL('image/png');}catch(e){return null;}
return c;}
this.init=function(){if(self.config.useFavIcon){me.vuDataCanvas=me.testCanvas();if(me.vuDataCanvas&&(navigator.userAgent.match(/(firefox|opera)/i))){me.createVUData();}else{self.config.useFavIcon=false;}}}
this.init();}
ThreeSixtyPlayer.prototype.Metadata=function(oSound,oParent){soundManager._wD('Metadata()');var me=this;var oBox=oSound._360data.oUI360;var o=oBox.getElementsByTagName('ul')[0];var oItems=o.getElementsByTagName('li');this.lastWPExec=0;this.refreshInterval=250;var isAlt=false;this.events={whileplaying:function(){var width=oSound._360data.width;var radius=oSound._360data.radius;var fullDuration=(oSound.durationEstimate||(me.totalTime*1000));var isAlt=null;for(var i=0,j=me.data.length;i<j;i++){isAlt=(i%2==0);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);}
var d=new Date();if(d-me.lastWPExec>me.refreshInterval){me.refresh();me.lastWPExec=d;}}}
this.refresh=function(){var index=null;var now=oSound.position;var metadata=oSound._360data.metadata.data;for(var i=0,j=metadata.length;i<j;i++){if(now>=metadata[i].startTimeMS&&now<=metadata[i].endTimeMS){index=i;break;}}
if(index!=metadata.currentItem&&index<metadata.length){oSound._360data.oLink.innerHTML=metadata.mainTitle+' <span class="metadata"><span class="sm2_divider"> | </span><span class="sm2_metadata">'+metadata[index].title+'</span></span>';metadata.currentItem=index;}}
this.totalTime=0;this.strToTime=function(sTime){var segments=sTime.split(':');var seconds=0;for(var i=segments.length;i--;){seconds+=parseInt(segments[i])*Math.pow(60,segments.length-1-i,10);}
return seconds;}
this.data=[];this.data.givenDuration=null;this.data.currentItem=null;this.data.mainTitle=oSound._360data.oLink.innerHTML;for(var i=0;i<oItems.length;i++){this.data[i]={o:null,title:oItems[i].getElementsByTagName('p')[0].innerHTML,startTime:oItems[i].getElementsByTagName('span')[0].innerHTML,startSeconds:me.strToTime(oItems[i].getElementsByTagName('span')[0].innerHTML.replace(/[()]/g,'')),duration:0,durationMS:null,startTimeMS:null,endTimeMS:null,oNote:null}}
var oDuration=oParent.getElementsByClassName('duration','div',oBox);this.data.givenDuration=(oDuration.length?me.strToTime(oDuration[0].innerHTML)*1000:0);for(i=0;i<this.data.length;i++){this.data[i].duration=parseInt(this.data[i+1]?this.data[i+1].startSeconds:(me.data.givenDuration?me.data.givenDuration:oSound.durationEstimate)/1000)-this.data[i].startSeconds;this.data[i].startTimeMS=this.data[i].startSeconds*1000;this.data[i].durationMS=this.data[i].duration*1000;this.data[i].endTimeMS=this.data[i].startTimeMS+this.data[i].durationMS;this.totalTime+=this.data[i].duration;}}
var threeSixtyPlayer=null;soundManager.debugMode=(window.location.href.match(/debug=1/i));soundManager.consoleOnly=true;soundManager.flashVersion=9;soundManager.useHighPerformance=true;if(soundManager.debugMode){var t=window.setInterval(function(){if(threeSixtyPlayer&&threeSixtyPlayer.lastSound&&threeSixtyPlayer.lastSound._360data.fps){soundManager._writeDebug('fps: ~'+threeSixtyPlayer.lastSound._360data.fps);threeSixtyPlayer.lastSound._360data.fps=0;}},1000);}
threeSixtyPlayer=new ThreeSixtyPlayer();if(threeSixtyPlayer.config.useWaveformData){soundManager.flash9Options.useWaveformData=true;}
if(threeSixtyPlayer.config.useEQData){soundManager.flash9Options.useEQData=true;}
if(threeSixtyPlayer.config.usePeakData){soundManager.flash9Options.usePeakData=true;}
soundManager.onready(function(){if(soundManager.supported()){threeSixtyPlayer.init();}});