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


	// -------------------------------------------------------------------------------------------------------------------
	// 	when "More Details" is clicked then we replace "hideIndustry" with the "industry" page based on the rel of the
	//	link then we append a new hashtag to the URL of the site
	
	jQuery("#industryExpertise .moreDetails").click(
		function () {
			jQuery(".hideIndustry").fadeOut('slow');
	  		jQuery(".displayIndustry").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(".displayIndustry").load('/industry/' + frameId + '/' );
			
			// appends rel to hashtag of URL
			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.indexOf("industry_") != -1 ) { 
		
			jQuery(".hideIndustry").hide();
			jQuery(".displayIndustry").load('/industry/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csh_") != -1 ) { 
		
			jQuery(".hideIndustry").hide();
			jQuery(".displayIndustry").load('/industry/industry_healthcare/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("cse_") != -1 ) { 
		
			jQuery(".hideIndustry").hide();
			jQuery(".displayIndustry").load('/industry/industry_energy/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csg_") != -1 ) { 
		
			jQuery(".hideIndustry").hide();
			jQuery(".displayIndustry").load('/industry/industry_government/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
		if(hash.indexOf("csi_") != -1 ) { 
		
			jQuery(".hideIndustry").hide();
			jQuery(".displayIndustry").load('/industry/industry_insurance/' + hash + '/').fadeIn('slow');
		
		} else {
		// do nothing
		}
		
	} else {
	// do nothing
	
	}

});
