<!--

var ImgNum = 0;
var ImgLength = preLoad.length - 1;
var delay = 5000; //Time delay between Slides in milliseconds
var tmpDelay = 10000; // temp delay when user clicks on a photo
var lock = false;
var run;
var autoPlay = false;
var iPlayed = 0;

function chgImg(direction)
{
	var oSlideshow = document.getElementById("slideshow")
	var oSlideshowCaption = document.getElementById("slideshowCap")

	if (iPlayed > 2)
	{
		lock = false;
		autoPlay = false;
		window.clearInterval(run);
	}
	else
	{
		if (document.images)
		{
			ImgNum = ImgNum + direction;
			if (ImgNum > ImgLength) 
			{
				ImgNum = 0;
				iPlayed = iPlayed + 1
			}
			if (ImgNum < 0) {ImgNum = ImgLength;}

			if (document.all)
			{
				oSlideshow.style.filter = "blendTrans(duration=2)"
				oSlideshow.style.filter = "blendTrans(duration=crossFadeDuration)"
				oSlideshow.filters.blendTrans.Apply()
			}

			oSlideshow.src = preLoad[ImgNum].src;
			oSlideshowCaption.innerHTML = NewCap[ImgNum];

			if (document.all) {oSlideshow.filters.blendTrans.Play()}
		}
	}
}

function auto()
{
	if (lock == true)
	{
		lock = false;
		autoPlay = false;
		window.clearInterval(run);
		run = setInterval("auto()", tmpDelay);
	}
	else if (lock == false)
	{
		lock = true;
		autoPlay = true;
		run = setInterval("chgImg(1)", delay);
	}
}

function showPicture(whichPic)
{
	var oSlideshow = document.getElementById("slideshow")
	var oSlideshowCaption = document.getElementById("slideshowCap")

	if (whichPic == '+')
	{
		if (ImgNum == ImgLength) {ImgNum = 0}
		else {ImgNum = ImgNum + 1}
	}
	else
	{
		if (ImgNum == 0) {ImgNum = ImgLength}
		else {ImgNum = ImgNum - 1}
	}

	if (autoPlay == true) {auto()}

	if (document.all)
	{
		oSlideshow.style.filter = "blendTrans(duration=2)"
		oSlideshow.style.filter = "blendTrans(duration=crossFadeDuration)"
		oSlideshow.filters.blendTrans.Apply()
	}

	oSlideshow.src = preLoad[ImgNum].src;
	oSlideshowCaption.innerHTML = NewCap[ImgNum];

	if (document.all){document.getElementById("slideshow").filters.blendTrans.Play()}
}

auto()

-->

