// CONTENTS OF THIS FILE HAVE BEEN MOVED INTO subNav.js

jQuery.noConflict();
jQuery(document).ready(function($) {

//	$("#mediaControls ul").prepend("<li id=\"mediaControls_watch\"><a href=\"video\">Watch</a></li>");

	// Lets add a close button to the video container
	$("#videoContainer").append("<button class=\"smallCloseButton\">Close</button>");
	$("#videoContainer > .smallCloseButton").click(function() {
		closeHomeVideo();
		return false;
	});


	$("#mediaControls_watch a").click(function() {

		$("body").addClass("animating");

		// Get rid of featured and subNavs
		clearSubs();
		$("#mainContent .contentBox").fadeOut(500);
		$("#mainContent #subFeatures").fadeOut(500);

		resizeContentContainer($("#mainContent #videoContainer"), 500);

		setTimeout(
			function() {
				$("#videoContainer > .boxTop").fadeIn(500);
				$("#videoContainer > .boxBottom").fadeIn(500);
				$("#videoContainer").fadeIn(500);
			},
			750
		);


		setTimeout(
			function() {
				$("body").removeClass("animating");
			},
			1250
		);

		return false;

	});


	// Functions

	function closeHomeVideo() {
	
		$("body").addClass("animating");
	
		$("#videoContainer > .boxTop").fadeOut(500);
		$("#videoContainer > .boxBottom").fadeOut(500);
		$("#videoContainer").fadeOut(500);
	
		// Resize the content box for the featured content
		resizeContentContainer($("#mainContent #featured.contentBox"), 500, 216);
	
		// Bring feature back after timeout (to allow for animations)
		setTimeout(function() {
			$("#mainContent #featured.contentBox").fadeIn(500);
			$("#mainContent #subFeatures").fadeIn(500);
			},
			750
		);
	
	
		setTimeout(
			function() {
				$("body").removeClass("animating");
			},
			1250
		);
	
	}

});
