var rotateSpeed = 500000; // Milliseconds to wait until switching tabs.
var currentTab = 0; // Set to a different number to start on a different tab.
var numTabs; // These two variables are set on document ready.
var autoRotate;

function openTab2(clickedTab) {
   var thisTab = $(".tabbed-box2 .tabs a").index(clickedTab);
   $(".tabbed-box2 .tabs li a").removeClass("active");
   $(".tabbed-box2 .tabs li a:eq("+thisTab+")").addClass("active");
   $(".tabbed-box2 .tabbed-content2").hide();
   $(".tabbed-box2 .tabbed-content2:eq("+thisTab+")").show();
   currentTab = thisTab;
}

function rotateTabs2() {
   var nextTab = (currentTab == (numTabs - 1)) ? 0 : currentTab + 1;
   openTab2($(".tabbed-box2 .tabs li a:eq("+nextTab+")"));
}

$(document).ready(function() {
   $(".tabbed-content2").equalHeights2();
   numTabs = $(".tabbed-box2 .tabs li a").length;
   
   $(".tabbed-box2 .tabs li a").click(function() { 
      openTab2($(this)); return false; 
   });
   
   autoRotate = setInterval("rotateTabs()", rotateSpeed);   
   $(".tabbed-box2 .tabs li a:eq("+currentTab+")").click()   
});
