var total_tabs = 10;
var current_tab = 1;
var timeout = 5000;
var slideInterval = timeout * 5; // menu items count
var slideStatus = true;

var rotator;
function change_tab() {
	$("#featured").tabs("select", current_tab++%total_tabs);
	rotator = setTimeout("change_tab();", 5000);
}

$(document).ready(function() {
	$("#featured").tabs({ fx: { opacity: 'toggle' } });
	
	$("div#carousel-text").carousel(
		{
			autoSlide: slideStatus,
			autoSlideInterval: slideInterval,
			delayAutoSlide: 1,
			dispItems: 5,
			animSpeed: "slow",
			loop: true
		}
	);
	
	$("a.carousel-control").click(function() {
		clearTimeout(rotator);
		slideStatus = false;
	});

	$("a.brand-name").click(function() {
		clearTimeout(rotator);
		slideStatus = false;
	});
	
	setTimeout("change_tab();", 5000);
});

