jQuery.extend( jQuery.easing, {
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	}
});

function init_topmenu()
{
	$('#topmenu').hide();
	
	$(function()	{
		setTimeout(function()	{
			$('#topmenu').animate({ height: 'show', opacity: 'show' }, 1000, 'easeOutBounce');
		}, 1000);
	});	
}

function init_menu()
{
	$('#menu > ul > li').hover(
		function() {
			$(this).addClass("hover");
			$("ul", this).width(0).animate({ width: '203px' }, 200, function() { $(this).show(); });
		},
		function() {
			$(this).removeClass("hover");
			$('#menu li ul').hide();
			$("ul", this).stop().animate({ width: '0' }, 200, function() { $(this).hide(); });
		}
	);
}

/* 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).click(function(){
			window.location = $("a:first", this).attr("href");
		});
	});
	
	return this;
};

$(function()
{
	// sifr
	if(typeof sIFR == "function")
	{
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"#content h1", sFlashSrc: config.submap +"/fla/titel.swf", sColor:"#383D67", sBgColor:"#F5E1C1", sWmode:'opaque'}));
		sIFR.replaceElement(named({sSelector:"#producten h2", sFlashSrc: config.submap +"/fla/titel.swf", sColor:"#383D67", sBgColor:"#ffffff", sWmode:'opaque'}));
	}
	

	// informatie formulier labels in de velden zetten
	$("form#informatie label").each(function()
	{
		var label = $(this);
		var formE = $("#"+ label.attr("for"));
		
		formE.focus(function()	{
			if($(this).val() == $("label[for="+ $(this).attr("id") +"]").text())
				$(this).val("");
		});
		
		formE.blur(function()	{
			if($(this).val() == "")
				$(this).val($("label[for="+ $(this).attr("id") +"]").text());
		});
		
		if(formE[0])
		{
			switch(formE[0].tagName.toLowerCase())
			{
				case 'input':
					if(formE[0].type == 'text' && formE.val() == '')
						formE.val(label.text());
					break;
				case 'textarea':
					if(formE.val() == '')
						formE.val(label.text());
					break;
			}
		}
	});
	
	// bij versturen velden waar de label nog instaat leeg gooien
	$("form#informatie").submit(function()
	{
		$("input:text, textarea", this).each(function()
		{
			 if($(this).val() == $("label[for="+ $(this).attr("id") +"]").text())
			 {
				 $(this).val("");
			 }
		});
	});
   
});