$(document).ready(function() {
	var queryhash = window.location.hash
	switch (queryhash) {
		case "#about":
			document.title = "Ibrahim Demir - About";
			initialShowAbout();
			break;
		case "#contact":
			document.title = "Ibrahim Demir - Contact";
			initialShowContact();
			break;
		case "#research":
			document.title = "Ibrahim Demir - Research";
			initialShowResearch();
			break;
		default:
			initialShowResearch();
			break;
	}
	$("h2").hide();
	$("#vcard a").hover(showVcardLabel, hideVcardLabel);
	$("#nav-about a").click(showAbout);
	$("#nav-research a").click(showResearch);
	$("#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 initialShowResearch() {
	$("#content").hide();
	$("#idemir").removeClass();
	$("#idemir").addClass("research");
	$(".node").hide();
	$("#research").show();
	setTimeout("$('#content').slideDown('slow');", 1000);
}

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

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

function showAbout() {
	if ($("#idemir").hasClass("about")){ }
	else {
		document.title = "Ibrahim Demir - About";
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#about').show();", 500);
		$("#content").slideDown(500);
		$("#idemir").removeClass();
		$("#idemir").addClass("about");
	}
}

function showResearch() {
	document.title = "Ibrahim Demir - Research";
	if ($("#idemir").hasClass("research")){ }
	else {
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#research').show();", 500);
		$("#content").slideDown(500);
		$("#idemir").removeClass();
		$("#idemir").addClass("research");
	}
}

function showContact() {
	if ($("#idemir").hasClass("contact")){ }
	else {
		document.title = "Ibrahim Demir - Contact";
		$("#content").slideUp(500);
		$(".node").fadeOut(500);
		setTimeout("$('.node').hide();", 500);
		setTimeout("$('#contact').show();", 500);
		$("#content").slideDown(500);
		$("#idemir").removeClass();
		$("#idemir").addClass("contact");
	}
}