var playerChange=function(e,c,d){var f=$("#"+c);var b=$("#"+c+" img");var a=$(".jplayer");switch(e){case"load":break;case"ioerror":a.each(function(){$(this).unbind("click");player.jStop();$(this).click(function(){player.jLoad($(this).attr("href"),$(this).attr("id"));player.jPlay();return false})});break;case"play":$(".jplayer img").each(function(){$(this).attr("src",assetsPath+"/images/play.png")});b.attr("src",assetsPath+"/images/pause.png");a.each(function(){$(this).unbind("click");if($(this).attr("id")==c){$(this).click(function(){player.jPause();return false})}else{$(this).click(function(){player.jLoad($(this).attr("href"),$(this).attr("id"));player.jPlay();return false})}});break;case"pause":b.attr("src",assetsPath+"/images/play.png");a.each(function(){$(this).unbind("click");if($(this).attr("id")==c){$(this).click(function(){player.jPlay();return false})}else{$(this).click(function(){player.jLoad($(this).attr("href"),$(this).attr("id"));player.jPlay();return false})}});break;case"stop":b.attr("src",assetsPath+"/images/play.png");a.each(function(){$(this).unbind("click");$(this).click(function(){player.jLoad($(this).attr("href"),$(this).attr("id"));player.jPlay();return false})});break}};var player;var JuanitoPlayerReady=function(){try{player=document.JuanitoPlayer?document.JuanitoPlayer:window.document.JuanitoPlayer;player.jAddListener("play","playerChange");player.jAddListener("pause","playerChange");player.jAddListener("stop","playerChange");player.jAddListener("load","playerChange");player.jAddListener("ioerror","playerChange");$(".jplayer").each(function(){$(this).click(function(){player.jLoad($(this).attr("href"),$(this).attr("id"));player.jPlay();return false})})}catch(a){alert("Exception: "+a)}};var toFirebug=function(a){};var sharePopup=function(b,c){window.open($(b).attr("href"),"popupWindow","status=0,menubar=0,resizable=0,location=0,width=910,height=475");(window.event)?window.event.returnValue=false:c.preventDefault();(window.event)?window.event.cancelBubble=true:c.stopPropagation()};$(document).ready(function(){var a=$("#newsletterForm");var b=function(c){var e=c.errors;if(!e.length){return}var f='<div style="text-align: center;"><div style="font-size: 1.2em;">';$(e).each(function(){f+=this.text+"<br />"});f+="</div>";var d="";if(c.success){var g=encodeURIComponent("Artists use Tweet for a Track to launch new songs, signup and be the first to know and get the music for free: "+document.location.href.replace(/\/$/,""));d='				<div style="margin-top: 10px;">					<h3 style="margin-bottom: 5px;">Please help spread the word!</h3>					<p>						<a class="gaTrack" rel="dontRedirect" onclick="return sharePopup(this, event);" href="http://twitter.com/home?status='+g+'"><img src="'+assetsPath+'/images/newsletter/tweet_this.png" /></a>						<a class="gaTrack" rel="dontRedirect" onclick="return sharePopup(this, event);" href="http://www.facebook.com/sharer.php?u='+encodeURIComponent(window.location.href)+"&t="+encodeURIComponent("TweetForATrack Newsletter")+'"><img src="'+assetsPath+'/images/newsletter/facebook_share2.png" /></a>					</p>				</div>'}$.facebox(f+d+'                <div class="footer">                   <a href="#" class="close" onclick="$.facebox.close();return false;">                     <img src="'+assetsPath+'/images/facebox/closelabel.gif" title="close" class="close_image" />                   </a>                 </div>            </div>')};a.submit(function(){$.ajax({type:"POST",url:a.attr("action"),data:a.serialize(),dataType:"json",cache:false,success:function(c){if(!c){$.facebox("There was a network error, please try again!");return false}b(c)},error:function(c){$.facebox("There was a network error, please try again!")}});return false});$("<img>").attr("src",assetsPath+"/images/pause.png");$("#juanitoPlayerContainer").flash({name:"JuanitoPlayer",id:"JuanitoPlayer",swf:"/swf/JuanitoPlayer.swf?"+new Date().getTime(),width:1,height:1})});
