
/*
	Cycle an image set on a page. 

	These functions expect to find  : 
	- a var array on the page called CycleImgs 
    	containing the urls of the images to be cycled and the URLs in pairs
    	
    	... array=(img,url,img2,url2....imgn,urln)

	- a var on the page called CycleImgsSize which is the size of this Array
	
	The image to be cycled should be called "CycledImg" in the page
	The A Tag around the img should call the url in CycleImgs[ImgCurrentNum+1]
	
*/



var ImgCurrentNum = 0;
var ImgCurrent = new Image();

function startCycleImg(timeDelay) {
	
	setInterval("CycleImages()", timeDelay);
}

function CycleImages() {
	ImgCurrentNum=ImgCurrentNum+2;
	if ((ImgCurrentNum) == CycleImgsSize) {
		ImgCurrentNum = 0;
	}

	ImgCurrent.src = CycleImgs[ImgCurrentNum];
	document["CycledImg"].src = ImgCurrent.src;	
}
