// JavaScript Document
////////////////////////////////////////////////////////////////////////
// This Script controls the bottom boxed banner rotation 
// for the thrid box in the row...for now!
// written by Robin Kidd, Nexolink Inc.
// for use by Travelex plc.
// dated December 31, 2004
///////////////////////////////////////////////////////////////////////

//call the startBanners to run
//event listeners to start the banners with different browser types IE and Mozilla
// To TURN OFF the rotator simply comment out the following IF statement
// this will stop the function from being attached to the onLoad event handler
///==================================

		if (window.attachEvent){
			//alert("window.attachEvent has been run");
			window.attachEvent("onload", startBanners);
		}
		else if (window.addEventListener) {
			//alert("window.addEventListener has been run");
			window.addEventListener("load", startBanners, false);
		}

///===================================

// create an array to hold the id/name of the banners to rotate
// new banners can be placed in the code page and will not display
// until their ID is added to this array
var divList = new Array()

divList[0]= "BOX_Hotel";
/*divList[1]= "BOX_Phoneorder";
//divList[1]= "BOX_Insurance";
divList[2]= "BOX_BusinessCentre";
divList[3]= "BOX_GlobalPayments";*/



/*
// this is for debugging only
for (i=0; i<divList.length; i++){
	alert("divList["+i+"]="+divList[i]);
}
*/	

//set a start position for banner display
var selectedDiv = 0;
//set an end position
var maxDiv = divList.length;
//set a tickcount in miliseconds (1sec=1000) to controll banner roll over
var tickcount = 8000;

//startBanners runs the rotator code
function startBanners(){
	//alert("Start Banners has been called");
	for (i=0; i<divList.length; i++){
		//alert("divList["+i+"]="+divList[i]);
		if(i==selectedDiv){
			document.getElementById(divList[selectedDiv]).style.display="block";
			//alert("div called is: "+divList[selectedDiv]);
		}else{
			document.getElementById(divList[i]).style.display="none"
		}
	}
	
	//incriment to the next division
	selectedDiv++;
	//alert("selectedDiv is now="+selectedDiv);
	if (selectedDiv >= maxDiv){
		selectedDiv = 0;
	}	
	//set a timeout to run the next banner
	setTimeout("startBanners()",tickcount);
	
}; //ends startBanners