// Flip between photos. The photo information is built up by PHP within the photos page.
// Assumes that photoFileArray, photoTitleArray and photoCommentArray are set up with
// the photo information, as well as int curPhoto corresponding to the current photo index.

function nextPhoto()
{
	curPhoto++;
	if (curPhoto > photoFileArray.length - 1) {
		curPhoto = 0;
	}
	renderPhoto();
	return false;
}

function prevPhoto()
{
	curPhoto--;
	if (curPhoto < 0) {
		curPhoto = photoFileArray.length - 1;
	}
	renderPhoto();
	return false;
}

function renderPhoto()
{
	nTitle = document.getElementById("photoName")
	if (nTitle) {
		nTitle.innerHTML = photoTitleArray[curPhoto];
	}
	nImage = document.getElementById("photoImage")
	if (nImage) {
		nImage.src = photoFileArray[curPhoto];
		//nImage.style.width = photoWidthArray[curPhoto];
		//nImage.style.height = photoHeightArray[curPhoto];
		nImage.alt = nImage.title = photoTitleArray[curPhoto]
	}
	nDesc = document.getElementById("photoCaption")
	if (nDesc) {
		nDesc.innerHTML = photoCommentArray[curPhoto];
	}
}
