/* functie om hele blokken klikbaar te maken, en hover toevoegen */
$.fn.hoverClick = function()
{
	this.each(function()
	{
		if($("a:first", this).length)
		{
			$(this).hover(
				function() { $(this).addClass("hover").css("cursor", "pointer"); },
				function() { $(this).removeClass("hover").css("cursor", "pointer"); }
			);
			
			$(this).attr("title", $("a:first", this).attr("title"));
			
			$(this).click(function(){
				window.location = $("a:first", this).attr("href");
			});
		}
	});
	
	return this;
};


$(function()
{
	
	// Formulier focus op velden
	$(":input").not("input[type=button], input[type=submit]").focus(function() { $(this).addClass("veldfocus"); });
	$(":input").not("input[type=button], input[type=submit]").blur(function() { $(this).removeClass("veldfocus"); });
	
	// Submenu 
	var menu = {};
	
	menu.laatstGeopend = null;
	menu.timeoutTime = 2000;
	menu.timeout = null;
	
	menu.init = function()
	{
		$("#menu>li").hover( 	
			function() 
			{ 
				// als laatstegeopend dezelfde is als de huidige, dan de timeout verwijderen
				if($(this).hasClass("hover"))
				{
					clearTimeout(menu.timeout);
				}
				// nieuwe uitschuiven
				else
				{
					//$("#menu>li>div").hide();
					$("#menu>li").not(this).removeClass("hover");
					
					$(this).addClass("hover"); 
					$('ul', this).hide().slideDown(300);
					
					// selectbox in <ie7 verwijderen
					if($.browser.msie && $.browser.version < 7)	{
						$("select").css({ visibility: 'hidden' });	
					}
				}
			},
			function() 
			{  
				// timeout zetten om na x aantal sec te sluiten
				menu.laatstGeopend = this;
				menu.timeout = setTimeout(function()
				{
					//$('div', this).stop().animate({top: '70px', opacity: 0}, 300, 'easeOut');
					$(menu.laatstGeopend).removeClass("hover");
					
					// selectbox in <ie7 tonen
					if($.browser.msie && $.browser.version < 7)	{
						$("select").css({ visibility: 'visible' });	
					}
				}, menu.timeoutTime);
			}
		);
	}
	menu.init();

});

sIFR.replaceElement(named({ sSelector:"#content h1", sFlashSrc: "fla/helvetica.swf", sColor:"#16425B", sBgColor:"#FFFFFF", sWmode:"transparent" }));
