// Function to add slide show images in to the index. 
/*

var displaySecs = used to set the time between images
var pictureName = Image id (Collector)
var imageFiles = all images in the slide show
var 
*/
var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs)
{

	var imageSeparator = imageFiles.indexOf(";");
	var nextImage = imageFiles.substring(0,imageSeparator);
	//Apply the blend effect but only works on IE because needs actionX
	if (document.all)
	{
		document.getElementById(pictureName).style.filter=
			"blendTrans(duration=2)";
		document.getElementById(pictureName).filters.blendTrans.Apply();  
	}
	document.getElementById(pictureName).src = nextImage;

	if (document.all)
	{
		document.getElementById(pictureName).filters.blendTrans.Play();
	}
	var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
		+ ';' + nextImage;
 
	count = count + 1 // this line increments the count
	if (count == max) { // have we reached the maximum yet?
	return false // this line just quits the function, so the slideshow stops.
	}
 
	setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
	// Cache the next image to improve performance.
	imageSeparator = futureImages.indexOf(";");
	nextImage = futureImages.substring(0,imageSeparator);
	if (slideCache[nextImage] == null) {
		slideCache[nextImage] = new Image;
		slideCache[nextImage].src = nextImage;
	}		
}
