kapp.namespace("kapp.share");kapp.share.initshare=function(){$$('.share_link').each(function(s){Event.observe(s,'click',kapp.share.Popup.bind(s));if(s.getAttribute('k_used')){Event.observe(s,'mouseover',kapp.share.smallPop.bind(s))}})};kapp.share.newPopup=function(){title=encodeURIComponent('Kosmix: '+searchParams['qtitle']);url=encodeURIComponent(window.location.href);site=kapp.search.kosmixSite=='righthealth'?'RightHealth':'Kosmix';code='<div class="before">&nbsp;</div>'+'<div class="container"><div class="container">'+'<span class="share_link"><span class="link_text">Bookmark&nbsp;/&nbsp;Share</span>&nbsp;<span class="share_close">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>'+'<div class="content">'+'<form method="post" action="/share">'+'<label for="from_email">Enter your name:</label>'+'<input type="text" name="from_name" id="from_name"/>'+'<label for="from_email">Enter your email address:</label>'+'<input type="text" name="from_email" id="from_email"/>'+'<label for="to_email">Enter up to five email addresses:</label>'+'<input type="text" name="to_email" id="share_email_box"/>'+'<div id="share_email_container"></div>'+'<label for="message">Here\'s the note you\'re sending:</label>'+'<textarea name="message" rows="7" id="email_message">Hi,\n\nI want to share this page on '+site+' with you. It\'s about \''+searchParams['qtitle']+'\'.\n\nEnjoy!</textarea>'+'<input type="submit" class="button" value="Send" id="share_send_button"/>'+'<hr/>'+'<label class="footnote">Or, select a bookmark service:</label>'+'<ul class="services">'+'<li><a href="http://del.icio.us/post? &url='+url+'&title='+title+'"><img src="/images/icons/del.icio.us.png" class="favicon" alt="Delicious"/>Delicious</a></li>'+'<li><a href="http://www.myspace.com/Modules/PostTo/Pages/?c='+url+'&t='+title+'"><img src="/images/icons/myspace.com.png" class="favicon" alt="MySpace"/>MySpace</a></li>'+'<li><a href="http://digg.com/submit?phase=2&url='+url+'&title='+title+'&bodytext=A topic guide from Kosmix about '+searchParams['qtitle']+'" title="Digg this topic"><img src="/images/icons/digg.com.png" class="favicon" alt="Digg"/>Digg</a></li>'+'<li><a href="http://www.stumbleupon.com/submit?url='+url+'&title='+title+'"><img src="/images/icons/stumbleupon.com.png" class="favicon" alt="Stumbleupon"/>Stumbleupon</a></li>'+'<li><a href="http://www.facebook.com/share.php?u='+url+'&t='+title+'"><img src="/images/icons/facebook.com.png" class="favicon" alt="Facebook"/>Facebook</a></li>'+'<li><a href="http://twitter.com/home/?status=Check out the topic guide for '+searchParams['qtitle']+' at '+url+'."><img src="/images/icons/twitter.com.png" class="favicon" alt="Twitter"/>Twitter</a></li>'+'<li><a href="http://furl.net/storeIt.jsp?t='+title+'&u='+url+'"><img src="/images/icons/furl.net.png" class="favicon" alt="Furl"/>Furl</a></li>'+'<li><a href="http://buzz.yahoo.com/article/pub/'+url+'"><img src="/images/icons/buzz.yahoo.com.png" class="favicon" alt="Yahoo! Buzz"/>Yahoo! Buzz</a></li>'+'</ul><br class="clr">'+'</form>'+'</div>'+'</div></div>'+'<div class="after">&nbsp;</div>';popper=new Element('div',{'class':'share_popup'}).update(code);popper.hook=kapp.share.hookPopEvents.bind(popper);return popper};kapp.share.hookPopEvents=function(){Event.observe(this.down('.share_close'),'click',kapp.share.closePop.bind(this));Event.observe(this.down('#share_email_box'),'keyup',kapp.share.ku_Email.bind(this.down('#share_email_box')));Event.observe(this.down('#share_email_box'),'keypress',kapp.share.kp_Email.bind(this.down('#share_email_box')));Event.observe(this.down('#share_email_box'),'blur',kapp.share.ku_Email.bind(this.down('#share_email_box')));Event.observe(this.down('form'),'submit',kapp.share.submit.bind(this));Event.observe(this.down('#share_send_button'),'click',kapp.share.submit.bind(this))};kapp.share.newSmallPopup=function(){title=encodeURIComponent('Kosmix: '+searchParams['qtitle']);url=encodeURIComponent(window.location.href);code='<div class="before">&nbsp;</div>'+'<div class="container"><div class="container">'+'<a href="/share" class="share_link"><span class="link_text">Bookmark&nbsp;/&nbsp;Share</span>&nbsp;<span class="share_icon">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>'+'<div class="content">'+'<ul class="services">'+'<li><a href="http://del.icio.us/post? &url='+url+'&title='+title+'"><img src="/images/icons/del.icio.us.png" class="favicon" alt="Delicious"/>Delicious</a></li>'+'<li><a href="http://www.myspace.com/Modules/PostTo/Pages/?c='+url+'&t='+title+'"><img src="/images/icons/myspace.com.png" class="favicon" alt="MySpace"/>MySpace</a></li>'+'<li><a href="http://digg.com/submit?phase=2&url='+url+'&title='+title+'&bodytext=A topic guide from Kosmix about '+searchParams['qtitle']+'" title="Digg this topic"><img src="/images/icons/digg.com.png" class="favicon" alt="Digg"/>Digg</a></li>'+'<li><a href="http://www.stumbleupon.com/submit?url='+url+'&title='+title+'"><img src="/images/icons/stumbleupon.com.png" class="favicon" alt="Stumbleupon"/>Stumbleupon</a></li>'+'<li><a href="http://www.facebook.com/share.php?u='+url+'&t='+title+'"><img src="/images/icons/facebook.com.png" class="favicon" alt="Facebook"/>Facebook</a></li>'+'<li><a href="http://twitter.com/home/?status=Check out the topic guide for '+searchParams['qtitle']+' at '+url+'."><img src="/images/icons/twitter.com.png" class="favicon" alt="Twitter"/>Twitter</a></li>'+'<li><a href="http://furl.net/storeIt.jsp?t='+title+'&u='+url+'"><img src="/images/icons/furl.net.png" class="favicon" alt="Furl"/>Furl</a></li>'+'<li><a href="http://buzz.yahoo.com/article/pub/'+url+'"><img src="/images/icons/buzz.yahoo.com.png" class="favicon" alt="Yahoo! Buzz"/>Yahoo! Buzz</a></li>'+'</ul><br class="clr">'+'</div>'+'</div></div>'+'<div class="after">&nbsp;</div>';popper=new Element('div',{'class':'share_popup small_popup'}).update(code);Event.observe(popper,'mouseover',kapp.share.popHover.bind(popper));Event.observe(popper,'mouseout',kapp.share.smallPopOut.bind(popper));Event.observe(popper.down('.share_link'),'click',kapp.share.Popup.bind(popper.down('.share_link')));return popper};kapp.share.submit=function(ev){$$('.error_popup').each(function(e){e.hide()});elem=this;valid=true;email_list=[];$$('#share_email_container .addy').each(function(a){if(!a.hasClassName('deleted')){email_list.push(a.getAttribute('k_email'))}});elist=email_list.join(',');if(elist==''){kapp.share.raise_error($('share_email_box'),'I don\'t see any addresses...');valid=false}from_list=$A($('from_email').value.replace(/['"<>]/g," ").split(/[\s|,|;|:]/));from='';from_list.each(function(f){if(kapp.share.validate_email(f)){from=f}});if(from==''){kapp.share.raise_error($('from_email'),'Hmm. This isn\'t a properly formed email address.');valid=false}if(valid){new Ajax.Request('/share',{method:'post',parameters:{from_email:from,to_email:elist,message:$('email_message').value,query:searchParams["qtitle"],link:$('share_link')?$('share_link').value:window.location.href,name:$('from_name').value},onSuccess:kapp.share.success.bind(elem),onFailure:kapp.share.fail.bind(elem)})}Event.stop(ev)};kapp.share.success=function(){this.down('.content').setStyle({height:this.down('.content').getDimensions().height+'px'});this.down('.content').update('<br/>Ok, we sent it!<br/><br/><input type="submit" class="button" value="Thanks" id="share_thanks_button"/>');Event.observe($('share_thanks_button'),'click',kapp.share.removePop.bind(this))};kapp.share.fail=function(){kapp.share.raise_error($('share_send_button'),'Not sure why, but your message could not be sent. Please try again later.')};kapp.share.raise_error=function(elem,message){if(!elem.err_obj){elem.err_obj=new Element('div',{'class':'error_popup'});elem.err_obj.setStyle({display:'none'});document.body.appendChild(elem.err_obj)}elem.err_obj.update('<div class="top">&nbsp;</div><div class="content">'+message+'</div><div class="bottom">&nbsp;</div><div class="arrow">&nbsp;</div>');elem.err_obj.setStyle({position:'absolute',left:elem.cumulativeOffset()[0]-141+'px',top:elem.cumulativeOffset()[1]-elem.err_obj.getDimensions().height+29+'px'});if(elem.err_obj.style.display=='none')new Effect.Appear(elem.err_obj,{duration:0.3})};kapp.share.validate_email=function(addr){if(addr.match(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/)){return true}else{return false}};kapp.share.add_email=function(addr){exists=false;$$('#share_email_container .addy').each(function(a){if(a.getAttribute('k_email')==addr){exists=true}});if(exists)return false;em_obj=new Element('div',{'class':'addy','k_email':addr,'style':'display:none;'}).update('<span class="email_delete">[x]</span>&nbsp;'+addr);Event.observe(em_obj.down('.email_delete'),'click',kapp.share.delete_email.bind(em_obj));$('share_email_container').appendChild(em_obj);new Effect.BlindDown(em_obj,{duration:0.2})};kapp.share.delete_email=function(){var elem=this;new Effect.BlindUp(elem,{duration:0.2,afterFinish:function(){elem.addClassName('deleted')}})};kapp.share.refresh_emails=function(mail_str){var emails=$A(mail_str.replace(/['"<>]/g," ").split(/[\s|,|;|:]/));$$('#share_email_container .addy').each(function(a){if(emails.indexOf(a.getAttribute('k_email'))==-1){new Effect.BlindUp(a,{duration:0.2,afterFinish:function(){a.remove()}})}});emails.each(function(a){if(kapp.share.validate_email(a))kapp.share.add_email(a)})};kapp.share.ku_Email=function(event){kapp.share.refresh_emails(this.value);if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0)){Event.stop(event);this.value+=' ';return false}};kapp.share.kp_Email=function(event){if(event.keyCode==Event.KEY_RETURN){Event.stop(event);return false}};kapp.share.closePop=function(){$$('.share_popup input').each(function(e){if(e.err_obj)e.err_obj=false});$$('.error_popup').each(function(e){e.remove()});new Effect.Fade(this,{duration:0.3})};kapp.share.removePop=function(){var elem=this;$$('.share_popup input').each(function(e){if(e.err_obj)e.err_obj=false});$$('.error_popup').each(function(e){e.remove()});new Effect.Fade(elem,{duration:0.3,afterFinish:kapp.share.destroyPop.bind(elem)})};kapp.share.destroyPop=function(){$$('.share_link').each(function(s){s.popUp=false})};kapp.share.Popup=function(ev){Event.stop(ev);if(!this.popUp)this.popUp=kapp.share.newPopup();this.popUp.setStyle({position:'absolute',width:'316px',top:(this.cumulativeOffset()[1]-13)+'px',left:(this.cumulativeOffset()[0]+this.getDimensions().width-333)+'px',display:'none'});document.body.appendChild(this.popUp);this.popUp.hook();new Effect.Appear(this.popUp,{duration:0.3})};kapp.share.smallPop=function(ev){Event.stop(ev);if(this.timeout)clearTimeout(this.timeout);if(!this.smallPop)this.smallPop=kapp.share.newSmallPopup();this.smallPop.setStyle({position:'absolute',width:'116px',top:(this.cumulativeOffset()[1]-13)+'px',left:(this.cumulativeOffset()[0]+this.getDimensions().width-183)+'px',display:'none'});document.body.appendChild(this.smallPop);new Effect.Appear(this.smallPop,{duration:0.3})};kapp.share.popHover=function(ev){if(this.timeout)clearTimeout(this.timeout)};kapp.share.smallPopOut=function(ev){this.timeout=setTimeout(kapp.share.closePop.bind(this),500)};kapp.share.initshare();var soundManager=null;function SoundManager(smURL,smID){this.flashVersion=8;this.debugMode=true;this.useConsole=true;this.consoleOnly=false;this.waitForWindowLoad=false;this.nullURL='null.mp3';this.allowPolling=true;this.useMovieStar=false;this.bgColor='#ffffff';this.useHighPerformance=false;this.flashLoadTimeout=750;this.wmode=null;this.allowFullScreen=true;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,'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;this.version=null;this.versionNumber='V2.95a.20090501';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.isGecko=(navigator.userAgent.match(/gecko/i));this.debugID='soundmanager-debug';this.specialWmodeCase=false;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('soundManager.flashVersion must be 8 or 9. "'+_s.flashVersion+'" is invalid. Reverting to '+_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:'soundManager._createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.'};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){if(!_s._didInit){throw _s._complain('soundManager.createSound(): '+_s.strings.notReady,arguments.callee.caller);}if(arguments.length==2){oOptions={'id':arguments[0],'url':arguments[1]}}var thisOptions=_s._mergeObjects(oOptions);var _tO=thisOptions;_s._wD('soundManager.createSound(): '+_tO.id+' ('+_tO.url+')',1);if(_s._idCheck(_tO.id,true)){_s._wD('soundManager.createSound(): '+_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('soundManager.createSound(): using MovieStar handling')}if(_tO.isMovieStar&&(_tO.usePeakData||_tO.useWaveformData||_tO.useEQData)){_s._wD('Warning: peak/waveform/eqData features unsupported for non-MP3 formats');_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){if(arguments.length==2){oOptions={'id':arguments[0],'url':arguments[1]}}if(_s.flashVersion>=9){oOptions.isMovieStar=true;oOptions.useVideo=true}else{_s._wD('soundManager.createVideo(): flash 9 required for video. Exiting.',2);return false}if(!_s.useMovieStar){_s._wD('soundManager.createVideo(): MovieStar mode not enabled. Exiting.',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){if(!_s._didInit){throw _s._complain('soundManager.play(): '+_s.strings.notReady,arguments.callee.caller);}if(!_s._idCheck(sID)){if(typeof oOptions!='Object'){oOptions={url:oOptions}}if(oOptions&&oOptions.url){_s._wD('soundController.play(): 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){if(typeof sID!='string'){sID=null}if(!sID){_s._wD('soundManager.mute(): 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('soundManager.mute(): Muting "'+sID+'"');_s.sounds[sID].mute()}};this.muteAll=function(){_s.mute()};this.unmute=function(sID){if(typeof sID!='string'){sID=null}if(!sID){_s._wD('soundManager.unmute(): 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('soundManager.unmute(): Unmuting "'+sID+'"');_s.sounds[sID].unmute()}};this.unmuteAll=function(){_s.unmute()};this.getMemoryUse=function(){if(_s.flashVersion==8){return 0}if(_s.o){return parseInt(_s.o._getMemoryUse(),10)}};this.setPolling=function(bPolling){if(!_s.o||!_s.allowPolling){return false}_s.o._setPolling(bPolling)};this.disable=function(bNoDisable){if(typeof bNoDisable=='undefined'){bNoDisable=false}if(_s._disabled){return false}_s._disabled=true;_s._wD('soundManager.disable(): Shutting down',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.onload=function(){soundManager._wD('Warning: soundManager.onload() is undefined.',2)};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._wD('soundManager: Failed to initialise.',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._createMovie=function(smID,smURL){if(_s._didAppend&&_s._appendSuccess){return false}if(window.location.href.indexOf('debug=1')+1){_s.debugMode=true}_s._didAppend=true;_s._setVersionInfo();var remoteURL=(smURL?smURL:_s.url);var localURL=(_s.altURL?_s.altURL:remoteURL);_s.url=_s._normalizeMovieURL(_s._overHTTP?remoteURL:localURL);smURL=_s.url;var specialCase=null;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.isIE&&navigator.platform.match(/win32/i)){_s.specialWmodeCase=true;_s._wD('soundManager note: Removing wmode, preventing off-screen SWF loading issue');_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:'always',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.wmode){delete oEmbed.wmode}var oObject={id:smID,data:smURL,type:'application/x-shockwave-flash',width:'100%',height:'100%',wmode:_s.wmode};var oMovie=null;var tmp=null;if(_s.isIE){oMovie=document.createElement('div');var movieHTML='<object id="'+smID+'" data="'+smURL+'" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="'+smURL+'" /><param name="AllowScriptAccess" value="always" /><param name="quality" value="high" />'+(_s.wmode?'<param name="wmode" value="'+_s.wmode+'" /> ':'')+'<param name="bgcolor" value="'+_s.bgColor+'" /><param name="allowFullScreen" value="'+(_s.allowFullScreen?'true':'false')+'" /><!-- --></object>'}else{oMovie=document.createElement('embed');for(tmp in oEmbed){if(oEmbed.hasOwnProperty(tmp)){oMovie.setAttribute(tmp,oEmbed[tmp])}}}var oD=document.createElement('div');oD.id=_s.debugID+'-toggle';var 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');if(!_s.oMC.id){_s.oMC.id='sm2-container';_s.oMC.className='movieContainer';var s=null;var oEl=null;if(_s.useHighPerformance){s={position:'fixed',width:'8px',height:'8px',bottom:'0px',left:'0px'}}else{s={position:'absolute',width:'1px',height:'1px',top:'-999px',left:'-999px'}}var x=null;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.strings.appXHTML);}}else{_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.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.strings.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.wmode?', wmode: '+_s.wmode:'')+' --',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';try{var 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._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._wD('--- soundManager._debug(): Current sound objects ---',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){_s._wD('soundManager._initMovie(): Got '+_s.o.nodeName+' element ('+(_s._didAppend?'created via JS':'static HTML')+')',1);if(_s.flashLoadTimeout>0){_s._wD('soundManager._initMovie(): Waiting for ExternalInterface call from Flash..')}}};this.waitForExternalInterface=function(){if(_s._waitingForEI){return false}_s._waitingForEI=true;if(_s._tryInitOnFocus&&!_s._isFocused){_s._wD('soundManager: Special case: Waiting for focus-related event..');return false}if(_s.flashLoadTimeout>0){if(!_s._didInit){_s._wD('soundManager: Getting impatient, still waiting for Flash.. ;)')}setTimeout(function(){if(!_s._didInit){_s._wD('soundManager: No Flash response within reasonable time after document load.\nPossible causes: Loading '+_s.movieURL+' failed, Flash version under '+_s.flashVersion+', no support, flash blocked or JS-Flash security error.',2);if(!_s._overHTTP){_s._wD('soundManager: Loading this page from local/network file system (not over HTTP?) Flash security likely restricting JS-Flash access. Consider adding current URL to "trusted locations" in the Flash player security settings manager at '+flashCPLink+', or simply serve this content over HTTP.',2)}_s._debugTS('flashtojs',false,': Timed out'+(_s._overHTTP)?' (Check flash security)':' (No plugin/missing SWF?)')}if(!_s._didInit&&_s._okToDisable){_s._failSafely(true)}},_s.flashLoadTimeout)}else if(!_s.didInit){_s._wD('soundManager: Waiting indefinitely for Flash...')}};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._wD('soundManager.initComplete(): calling soundManager.onerror()',1);_s._debugTS('onload',false);_s.onerror.apply(window);return false}else{_s._debugTS('onload',true)}if(_s.waitForWindowLoad&&!_s._windowLoaded){_s._wD('soundManager: Waiting for window.onload()');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._wD('soundManager: Document already loaded')}_s.initUserOnload()}};this.initUserOnload=function(){_s._wD('soundManager.initComplete(): calling soundManager.onload()',1);_s.onload.apply(window);_s._wD('soundManager.onload() complete',1)};this.init=function(){_s._wD('-- soundManager.init() --');_s._initMovie();if(_s._didInit){_s._wD('soundManager.init(): Already called?');return false}if(window.removeEventListener){window.removeEventListener('load',_s.beginDelayedInit,false)}else if(window.detachEvent){window.detachEvent('onload',_s.beginDelayedInit)}try{_s._wD('Attempting to call Flash from JS..');_s.o._externalInterfaceTest(false);if(!_s.allowPolling){_s._wD('Polling (whileloading/whileplaying support) is disabled.',1)}_s.setPolling(true);if(!_s.debugMode){_s.o._disableDebug()}_s.enabled=true;_s._debugTS('jstoflash',true)}catch(e){_s._debugTS('jstoflash',false);_s._failSafely(true);_s.initComplete();return false}_s.initComplete()};this.beginDelayedInit=function(){_s._wD('soundManager.beginDelayedInit()');_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(){_s._wD('soundManager.domContentLoaded()');if(document.removeEventListener){document.removeEventListener('DOMContentLoaded',_s.domContentLoaded,false)}_s.go()};this._externalInterfaceOK=function(){if(_s.swfLoaded){return false}_s._wD('soundManager._externalInterfaceOK()');_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._wD('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',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._wD('Warning: Failed to remove flash movie.',2)}_s.enabled=false;_s._didInit=false;_s._waitingForEI=false;_s._initPending=false;_s._didInit=false;_s._didAppend=false;_s._appendSuccess=false;_s._didInit=false;_s._disabled=false;_s._waitingforEI=true;_s.swfLoaded=false;_s.soundIDs={};_s.sounds=[];_s.o=null;_s._wD('soundManager: Rebooting...');window.setTimeout(function(){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.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._wD('SMSound.load(): Using manually-assigned URL');_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._wD('soundManager.load(): current URL already assigned.',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._wD('SMSound.load(): Exception: JS-Flash communication failed, or JS error.',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){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('SMSound.play(): "'+_t.sID+'" already playing (one-shot)',1);return false}else{_s._wD('SMSound.play(): "'+_t.sID+'" already playing (multi-shot)',1)}}if(!_t.loaded){if(_t.readyState===0){_s._wD('SMSound.play(): Attempting to load "'+_t.sID+'"',1);_t._iO.stream=true;_t._iO.autoPlay=true;_t.load(_t._iO)}else if(_t.readyState==2){_s._wD('SMSound.play(): Could not load "'+_t.sID+'" - exiting',2);return false}else{_s._wD('SMSound.play(): "'+_t.sID+'" is loading - attempting to play..',1)}}else{_s._wD('SMSound.play(): "'+_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._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.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(_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&&typeof oEQData!='undefined'&&oEQData){_t.eqData=oEQData}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){bSuccess=(bSuccess==1?true:false);_s._wD('SMSound._onload(): "'+_t.sID+'"'+(bSuccess?' loaded.':' failed to load? - '+_t.url),(bSuccess?1:2));if(!bSuccess){if(_s.sandbox.noRemote===true){_s._wD('SMSound._onload(): Reminder: Flash security is denying network/internet access',1)}if(_s.sandbox.noLocal===true){_s._wD('SMSound._onload(): Reminder: Flash security is denying local access',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._iO.onfinish){_s._wD('SMSound._onfinish(): "'+_t.sID+'"');_t._iO.onfinish.apply(_t)}}}else{if(_t.useVideo){}}};this._onmetadata=function(oMetaData){_s._wD('SMSound.onmetadata()');if(!oMetaData.width&&!oMetaData.height){_s._wD('No width/height given, assuming defaults');oMetaData.width=320;oMetaData.height=240}_t.metadata=oMetaData;_t.width=oMetaData.width;_t.height=oMetaData.height;if(_t._iO.onmetadata){_s._wD('SMSound._onmetadata(): "'+_t.sID+'"');_t._iO.onmetadata.apply(_t)}_s._wD('SMSound.onmetadata() complete')};this._onbufferchange=function(bIsBuffering){if(_t.playState===0){return false}if(bIsBuffering==_t.isBuffering){_s._wD('_onbufferchange: ignoring false default / loaded sound');return false}_t.isBuffering=(bIsBuffering==1?true:false);if(_t._iO.onbufferchange){_s._wD('SMSound._onbufferchange(): '+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 InlinePlayer(){var self=this;var pl=this;var sm=soundManager;this.links=[];this.sounds=[];this.soundsByURL=[];this.indexByURL=[];this.lastSound=null;this.soundCount=0;var isIE=(navigator.userAgent.match(/msie/i));this.config={playNext:false,autoPlay:false};this.css={sDefault:'inline_audio_link',sLoading:'inline_audio_playing',sPlaying:'inline_audio_playing',sPaused:'inline_audio_paused',sError:'inline_audio_error'};this.addEventHandler=Event.observe;this.removeEventHandler=Event.stopObserving;this.classContains=function(o,cStr){return o.hasClassName(cStr)};this.addClass=function(o,cStr){o.addClassName(cStr)};this.removeClass=function(o,cStr){o.removeClassName(cStr)};this.getSoundByURL=function(sURL){return(typeof self.soundsByURL[sURL]!='undefined'?self.soundsByURL[sURL]:null)};this.events={whileloading:function(){self.setProgress(this,this.position,this.bytesLoaded)},whileplaying:function(){self.setProgress(this,this.position,this.bytesLoaded)},onload:function(){if(this.readyState==2){pl.removeClass(this._data.oLink,this._data.className);this._data.className=pl.css.sError;pl.addClass(this._data.oLink,this._data.className);$$('.audio_toolbar').each(function(a){a.remove()});Event.stopObserving(this._data.oLink,'click',self.handleClick);Event.stopObserving(this._data.oLink.down('a'),'click',self.handleClick);self.setError(this,self.getErrorMessage())}},play:function(){pl.removeClass(this._data.oLink,this._data.className);this._data.className=pl.css.sPlaying;pl.addClass(this._data.oLink,this._data.className)},stop:function(){pl.removeClass(this._data.oLink,this._data.className);this._data.className=''},pause:function(){pl.removeClass(this._data.oLink,this._data.className);this._data.className=pl.css.sPaused;pl.addClass(this._data.oLink,this._data.className)},resume:function(){pl.removeClass(this._data.oLink,this._data.className);this._data.className=pl.css.sPlaying;pl.addClass(this._data.oLink,this._data.className)},finish:function(){}};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.createToolbar=function(){$$('.audio_toolbar').each(function(a){a.remove()});toolbar=new Element('div',{'class':'audio_toolbar'});toolbar.playpause=new Element('div',{'class':'pause button'}).update('<span class="icon">&nbsp;</span><span class="separator">&nbsp;</span>');Event.observe(toolbar.playpause,'click',this.handleClick);toolbar.appendChild(toolbar.playpause);toolbar.progress=new Element('div',{'class':'progress_bar button'}).update('<div class="bars"><div class="loaded">&nbsp;</div><div class="indicator">&nbsp;</div></div>');toolbar.appendChild(toolbar.progress);Event.observe(toolbar.progress,'click',this.setPosition);toolbar.times=new Element('div',{'class':'progress_time button'}).update('<span class="separator">&nbsp;</span><span class="content">00:00 of 00:00</span>');toolbar.appendChild(toolbar.times);toolbar.vars={totalTime:0,totalSize:0,lastTime:0,lastLoaded:0};return toolbar};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<10?'0'+min:min)+':'+(sec<10?'0'+sec:sec)):{'min':min,'sec':sec})};this.setError=function(obj,message){obj._data.oLink.appendChild(new Element('div',{'class':'inline_audio_popup_error'}).update(message))};this.error_messages=['We can\'t load this song for some reason. Maybe try another one.','Gosh, this one too! Sorry about that.','Wow! Lots of these songs are broken.','Ok, this is just getting ridiculous.','Sorry again.','What\'s the deal with this source?'];this.getErrorMessage=function(){old_err=self.error_messages.shift();self.error_messages.push(old_err);return self.error_messages[self.error_messages.length-1]};this.setProgress=function(obj,time,loaded){if(obj._data.oLink.toolbar.vars.lastTime!=time){obj._data.oLink.toolbar.progress.down('.indicator').setStyle({left:Math.round(obj.position/obj.durationEstimate*10000)/100+'%'});obj._data.oLink.toolbar.vars.lastTime=time;obj._data.oLink.toolbar.times.down('.content').innerHTML=this.getTime(obj.position,true)+' of '+this.getTime(obj.durationEstimate,true)}if(obj._data.oLink.toolbar.vars.lastLoaded!=loaded){obj._data.oLink.toolbar.progress.down('.loaded').setStyle({width:Math.round(obj.bytesLoaded/obj.bytesTotal*10000)/100+'%'});obj._data.oLink.toolbar.vars.lastLoaded=loaded}};this.setPosition=function(ev){Event.stop(ev);if(ev.currentTarget.down('.bars').cumulativeOffset()[0]<ev.clientX&&ev.currentTarget.down('.bars').cumulativeOffset()[0]+ev.currentTarget.down('.bars').getDimensions().width>ev.clientX){progress=(ev.clientX-ev.currentTarget.down('.bars').cumulativeOffset()[0])/ev.currentTarget.down('.bars').getDimensions().width;self.lastSound.setPosition(Math.round(self.lastSound.duration*progress))}};this.handleClick=function(e){var o=e.target?e.target:Event.findElement(e,'li');if(o.tagName!='LI')o=o.up('li');a=Selector.findElement(o.descendants(),'a[href]');var sURL=a.getAttribute('href');try{Event.stop(e)}catch(er){}if((!a.href||!a.href.match(/\.mp3/i))&&!o.hasClassName('audio_embed')){if(isIE&&a.onclick){return false}return true}sm._writeDebug('handleClick()');var soundURL=(a.href);var thisSound=self.getSoundByURL(soundURL);if(thisSound){if(thisSound==self.lastSound){thisSound.togglePause()}else{$$('li.audio_embed').each(function(s){s.removeClassName('inline_audio_playing')});thisSound.togglePause();sm._writeDebug('sound different than last sound: '+self.lastSound.sID);if(self.lastSound)self.stopSound(self.lastSound);thisSound._data.oLink.toolbar=self.createToolbar();thisSound._data.oLink.toolbar.vars.totalSize=thisSound.bytesTotal;thisSound._data.oLink.toolbar.vars.totalTime=thisSound.duration;thisSound._data.oLink.appendChild(thisSound._data.oLink.toolbar)}}else{$$('li.audio_embed').each(function(s){s.removeClassName('inline_audio_playing')});thisSound=sm.createSound({id:'mp3Sound'+(self.soundCount++),url:soundURL,onplay:self.events.play,onstop:self.events.stop,onpause:self.events.pause,onresume:self.events.resume,onfinish:self.events.finish,whileloading:self.events.whileloading,whileplaying:self.events.whileplaying,onload:self.events.onload,autoPlay:(!e.pausePlay)});thisSound._data={oLink:o,className:self.css.sPlaying};self.soundsByURL[soundURL]=thisSound;self.sounds.push(thisSound);if(self.lastSound)self.stopSound(self.lastSound);thisSound._data.oLink.toolbar=self.createToolbar();thisSound._data.oLink.toolbar.vars.totalSize=thisSound.bytesTotal;thisSound._data.oLink.toolbar.vars.totalTime=thisSound.duration;thisSound._data.oLink.appendChild(thisSound._data.oLink.toolbar)}self.lastSound=thisSound};this.stopSound=function(oSound){soundManager.stop(oSound.sID);soundManager.unload(oSound.sID)};this.init=function(){sm._writeDebug('inlinePlayer.init()');var foundItems=0;$$('.m_audio a').each(function(a){l=a.up('li');if(a.href.match(/\.mp3/i)||(l&&l.hasClassName('audio_embed'))){l.setAttribute('href',a.href);l.href=a.href;self.addClass(l,self.css.sDefault);self.links[foundItems]=(l);self.indexByURL[a.href]=foundItems;Event.observe(l,'click',self.handleClick);Event.observe(a,'click',self.handleClick);if(!l.hasClassName('audio_embed'))l.addClassName('audio_embed');foundItems++;if(l.hasClassName('auto_load')){self.handleClick({target:l,preventDefault:function(){},pausePlay:true})}}});if(self.config.autoPlay&&foundItems>0){self.handleClick({target:self.links[0],preventDefault:function(){}})}sm._writeDebug('inlinePlayer.init(): Found '+foundItems+' relevant items.')};this.init()};var inlinePlayer=null;soundManager.debugMode=false;soundManager.url='/flash/';soundManager.nullURL='/images/null.mp3';soundManager.onload=function(){inlinePlayer=new InlinePlayer()};kapp.namespace('suggest');kapp.suggest.AutoSuggest=function(id,param){if(!document.getElementById)return 0;this.fld=$(id);if(!this.fld)return 0;this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;var defaults={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:2500,delay:500,offsety:-5,shownoresults:true,noresults:"No results!",maxheight:250,cache:true,maxentries:25};this.oP=param?$H(defaults).merge(param)._object:{};var p=this;Event.observe(this.fld,'keypress',p.onKeyPress.bind(this));Event.observe(this.fld,'keyup',p.onKeyUp.bind(this));Event.observe(this.fld,'blur',p.clearSuggestions.bind(this));this.fld.setAttribute("autocomplete","off")};kapp.suggest.AutoSuggest.prototype.onKeyPress=function(ev){var key=(window.event)?window.event.keyCode:ev.keyCode;var RETURN=13;var TAB=9;var ESC=27;var bubble=1;switch(key){case RETURN:this.setHighlightedValue.bind(this).call();bubble=0;break;case ESC:this.clearSuggestions.bind(this).call();break}return bubble};kapp.suggest.AutoSuggest.prototype.onKeyUp=function(ev){var key=(window.event)?window.event.keyCode:ev.keyCode;var ARRUP=38;var ARRDN=40;var bubble=1;switch(key){case ARRUP:this.changeHighlight.bind(this,key).call();bubble=0;break;case ARRDN:this.changeHighlight.bind(this,key).call();bubble=0;break;default:this.getSuggestions.bind(this,this.fld.value).call()}return bubble};kapp.suggest.AutoSuggest.prototype.getSuggestions=function(val){if(val==this.sInp)return 0;if($(this.idAs))$(this.idAs).remove();this.sInp=val;if(val.length<this.oP.minchars){this.aSug=[];this.nInpC=val.length;return 0}var ol=this.nInpC;this.nInpC=val.length?val.length:0;var l=this.aSug.length;if(this.nInpC>ol&&l&&l<this.oP.maxentries&&this.oP.cache){var arr=[];for(var i=0;i<l;i++){if(this.aSug[i]&&this.aSug[i].value&&this.aSug[i].value.substr(0,val.length).toLowerCase()==val.toLowerCase())arr.push(this.aSug[i])};this.aSug=arr;this.createList(this.aSug);return false}else{var pointer=this;var input=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(pointer.doAjaxRequest.bind(this,input),this.oP.delay)};return false};kapp.suggest.AutoSuggest.prototype.doAjaxRequest=function(input){if(input!=this.fld.value)return false;var pointer=this;if(typeof(this.oP.script)=="function")var url=this.oP.script(encodeURIComponent(this.sInp));else var url=this.oP.script+encodeURIComponent(this.sInp);if(!url)return false;var meth=this.oP.meth;var input=this.sInp;var onSuccessFunc=function(req){pointer.setSuggestions(req,input)};var onErrorFunc=function(status){alert("AJAX error: "+status)};new Ajax.Request(url,{'method':meth,onSuccess:onSuccessFunc,onFailure:onErrorFunc})};kapp.suggest.AutoSuggest.prototype.setSuggestions=function(req,input){if(input!=this.fld.value)return false;this.aSug=[];if(this.oP.json){var jsondata=eval('('+req.responseText+')');for(var i=0;i<jsondata.results.length;i++){this.aSug.push({'id':jsondata.results[i].id,'value':jsondata.results[i].value,'info':jsondata.results[i].info})}}else{var xml=req.responseXML;var results=xml.getElementsByTagName('results')[0].childNodes;for(var i=0;i<results.length;i++){if(results[i].hasChildNodes())this.aSug.push({'id':results[i].getAttribute('id'),'value':results[i].childNodes[0].nodeValue,'info':results[i].getAttribute('info')})}};this.idAs="as_"+this.fld.id;this.createList(this.aSug)};kapp.suggest.AutoSuggest.prototype.createList=function(arr){var pointer=this;if($(this.idAs))$(this.idAs).remove();this.killTimeout();if(arr.length==0&&!this.oP.shownoresults)return false;var div=new Element("div",{'id':this.idAs,'class':this.oP.className});this.ul=new Element("ul",{'id':"as_ul"});for(var i=0;i<arr.length;i++){var val=arr[i].value;var st=val.toLowerCase().indexOf(this.sInp.toLowerCase());var output=val.substring(0,st)+"<span>"+val.substring(st,st+this.sInp.length)+"</span>"+val.substring(st+this.sInp.length);var li=new Element("li").update(output);li.name=i+1;Event.observe(li,'click',pointer.setHighlightedValue.bind(this));Event.observe(li,'mouseover',pointer.setHighlight.bind(this,li.name));this.ul.appendChild(li)};if(arr.length==0&&this.oP.shownoresults){var li=new Element("li",{'class':"as_warning"}).update(this.oP.noresults);this.ul.appendChild(li)};div.appendChild(this.ul);var pos=$(this.fld).cumulativeOffset();div.style.left=pos.left+"px";div.style.top=(pos.top+this.fld.offsetHeight+this.oP.offsety+10)+"px";div.style.width=this.fld.offsetWidth+"px";Event.observe(div,'mouseover',function(){pointer.killTimeout.bind(this)});Event.observe(div,'mouseout',function(){pointer.resetTimeout.bind(this)});document.getElementsByTagName("body")[0].appendChild(div);this.iHigh=0;var pointer=this;this.toID=setTimeout(function(){pointer.clearSuggestions()},this.oP.timeout)};kapp.suggest.AutoSuggest.prototype.changeHighlight=function(key){var list=this.ul;if(!list)return false;var n;if(key==40)n=this.iHigh+1;else if(key==38)n=this.iHigh-1;if(n>list.childNodes.length)n=list.childNodes.length;if(n<1)n=1;this.setHighlight.bind(this,n).call()};kapp.suggest.AutoSuggest.prototype.setHighlight=function(n){var list=this.ul;if(!list)return false;if(this.iHigh>0)this.clearHighlight.bind(this).call();this.iHigh=Number(n);list.childNodes[this.iHigh-1].addClassName("highlight");this.killTimeout()};kapp.suggest.AutoSuggest.prototype.clearHighlight=function(){var list=this.ul;if(!list)return false;if(this.iHigh>0){list.childNodes[this.iHigh-1].removeClassName("highlight");this.iHigh=0}};kapp.suggest.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart)this.fld.setSelectionRange(this.sInp.length,this.sInp.length);this.clearSuggestions();if(typeof(this.oP.callback)=="function")this.oP.callback(this.aSug[this.iHigh-1])}};kapp.suggest.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID)};kapp.suggest.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);this.toID=setTimeout(this.clearSuggestions.bind(this),1000)};kapp.suggest.AutoSuggest.prototype.clearSuggestions=function(){this.killTimeout();var ele=$(this.idAs);var pointer=this;if(ele){var fade=new Effect.Fade(ele,{from:1,to:0,duration:.25,onComplete:function(){$(pointer.idAs).remove()}})}};kapp.suggest.as=new kapp.suggest.AutoSuggest('searchText',{script:"/suggest/",json:true,maxresults:5,shownoresults:false,timeout:5000,cache:false});
