GRCSlideShow =
{
	containId:'',
	width:0,
	height:0,
	imgPath:'',
	imgList:null,
	imgTag:null,
	
	imgDelayTime:1,
	slideTimer:null,
	currentImg:0,
	//======================================================//
	//	This function changes the current front picture		//
	//======================================================//
	changeCurrent:function()
	{
		with (GRCSlideShow)
		{
			var newCurrent = currentImg + 1;
			clearTimeout(slideTimer);
			if (newCurrent >= imgList.length)
			{
				newCurrent = 0;
			}
			imgTag.src = imgPath + imgList[newCurrent];
			currentImg = newCurrent;
			slideTimer = setTimeout("GRCSlideShow.changeCurrent()",imgDelayTime * 1000);
		}
	},
	//======================================================================//
	//	This function sets the parameters needed for SlideShow				//
	//	the required parameters are:										//
	//		pImgId		- The Id of the image displaying the slide show		//
	//		pImgPath	- Path to the forlder holding the images			//
	//		pImgList	- An arrary with the names of the images			//
	//		pDelayTime	- Delay time in seconds between image switching		//
	//======================================================================//
	setupSlideShow:function(pContainId,pWidth,pHeight,pImgPath,pImgList,pDelayTime)
	{
		
		var	imgVar;
		with (GRCSlideShow)
		{
			containId = pContainId;
			width = pWidth;
			height = pHeight;
			imgPath = pImgPath;
			imgList = pImgList;
			imgDelayTime = pDelayTime;
		}
	},
	init:function()
	{
		if (!document.getElementById || !document.createTextNode) return;
		with (GRCSlideShow)
		{
			var	imgHolder = document.getElementById(containId);
			if (imgHolder == null)	return;
			if (!imgHolder.appendChild)	return; 
			imgHolder.innerHTML='';
			//	Create tag for image scrolling
			imgTag = document.createElement('img');
			imgTag.id = containId + 'Image';
			imgTag.width = width;
			imgTag.height = height;
			imgHolder.appendChild(imgTag);

			for (var imgNum = 0; imgNum < imgList.length; imgNum++)
			{
				imgVar = new Image();
				imgVar.src = imgPath + imgList[imgNum];
			}
			currentImg = -1;
			changeCurrent();
		}
	}
}
DOMhelp.addEvent(window,'load',GRCSlideShow.init,false);

