/* functie om hele blokken klikbaar te maken, en hover toevoegen */
$.fn.hoverClick = function()
{
	this.each(function()
	{
		$(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;
};

jQuery.extend( jQuery.easing,
{
	easeOut: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	}
});

$(function()
{
	// menu slidebalkje
	var hoverTerugTimeout = false;

	// slider toevoegen
	$("#header").prepend('<div class="slider"></div>');
	var slider = $("#header .slider");	

	// init positie achter actieve link zetten
	if($("#header ul li.actief").length)
	{
		slider.css("left", $("#header ul li.actief a").offset().left - $("#container").offset().left);
		slider.width($("#header ul li.actief a").width());
	}
	
	// animatie regelen
	$("#header ul li a").hover(
		function()
		{
			// slider uitfaden stoppen
			clearTimeout(hoverTerugTimeout);
			
			// vars zetten
			var menuLink = $(this);
			var left = menuLink.offset().left - $("#container").offset().left;
			
			// alle huidige effecten stoppen, en de volgende uitvoeren
			slider.stop().animate({
				opacity: 1,
				left: left +"px",
				width: menuLink.width() +"px"
			}, 500, 'easeOut');
		},
		function()
		{
			// uitaden na 1 sec
			hoverTerugTimeout = setTimeout(function()	{
				slider.fadeOut(400);
			}, 1000);
		}
	);
});

function init_sifr( pagina_type )
{
	switch( pagina_type )
	{
		case "frontpage":			
			sIFR.replaceElement(named({sSelector:"#content .nieuws h2", sFlashSrc: config.submap +"fla/titel.swf", sColor:"#ee1c23", sLinkColor:"#ee1c23", sBgColor:"#ffffff", sWmode:"transparent" }));
		
			sIFR.replaceElement(named({sSelector:"#content h2", sFlashSrc: config.submap +"fla/titel.swf", sColor:"#8d8c8c", sLinkColor:"#8d8c8c", sBgColor:"#ffffff", sWmode:"transparent" }));						
			break;
		default:
			sIFR.replaceElement(named({sSelector:"#content h1", sFlashSrc: config.submap +"fla/titel.swf", sColor:"#8d8c8c", sLinkColor:"#8d8c8c", sBgColor:"#ffffff", sWmode:"transparent" }));
			break;
	}
}