// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(document).ready(function() {
	// Nav Control
	$("#nav a.sync, #top a").click(function(){
		that = this;
	 	$('div#content').load(this.href + ' #content p', function() {
		  // stuff to do when the content has been loaded
		});
		return false;	
	});
	
	// Music Control
	$('#music').click(function(){
		console.log($(this));
		if ($(this).hasClass('on')){
			$('#mp3').remove();
			console.log($('#mp3'));
			$(this).toggleClass('on');
			$(this).html('Music: Off');
		} else {
			$(this).toggleClass('on');
			$(this).html('Music: On');
			$('body').prepend('<embed id="mp3" src="/music/bg.mp3" autostart="true" loop="true" width="1" height="0">');
		}
	});
});
