jQuery.extend( jQuery.easing,
{
	easeOut: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	}
});

/* 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.defaultvalue 
 * @param	string	defaultvalue
*/
$.fn.defaultvalue = function( defaultvalue ) {
	return this.each(function() {				
		var input = $(this);
		var form = input.parents("form");
		
		if(input.val() == "" || input.val() == defaultvalue)	{
			input.val(defaultvalue).addClass("defaultvalue");
		}

		input
			.focus(function() {
				if(input.val() == defaultvalue) {
					input.val("").removeClass("defaultvalue");
				}
			})
			.blur(function() 	{
				if(input.val() == "") {
					input.val(defaultvalue).addClass("defaultvalue");
				}
			});
		
		form.submit(function()
		{
			if(input.val() == defaultvalue) {
				input.val("").removeClass("defaultvalue");
			}
		});
	})
};

// keycode object, zo wordt de code iets duidelijker
window.Keycode = {
	escape	: 0,
	space	: 32,
	enter	: 13
};

$(function()
{
	
	// Formulier focus op velden
	$("#content input, #content textarea").focus(function() { $(this).addClass("veldfocus"); });
	$("#content input, #content textarea").blur(function() { $(this).removeClass("veldfocus"); });


	$("#menu li:not(.actief), #zijbalk li:not(.actief)").hover(
		function() { $(this).stop().animate({ opacity: 0.8 }, 200); },
		function() { $(this).stop().animate({ opacity: 1 }, 200); }
	);
	
	$('#zoeken input').keypress(function (e) {
		if (e.which == window.Keycode.enter)
		{
			document.location = submap + "/zoeken/trefwoord/" +$('#trefwoord').val();
		}
	});
	
	// formulier elementen met default attribute
	$("input[default], textarea[default]").each(function() { 
		$(this).defaultvalue( $(this).attr("default") );
	});
});