// 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
if (window.attachEvent){
	//alert("window.attachEvent has been run");
	window.attachEvent("onload", startBanners);
	window.attachEvent("onload", startBanners2);	
}
else if (window.addEventListener) {
	//alert("window.addEventListener has been run");
	window.addEventListener("load", startBanners, false);
	window.addEventListener("load", startBanners2, 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_PT_Default";
divList[1]= "BOX_PT_Emigration";
divList[2]= "BOX_PT_Property";
divList[3]= "BOX_PT_Education";
/*
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 = 10000;

//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


var divList2 = new Array()

divList2[0]= "BOX_Ruesch";
divList2[1]= "BOX_SG_NewLocation";


//set a start position for banner display
var selectedDiv2 = 0;
//set an end position
var maxDiv2 = divList2.length;

//startBanners2 runs the rotator code
function startBanners2(){
	//alert("Start Banners has been called");
	for (i=0; i<divList2.length; i++){
		//alert("divList["+i+"]="+divList[i]);
		if(i==selectedDiv2){
			document.getElementById(divList2[selectedDiv2]).style.display="block";
			//alert("div called is: "+divList[selectedDiv]);
		}else{
			document.getElementById(divList2[i]).style.display="none"
		}
	}
	
	//incriment to the next division
	selectedDiv2++;
	//alert("selectedDiv is now="+selectedDiv);
	if (selectedDiv2 >= maxDiv2){
		selectedDiv2 = 0;
	}	
	//set a timeout to run the next banner
	setTimeout("startBanners2()",tickcount);
	
}; //ends startBanners
