/* 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()
{
	/* Subsubmenu */
	var menu = {};

	menu.laatstGeopend = null;
	menu.timeoutTime = 2000;
	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
				{
					if ( !$(this).hasClass("actief") )
					{
						$("a:first", this).css("opacity", 0.95); 
						$("a:first", this).animate({opacity: "1"}, 200); 
					}
					
					$("a:first", this).fadeIn(200);
					$("#menu>li>ul").hide();
					$("#menu>li").not(this).removeClass("hover");
					
					$(this).addClass("hover");
					$(">div", this).css("opacity", 0.95).animate({opacity:"1"}, 200);
				}
			},
			function() 
			{ 
 

				// timeout zetten om na x aantal sec te sluiten
				menu.laatstGeopend = this;
				menu.timeout = setTimeout(function()
				{
					// submenu uitfaden
					$(menu.laatstGeopend).removeClass("hover");
					
				}, menu.timeoutTime);
			}
		);
	}
	
	menu.init();	
	
	// Formulier focus op velden
	$(":input").not("input[type=button], input[type=submit], input[type=radio], input[type=checkbox]").focus(function() { $(this).addClass("veldfocus"); });
	$(":input").not("input[type=button], input[type=submit], input[type=radio], input[type=checkbox]").blur(function() { $(this).removeClass("veldfocus"); });

});

function flash_teaser(container) 
{
	var s1 = new SWFObject(config.submap +"/fla/flashheader.swf", "flashheader", "994", "195", "8");
	s1.addParam("menu","false");
	s1.addParam("wmode","transparent");	
	var randomnumber=Math.floor(Math.random()*11);
	s1.addVariable("url_xml", config.submap +"/testimonials.xml?"+randomnumber);
	s1.write(container);	
}
