/* 
 * Template JavaScript Additions
 * 
 * These methods add the following functionality to the templates:
 * 	1. Ability to have expanding/collapsing page sections
 * 	2. Ability to enable and embed any SWF file using SWFObject
 * 	3. Abillity to enable/disable various side sections of the template
 * 		on a page-by-page basis
 * 
 * This code relies on the jQuery library
 */

 var hatchling = {
 	headline: function(className,targetType) {
		// Get a collection of all elements matching className
		var headlines = $("." + className);
		// Define the behavior
		var showContent = function(e) {
			$(this).toggleClass("open");
			// Get the element to show/hide, as defined by targetType
			var myTarget = $(this).next(targetType);
			// Toggle display of the element
			myTarget.toggle("fast").toggleClass("headlineBody");
		}
		// Bind the behavior to the elements
		headlines.click(showContent);
	}
 };
 
 // Trigger the function on document ready
 $(function() {
 	hatchling.headline("headline","div");
	// Check the query string for headline requests
	var keepVisible = $(location.hash);
	$(".headline").next("div").hide();
	try {
		keepVisible.trigger("click");
		$.scrollTo(keepVisible[0],{
			axis: 'y',
			duration: 1000
		});
	} catch(e) {
		// Do nothing
	}
 });