// Code to run the slideshow
// Add an image to the array by increasing the arrayLength variable by the number of images being added. 
// Make sure the images are named in this format: "slideX.jpg", where X is the number of the slide in interger format.

var arrayLength = 2; // Change this to be the amount of images in your slideshow.
var x, y = 1, counter = 0; // Counter variables

//This function initializes the array of images. 
imageArray = new Array; // Array of images
for(x = 0; x < arrayLength; x++)
{
	imageArray[x] = "Slide" + y + ".jpg";
	y++;
}

function start1()
{
	document.images["Slides"].src = imageArray[0];
	counter = 0;
}

function end()
{
	document.images["Slides"].src = imageArray[arrayLength-1];
	counter = arrayLength-1;
}

function next()
{
	if (counter < arrayLength - 1)
	{
		document.images["Slides"].src = imageArray[counter+1];
		counter++;
	}
	else
	{
		window.alert("You have reached the end of the presentation.");
	}
}

function previous()
{
	if (counter > 0)
	{
		document.images["Slides"].src = imageArray[counter-1];
		counter--;
	}
	else 
	{
		window.alert("You have reached the beginning of the presentation.");
	}
}

