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


	// -------------------------------------------------------------------------------------------------------------------
	// 	when "More Details" is clicked then we replace "hideCapabilities" with the "Capabilities" page based on the rel of the
	//	link then we append a new hashtag to the URL of the site
	
	jQuery("#capabilities .moreDetails").click(
		function () {
			jQuery(".hideCapabilities").fadeOut('slow');
	  		jQuery(".displayCapabilities").fadeIn('slow');

			// 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(".displayCapabilities").load('/capabilities/' + frameId + '/' );
			
			// appends rel to hashtag of URL
			window.location.hash = jQuery(this).attr('rel');

		}
	);

	
	if(window.location.hash) {
		var hash = window.location.hash.substring(1);
		if(hash.indexOf("sec_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csam_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_appmod/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csad_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_appdev/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csmc_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_manacons/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("cssi_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_sysint/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csaa_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_apparch/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csms_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_manaserv/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csit_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_itsg/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("cssa_") != -1 ) { 
		
			jQuery(".hideCapabilities").hide();
			jQuery(".displayCapabilities").load('/capabilities/sec_saas/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
	} else {
	// do nothing
	
	}

});
