$(function() {

 $('#menu').each(function() {
  var me = $(this), $marker = $('<li class="marker"></li>').appendTo(me), $li = $('li', this), curr = $('li.current', this)[0] || $($li[0]).addClass('current')[0];
  $li.not('.marker').find('a').hover(function() { move(this.parentNode); }, function() { move(curr); } );
  $marker.css({'top': curr.offsetTop });
  function move(el) {
   $marker.each(function() {
    $(this).dequeue();
   }).animate({
    top: el.offsetTop
   }, 600, 'bounceout');
  };
 });

});


jQuery.easing = {
 bounceout: function(x, t, b, c, d) {
  if ((t/=d) < (1/2.75)) {
   return c*(7.5625*t*t) + b;
  } else if (t < (2/2.75)) {
   return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  } else if (t < (2.5/2.75)) {
   return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  } else {
   return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  }
 },
 linear: function(x, t, b, c, d) {
  return c*t/d + b; //linear
 }
};