// JavaScript Document
var orgtekst;
var orgnieuws;
var orgaanbod;

$(document).ready(function(){
	hoofdmenu();
	
	orgtekst = $("#tekstcontainer").height();
	orgnieuws = $("#nieuwscontainer").height();
	orgaanbod = $("#aanbodcontainer").height();
	pos(orgtekst,orgnieuws,orgaanbod);
	
	$(".tmp").innerfade({
		animationtype: 'fade',
		speed: 750,
		type: 'sequence'
	});
});

$(window).resize(function(){pos(orgtekst,orgnieuws,orgaanbod)});

function hoofdmenu(){
	$("#menunav ul").css({display: "none"}); // Opera Fix
	$("#menunav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400);
	},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
}

function pos(ot,on,oa){
	var xpos = ($(window).width()-900)/2;
	
	if(xpos<0){
		xpos = 0;
	}
	$("#main").css({marginLeft:+xpos+"px"});

	var windowheight = $(window).height()-270;
	var maxheight;
	
	maxheight = ot;
	if(on > maxheight){
		maxheight = on;
	}
	if(oa > maxheight){
		maxheight = oa;
	}
	if(windowheight > maxheight){
		maxheight = windowheight;
	}
	
	$("#tekstcontainer").height(maxheight);
	$("#nieuwscontainer").height(maxheight);
	$("#aanbodcontainer").height(maxheight);
	
}