window.onload = initLinks;


var thisPic = 0;



	 
function initLinks() {
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
	document.getElementById("imgText").innerHTML = captionText[0];
}


function processPrevious() {
	if (thisPic == 0) {
		thisPic = myPix.length;
	}
	thisPic--;
	document.getElementById("main").src = myPix[thisPic];
	document.getElementById("imgText").innerHTML = captionText[thisPic];
	return false;
}

function processNext() {
	thisPic++;
	if (thisPic == myPix.length) {
		thisPic = 0;
	}
	document.getElementById("main").src = myPix[thisPic];
	document.getElementById("imgText").innerHTML = captionText[thisPic];
	return false;
}

