// JavaScript Document

$(document).ready(function() {
	currentPage = "#home";
	$(".nav_link").click(function() {
		cleanCurrentPage = currentPage.substring(1);
		clickedLink = $(this).attr("href");
		cleanClickedLink = clickedLink.substring(1);
		newBackground = "url(images/sd_" + cleanClickedLink + ".jpg)"
		if(clickedLink == currentPage) {
			return false;
		}
		else {
			$(currentPage).removeClass("current");
			$(clickedLink).addClass("current");
			$("#background").fadeOut("fast");
			$("#text_" + cleanCurrentPage).fadeOut("fast");
			$("#overlay").fadeOut("normal", function() {
				$("#background").css({'background-image' : newBackground, 'display' : 'none'});
				$("#background").fadeIn("slow", function() {
					$("#overlay").show("clip",400, function() {
						$("#text_" + cleanClickedLink).fadeIn("normal");
					});
				});
			});
			currentPage = clickedLink;
			return false;
		}
	});
	$(".tweet").tweet({
    	username: "zacatac",
        join_text: "auto",
        avatar_size: 32,
        count: 6,
        auto_join_text_default: "I said,",
        auto_join_text_ed: "I",
        auto_join_text_ing: "I was",
        auto_join_text_reply: "I replied to",
        auto_join_text_url: "I was checking out",
        loading_text: "loading tweets..."
    });
});
