/*
	This is the Javascript file for dealing with the slideshow
	on the pumas homepage
*/

// Create an object which holds the title, pathname and alternate
// text info of the images used.

var mainSlides = [
	{
	"title" : "Rest In Peace.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/rip56.jpg",
	"alt" : "A tribute image to Alan Newcombe"},
	{
	"title" : "Rest In Peace.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/rip56b.jpg",
	"alt" : "A tribute image to Alan Newcombe"},
	{
	"title" : "Rest In Peace.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/rip56c.jpg",
	"alt" : "A tribute image to Alan Newcombe"},
	{
	"title" : "Run blocking.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/IMG_7218.jpg",
	"alt" : "Alan Newcombe blocking for the runner"},
	{
	"title" : "Opening the gap.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/IMG_7202jpg",
	"alt" : "Alan Newcombe blocking for the runner"},
	{
	"title" : "On the chase.",
	"path" : "http://www.pumasafc.co.uk/seniors/pictures/minty56.jpg",
	"alt" : "Alan Newcombe chasing the runner"}
];

// A function for switching between images.
// The argument 'product' expects the name of an object
// that holds image data. This has been added in order
// to increase the scalability of the function.


function imageSwitcher(product) {
	if (img >= product.length) {		// Once the end of the object is reached
		img = 0;						// return to the start.
	} else if (img < 0) {				// If viewing backwards past the start
		img = product.length - 1;		// skip to the end.
	}
	document.getElementById('slideshow').src=product[img]["path"];	
	document.getElementById('title').innerHTML=product[img]["title"];
	document.getElementById('slideshow').alt=product[img]["alt"];
};