	var aRotatingImages = new Array();

	var iImageCount = 0;
	var aImages = new Array();
	for (var k = 0; k < document.images.length; k++)
	{
		if (document.images[k].id == "rotatingImgImage")
		{
			aImages[iImageCount] = document.images[k];
			iImageCount++;
		}
	}

	var iNumImages = 0;	
	for (var j = 0; j < document.forms.length ; j++)
	{
		if (document.forms[j].rotatingImgList != null)
		{	
			aRotatingImages[iNumImages] = new Array();
			
			aRotatingImages[iNumImages][0] = document.forms[j];
			
			aRotatingImages[iNumImages][1] = aImages[iNumImages];
			aRotatingImages[iNumImages][2] = document.forms[j].rotatingImgList;
			aRotatingImages[iNumImages][3] = document.forms[j].rotatingImgList.length;
			aRotatingImages[iNumImages][4] = document.forms[j].rotatingImgList.selectedIndex;
			
			iNumImages++;
		}
	}
	
	var oTimer;
	var iCycleMilliSeconds = 3000;
	var iCycleMilliSecondsSaved = 3000;
	window.clearInterval(oTimer);
	if (iNumImages > 0)
	{
		startRotation();
	}

	var iImageRotations = 0;
		
	function scrollPicture()
	{
		var iImage = iImageRotations % aRotatingImages.length;
		
		aRotatingImages[iImage][4] 								= (aRotatingImages[iImage][4] + 1) % aRotatingImages[iImage][3];
		
		aRotatingImages[iImage][2].selectedIndex	= aRotatingImages[iImage][4];
		aRotatingImages[iImage][1].src						= aRotatingImages[iImage][2].value;
		
		iImageRotations++;
		
		window.clearInterval(oTimer);
		oTimer=window.setInterval(scrollPicture,iCycleMilliSeconds);
	}
	
	function stopRotation(oForm, cSrc)
	{
		for (var i = 0; aRotatingImages.length; i++)
		{
			if (aRotatingImages[i][0] == oForm)
			{
					aRotatingImages[i][1].src = cSrc;
					window.clearInterval(oTimer);
					break;
			}
		}
	}
	
	function setIntervalTime(iCycleTime)
	{
		if (iCycleTime == null)
			iCycleMilliSeconds = iCycleMilliSecondsSaved;
		else
			iCycleMilliSeconds = iCycleTime;
	}
	
	function startRotation(iCycleTime)
	{
		window.clearInterval(oTimer);
		if (iCycleTime == null)
			oTimer=window.setInterval(scrollPicture,iCycleMilliSeconds);
		else
			oTimer=window.setInterval(scrollPicture,iCycleTime);
	}
	
	function setImage(oForm, iDirection)
	{
		switch(iDirection)
		{
		case -2:
			oForm.rotatingImgList.selectedIndex = 0;
		break;	
		
		case -1:
			oForm.rotatingImgList.selectedIndex = Math.max(oForm.rotatingImgList.selectedIndex-1,0);
		break;
		
		case 0:
		break;
		
		case 1:
			oForm.rotatingImgList.selectedIndex = Math.min(oForm.rotatingImgList.selectedIndex+1,oForm.rotatingImgList.length-1);
		break;	
		
		case 2:
			oForm.rotatingImgList.selectedIndex = oForm.rotatingImgList.length-1;
		break;	
		}
		
		stopRotation(oForm, oForm.rotatingImgList.value);
	}
