function preload(imgObj,imgSrc)
{
  eval(imgObj + ' = new Image()');
  eval(imgObj + '.src = "' + imgSrc + '"');
}

function browseImages(dir)
{
	curImage += dir;
	
	if (curImage == imageList.length)
    curImage = 0;
  else if (curImage < 0)
    curImage = imageList.length - 1;
  
  // display image
  displayImg(curImage);
}

function shuffleImages()
{
  ID = setInterval('browseImages(1)', 5000);
}

function displayImg(index)
{
  // make sure that the current image is set, also when selected from thumbnails
  curImage = index;
  // display current image
  var imgField = document.getElementById("slide");
  imgField.src = imageList[index][0];
  imgField.alt = imageList[index][1] + ", " + imageList[index][2] + ", " + imageList[index][3];
  // display additional info
  var descriptionField = document.getElementById("desc");
  descriptionField.innerHTML = imageList[index][1] + "<br />" + imageList[index][2] + ", " + imageList[index][3] + "<br />" + imageList[index][4];
}
