//<!-- <SCRIPT LANGUAGE="JavaScript"> -->
//<!-- Begin

var Delay = 6000; // delay in milliseconds (5000 = 5 secs)
Current = 0;
var PhotoURL = ""

function SetPhotoURL(URL)
{
	PhotoURL = URL;
	//ShowPhoto()
}

function ShowPhoto()
{
	document.PhotoShow.PhotoSelector.selectedIndex = Current;
	document.images.Photo.src = PhotoURL + document.PhotoShow.PhotoSelector[Current].value;
	document.getElementById("Caption").innerHTML = document.PhotoShow.PhotoSelector[Current].title;
}
	
function ShowFirst()
{
	Current = 0;
	ShowPhoto();
}

function ShowNext()
{
	if (document.PhotoShow.PhotoSelector[Current+1])
	{
		Current = ++Current;
		ShowPhoto();
	}
	else ShowFirst();
}

function ShowPrevious()
{
	if (Current-1 >= 0)
	{
		Current = --Current;
		ShowPhoto();
	}
	else ShowLast();
}

function ShowLast()
{
	Current = document.PhotoShow.PhotoSelector.length-1;
	ShowPhoto();
}

function Change()
{
	Current = document.PhotoShow.PhotoSelector.selectedIndex;
	ShowPhoto();
}

function StartRotate(text)
{
	document.PhotoShow.AutoPlayButton.value = (text == "Stop") ? "Start" : "Stop";
	Rotate();
}

function StopRotate()
{
	(document.PhotoShow.AutoPlayButton.value) == "Start";
}

function Rotate()
{
	if (document.PhotoShow.AutoPlayButton.value == "Stop")
	{
		Current = (Current == document.PhotoShow.PhotoSelector.length-1) ? 0 : Current+1;
		ShowPhoto();
		{
			if (Current == document.PhotoShow.PhotoSelector.length-1)
			{
				document.PhotoShow.AutoPlayButton.value = "Start";
			}
			window.setTimeout("Rotate()" , Delay);
		}
	}
}

function ChangeDelay()
{
	Delay = document.PhotoShow.RotateDelay.value;
	//window.setTimeout("Rotate()" , Delay);
	//(document.PhotoShow.AutoPlayButton.value) == "Start";
	StopRotate();
}

//  End -->

