(function(){if(window.LocalConnection){return}window.LocalConnection={_onload:function(k){a=k;var l=window.LocalConnection=d,j=d(a);l[k]=function(n,h,m,o){setTimeout(function(){n=n.charAt(0)=="_"?j:c[n];if(!n){return}n.trigger(h,m,o)})};l.sendTo=function(m,n,o,q,p){var h="cb"+(+new Date);l[h]=function(r){delete d[h];if(r){q&&q(m,n,o)}else{p&&p(m,n,o)}};g.sendTo(m,n,o,h)};l.clients=function(){return g.clients()};l.ready=function(h,m){if(typeof h=="string"&&b(m)){var n=d(h);h=function(){m(n)}}setTimeout(h)};l.namespaces=c;l.hash=k;l.addListener=j.addListener;l.removeListener=j.removeListener;delete l.send;delete l.getNamespace;var i;while(i=f.shift()){i()}f=undefined},ready:function(h,i){if(typeof h=="string"&&b(i)){var j=d(h);h=function(){i(j)}}if(b(h)){f.push(h)}}};var f=[],c={},g=(function(h,k){var i=k[k.length-1],j=(window.MySpace?MySpace.StaticContentBase.replace("x.","js."):"http://js.myspacecdn.com")+"/modules/common/static/swf/fcomm.swf";i.parentNode.insertBefore(h,i);h.innerHTML='<object id=LocalConnection style="visibility:visible" width=1 height=1'+(!+"\v1"?' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><param name="movie" value="'+j+'">':' type="application/x-shockwave-flash" data="'+j+'">')+'<param name="AllowScriptAccess" value="always"></object>';var l=document.getElementById("LocalConnection");i.parentNode.replaceChild(l,h);return l})(document.createElement("div"),document.getElementsByTagName("script")),a;function b(h){return h&&Object.prototype.toString.call(h)=="[object Function]"}function d(j){j=j||document.domain;var i=c[j],h=[];if(i){return i}return i=c[j]={getNamespace:function(){return j},send:function(k,l){g.send(j,k,l)},addListener:function(k){if(!b(k)){return}h.push(k)},removeListener:function(k){if(!b(k)){return}for(var m=0,n=h.length;m<n;m++){if(h[m]===k){h.splice(m,1)}}if(!h.length){delete c[j]}},trigger:function(k,m,p){for(var n=0,o=h.length;n<o;n++){if(h[n](k,m,p)===true){i.removeListener(h[n])}}},hash:a}}SharedObject=function(h,i){if(arguments.length<1){return}if(arguments.length==1){return g.getShared(h)}else{g.setShared(h,i)}};SharedObject.clear=function(){g.clear()};function e(){g.unload()}if(window.addEventListener){window.addEventListener("beforeunload",e,false)}else{window.attachEvent("onbeforeunload",e)}})();my_=window.my_||{};if(document.querySelectorAll){(function(){var c=document.querySelectorAll("a.my_play"),e="http://x.myspacecdn.com",j="http://www.myspace.com",M="Play",L="Play Next",K="Add to Queue",I="Embed Code",J="Copy and paste the embed code below",k="/music/buttons/js";if(!my_.playbutton){var D=document.createTextNode((function(){function a(S,U,T){var R="div.my_play",Q="button",i="{background-position:";T+="px";return[R,S," ",Q,i,"0 ",T,";width:",U,"px;height:",U,"px}",R,S," ",Q,":hover",i,"-50px ",T,"}",R,S,".playing ",Q,i,"-100px ",T,"}",R,S,".playing ",Q,":hover",i,"-150px ",T,"}"].join("")}return".my_play{display:inline-block;text-decoration:none;text-indent:-9999px}div.my_play .my_wrap{position:relative}div.my_play button{position:relative;z-index:2;display:block;border:0;padding:0;margin:0;background:transparent url(http://x.myspacecdn.com/modules/common/static/img/playbuttonsprite.png) no-repeat;text-indent:-9999px;cursor:pointer}div.my_play ol,div.my_play li{margin:0;padding:0;border:0;outline:0;line-height:normal;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;word-spacing:normal;letter-spacing:normal;vertical-align:baseline;list-style:none}div.my_play.my_xs ol li:first-child{padding:4px 10px 4px 25px;font-size:11px}div.my_play.my_sm ol{top:-7px}div.my_play.my_sm ol li:first-child{padding:8px 10px 8px 32px;font-size:13px}div.my_play.my_l ol{top:-7px}div.my_play.my_l ol li:first-child{padding:15px 10px 15px 46px;font-size:16px}div.my_play.my_xl ol{top:-10px}div.my_play.my_xl ol li:first-child{padding:20px 10px 28px 60px;font-size:16px}.my_player div.my_play:hover ol{left:-6px;z-index:3}.my_player div.my_play:hover button{z-index:4}div.my_play ol{line-height:1px;position:absolute;top:-5px;left:-9999px;z-index:1;background:#545454;-webkit-box-shadow:2px 2px 2px rgba(0,0,0,0.2);-moz-box-shadow:2px 2px 2px rgba(0,0,0,0.2);box-shadow:2px 2px 2px rgba(0,0,0,0.2)}div.my_play li{padding:5px 10px;border-top:1px solid #333;line-height:normal;font:bold 11px Arial,Helvetica,sans-serif;color:#fff;white-space:nowrap;cursor:pointer;text-indent:0}div.my_play li:first-child{border-top:none;padding:10px 10px 10px 38px;font-size:13px}div.my_play button:hover+ol li:first-child,div.my_play li:hover{background:#656565;color:#fff}div.my_play ol,div.my_play li:first-child{-moz-border-radius-topright:5px;-moz-border-radius-topleft:5px;-webkit-border-top-right-radius:5px;-webkit-border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-left-radius:5px}div.my_play ol,div.my_play li:last-child{-moz-border-radius-bottomright:5px;-moz-border-radius-bottomleft:5px;-webkit-border-bottom-right-radius:5px;-webkit-border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div.my_play.playing ol,div.my_play.loading ol,div.my_play.paused ol{display:none}div.my_play li span.copy,div.my_play li span.close,div.my_play li textarea,div.my_play li a{display:none}div.my_play .my_embed{position:relative}div.my_play.embed .my_embed:hover{background:transparent}div.my_play.embed .my_embed textarea{display:block;width:270px;height:150px;margin:0 0 5px;padding:4px;font:normal 11px Arial,Helvetica,Sans-serif;color:#333;border:1px solid #CCC;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-moz-box-shadow:1px 1px 1px 0 #d0d0d0 inset;-webkit-box-shadow:1px 1px 1px 0 #d0d0d0 inset;box-shadow:1px 1px 1px 0 #d0d0d0 inset}div.my_play.embed .my_embed span.embed{display:none}div.my_play.embed .my_embed span.copy{display:block;white-space:normal;margin:0 20px 5px 0}div.my_play.embed .my_embed span.close{display:block;position:absolute;top:5px;right:5px;width:15px;height:15px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABBklEQVR42pWSQWqDQBSGhUBWhRxAyA16AMVVV71BINtA7+LWrtwYcSNSKAQRQagUuhVdddVVNRAIBAI9wPSfwZHHQ0kUPh4z4zfz/mEM27YpS/ACCvAHBLiAA9gCg0IHj+BHCdNUYK0dKl4nBM4RmFpe6hNn8KnlHV3I81yEYTiMHccRaZqKKIr4Bk9S/qKTcRwLfLIqsSxLNXZdl8uRMZY1SRIltG2rqud5o5dn0Anaatd1Sqzreir3r5TPXNStNk2jI0yeXNDJLMuGVmkE3/e57Et5w/PyywmCYCy3JeUFqICYwTt9YSY43Sk2YKVlusHHDfENPNC3zXkG+z7Kd19fgcX//QdCzHuQePBTjQAAAABJRU5ErkJggg==)}div.my_play.embed .my_embed a{display:inline-block;margin:0;color:white;font-size:11px;white-space:normal}div.my_play.embed li,div.my_play.embed .my_wrap button.my_now{display:none;z-index:0}div.my_play.embed li.my_embed{display:block;border-top:none}div.my_play.embed ol{left:-6px}#SpaceButton{position:absolute;left:-9999px}"+a("",27,-85)+a(".my_xs",15,-132)+a(".my_sm",20,-112)+a(".my_l",35,-50)+a(".my_xl",15,-0)})()),y=document.createElement("style");y.type="text/css";if(y.styleSheet){y.styleSheet.cssText=D.nodeValue}else{y.appendChild(D)}document.getElementsByTagName("head")[0].appendChild(y)}function d(i,Q,a){if(window.jQuery){jQuery.event.add(i,Q,a)}else{if(i.addEventListener){i.addEventListener(Q,a,false)}else{if(i.attachEvent){i.attachEvent("on"+Q,a)}else{i["on"+Q]=a}}}}for(var r=0,u=c.length;r<u;r++){var b=c[r],q=b.attributes.href.value,x=q.substr(q.lastIndexOf("-")+1),s=q.indexOf("/albums/")>-1,t=q.indexOf("/playlists/")>-1,v=b.innerHTML.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(/"/g,"'");var g=[" data-src=",j,"/music/player?",((t)?"pid":(s)?"aid":"sid"),"=",x].join(""),l=document.createElement("div").appendChild(b.cloneNode(true)).parentNode.innerHTML.replace(/"/g,"'")+"<script defer='true' type='text/javascript' src='"+j+k+"'></script>",E=["<div class='",b.className,"'",g,"><div class=my_wrap>",'<button class=my_now title="',v,'">',M,"</button><ol><li class=my_now>",M,"</li><li class=my_next>",L,"</li><li class=my_last>",K,"</li><li class=my_embed><span class='embed'>",I,"</span><span class='copy'>",J+"</span><span class='close MSIcon xCircleIconDarkWhite'></span><textarea>"+l,"</textarea><a href='http://www.myspace.com/music/buttons' target='_new'>More Embed Options</a></li></ol></div></div>"];var P=document.createElement("div");P.className=b.className;P.innerHTML=E.join("");var n=P.firstChild;b.parentNode.replaceChild(n,b);d(n,"click",o)}if(my_.playbutton){return}var h=false,f={id:-1,playing:false},H=(function(){var a=document.createElement("div"),R=document.getElementsByTagName("script"),i=R[R.length-1],Q=e+"/modules/common/static/swf/spacebutton.swf";i.parentNode.insertBefore(a,i);a.innerHTML='<object id=SpaceButton style="visibility:visible" width=1 height=1'+(!+"\v1"?' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><param name="movie" value="'+Q+'">':' type="application/x-shockwave-flash" data="'+Q+'">')+'<param name="AllowScriptAccess" value="always"></object>';return document.getElementById("SpaceButton")})();function G(U,T){U=" "+(U||"");var Q=document.querySelectorAll(T?'div.my_play[data-src*="'+T+'"]':"div.my_play");for(var R=0,S=Q.length;R<S;R++){var a=Q[R];a.className=a.className.replace(/ *(loading|playing|paused)/g,"")+U}return Q}function O(i,Q,a){if(f.id==i&&f.playing==a){return}G();f.id=i;f.playing=a;if(a){G("playing",i)}else{G("paused",i)}if(i=="-1"){w("queue has been cleared")}}function B(i,a,S,Q){w("playSong called");if(S==="now"){G();G("loading",i)}if(a){var R=escape(location.href);H.playSong(i,S,"function(state) { my_.playbutton.playSongCallback(state,"+i+", '"+S+"') }",Q,R);O(i,S,true)}}function C(i,a,Q){if(i){w("song playback succeeded")}else{w("Song callback returned a failure")}}function N(a){w("toggle: "+a);G();G("playing",a);H.togglePlay()}function A(R,Q,T,S){if(!R){w("opening window");H.pauseTimer(10);var a=((S==="album")?"aid":(S==="playlist")?"pid":"sid"),i=[j,"/music/player?",a,"=",Q,"&ac=",T,"&url=",escape(location.href)].join("");if(!open(i,"thePlayer","width=372,height=800,left=20")){alert("I want to play this song for you...\nReally. I tried!\n...but I couldn't.\n\nMaybe a popup blocker ate it?!");return}}else{H.pauseTimer(5)}B(Q,R,T,S)}function p(a,i){return a.className.indexOf(i)>-1}function m(a){while(a&&!p(a,"my_play")){a=a.parentNode}return a}function o(Q){H=document.getElementById("SpaceButton");if(!Q){Q=window.event}var X=Q.target||Q.srcElement,i=m(X);if(p(i,"embed")){if(p(X,"close")){i.className=i.className.replace(" embed","");return}if(X.nodeName=="TEXTAREA"){X.focus();X.select()}return}if(p(X,"my_embed")||p(X.parentNode,"my_embed")){i.className+=" embed";return}if(p(i,"loading")){w("song is loading, ignore click");return}var W=i.getAttribute("data-src"),V=X.className.replace("my_",""),U=W+"&ac="+V,S=W.indexOf("aid=")>-1,T=W.indexOf("pid=")>-1,R=(S)?"aid=":(T)?"pid=":"sid=",a=W.substring(W.lastIndexOf(R)+4,W.length),Y=(S)?"album":(T)?"playlist":"song";if(p(i,"playing")||p(i,"paused")){w("song is playing - pause or resume");N(a)}else{w("song is not playing - send to swf.isPlayerOpen");A(H.isPlayerOpen(),a,V,Y)}}function z(a){w(a)}function F(i,a){h=i;if(a){H.setDebug(i)}}function w(a){if(h){console.log(a)}}my_.playbutton={playSongCallback:C,playerOpenCallback:A,playSong:B,togglePlay:N,resetButtons:function(){G()},newSongAlert:O,swf:H,offsiteLoaded:z,setPlayerOpen:function(i){var a=document.body;if(i){if(!p(a,"my_player")){a.className+=" my_player"}}else{a.className=a.className.replace(" my_player","")}},setDebug:F}})()};
