$(document).ready(function(){
		
	function mycarousel_initCallback(carousel) {
		$('.jcarousel-control a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval($(this).text()));
			return false;
		});
	};
	
	hoezo_status = "closed";
	gedichten_status = "closed";
	contact_status = "closed";
		
	$("#nav li a").click(function(){
		id = $(this).parents().attr("id");
		
	
		
		if(id == "nav_hoezo") {
			if(gedichten_status == "open") {
				$("#gedichten_container").animate({width: 0}, "normal",function(){
					gedichten_status = "closed";
					$("#hoezo_container").animate({width: 557}, "normal");
					hoezo_status = "open";
				});
			}
			else if(contact_status == "open") {
				$("#contact_container").animate({width: 0}, "normal",function(){
					contact_status = "closed";
					$("#hoezo_container").animate({width: 557}, "normal");
					hoezo_status = "open";
				});
			}
			else {
				$("#hoezo_container").animate({width: 557}, "normal");
				hoezo_status = "open";
			}
		}
		
		else if(id == "nav_gedichten") {
			if(hoezo_status == "open") {
				$("#hoezo_container").animate({width: 0}, "normal",function(){
					hoezo_status = "closed";
					$("#gedichten_container").animate({width: 557}, "normal");
					gedichten_status = "open";
				});
			}
			else if(contact_status == "open") {
				$("#contact_container").animate({width: 0}, "normal",function(){
					contact_status = "closed";
					$("#gedichten_container").animate({width: 557}, "normal");
					gedichten_status = "open";
				});
			}
			else {
				$("#gedichten_container").animate({width: 557}, "normal");
				gedichten_status = "open";
			}
		}
		
		else if(id == "nav_contact") {
			if(gedichten_status == "open") {
				$("#gedichten_container").animate({width: 0}, "normal",function(){
					gedichten_status = "closed";
					$("#contact_container").animate({width: 557}, "normal");
					contact_status = "open";
				});
			}
			else if(hoezo_status == "open") {
				$("#hoezo_container").animate({width: 0}, "normal",function(){
					hoezo_status = "closed";
					$("#contact_container").animate({width: 557}, "normal");
					contact_status = "open";
				});
			}
			else {
				$("#contact_container").animate({width: 557}, "normal");
				contact_status = "open";
			}
		}
		
		else {
			$("#hoezo_container").animate({width: 0}, "normal");
			$("#gedichten_container").animate({width: 0}, "normal");
			$("#contact_container").animate({width: 0}, "normal");
			hoezo_status = gedichten_status = contact_status = "closed";
		}
	});
				   
	$('#mycarousel').jcarousel({
		scroll: 1,
		animation: "slow",
		initCallback: mycarousel_initCallback
	});
	$('#container #nav').tabs({fxFade:true,fxSpeed:'normal'});
	$('#fragment-3 #albumcontrol').tabs({fxFade:true,fxSpeed:'normal'});
	
});