var currentPhoto = 0;
var timer;

function startTimer() {
	timer = setInterval("flipPhoto()",3000);
}

function stopTimer() {
	clearInterval(timer);
}

function flipPhoto() {
	if(currentPhoto<numberPhotos-1) {
		currentPhoto++;
	} else {
		currentPhoto=0;
	}
	thisPhoto = "slideshows/" + photoArray[currentPhoto] + ".jpg";
	document.images.bigPhoto.src = thisPhoto;
	flipPhotoCaption();
}

function flipPhotoCaption() {
	document.getElementById('slideText').innerHTML = captionArray[currentPhoto];
}

function rollOver(btn) {
	eval("document.images." + btn + ".src = 'images/btn_" + btn + "_on.gif'");
}

function rollOut(btn) {
	eval("document.images." + btn + ".src = 'images/btn_" + btn + "_off.gif'");
}

function previousPhoto() {
	if(currentPhoto != 0) {
		showPhoto = currentPhoto-1;
	} else {
		showPhoto = lastPhoto;
	}
	thisPhoto = "slideshows/" + photoArray[showPhoto] + ".jpg";
	document.images.bigPhoto.src = thisPhoto;
	currentPhoto = showPhoto;
	flipPhotoCaption();
}

function nextPhoto() {
	if(currentPhoto != lastPhoto) {
		showPhoto = currentPhoto+1;
	} else {
		showPhoto = 0;
	}
	thisPhoto = "slideshows/" + photoArray[showPhoto] + ".jpg";
	document.images.bigPhoto.src = thisPhoto;
	currentPhoto = showPhoto;
	flipPhotoCaption();
}