
var numberOfImages = 9;
var arrSlides = new Array(numberOfImages);
var currentIndex = 0;


arrSlides[0] = new slidePicture('images/home/slide-thumb-xanadu.jpg','images/home/slide-xanadu.jpg','Meadowlands Xanadu');;
arrSlides[1] = new slidePicture('images/home/slide-thumb-meadowlands-racetrack.jpg','images/home/slide-meadowlands-racetrack.jpg','Meadowlands Racetrack');
arrSlides[2] = new slidePicture('images/home/slide-thumb-izod-center.jpg','images/home/slide-izod-center.jpg','IZOD Center');
arrSlides[3] = new slidePicture('images/home/slide-thumb-giant-stadium.jpg','images/home/slide-giant-stadium.jpg','Giants Stadium');
arrSlides[4] = new slidePicture('images/home/slide-thumb-monmouth-park.jpg','images/home/slide-monmouth-park.jpg','Monmouth Park Racetrack');
arrSlides[5] = new slidePicture('images/home/slide-thumb-atlantic-city-center.jpg','images/home/slide-atlantic-city-center.jpg','Atlantic City Convention Center');
arrSlides[6] = new slidePicture('images/home/slide-thumb-wildwoods.jpg','images/home/slide-wildwoods.jpg','The Wildwoods Convention Center');
arrSlides[7] = new slidePicture('images/home/slide-thumb-boardwalk-hall.jpg','images/home/slide-boardwalk-hall.jpg','Historic Boardwalk Hall');
arrSlides[8] = new slidePicture('images/home/slide-thumb-xanadu.jpg','images/home/slide-xanadu.jpg','Meadowlands Xanadu');;

function nextPicture(offset) {
	currentIndex = currentIndex + offset;
	if (currentIndex < 0) {								// rotate between 0 and (numberOfImages - 1)
		currentIndex = numberOfImages - 1;
	} else if (currentIndex > (numberOfImages -1)) {
		currentIndex = 0;
	}
	displayPicture(currentIndex);
}

function displayPicture(current) {
	if (document.getElementById('img-slide-image')) {
		document.getElementById('img-slide-image').src = arrSlides[current].image;
		document.getElementById('slide-caption').innerHTML = arrSlides[current].caption;
	}
}

function setDisplayPicture(index) {
		currentIndex = index;
		displayPicture(currentIndex);
}

function slidePicture(thumb, image, caption) {
	this.thumb = thumb;
	this.image = image; 
	this.caption = caption;
}

function displayThumbImages() {
	for (var i=0; i<numberOfImages; i++) {
			if (eval('document.getElementById("thumb'+i+'")')) {
				eval('document.getElementById("thumb'+i+'").src = "' + arrSlides[i].thumb + '"');
			}
	}
}
