var iNumMarkets = 5;

var iInterval		= 10000;
//var iInterval		= 400;
var iIntervalId = 0;
var iOldLayerId = 0;

function initScrollLayer() {
  
  //* Set the interval to automatically change the market information
  iIntervalId = window.setInterval(changeMarket, iInterval);
  
  changeMarket();
  
}

//*
//* resetInterval
//* Resets the interval.
function resetInterval() {

	//* First we need to clear it.
	window.clearInterval(iIntervalId);
	
	//* Now we need to set it again.
	iIntervalId = window.setInterval(changeMarket, iInterval);

}

function getElement(psID) { 
   if(document.all) { 
      return document.all[psID]; 
   } else { 
      return document.getElementById(psID); 
   } 
} 

xTmpOldMarket		= null;

//* 
//* changeMarket
//*
//* Randomly change the market.
function changeMarket() {
		
	
	//* Pich a random number between 0 and the max.  Thhis will be the market we want to display.
	iRand = Math.round(Math.random() * (iNumMarkets - 1));
		
	//* Make the new layer visible.
	rdShowLayer("lyr" + (iRand + 1));
	
	//* hide the old layer.
	if (iOldLayerId != iRand)
		rdHideLayer("lyr" + (iOldLayerId + 1));
	
	iOldLayerId = iRand;
		
}

//* Setup a bunch of shell functions to perform the scrolling functions.
function stopScroll() {
	
	//* Reset the timer.
	resetInterval();
}

function doubleSpeed() {
	
	//* Reset the timer.
	resetInterval();

}
