var interval = 1500;
var imageNum = 0;
var totalImages = 0;
imageArray = new Array();

function addImageToSlideshow(imageURL)
{
	imageArray[totalImages++] = imageURL;
}

function nextSlideshowImage(imageId)
{
	imageNum++;	
	switchSlideshowImage(imageId, imageNum);
}

function prevSlideshowImage(imageId)
{
	imageNum--;
	switchSlideshowImage(imageId, imageNum);
}

function switchSlideshowImage(imageId, rawImageNum)
{
	// First make sure our image is within the range
	// Remember, imageNum starts at zero and totalImages at one
	if (rawImageNum >= totalImages)
	{
		imageNum = 0;
	}
	else if (rawImageNum < 0)
	{
		imageNum = totalImages - 1;
	}

	// Get the image element and change the source attribute
	myElement = document.getElementById(imageId);
	if (myElement != null)
	{
		myElement.src = imageArray[imageNum];
	}
}
