$(document).ready(function() {
	// When the WATCH A PREVIEW graphic is clicked...
	$("#vsWatchPreview a").toggle(
		// Toggle between this function...
		function(){
			// #1 Slide down the embedded slides panel.
			$("#vsSlidesPreview").slideDown();
			// #2 Fade the "WATCH A PREVIEW" graphic to 20%.
			$("#vsWatchPreview").fadeTo(400, 0.20);
			// #3 Fade the "Click the play button..." note after 5 seconds.
			$("#vsClickToPlay").delay(5000).fadeTo(400, 0.20);
			return false;
		},
		// and this function...
		function(){
			// #1 Slide up the embedded slides panel.
			$("#vsSlidesPreview").slideUp();
			// #2 Fade the "WATCH A PREVIEW" graphic to 100%.
			$("#vsWatchPreview").fadeTo(400, 1);
			return false;
		}
	);
	// When the Slide Preview panel's "[x] Hide this window" button is clicked...
	$("#vsHideSlidesPreview").click(function(){
		// #1 Slide up the embedded slides panel.
		$("#vsSlidesPreview").slideUp();
		// #2 Fade the "WATCH A PREVIEW" graphic to 100%.
		$("#vsWatchPreview").fadeTo(400, 1);
	});
	// First, grab everything after the # and turn it into the 'urlHash' variable while also making it lowercase.
	var urlHash = location.hash.substring(1).toLowerCase();
	// If the variable 'urlHash' is equal to 'openpreview,' execute the fun stuff that shows the hidden preview.
	if (urlHash == 'openpreview') {
		// #1 Scroll down 300px so the video's towards the top of the web browser
		window.scrollTo(0, 150);
		// #2 Slide down the embedded slides panel.
		$('#vsSlidesPreview').slideDown();
		// #3 Fade the "WATCH A PREVIEW" graphic to 20%.
		$("#vsWatchPreview").fadeTo(400, 0.20);
		// #4 Fade the "Click the play button..." note after 5 seconds.
		$("#vsClickToPlay").delay(5000).fadeTo(400, 0.20);
	}
});
