var imgList = new Array();
var currentImage = 0;

function nextImage()
{
	currentImage += 1;
	currentImage = currentImage % imgList.length;
	if (imgList[currentImage] == '')
	{ nextImage(); }
	else
	{ document.getElementById('pageimage').src = imgList[currentImage]; }
	writeImgXofY();
}

function prevImage()
{
	currentImage -= 1;
	currentImage = (currentImage+imgList.length) % imgList.length;
	if (imgList[currentImage] == '')
	{ nextImage(); }
	else
	{ document.getElementById('pageimage').src = imgList[currentImage]; }
	writeImgXofY();
}

function writeImgXofY()
{
	imgX = currentImage + 1;
	imgY = imgList.length;
	document.getElementById('imgnum').innerHTML = imgX + '/' + imgY;
}