myImageList = new Array('images/home1.jpg', 'images/home2.jpg', 'images/home3.jpg', 'images/home6.jpg', 'images/home7.jpg', 'images/home8.jpg'); 
nSub = 0;

// Call imageFlip() after an initial delay of five seconds.
setTimeout('imageFlip()',5000);

function imageFlip() {
  // If we're at the end of the array then go back to the first image
  // (subscript zero), otherwise add 1 to the subscript.
  if(nSub == myImageList.length - 1) {
    nSub = 0;
  } 
  else {
    nSub++;
  }

  /* debug code
  // debug
  document.write("<p>Debug...</p>")
  document.reload()
  */
  
  // Change to the next image.
  document.images['myImage'].src = myImageList[nSub];

  // Repeat every five seconds after that.
  setTimeout('imageFlip()',5000);

}
