$(document).ready(function() {
	// Check for hash value in URL
	var hash = window.location.hash.substr(1);
	var href = $('#catalogNav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-4)){
			var toLoad = hash+'.php';
			$('#catalog').load(toLoad);
		}
	});
	$('#catalogNav li a').click(function(){
	var toLoad = $(this).attr('href');
	$('#catalog').fadeOut('3000',loadCatalog);
	window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
	function loadCatalog() {
		$('#catalog').load(toLoad,'',showNewCatalog());
	}
	function showNewCatalog() {
		$('#catalog').fadeIn('3000');
	}
	return false;
	});
});
