
jQuery(document).ready(function () {
    //get the default top value
    var top_val = jQuery('#menu li a').css('top');

    //animate the selected menu item
    jQuery('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});        

    jQuery('#menu li').hover(
        function () {
                
            //animate the menu item with 0 top value
            jQuery(this).children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});        
        },
        function () {

            //set the position to default
            jQuery(this).children('a').stop().animate({top:top_val}, {easing: 'easeOutQuad', duration:500});        

            //always keep the previously selected item in fixed position            
            jQuery('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});        
        }        
    );
    
});

