// Product Tab Switcher Script

var inSpeed = 150;
var outSpeed = 150;

$(document).ready(function() {
  // Tab switcher:
  var productTabs = $('#productTabs'); // this is the container of the tabs.
  if (productTabs) {
  (productTabs).find('dl#nav dd').hide(); // hide all these elements from view.
    (productTabs).find('dl#nav dt a').each(function() {
    
      // then do the rest of the clicky stuff:
      $(this).click(function() {
        if (!$(this).parent().hasClass('current') && $(this).attr('href')) {
          (productTabs).find('dl#nav dt').removeClass('current').removeClass('spriteBackground');
          (productTabs).find('dl#nav dd').hide();
          $(this).parent().addClass('current').addClass('spriteBackground');
          var currentContent  = $(this).attr('href');
          $(currentContent).fadeIn(inSpeed);
        }
        return false;
      });
    });
    
    // Onload: make  first tab current and display the first tab's content:
    (productTabs).find('dl#nav  dt:first').addClass('current').addClass('spriteBackground');
    (productTabs).find('dd:first').fadeIn(inSpeed)
  }
  
  productTabs.find('dt:first').append('<div class="currentCorner spriteBackground">&nbsp;</div>')
});
