$(document).ready(function(){
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a,#category li a,#footer a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
	        	var toLoad = hash+'.html #content';
	            	$('#content').load(toLoad)
		}
	});
	$("#nav,h1,#catportrait,#catsport,#catlebenswelt,#catpeople,#footer,#content").css("display","none");
         $("a[href^='http']").not("[href*='manuel-list.de']").attr("target","_blank");
	$("h1").show("slow", function() {
			$("#catlebenswelt").show("slow");
         	$("#catpeople").show("slow", function() {
         		$("#catportrait").show("slow");
         		$("#catsport").show("slow", function() {
					$("#content,#footer").slideDown("normal",function() {
						$("#nav").fadeIn("slow");
                                 	});
                         	});}
                 	);}
         );
         $('#nav li a,#catpeople a,#catportrait a,#catsport a,#footer a').click(function(event){
         	event.preventDefault();
		var toLoad = $(this).attr('href')+' #content';
                 $('#content').slideUp('fast',loadContent);
                 $('#loading').remove();
    		$('#container').append('<span id="loading">LOADING...</span>');
    		$('#loading').fadeIn('normal');
                 window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
                 function loadContent() {
    			$('#content').load(toLoad,'',showNewContent);
		}
                 function showNewContent() {
                 	$(this).hide();
			$('#content').slideDown('slow',hideLoader);
    		}
		function hideLoader() {
			$('#loading').fadeOut('normal');
		}
	});
});
