$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};

/**
 * maak hele blokken klikbaar
 *
 * @param	obj     options
 *
 * @return	jQuery
 */
$.fn.hoverClick = function( options )
{
    var defaults = {
        trigger_click       : false,    // trigger het click event ipv de url
        hoverclass          : 'hover'
    }

    options = jQuery.extend(defaults, options);

    return this.bind("mouseover mouseout click", function( event )
	{
        if (event.type == 'mouseover')
		{
            if($("a", this).length)
			{
                $(this).addClass(options.hoverclass).css("cursor", "pointer");
				$(this).attr("title", $("a:first", this).attr("title"));
			}
		}
		else if(event.type == 'click' && event.target.nodeName.toUpperCase() != 'A' && $("a", this).length)
		{
			if(options.trigger_click)
			{
				$("a:first", this).trigger("click");
			}
			else
			{
				var link = $("a:first", this);

				if (link.attr("target"))
				{
					window.open(link.attr("href"), link.attr("target"));
				}
				else
				{
					window.location = link.attr("href");
				}
			}

			return false;
		}
		else
		{
			$(this).removeClass(options.hoverclass);
		}
	});
};

jQuery(function()	{  
	$("#menu > li").hover(
        function()	{ 
			if( $(this).children("ul").length )
			{
				$("ul", this).slideDown('fast'); 
			}
		}, 
		
        function() 
		{ 
			$("ul", this).hide(); 			
		} 
    );
	
	if (document.all) {
        $("#menu li").hoverClass("sfhover");
    }
});





