var arrayPhotos = new Array();
var currentPhoto = 0;

var playing = false;

function slideshow(){
	if (playing){
		nextPhoto();
		
		setTimeout("slideshow();", 5000);
	}
}

function startSlideshow(){
	playing = true;
	
	slideshow();
}

function stopSlideshow(){
	playing = false;
}

function nextPhoto(){
	if (currentPhoto + 1 >= arrayPhotos.length){
		currentPhoto = 0;
	} else {
		currentPhoto++;
	}
	
	setPhoto();
}

function previousPhoto(){
	if (currentPhoto - 1 < 0){
		currentPhoto = arrayPhotos.length - 1;
	} else {
		currentPhoto--;	
	}
	
	setPhoto();
}

function setPhoto(){
	document.getElementById("slideShowDescription").innerText = arrayPhotos[currentPhoto][0];
	document.getElementById("slideShowPicture").src = arrayPhotos[currentPhoto][1];
}
