jQuery.extend( jQuery.easing,
{
	easeOut: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	}
});

/*******
 menu functions 
********/
window.Menu = {
	delay		: 2000,
	timer		: null,
	menuitem	: null,
	
	/**
	 * apply
	 * @param	string	selector
	 */
	apply: function( selector ) {
		$(selector).hover(Menu.open, Menu.setTimer);
		$(document).click(Menu.close);
	},
	
	/** 
	 * cancelTimer
	 */
	cancelTimer: function() {
		if(Menu.timer)	{
			clearTimeout(Menu.timer);
     		Menu.timer = null;
		}
	},
	
	/**
	 * setTimer
	 */
	setTimer: function() {
		Menu.timer = window.setTimeout(Menu.close, Menu.delay);
	},
		
	/** 
	 * close
	 * @param	string	currect_menu_id
	 */
	close: function( current_menu_id ) {
		if(Menu.menuitem)	{
			if(Menu.menuitem.data("menuID") != current_menu_id)	{
				$(Menu.menuitem).css({ height: 'auto', zIndex: "" }).stop().hide();
			}
		}
	},
			
	/** 
	 * open
	 */
	open: function() {
		currect_menu = $("div", this);
		
		// uniek menu id per submenu, dit om bij het sluiten te checken of niet de actieve wordt gesloten
		if(!currect_menu.data("menuID"))	{
			currect_menu.data("menuID", (Math.random() +''+ Math.random()).replace(/\./g,""))
		}
		
		Menu.cancelTimer();
		Menu.close( currect_menu.data("menuID") );
		Menu.menuitem = currect_menu;
		
		Menu.menuitem.css({ height: 'auto', zIndex: 100 }).stop().show();	
	}

};



/*******
 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;
};

/*******
 functie om input velden van tekst te voorzien
*******/
(function($){ 
$.fn.inputDefaultText = function( options )
{	
	var defaults = {
		default_txt: ""
	};
	
	var options = $.extend(defaults, options);

	// set default text
	if ( $(this).val() == "" )
		$(this).val( options.default_txt );

	// add behaviour at focus and blur
	$(this).focus( function() 
	{ 
		if ( $(this).val() == "" || $(this).val() == options.default_txt )
			$(this).val(""); 
	});
	
	$(this).blur( function() 
	{ 
		if ( $(this).val() == "" )
			$(this).val( options.default_txt );
	});
};
})(jQuery);
