// These are the core function used for the slideshows - they should not be modified
// Each slideshow should define the images and comments in the page itself

var iCounter = 0;
var iMax = 0;
var iPause = 7000;	// this defines the slide display time, recommend 8500
var slideShowTimer = null;
var wd = window.document;
var oComment = null;
var oSlideRef = null;

function startSlideShow() {
	clearTimeout(slideShowTimer);
	//iCounter = 0;
	iMax = aImages.length;
	oComment = document.getElementById("comment");
	oSlideRef = document.getElementById("slideRef");
	changeSlide();
}


function writeComment(iCommentIndex) {
	var sComment = comments[iCommentIndex];
	var sSlideRef = "Slide " + (iCounter+1) + " of " + iMax;
   	oComment.firstChild.nodeValue=sComment;
   	oSlideRef.firstChild.nodeValue=sSlideRef;
}


function changeSlide(single) {
	window.document.iSlideShow.src = aImages[iCounter];
	if(iCounter < iMax) {
		writeComment(iCounter);
		iCounter++;
		if(single == true){
			// stop
		} else
			slideShowTimer = setTimeout('changeSlide()', iPause);
	
	} else {
		iCounter = 0;
		oComment.firstChild.nodeValue="";
		oSlideRef.firstChild.nodeValue="";
		window.document.iSlideShow.src = "multimedia_slideshows.jpg";
		return null;
	}
}


function nextSlide() {
	clearTimeout(slideShowTimer);
	oComment = document.getElementById("comment");
	oSlideRef = document.getElementById("slideRef");
	iMax = aImages.length;
	changeSlide(true)
}

function previousSlide() {
	clearTimeout(slideShowTimer);
	oComment = document.getElementById("comment");
	oSlideRef = document.getElementById("slideRef");
	iMax = aImages.length;
	iCounter = ((iCounter-2) < 0) ? iMax-1 : iCounter-2
	changeSlide(true)
}


function stopSlideShow() {
	clearTimeout(slideShowTimer);
}

