$(document).ready( function() {

	
	//Set the height of the block
	//$('#menu_main .block').height($('#menu_main li').height() + 2); 

	//go to the default selected item
	if($('#menu_main').find('ul li a').hasClass('selected') == true)
	{
		var topval = $('#menu_main ul li a.selected').position();
	}
	else
	{
		var topval = $('#menu_main ul li a:eq(0)').position();	
	}

	$('#menu_main .block').stop(true,true).animate({top: topval.top - 5}, {easing: '', duration:900});
	
	$('#menu_main a').mouseenter(function()
	{
		//get the top position
		var topval = $(this).position();
		//animate the block
		//you can add easing to it
		$('#menu_main .block').stop().animate({top: topval.top - 5}, {easing: '', duration:300});
		//add the hover effect to menu item
		$(this).parent('li').addClass('hover');
	}).mouseleave(function()
	{		
		//remove the hover effect
		$(this).parent('li').removeClass('hover');	
	});
});
