<!-- // hide script from browsers that do not support javascript

// the list of images that can be used
// the name must match an image in the 
// gallery-thumb and gallery-full directories
var ImageFileNames = new Array(
  "casey_trees-photo_01",
  "casey_trees-photo_02",
  "casey_trees-photo_03",
  "casey_trees-photo_04",
  "casey_trees-photo_05",
  "casey_trees-photo_06",
  "cbf-photo_01",
  "cbf-photo_02",
  "cbf-photo_03",
  "cbf-photo_04",
  "cref-photo_01",
  "cref-photo_02",
  "env_concern-photo_01",
  "env_concern-photo_02",
  "env_concern-photo_03",
  "env_concern-photo_04",
  "living_classrooms-photo_01",
  "living_classrooms-photo_02",
  "living_classrooms-photo_03",
  "living_classrooms-photo_04",
  "living_classrooms-photo_05",
  "living_classrooms-photo_06",
  "living_classrooms-photo_07",
  "noaa-photo_01",
  "noaa-photo_02",
  "noaa-photo_03",
  "noaa-photo_04",
  "sat_env_academy-photo_01",
  "sat_env_academy-photo_02",
  "sat_env_academy-photo_03",
  "sat_env_academy-photo_04",
  "sat_env_academy-photo_05",
  "sat_env_academy-photo_06",
  "sat_env_academy-photo_07",
  "sca-photo_01",
  "sca-photo_02",
  "sca-photo_03",
  "sca-photo_04",
  "sca-photo_05",
  "thorpe_wood-photo_01",
  "youth_garden-photo_01",
  "youth_garden-photo_02",
  "youth_garden-photo_03"
);

// the location of the available images
var ThumbDirectory = "images/gallery-thumb/";
var FullDirectory = "images/gallery-full/";

// select a random image from the ImageFileNames array
// for each image on the page that needs a random image
function selectImages() {

    var i = 0;
    while(document.getElementById("image" + (i + 1)) != null) {

    // sanity check - if more images are needed than what is available
    // than start reusing images
    var j = i % ImageFileNames.length;

    // generate a random number between 0 and the number of images still needed
    // becomes the index of the soon to be selected image
    var r = Math.round((ImageFileNames.length - 1 - j) * Math.random());

    // tell the element to display the image
    document.getElementById("image" + (i + 1)).src = 
      ThumbDirectory + ImageFileNames[r] + "-thumb.jpg";
    document.getElementById("link" + (i + 1)).href =
      FullDirectory + ImageFileNames[r] + "-full.jpg";

    // make sure that image is not used again by putting the recently used 
    // image file name in the back of the array, where it will not be
    // selected again, and putting the image file name in the back of the
    // where the newly used image was
    var TempFileName = ImageFileNames[r];
    ImageFileNames[r] = ImageFileNames[ImageFileNames.length - 1 - j];
    ImageFileNames[ImageFileNames.length - 1 - j] = TempFileName;

    // increment the index of required images for the while loop
    i++;

  } // end while

} // end selectImages

-->
