$(document).ready(function(){
	var opac_ = false;

	$("#audio-button").css({
		opacity: 0.3
	});
	$("#video-button").css({
		opacity: 0.3
	});
	$("#page-wrap div.nav").click(function(){
		$clicked = $(this);
		opac_=false;
//		if($clicked.css("opacity") != "1" && $clicked.is(":not(animated)"))
//		{
			$clicked.animate({opacity: 1}, 600 );
			var idToLoad = $clicked.attr("id").split('-');
			$("#content").find("div:visible").fadeOut("fast", function(){
				$(this).parent().find("#"+idToLoad[0]).fadeIn();
			})
//		}
		//we reset the other buttons to default style
		$clicked.siblings(".nav").animate({opacity: 0.3}, 600 );
	});
	$(".nav").hover(
		function () {
			if($(this).css("opacity")!=1) {$(this).animate({opacity: 1}, 200 );opac_=true;}
		}, 
		function () {
			if(opac_==true) {$(this).animate({opacity: 0.3}, 200 );opac_=false;}
		}
	);
});
