$.noConflict();
jQuery(document).ready(function($) {
  // get the hight of the header and set it, to prevent it from collapsing, when it is faded out
  $('.anpHeader').css('height', $('.anpHeader').css('height'));
  // hide the main nav
  $('.anpMainNav').hide();
  // add a 'show navigators' button
  $('.anpHeader').append(
    '<div class="anpShowNavigators"><a href="">Weitere Navigatoren der AOK</a></div>'
  );
  // bind the event handlers
  $('.anpShowNavigators a').bind('mouseenter', function () {
    $('.anpShowNavigators').fadeOut();
    $('.anpMainNav').fadeIn();
  });
  $('.anpShowNavigators a').bind('keydown', function (e) {
    // do only make this happen on
    // return and space, especially not make this happen on tab (9)
    var code = (e.keyCode ? e.keyCode : e.which);
    if (code == 13 || code == 32) {
      // set the focus on the first navigation item
      $('.anpMainNav li a').eq(0).focus();
      $('.anpShowNavigators').fadeOut();
      $('.anpMainNav').fadeIn();
      return false;
    }
  });
  $('.anpHeader').bind('mouseleave', function () {
    $('.anpShowNavigators').fadeIn();
    $('.anpMainNav').fadeOut();
  });
  $('.anpMainNav a').blur(function () {
    $('.anpMainNav').fadeOut();
    $('.anpShowNavigators').show();
  });
  $('.anpMainNav a').focus(function () {
    $('.anpMainNav').stop().show();
    $('.anpShowNavigators').hide();
  });
});
