timerOn = true;
rotationTimer = "";
//arrSlideshowOne = ["testimonials","distributors","featured_distributor"]
arrSlideshowOne = ["testimonialsB","testimonials","featured_distributor"]
alertTimerId = "";
_on_or_off = "";
rotationValue = 0;
previousRotationID = "featureBox_load";

function showFeature(whichFeature) {
	//stop the rotation on a click
	

	switch(whichFeature) {
		case "testimonials":
			//$('#featureBox_nav_featureddistributor').css("opacity","0");
			//$('#featureBox_nav_distributors').css("opacity","0");
			//$('#sectionNav_testimonials').css("display","block");
		break;
	
		case "distributors":
			//$('#featureBox_nav_testimonials').css("opacity","0");
			//$('#featureBox_nav_featureddistributor').css("opacity","0");
			//$('#sectionNav_testimonials').css("display","none");
		break;
		
		case "featureddistributor":
			//$('#featureBox_nav_testimonials').css("opacity","0");
			//$('#featureBox_nav_distributors').css("opacity","0");
			//$('#sectionNav_testimonials').css("display","none");			
		break;
	}
	
	$("#" + previousRotationID).css("z-index","10").animate({ opacity:0 }, 1000);
	$("#featureBox_" + whichFeature).css("z-index","100").animate({ opacity:1 }, 1000);
	previousRotationID = "featureBox_" + whichFeature ;
	
	rotationValue++;
	if (rotationValue > arrSlideshowOne.length - 1 ) { rotationValue = 0; }
	
	if (timerOn == true) {
		startRotation(rotationValue);
	}
}


function stopRotation() {
	timerOn = false;
	clearTimeout(rotationTimer);
}



function startRotation(rotationValue) {
	// turn on testimonial bar
	rotationTimer = setTimeout("showFeature('" + arrSlideshowOne[rotationValue] + "')", 5000);
}






function clearSubs(subID) {
	if (_on_or_off == "off") {
		document.getElementById("dropdown_" + subID).style.display = "none";
	}
}

function subDisplay(subID,action) {
	if (action == "show") {
		document.getElementById("dropdown_" + subID).style.display = "block";
		clearTimeout (alertTimerId);
		_on_or_off = "on";
	} else { 
		alertTimerId = setTimeout ("clearSubs('" + subID + "')", 500 );
		_on_or_off = "off";
	}
}

$(document).ready(function() {
	$('#featureBox_nav_testimonials').css("opacity","0");
	$('#featureBox_nav_distributors').css("opacity","0");
	$('#featureBox_nav_featureddistributor').css("opacity","0");

	//$('#featureBox_load').css("opacity","0");
	$('#featureBox_testimonials').css("opacity","0");
	$('#featureBox_testimonialsB').css("opacity","0");
	$('#featureBox_distributors').css("opacity","0");
	$('#featureBox_featured_distributor').css("opacity","0");
	
	startRotation(rotationValue);
});

function showAnswer(whichAnswer) {
	//$('#' + whichAnswer).css({ height:'0', display:'block' }).animate({
	//	height: 'toggle'
	//},1000);
	$('#' + whichAnswer).slideToggle('fast');
}

