var current = 1;
var old = 1;
var bgpos = 10;
var interval = setInterval(cycle, 5000);
var values = Array("106","146","186","226","266");
$(document).ready(function() {
$(".tab-content").hide();
$("ul.tabs li:first").addClass("active").show(); 
$(".tab-content:first").show();

$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); 
$(".tab-content").hide();
var activeTab = $(this).find("a").attr("href"); 
$(activeTab).show(); 
var split_id = activeTab.split("-");		
current = parseInt(split_id[2]);
$(".tabs-highlight").animate({ top: values[current-1]+'px' }, "slow", function(){  $("ul.tabs li").eq(current-1).addClass("active");  });	
clearInterval(interval);
interval = setInterval(cycle, 5000);
return false;
});
});
function cycle(){
old = current;
current += 1;
if(current > 5) { current = 1; }
var index = current - 1;
bgpos = values[index];
$("ul.tabs li").removeClass("active");
$("#promo-tab-"+old).fadeOut("slow", function(){ $("#promo-tab-"+current).fadeIn("slow"); });
$(".tabs-highlight").animate({ top: bgpos+'px' }, "slow", function() { $("ul.tabs li").eq(index).addClass("active"); });	
}
