$(document).ready( function() {
	//hides vidContainer div
	//$(".vidContainer div").hide();
	//$(".picContainer div").hide();
	
	//makes WPM Calculator visible
	
	$("form#WPMform").show();
	
	//inserts button to control display of video	
	$("div.vidContainer").prepend("<a class='showHide arrowdown' href='#'>hide the video demonstration</a>");
	$("div.picContainer").prepend("<a class='showHide arrowdown' href='#'>hide the illustration</a>");
	
	//shows video when button is clicked and hides it when it is clicked again (orange arrow for captioning 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();				
				}			
			);				
		}			
	);
	//same for pictures
	$("div.picContainer a.showHide").toggle(	
		function(){				
			$(this).text("show the illustration");
			$(this).removeClass("arrowdown").addClass("arrowup");
			$(this).siblings("div").children().slideUp("slow",			
				function(){				
					$(this).parent().slideUp("slow");				
				}			
			);				
		},
		function() {				
			$(this).text("hide the illustration");
			$(this).removeClass("arrowup").addClass("arrowdown");
			$(this).siblings("div").slideDown("slow",			
				function(){				
					$(this).children().show();				
				}			
			);				
		}			
	);
	//adds PDF icon to links to PDFs
	$("a[href$='pdf']").after("<img class='pdfFile' alt='P D F file' src='images/pdf_icon.gif' title='PDF' />");
	//hides and shows each sub-set of guidelines	
	$("#content h3").not( $("div.sM h3") ).css("cursor","pointer").addClass("minimizeAction");
	$("#content h3").not( $("div.sM h3") ).toggle(	
		function(){		
			$(this).removeClass("minimizeAction").addClass("maximizeAction");
			$(this).next("div.toggle, ul.vendor").children().slideUp("fast");		
		},		
		function(){		
			$(this).removeClass("maximizeAction").addClass("minimizeAction");
			$(this).next("div.toggle, ul.vendor").children().slideDown("fast");		
		}	
	);	
	//displays divs to change font size and switch stylesheets	
	$("#fontChange, #styleSwitch").css("display","block");	
	
	//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>");
});
