$(document).ready(function() {
	var queryhash = window.location.hash
	switch (queryhash) {
		case "#radio":
			document.title = "Nicolas SALAUN";
			initialShowAbout();
			break;
		case "#contact":
			document.title = "Nicolas SALAUN";
			initialShowContact();
			break;
		case "#reseaux":
			document.title = "Nicolas SALAUN";
			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();
	$("#timvandamme").removeClass();
	$("#timvandamme").addClass("reseaux");
	$(".node").hide();
	$("#reseaux").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

function initialShowAbout() {
	$("#content").hide();
	$("#timvandamme").removeClass();
	$("#timvandamme").addClass("radio");
	$(".node").hide();
	$("#radio").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

function initialShowContact() {
	$("#content").hide();
	$("#timvandamme").removeClass();
	$("#timvandamme").addClass("contact");
	$(".node").hide();
	$("#contact").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

function showAbout() {
	if ($("#timvandamme").hasClass("radio")){ }
	else {
		document.title = "Nicolas SALAUN";
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#radio').show();", 500);
		$("#content").slideDown(500);
		$("#timvandamme").removeClass();
		$("#timvandamme").addClass("radio");
	}
}

function showNetworks() {
	document.title = "Nicolas SALAUN";
	if ($("#timvandamme").hasClass("reseaux")){ }
	else {
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#reseaux').show();", 500);
		$("#content").slideDown(500);
		$("#timvandamme").removeClass();
		$("#timvandamme").addClass("reseaux");
	}
}

function showContact() {
	if ($("#timvandamme").hasClass("contact")){ }
	else {
		document.title = "Nicolas SALAUN";
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#contact').show();", 500);
		$("#content").slideDown(500);
		$("#timvandamme").removeClass();
		$("#timvandamme").addClass("contact");
	}
}
