// JavaScript Document
var currentFeature = 0;
var featureInterrupt = 0;
var featurePaused = 0;
var homeTimer, pauseButTimer;
function swapHomeFeature(){
	if(currentFeature == 0){
		divShow('homeRot_2');
		divHide('homeRot_1');
		currentFeature = 1;
		//setPauseButtonState();
		pauseButTimer = setTimeout("setPauseButtonState()",10);
		startFeatureRotation();
		return false;
	}
	if(currentFeature == 1){
		divShow('homeRot_1');
		divHide('homeRot_2');
		currentFeature = 0;
		//setPauseButtonState();
		pauseButTimer = setTimeout("setPauseButtonState()",10);
		startFeatureRotation();
		return false;
	}
}
function startFeatureRotation(){
	clearTimeout(homeTimer);
	if(featurePaused == 0){
		homeTimer = setTimeout("autoRotate()",7000);
	}
}
function autoRotate(){
	if(featurePaused == 0){
		rotateStepA();
	}
}
function rotateStepA(){
	if(currentFeature == 0){
			MM_swapImage('butFor','','/images/home/navBtn_A_forward2.gif',1)
	}
	if(currentFeature == 1){
			MM_swapImage('butForb','','/images/home/navBtn_A_forward2.gif',1)
	}
	homeTimer = setTimeout("rotateStepB()",500);
}
function rotateStepB(){
	if(currentFeature == 0){
			MM_swapImage('butFor','','/images/home/navBtn_A_forward.gif',1)
	}
	if(currentFeature == 1){
			MM_swapImage('butForb','','/images/home/navBtn_A_forward.gif',1)
	}
	homeTimer = setTimeout("swapHomeFeature()",100);
}
function toggleHomePause(){
	if(featurePaused == 0){
		featurePaused = 1;
		clearTimeout(homeTimer);
		setPauseButtonState();
		return false;
	}
	if(featurePaused == 1){
		featurePaused = 0;
		startFeatureRotation();
		setPauseButtonState();
		return false;
	}
}
function setPauseButtonState(){
	MM_swapImgRestore();
	if(currentFeature == 0){
		if(featurePaused == 0){
			MM_swapImage('pause','','/images/home/navBtn_A_pause.gif',1)
		}
		if(featurePaused == 1){
			MM_swapImage('pause','','/images/home/navBtn_A_pause2.gif',1)
		}
	}
	if(currentFeature == 1){
		if(featurePaused == 0){
			MM_swapImage('pauseb','','/images/home/navBtn_A_pause.gif',1)
		}
		if(featurePaused == 1){
			MM_swapImage('pauseb','','/images/home/navBtn_A_pause2.gif',1)
		}
	}
}



var currentFilmstrip = 0;
var filmstripTimer;
var filmstripRotTime = 3790;

function swapHomeFilmstrip(){
	if(currentFilmstrip == 0){
		divShow('homeStrip_2');
		divHide('homeStrip_1');
		divHide('homeStrip_3');
		currentFilmstrip = 1;
		filmstripTimer = setTimeout("swapHomeFilmstrip()",filmstripRotTime);
		return false;
	}
	if(currentFilmstrip == 1){
		divShow('homeStrip_3');
		divHide('homeStrip_1');
		divHide('homeStrip_2');
		currentFilmstrip = 2;
		filmstripTimer = setTimeout("swapHomeFilmstrip()",filmstripRotTime);
		return false;
	}
	if(currentFilmstrip == 2){
		divShow('homeStrip_1');
		divHide('homeStrip_2');
		divHide('homeStrip_3');
		currentFilmstrip = 0;
		filmstripTimer = setTimeout("swapHomeFilmstrip()",filmstripRotTime);
		return false;
	}
	//clearTimeout(filmstripTimer);
	
}
function startFilmstripRotation(){
	filmstripTimer = setTimeout("swapHomeFilmstrip()",filmstripRotTime);
	
}

var hotUserCnt = 8;
var voyCnt = 6;
var mcWhCnt = 4;
var mcSfCnt = 2;
var outfitCnt = 6;

var curHotI = 1;
var curVoyI = 1;
var curMcWh = 1;
var curMcSf = 1;
var curOutfit = 1;


function swapHomeFilmstrips(){
	curHotI++;
	curVoyI++;
	curMcWh++;
	curMcSf++;
	curOutfit++;
	if(curHotI > hotUserCnt) curHotI = 1;
	if(curVoyI > voyCnt) curVoyI = 1;
	if(curMcWh > mcWhCnt) curMcWh = 1;
	if(curMcSf > mcSfCnt) curMcSf = 1;
	if(curOutfit > outfitCnt) curOutfit = 1;
	
	for(i=1;i<=hotUserCnt;i++){
		divHide('user_hot_' + i);
	}
	for(i=1;i<=voyCnt;i++){
		divHide('voy_' + i);
	}
	divShow('user_hot_' + curHotI);
	divShow('voy_' + curVoyI);
	
	
	for(i=1;i<=mcWhCnt;i++){
		divHide('mcwh_' + i);
	}
	for(i=1;i<=mcSfCnt;i++){
		divHide('mcsf_' + i);
	}
	divShow('mcwh_' + curMcWh);
	divShow('mcsf_' + curMcSf);
	
	for(i=1;i<=outfitCnt;i++){
		divHide('outfit_' + i);
	}
	divShow('outfit_' + curOutfit);
	
	
	filmstripTimer = setTimeout("swapHomeFilmstrips()",filmstripRotTime);
	return false;
	
}
function startFilmstripRotations(){
	filmstripTimer = setTimeout("swapHomeFilmstrips()",filmstripRotTime);
	
}
