/* 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"); });
	
		
	/* 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
				{
					$("#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();
	

});


// webplayer openen
function webplayer(s)
{
	openen = window.open(s.href, 'webplayer_window', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=600,height=500');
 	openen.focus();
 	return false;
}



