I saw this code at the time and didn't like it. Almost told you about it then. Guess I should have.
NOTE: This will give you a circular slide show. If the user clicks next when last image is showing, it will go back to the first image. If the user clicks prior when first image is showing, it will go to the last image.
// don't give a size for the image array...let it be self-sizing:
var myImg= [
// use a more meaningful variable name...
// one that is not likely to be used for other purposes
var currentImage = 0;
// Create function to load image
// this is the only place where "images/" and ".jpg" are used,
// so why bother with the global variables???
document.imgSrc.src = "images/ + myImg[currentImage] + ".jpg";
// Create link function to switch image backward
currentImage = ( currentImage + myImg.length - 1 ) % myImg.length;
// Create link function to switch image forward
currentImage = ( currentImage + 1 ) % myImg.length;
// Load function after page loads
If you don't want a circular show, just ask.