$(function(){
		   
	/* mb: functie geeft problemen en ik ben nog geen toepassing tegengekomen waar hij nut heeft
	function setFullWindowHeight() {
		var windowHeight = parseInt($(window).height()) - 211;
		var contentHeight = parseInt($('#content').height());
		
		$('#windowheight').val(windowHeight);
		$('#contentheight').val(contentHeight);
		
		if(contentHeight < windowHeight) {
		
			$('#content').height(windowHeight);
			$('#contentheight').val(windowHeight);
			$('#subpage_pagecontent').height((windowHeight - 100));
		}
	}
	
	setFullWindowHeight();

	
	$(window).resize(function() {
		setFullWindowHeight();					  
	});
	*/
	
	$(function() {
		$("img#morePanels").fadeIn('fast');
	});

	$('img#morePanels').click(function(){
		$('div#panelFlow').animate({ marginLeft: -735},400, 
			function() {
				$('img#morePanels').css('display','none');
				$('img#lessPanels').fadeIn('fast');
			});
	});
	$('img#lessPanels').click(function(){
		$('div#panelFlow').animate({ marginLeft: 0},400,
			function() {
				$('img#lessPanels').css('display','none');
				$('img#morePanels').fadeIn('fast');
			});
	});

	/* mb: removed in favor of css menu
	$('.menuItem, .menuItemLoggedIn').hover(
		function(){
			var id = $(this).attr("id").replace("menuItem","");
			$('#subMenu'+id).css("display","block");
			$(this).css("backgroundImage","url('/images/menubar1_over.png')").css("zIndex",2);
			//$('#subMenu'+id).slideDown('fast');
		},
		function(){
			var id = $(this).attr("id").replace("menuItem","");
			$('#subMenu'+id).css("display","none");
			$(this).css("backgroundImage","url('/images/menubar"+id+".png')").css("zIndex",1);
			//$('#subMenu'+id).slideUp('fast');
	});
	*/
	
	jQuery.fn.center = function () {
		this.css("position","absolute");
		this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
		this.css("left", "50%");
		this.css("margin-left","-"+this.width() /2+"px");
		return this;
	}

	function getDocHeight() {
		var docHeight = $(document).height();	
		return docHeight;
	}

	$('div#menuItem4').click(function(){
		if($(this).attr("class") == 'menuItem') {
			$("div#overlay").height(getDocHeight).css("display","block");
			$("#login_box").center().css("display","block");
			$("input#loginUsername").focus();
		}
	});
	
	$("#cancel_login, div#overlay").click(function(){
		$("#login_box").css("display","none");
		$("div#overlay").css("display","none");
	});
	
	$("#submitUpload").click(function(){
		$("#uploadDoc").submit();
	});

	$("#submitMessage").click(function(){
		$("#postMessage").submit();
	});
	
	$("#showUploadForm").click(function(){ 
		$(this).css("display","none");
		$("#uploadForm").css("display","block"); 
	})
	
	$("#showPostMessage").click(function(){ 
		$(this).css("display","none");
		$("#messageForm").css("display","block"); 
	})
	
	if($('#slideshow').length) {
		$("#slideshow").cycle({ timeout: 5000, pause: 1,  speed: 2000 });
	}
});
