$(document).ready(function() {
	DefaultSettings();
	BindClickEvents();
	$('#creations').css('display', 'block');
});

function BindClickEvents(){
	NavClick($(".home"), $("#creations"));
	NavClick($('.senw'), $('#suskeEnWiske'));
	NavClick($('.info'), $('#info'));
	NavClick($('.contact'), $('#contact'));
}

function DefaultSettings(){
	$('#suskeEnWiske').css('display', 'none');
	$('#info').css('display', 'none');
	$('#creations').css('display', 'none');
	$('#contact').css('display', 'none');
	
	$("#quote").html("<h1>Time is finite, treat it as a resource.</h1><div class=\"clear\"></div><p></p>");
	
	GalleryImagesHoverState();
}

function NavClick(clicked, visible){
		clicked.click(function(){
		var shown = visible.is(":visible");
		
		if(!shown)
		{
			DefaultSettings();
			visible.fadeIn();
		}
	});
}

function GalleryImagesHoverState(){
	$('.gallery.peek').hover(function(){
		$(".galleryInfo", this).stop().animate({bottom:'0px'},{queue:false,duration:160});
		}, function() {
			$(".galleryInfo", this).stop().animate({bottom:'-20px'},{queue:false,duration:160});
	});
	
	$('.gallery.toppeek').hover(function(){
		$(".galleryInfo", this).stop().animate({top:'0px'},{queue:false,duration:160});
		}, function() {
			$(".galleryInfo", this).stop().animate({top:'-15px'},{queue:false,duration:160});
	});
}

function EnlargeImage(name){
	$("#bigImage").fadeOut(function(){
		$("#selectedImage").attr("src", name.replace("-200", ""));
		$("#selectedImage").removeClass("imageBorder").addClass("imageBorder");
		$("#permalink").attr("href", name.replace("-200", ""));
		$("#bigImage").fadeIn(1000);
		
	});
}
