//CUSTOM JQUERY FUNCTIONS
jQuery(document).ready(function () {


	// -------------------------------------------------------------------------------------------------------------------
	// 	when "View All Leaders" is clicked then we replace "hideAbout" with the "leadership" page based on the rel of the
	//	link then we append a new hashtag to the URL of the site
	
	jQuery(".viewAllLeaders").click(
		function () {
			jQuery(".hideAbout").fadeOut('slow');
	  		jQuery(".displayAbout").fadeIn('slow');
	  		
	  		// check to see if #about already has a class of inner, this prevent the class from toggling if they're already 
	  		// on the leader page and they click the dropdown in the nav
	  		if( jQuery("#about").hasClass('inner') ) {
	  			// do nothing
	  		} else {
	  			jQuery("#about").toggleClass('inner');
	  		}

			// defines the frameId as the value in the rel
			var frameId = jQuery(this).attr('rel');
					
			// displays div based on frameId of the link clicked
			jQuery(".displayAbout").load('/about/' );
			
			// appends rel to hashtag of URL
			window.location.hash = jQuery(this).attr('rel');

		}
	);
	
	// -------------------------------------------------------------------------------------------------------------------
	// pull out the cartridge, blow on the game and reset
	jQuery(".root").click(function () {  
  
	  	jQuery(".displayAbout").fadeOut('slow');
	  	jQuery(".hideAbout").fadeIn('slow');
		
		window.location.hash = jQuery(this).attr('rel');
	  
	});
	
	// -------------------------------------------------------------------------------------------------------------------
	// 	checks the length of the hashtag and hides/displays accordingly
	
	if(window.location.hash) {
		var hash = window.location.hash.substring(1);
		
		if( hash == "leadership" ) {
						
			jQuery(".hideAbout").hide();
			jQuery(".displayAbout").load('/about/').fadeIn('slow');
			jQuery("#about").toggleClass('inner');
			
		} else {
			// do nothing
		}
		
	} else {
		// do nothing
	}
	
});
