var rotateSpeed = 5000; // 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 openTab(clickedTab) {
   var thisTab = jQuery(".tabbed-box .tabs a").index(clickedTab);
   jQuery(".tabbed-box .tabs li a").removeClass("active");
   jQuery(".tabbed-box .tabs li a:eq("+thisTab+")").addClass("active");
   jQuery(".tabbed-box .tabbed-content").hide();
   jQuery(".tabbed-box .tabbed-content:eq("+thisTab+")").fadeIn(500);
   currentTab = thisTab;
}

function rotateTabs() {
   var nextTab = (currentTab == (numTabs - 1)) ? 0 : currentTab + 1;
   openTab(jQuery(".tabbed-box .tabs li a:eq("+nextTab+")"));
}

jQuery(document).ready(function() {
   numTabs = jQuery(".tabbed-box .tabs li a").length;
   autoRotate = setInterval("rotateTabs()", rotateSpeed);
   jQuery(".tabbed-box .tabs li a").hover(function() {openTab($(this)); clearInterval(autoRotate); return false;}, function(){autoRotate = setInterval("rotateTabs()", rotateSpeed)});
   $('#contents li').hover(function(){
		clearInterval(autoRotate); return false;
   },function(){
		autoRotate = setInterval("rotateTabs()", rotateSpeed)
   });
   
  if($('.product').offset.top<824) {
	$('.product').offset({top: 824});
	}

	$('.block-1c h2 span').css({height: '35px'});
	
});

