function imgInfo(imgSrc,caption) {
 	this.imgSrc = imgSrc;
	this.caption = caption;
}

var curIdx = 0;
var galleryImgs = new Array(10);
var captionTxt =  new Array(10)
galleryImgs[0] = new Image();
galleryImgs[0].src = "images/gallery1_06.jpg"
galleryImgs[1] = new Image();
galleryImgs[1].src = "images/gallery2_06_bg.jpg";
galleryImgs[2] = new Image();
galleryImgs[2].src = "images/gallery3_06_bg.jpg";
galleryImgs[3] = new Image();
galleryImgs[3].src = "images/gallery4_06.jpg";
galleryImgs[4] = new Image();
galleryImgs[4].src = "images/gallery5_06_bg.jpg";
galleryImgs[5] = new Image();
galleryImgs[5].src = "images/gallery6_06.jpg";
galleryImgs[6] = new Image();
galleryImgs[6].src = "images/gallery7_06.jpg";
galleryImgs[7] = new Image();
galleryImgs[7].src = "images/gallery8_06_bg.jpg";
galleryImgs[8] = new Image();
galleryImgs[8].src = "images/gallery9_06.jpg";
galleryImgs[9] = new Image();
galleryImgs[9].src = "images/gallery10_06_bg.jpg";

captionTxt[0] = "photo by Howard Hall";
captionTxt[1] = "photo by the World Society for the Protection of Animals";
captionTxt[2] = "photo by Howard Hall";
captionTxt[3] = "photo by the World Society for the Protection of Animals";
captionTxt[4] = "photo by the World Society for the Protection of Animals";
captionTxt[5] = "photo by the World Society for the Protection of Animals";
captionTxt[6] = "photo by Howard Hall";
captionTxt[7] = "photo by the World Society for the Protection of Animals";
captionTxt[8] = "photo by Howard Hall";
captionTxt[9] = "photo by Naomi Rose";



function initImage() {
  imageId = 'thephoto';
  image = document.getElementById(imageId);
  image.src = galleryImgs[curIdx].src;
  document.getElementById("captions").innerHTML = captionTxt[curIdx];
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 1;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 10);
    }
  }
}

function next() {
	curIdx++;
	if (curIdx == 10) curIdx = 0;
	initImage();
}

function prev() {
	curIdx--;
	if (curIdx == -1) curIdx = 9;
	initImage();
}