$(document).ready( function() {	
	//adds "toggle captions" div and span
	$("div.goneAtFirst").after("<div class='toggleCaptionsDiv'><span class='toggleCaptions'></span></div>");
	//clears every other li in the expert panel bios
	$("ul#panel li:even, ul#designer li").css("clear","both");
	//inserts button to control display of video	
	$("div.vidContainer").prepend("<a class='showHide arrowdown' href='#'>hide the video demonstration</a>");	
	//shows video when button is clicked and hides it when it is clicked again (green arrows for description key)	
	$("div.vidContainer a.showHide").toggle(	
		function(){				
			$(this).text("show the video demonstration");
			$(this).removeClass("arrowdown").addClass("arrowup");
			$(this).siblings("div").children().slideUp("slow",			
				function(){				
					$(this).parent().slideUp("slow");				
				}			
			);				
		},
		function() {				
			$(this).text("hide the video demonstration");
			$(this).removeClass("arrowup").addClass("arrowdown");
			$(this).siblings("div").slideDown("slow",			
				function(){				
					$(this).children().show();				
				}
			);
		}			
	);	
	//hides and shows each sub-set of guidelines	
	$("#content h3").not( $("#describer h3, #voicer h3, #descriptionAudience h3, div.sM h3") ).css("cursor","pointer").addClass("minimizeAction");
	$("#content h3").not( $("#describer h3, #voicer h3, #descriptionAudience h3, div.sM h3") ).toggle(	
		function(){		
			$(this).removeClass("minimizeAction").addClass("maximizeAction");
			$(this).next("div.toggle").children().slideUp("fast");		
		},		
		function(){		
			$(this).removeClass("maximizeAction").addClass("minimizeAction");
			$(this).next("div.toggle").children().slideDown("fast");		
		}	
	);	
	//displays divs to change font size and switch stylesheets	
	$("#fontChange, #styleSwitch").css("display","block");	
	//minimize/maximize all button	
	$("a.minAll").css("display","block");
	$("a.minAll").toggle(	
		function(){		
			$(this).removeClass("minAll");
			$(this).addClass("maxAgain");
			$("div.toggle").slideUp("slow");
		},		
		function(){		
			$(this).removeClass("maxAgain");
			$(this).addClass("minAll");
			$("div.toggle").slideDown("slow");
		}	
	);	
	//for text-only and high-contrast version, function to close the information box warning	
	$("a.x").click(	
		function() {
			$(this).parent("div").slideUp("slow");		
		}
	);
	//removes spans with "noScript" classes if JS is enabled	
	$("div.noScript").remove();	
	//adds "download flash player" link if no player detected	
	$("a[title='download the MP4 excerpt']").after("<div class='flashLess'><span>Adobe Flash Player is required to view the fully featured video example.</span><a href='http://www.adobe.com/go/getflashplayer'>Download the latest version of Flash Player.</a></div>");
});