$(document).ready(function() {
	var queryhash = window.location.hash
	switch (queryhash) {
		case "#about":
			document.title = "Leif Bomberg om";
			initialShowAbout();
			break;
		//case "#contact":
			//document.title = "Tim Van Damme - Contact";
			//initialShowContact();
			//break;
		case "#networks":
			document.title = "Leif Bomberg - Networks";
			initialShowNetworks();
			break;
		default:
			initialShowNetworks();
			break;
	}
	$("h2").hide();
	$("#vcard a").hover(showVcardLabel, hideVcardLabel);
	$("#nav-about a").click(showAbout);
	$("#nav-networks a").click(showNetworks);
//	$("#nav-contact a").click(showContact);
});

function showVcardLabel() {
	$("#vcard a span").show();
	$("#vcard a span").animate({
		top: "-40px",
		opacity: 1
	}, 250 );
}

function hideVcardLabel() {
	$("#vcard a span").animate({ 
		top: "-35px",
		opacity: 0
	}, 250 );
	setTimeout("$('#vcard a span').hide();", 250);
	$("#vcard a span").animate({ 
		top: "-45px",
	}, 250 );
}

function initialShowNetworks() {
	$("#content").hide();
	$("#leifbomberg").removeClass();
	$("#leifbomberg").addClass("networks");
	$(".node").hide();
	$("#networks").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

function initialShowAbout() {
	$("#content").hide();
	$("#leifbomberg").removeClass();
	$("#leifbomberg").addClass("about");
	$(".node").hide();
	$("#about").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

//function initialShowContact() {
//	$("#content").hide();
//	$("#leifbomberg").removeClass();
//	$("#leifbomberg").addClass("contact");
//	$(".node").hide();
//	$("#contact").show();
//	setTimeout("$('#content').slideDown('slow');", 1000);
//}

function showAbout() {
	if ($("#leifbomberg").hasClass("about")){ }
	else {
		document.title = "Leif Bomberg - Om mig";
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#about').show();", 500);
		$("#content").slideDown(500);
		$("#leifbomberg").removeClass();
		$("#leifbomberg").addClass("about");
	}
}

function showNetworks() {
	document.title = "Leif Bomberg - Networks";
	if ($("#leifbomberg").hasClass("networks")){ }
	else {
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#networks').show();", 500);
		$("#content").slideDown(500);
		$("#leifbomberg").removeClass();
		$("#leifbomberg").addClass("networks");
	}
}

//function showContact() {
//	if ($("#leifbomberg").hasClass("contact")){ }
//	else {
//		document.title = "Tim Van Damme - Contact";
//		$("#content").slideUp(500);
//		$(".node").fadeOut(500);
//		setTimeout("$('.node').hide();", 500);
//		setTimeout("$('#contact').show();", 500);
//		$("#content").slideDown(500);
//		$("#leifbomberg").removeClass();
//		$("#leifbomberg").addClass("contact");
//	}
//}
