/**
 * Start music and hide/display controls
 */

var readyFunc = function() {
	var myThis = this.element;
	myThis.jPlayer("setFile", "scripts/Heart_and_Soul.mp3");

	myThis.jPlayer('onSoundComplete', function() {
		var myThis = this.element;
		myThis.jPlayer('play'); // Auto-Repeat
	});
}

$(document).ready(function() {
	$("#jquery_jplayer").jPlayer( {
		ready : readyFunc,
		swfPath : 'scripts',
		customCssIds : true
	})

	$("#off").hide();

	function showPauseBtn() {
		$("#on").fadeOut(function() {
			$("#off").fadeIn();
		});
	}

	function showPlayBtn() {
		$("#off").fadeOut(function() {
			$("#on").fadeIn();
		});
	}

	$("#on").click(function() {
		$("#jquery_jplayer").jPlayer("play");
		showPauseBtn();
		return false;
	});

	$("#off").click(function() {
		$("#jquery_jplayer").jPlayer("pause");
		showPlayBtn();
		return false;
	});

});
