document.getElementById("imgDisp").style.display = 'none';
function cellAct(oThis){
  document.getElementById("img_" + oThis.id).className ='tnImgAct';
  oThis.className ='tnDescAct';
}
function cellInact(oThis){
  document.getElementById("img_" + oThis.id).className ='tnImg';
  oThis.className ='tnDesc';
}

function showImg(oThis,sCaption){
  //return to clear to avoid images loading on top of one another
  document.getElementById("imgLarge").src = "images/gallery/" + oThis.id + ".jpg";
  
  document.getElementById("imgList").style.display = 'none';
  document.getElementById("imgDisp").style.display = 'block';
  document.getElementById("caption").innerHTML=sCaption;
  
  //resolves problem in Mozilla of remaining active state of selected image
  cellInact(oThis);

  iCurrImg = getCurrImgID(oThis.id);
}
function showMenu(){
  document.getElementById("imgList").style.display = 'block';
  document.getElementById("imgDisp").style.display = 'none';
  document.getElementById("imgLarge").src = "images/shim.gif";
}
function imgNav(sDirection){
  var i;
  
  if (sDirection == 'next') {
    i = iCurrImg+1;
    if (i < iUpperBound){
      document.getElementById("imgLarge").src = "images/gallery/" + arGallery[i][1] + ".jpg";
      document.getElementById("caption").innerHTML = arGallery[i][0];
    }else if (i== arGallery.length){
      //reset i to a valid value within the array
      i = i-1;
    }
    
  } else if (sDirection == 'prev'){
    i = iCurrImg-1;
    if (i >= 0 ){
      document.getElementById("imgLarge").src = "images/gallery/" + arGallery[i][1] + ".jpg";
      document.getElementById("caption").innerHTML = arGallery[i][0];
    }else if (i < 0) {
      //reset i to a valid value within the array
      i = i+1;
    }
  }
  iCurrImg = i;
}

function getCurrImgID(iImgName){
  for (var i=0; i < iUpperBound; i++){
    if (arGallery[i][1]==iImgName){
      return i;
    }
  }
}

function imgNavAct(oThis){
  oThis.className="imgNavAct";
}
function imgNavInact(oThis){

  if (iCurrImg == 0 || iCurrImg == iUpperBound-1){
    oThis.className="imgNavAct";
  }else{ 
    oThis.className="imgNavInact";
  }
}

