/* 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 itemClassName(className)	{
	eerste_class = className.split(" ")[0];
	
	if(className.match(/_hover/))	{
		return  eerste_class +"_hover";		
	}
	else	{
		return eerste_class;	
	}
}


$(function()
{


	$(".aktie-een, .aktie-twee, .aktie-drie").hover(
		function() { $(this).addClass( itemClassName(this.className + "_hover")); },
		function() { $(this).removeClass(itemClassName(this.className + "_hover")); }
	);
	
	
	/* Subsubmenu */
	var menu = {};

	menu.laatstGeopend = null;
	menu.timeoutTime = 600;
	menu.timeout = null;
	
	menu.init = function()
	{		
		/* hover op li */
		$("#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
				{
					$("a:first", this).css("opacity", 0.2); 
					$("a:first", this).animate({opacity: "1"}, 500); 
					//$("a", this).slideUp(200);
					
					//$("a:first", this).fadeIn(200);
					$("#menu>li>ul").hide();
					$("#menu>li").not(this).removeClass("hover");
					
					$(this).addClass("hover");
					$(">ul", this).slideDown(400);									
				}
			},
			function() 
			{ 
 

				// timeout zetten om na x aantal sec te sluiten
				menu.laatstGeopend = this;
				menu.timeout = setTimeout(function()
				{
					$(menu.laatstGeopend).removeClass("hover"); 
					
				}, menu.timeoutTime);
			}
		);
	}

	menu.init();	
	
	
	
	
	// 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"); });
	
	$("#keyword").focus(function(){
		if ($(this).val() == 'type hier uw trefwoord' )
			$(this).val('') ;

	})
	
	$("#keyword").blur(function(){
		if($(this).val() == '' )
			$(this).val('type hier uw trefwoord' );						
								
	})

	
	
	$(".aktie").hoverClick();

});


function maak_sifr()
{
	sIFR.replaceElement(named({ sSelector:"h1", sFlashSrc: submap+"/fla/frutiger.swf", sColor:"#6e8e24", sBgColor:"#fff", sWmode:"transparent" }));	
}

function checkZoeken()
{
	if(document.forms['form-zoeken'].elements['zoekterm'].value.length <= 2 || document.forms['form-zoeken'].elements['zoekterm'].value == 'type hier uw trefwoord' )
	{
		alert("Vul svp een zoekterm in met minimaal 3 karakters.");
		return false;
	}
}

function header_film( filmpje )
{
	var s1 = new SWFObject(submap +"/fla/header_film.swf", "knikaaskers", "267", "119", "8");
	s1.addParam("menu","false");
	s1.addParam("wmode","transparent");	
	s1.addVariable("bestand", submap +"/fla/"+ filmpje);			
	s1.write($(".filmpje")[0]);	
}
