$(document).ready(function(){
  var current = null;
     $('ul#navigation_secondary > li').hover(
      function() { 
        
        if (typeof($(this).css('background-position')) == 'undefined') {
          var backgroundPos = $(this).css('background-position-x') + ' '+ $(this).css('background-position-y');
        } else {
          var backgroundPos = $(this).css('background-position');
        }
        current = $(this).css('background-color') + ' '+$(this).css('background-image') + ' '+backgroundPos+' '+$(this).css('background-repeat');
        
        if ($('body').attr('id') == 'natural') {
          if ($(this).hasClass('first')) {
            $(this).css('background', '#EEF9F9  url(/patients/natural_menopause/images/background_selected-navigation.gif) 0px -1px no-repeat');
          } else {
            $(this).css('background', '#EEF9F9  url(/patients/natural_menopause/images/background_selected-navigation.gif) 0px top no-repeat');
          }
        } else {
          if ($(this).hasClass('first')) {
            $(this).css('background', '#ffeef3 url(/patients/images/climara/background_selected-navigation.gif) 0px -1px no-repeat');
          } else {
            $(this).css('background', '#ffeef3 url(/patients/images/climara/background_selected-navigation.gif) 0px top no-repeat');
          }
          
        }
      },
      function() { $(this).css('background', current); }
    );   


  $('a[rel=external]').attr('target', '_blank');

  $('a[rel=popup]').click(function(){
    var popup = window.open($(this).attr('href'),'','height=400,width=550,scrollbars=yes');

    if (window.focus) { popup.focus(); }

    return false;
  });
});


