// Adadpted from JTB code to handle a single slideshow per page, and no links...

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000;

// Duration of crossfade (seconds)
var crossFadeDuration = 2;

// Specify the image files
var url; //initial URL

var j = 0;
var t;


// Set the Slideshow container to hold the n'th image in the slideshow.
function setSlideshowImage(n)
{
	if (!document.images.SlideShow)
	{
		return;	// Stop if no slideshow!
	}

	document.images.SlideShow.src = preLoad[n].src;
}


// Initialise and then run the slideshow loop.
function runSlideShow()
{
	if (window["SlideshowPictures"])
	{
		for (i = 0; i < eval("SlideshowPictures.length"); i++)
		{
			eval("preLoad[i] = new Image()");
			eval("preLoad[i].src = SlideshowPictures[i]");
		}
	}

	runSlideShowLoop();
}


// Run the slideshow loop.
// Once this function is called, a setTimeout() will
// continue the calls to this function.
// NOTE: NO Preloading is done in this function!
function runSlideShowLoop() 
{
	// here will control the movement of the slideshow
	if (document.all) 
	{
		document.images.SlideShow.style.filter = "blendTrans(duration=2)";
		document.images.SlideShow.style.filter = "blendTrans(duration=crossFadeDuration)";
		document.images.SlideShow.filters.blendTrans.Apply();
		document.images.SlideShow.filters.blendTrans.Play();
	}
	
	if (window["SlideshowPictures"])
	{
		// Get the "cursor" for this slideshow.
		var nCursor;
		nCursor = SlideshowCursor;

		// Set the image.
		setSlideshowImage (nCursor);
		
		// Increment the cursor, and wrap if required.
		nCursor++;
		var l;
		l = SlideshowPictures.length;
		if (nCursor >= l)
		{
			nCursor = 0;
		}

		// Remember the "cursor" for the slideshow...
		SlideshowCursor = nCursor;
	}

	// Thank you. Come again!
	t = setTimeout('runSlideShowLoop()', slideShowSpeed);
}
