
$('div#header #navigation ul').css('backgroundImage',$('div#header ul li.active a').css('backgroundImage')).css('backgroundRepeat','no-repeat');
$('div#header #navigation ul li.active a').css('backgroundImage','none');

var halfImageWidth = 14;
var initialPosition = $('div#header #navigation ul li.active').offset().left - $('div#header ul').offset().left;
initialPosition += Math.round($('div#header #navigation ul li.active').width()/2) - halfImageWidth;

$('div#header #navigation ul').css('backgroundPosition', initialPosition + 'px bottom');

var contMenuAnimate = true;

$('div#header #navigation ul li').each(function(){
  $(this).hover(function(){
      oSet = $(this).offset().left;
      oSet -= $('div#header #navigation ul li').offset().left;
      var oPos = $(this).width() / 2;
      oPos += oSet;
      oPos = Math.round(oPos) - halfImageWidth;
      $('div#header #navigation ul').stop().animate({ "backgroundPosition" : '('+oPos+'px bottom)' });
      $(this).children('a').stop().animate({ "paddingTop" : '0px' });
    },
    function(){
      if(contMenuAnimate){ $('div#header #navigation ul').stop().animate({ "backgroundPosition" : '('+initialPosition+'px bottom)' }); }
      $(this).children('a').stop().animate({ "paddingTop" : '4px' });
    }
  );
  $(this).mousedown(function(){
    contMenuAnimate = false;
    window.location=$(this).children('a').attr('href');
    return false;
  });
});

var intialMoreHeight = $('div#header div#header_banner div.more').height();
var contMoreAnimate = true;
$('div#header div#header_banner div.more').hover(
  function(){
    if(contMoreAnimate){ $('div#header div#header_banner div.more').stop().animate({ "height": "100px"}); }
  },
  function(){
    $(this).stop().animate({ "height": intialMoreHeight+"px"});
  }
);

var subEl = $('div#header #subnavigation ul li')
if(subEl.size()>4){
  subEl.parent().css('height','64px');
}
subEl.each(function(){
  $(this).hover(function(){
      $(this).stop().animate({ "top" : '0px' }, { "duration": 100} );
    },
    function(){
      if($(this).attr('class')!='active'){
        $(this).stop().animate({ "top" : '4px' }, { "duration": 100} );
      }
    }
  );
});