// JavaScript for cmufront templates

// jQuery document ready
$(document).ready(function(){

	// handles multimedia button behavior
	$(".feature_mm").click(function(){
		// if backToStory is hidden, then show it
			$("#article").animate({"right": "-=495px"}, 500);
			$(".feature_mm").animate({"left": "-=749px"}, 500);
			$("#multimedia").fadeIn("slow");
			setTimeout('$("#embed").css("display", "block")', 600);
			//setTimeout('$("#multimedia").css("visibility", "visible")',500);
	});
	
	$("#backToStory").click(function(){
		/*
		If feature_mm is off screen all the way, then bring it back.
		Note: Without an if statement, the user has the ability to break the animation by quickly clicking on the button multiple times.
		*/
		if($(".feature_mm").css("left") == "-1242px") // this will break if the CSS position of the mm button is changed
		{
			$("#article").animate({"right": "+=495px"}, 500);
			$(".feature_mm").animate({"left": "+=749px"}, 500);
			$("#multimedia").fadeOut("slow");
			$("#embed").css("display", "none")
		}
	});
});
