function loadImages()
{
  images    = new Array();
  numImages = 25;
  for (frame = 1; frame < numImages+1; frame++)
  {
    images[frame]     = new Image();
    images[frame].src = "" + frame + ".jpg";
  }
}

// Function: loadText
// Purpose:  Stores textual descriptions for images into an array.

function loadText()
{    
  text      = new Array();
  text[1] = "The Members of the Team";
  text[2] = "Photographer Song Su Moon of Triumph Pictures, Korea";
  text[3] = "The route from the North Pole through North and Central America";
  text[4] = "The route through South America and to the South Pole";
  text[5] = "Pole to Pole 2000 Founder, Martyn Williams";
  text[6] = "Pole to Pole 2000 Office Manager, Carrie Sundahl";
  text[7] = "Team Member Devlin Fogg from South Africa";
  text[8] = "Team Member Dylan Spencer from Canada";
  text[9] = "Team Member Heidi Hausman from the United States";
  text[10] = "Team Member Jay Choi from Korea";
  text[11] = "Team Member Jessica Cassas from the United States";
  text[12] = "Team Member Naoki Ishikawa from Japan";
  text[13] = "Team Member Mercedes Rosauer from Argentina";
  text[14] = "Team Member Renaud Richard from France";
  text[15] = "";
  text[16] = "";
  text[17] = "";
  text[18] = "";
  text[19] = "";
  text[20] = "";
  text[21] = "";
  text[22] = "";
  text[23] = "";
  text[24] = "";
  text[25] = "";
}

// Function: displayImage
// Purpose:  First sets the textual description and the image counter,
//           then sets the source of the <IMG> tag with the name of
//           slideshow.

function displayImage()
{
  document.textForm.ta.value = text[i];         // text description
  document.numForm.imageCount.value = i;        // image number
  document.slideshow.src = images[i].src        // display image 
}

// Function: next
// Purpose:  Handles a request to view the next image.  If the next image
//           doesn't exist, it wraps around to the beginning of the array.

function next()
{
  i++;                                          // increment
  if (i == numImages+1)
    i = 1;                                      // restart at first image
  displayImage();                               // display the image
}

// Function: previous
// Purpose:  Same as next() but it wraps backward.

function previous()
{
  i--;                                          // decrement
  if (i == 0)
    i = images.length-1;                        // restart at last image
  displayImage();                               // display the image
}

// Function: jump
// Purpose:  Based on number entered by user, jump to that image.

function jump()
{
  i = document.numForm.imageCount.value;        // set image index
  if (i > numImages)                            // if out of range
    window.alert("There are only " + numImages + " images available.");
  else
    displayImage();                             // display the image
}
