$(document).ready(function()
{
	$('#menu li.top').each(function()
	{
		var sub = $(this).find('ul');

		// Skip non-existent sub menus
		if (sub.length == 0) return;

		// Fetch the current height and add padding
		sub._h = sub.height() + 8;

		// Prepare to animate
		sub.css({ height: 0 });

		$(this).hover(function()
		{
			// Go to full height
			sub.stop().animate({ height: sub._h }, 300);
		},
		function()
		{
			// Go to 0 height
			sub.stop().animate({ height: 0 }, 300);
		});
	});
	
});

