$(document).ready(function() {
    /*start config*/
    var slideDownSpeed = "fast";
    /*end config*/

    //add mouseover event handlers on navigation items
    $('#menuContent div.navitem').hoverIntent(function() {
        //stop all running animations and hide the sub-navigation items of all the children of this navitem that were open or opening
        $(this).siblings().find(".open").stop().css("display", "none").removeClass("open");
		
        //show the subnav of the mouseovered navitem
        $(this).children(".subnav").addClass("open").slideDown(slideDownSpeed,
        	function() {//make extra sure all animated styles are set properly at the end of the animation (jQuery tends to be buggy with this)
            	$(this).css({
                	display: "block",
               		height: "auto",
                	overflow: "visible"
            	})
        });
    },
    function() {
        /* there is no mouseout function needed */
    });

    //add mouseout eventhandler on navigation container to clear navigation when user is not navigating anymore
	// Zorgt ervoor dat als je met de muis uit het Nav-menu gaat, dat het navigeren stopt.
	$('#menuContent').hoverIntent(function() {},
    	function() {
        	$(".subnav", this).stop().css("display", "none").removeClass("open");
    	}
	)


    //at page initialize opens all subnav levels to current page so that nav looks the same as the previous page was left
    $('#menuContent a.current').parents(".subnav").addClass("open").css("display", "block");

    //at page initialize sets the path to current page to current (opacity=1.0)
    $('#menuContent a.current').parents(".navitem").children("h3").children("a").addClass("current");

});