//set the duration for each banner (1000 = 1sec)
var cycleDuration=3000;

//insert html code stating image source, alt tag and link
var bnrAry=new Array(
'<a href="/me/"><img src="/img/sg/common/rightnav/banners/117x46_me.gif" alt="ME" width="117" height="46" border="0" /></a>', 
'<a href="/sg/realtyeasy/"><img src="/img/sg/common/rightnav/banners/117x46_realtyeasy.gif" alt="RealtyEasy" width="117" height="46" border="0" /></a>',
'<a href="/sg/personal/rewards/"><img src="/img/sg/common/rightnav/banners/117x46_rewards_jun08.gif" alt="DBS Rewards" width="117" height="46" border="0" /></a>',
'<a href="/sg/dining/"><img src="/img/sg/common/rightnav/banners/117x46_indulge.gif" alt="DBS Indulge" width="117" height="46" border="0" /></a>',
'<a href="/sg/personal/cards/travel/"><img src="/img/sg/common/rightnav/banners/117x46_travel.gif" alt="DBS Travel" width="117" height="46" border="0" /></a>',
'<a href="/sg/personal/cards/healthcare/"><img src="/img/sg/common/rightnav/banners/117x46_healthcare.gif" alt="DBS Healthcare Privileges" width="117" height="46" border="0" /></a>');

/********** Don't change beyond this point **********/

var intCount, bnrHolder, timer;
_spBodyOnLoadFunctionNames.push("bnrCycle");
function bnrCycle(imgNum) {
	clearTimeout(timer);
	if (imgNum) intCount=imgNum-1; 
	else intCount=0; //reset banner queue
	//i=0; //reset banner queue
	bnrHolder=document.getElementById("rightnavLifestyleBnr");

	if (bnrHolder) {
		doCycle();
	}
}
function doCycle() {
	// RLR - Randell L. Rivera - Update code to be compatible with IE.
	var pnlBanner = document.createElement("span");
	pnlBanner.innerHTML = bnrAry[intCount];
	bnrHolder.removeChild(bnrHolder.firstChild);
	bnrHolder.appendChild(pnlBanner);
	(intCount==bnrAry.length-1)? intCount=0 : intCount++; //if this is the last banner in the array, reset to first banner, else go to next banner
	//if (i==bnrAry.length-1) i=0; else i++;
	//setTimeout("doCycle()", cycleDuration);
	timer = setTimeout("doCycle()", cycleDuration);
}

// var i, bnrHolder, timer;
//function bnrCycle() {
//	clearTimeout(timer);
//	i=0; //reset banner queue
//	if (document.getElementById('rightnavLifestyleBnr')) {
//		bnrHolder=document.getElementById("rightnavLifestyleBnr");
//		doCycle();
//	}
//}
//function doCycle() {
//	bnrHolder.innerHTML = bnrAry[i];
//	(i==bnrAry.length-1)? i=0 : i++; //if this is the last banner in the array, reset to first banner, else go to next banner
	//if (i==bnrAry.length-1) i=0; else i++;
//	timer = setTimeout("doCycle()", cycleDuration);
//}