
(function($){$.fn.MP3Player=function(options){var defaults={install:"http://i.usatoday.net/_common/_scripts/_swfObject/expressInstall.swf",player:"http://i.usatoday.net/_common/_flash/_mp3player/MP3Player.swf",version:"9"};var options=$.extend(defaults,options);$(this).css("visibility","visible");$(this).show();$("#gallery").prepend("<div id='swf' />");var attributes={};var flashvars={};var params={};if(swfobject.hasFlashPlayerVersion(options.version))
{if(typeof options.url!="undefined")
{flashvars.filepath=options.url;}
params.scale="noScale";params.allowScriptAccess="always";params.wmode="transparent";swfobject.embedSWF(options.player,"swf","1","1",options.version,options.install,flashvars,params,attributes);addClickEventsToPlayer();}
else
{attributes.data=options.install;swfobject.showExpressInstall(attributes,params,options.id);}}
function addClickEventsToPlayer(){if($(".stop").length>0)
{$(".stop").click(function(e){$.MP3Player.stop();});}
if($(".play,.pause").length>0)
{$(".play,.pause").click(function(e){$.MP3Player.togglePlay();});}}
function secondsToMinutes(seconds){var minutes=Math.floor(seconds/60);var modSeconds=seconds%60;modSeconds=(modSeconds<10)?"0"+modSeconds:modSeconds;return minutes+":"+modSeconds;}
$.MP3Player={audioLength:0,complete:function(){if($(".play,.pause").length>0)
{$(".play,.pause").attr("class","play");}
this.setProgress(this.audioLength,this.audioLength);},loadFile:function(url){if($(".play,.pause").length > 0) { $(".play,.pause").attr("class", "play"); } this.setProgress(0,0);var element=document.getElementById("swf");element.loadFile(url);},setProgress:function(position,length){if($(".progress").length>0&&$(".progressbar").length>0)
{var percent=position/length;var width=Math.floor($(".progressbar").width()*percent);if(!isNaN(width))
{$(".progress").width(width);}}
if($(".time").length>0)
{$(".time").text(secondsToMinutes(position)+" / "+secondsToMinutes(length));this.audioLength=length;}},start:function(){if($(".play,.pause").length>0)
{$(".play,.pause").attr("class","pause");}
this.setProgress(0,this.audioLength);},stop:function(){var element=document.getElementById("swf");element.stopSound();if($(".play,.pause").length>0)
{$(".play,.pause").attr("class","play");}
this.setProgress(0,this.audioLength);},togglePlay:function(){var element=document.getElementById("swf");var isPlaying=element.togglePlay();if($(".play,.pause").length>0)
{if(isPlaying)
{$(".play").attr("class","pause");}
else
{$(".pause").attr("class","play");}}}};})(jQuery);function setComplete(){jQuery.MP3Player.complete();}
function setProgress(position,length){jQuery.MP3Player.setProgress(position,length);}
function start(){jQuery.MP3Player.start();}
