// Function: AJAX Content Switch
// Project: SecureWest Consulting
// Author: Precinct 25
// Date: June 28th, 2010

$(document).ready(function() {
	
	// Check for hash value in URL  
	var hash = window.location.hash.substr(1);  
	var href = $('#services li a').each(function(){  
		var href = $(this).attr('href');  
		if(hash==href.substr(0,href.length-5)){  
			var toLoad = hash+'.html #description';  
				$('#description').load(toLoad)  
		}  
	});  
	
	$('#services li a').click(function(){
		
		var toLoad = $(this).attr('href')+' #description';
		$('#description').fadeOut('normal',loadContent);
		
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		
		function loadContent() {
			$('#description').load(toLoad,'',showNewContent())
		}
		
		function showNewContent() {
			$('#description').fadeIn('normal')
		}
		return false;
		
	});
	
	
});
