window.onload = initLinks;

var myPix;
var thisPic = 0;

function getArr(arr) {
	myPix = arr;
}

function initLinks() {
	document.getElementById("myPicture").src = myPix[thisPic];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}

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

function processNext() {
   thisPic++;
   if (thisPic >= myPix.length) {
      thisPic = 0;
   }
   document.getElementById("myPicture").src = myPix[thisPic];
   return false;
}
