// JavaScript Document
function getWidth() {
	var viewportwidth='';
	if(typeof window.innerWidth!='undefined'){viewportwidth=window.innerWidth}
	else if(typeof document.documentElement!='undefined'&&
	typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)
	{viewportwidth=document.documentElement.clientWidth}
	else{viewportwidth=document.getElementsByTagName('body')[0].clientWidth}
	return viewportwidth;
} // http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/

$(document).ready(function() {
	var isOpen = true;
						   
	$(".close").click(function(){
		
		var viewportwidth = getWidth();
		isOpen = false;

		$("#nav")
			.css( { left:"0px" } )
			.animate( { left:"-"+viewportwidth+"px" }, { "duration": 750, "easing": "easeInCubic" } );
		$("#nav-closed")
			.css( { left:"-"+viewportwidth+"px", display:"block" } )
			.animate( { left:"0px" }, { "duration": 750, "easing": "easeInCubic" } );
	});
	$(".open").click(function(){
	
		var viewportwidth = getWidth();
		isOpen = true;
	
		$("#nav")
			.css( { left:"-"+viewportwidth+"px", display:"block" } )
			.animate( { left:"0px" }, { "duration": 750, "easing": "easeInCubic" } );
		$("#nav-closed")
			.css( { left:"0px" } )
			.animate( { left:"-"+viewportwidth+"px" }, { "duration": 750, "easing": "easeInCubic" } );
	});
	$(".selecter").click(function(){
		$("#content")
			.css( { opacity:0 } )
			.animate( { opacity:1 }, { "duration": 750, "easing": "easeInCubic" } );
	});
	
	$(window).resize(function(){
		if ( isOpen ) {
			$("#nav-closed").css( { display:"none" } );
		} else if ( !isOpen ) {
			$("#nav").css( { display:"none" } );			
		}
	});
	
	$(".schilderijen").click(function(){
		$("#content").load("schilderijen.php");
	});
	$(".tekeningen").click(function(){
		$("#content").load("tekeningen.php");
	});
	$(".over").click(function(){
		$("#content").load("over.htm");
	});
	$(".agenda").click(function(){
		$("#content").load("agenda.php");
	});
	$(".contact").click(function(){
		$("#content").load("contact.htm");
	});
});
