
  var isDHTML = 0;
  var isLayers = 0;
  var isAll = 0;
  var isID = 0;

 
  if (document.getElementById) {
    isID = 1;
    isDHTML = 1;
  } else if (document.all) {
    isAll = 1;
    isDHTML = 1;
  } else {
    browserVersion = parseInt(navigator.appVersion);
        
    if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
      isLayers = 1;
      isDHTML = 1;
    }
  }

  function getDOM(objectID, withStyle) {
    if (withStyle == 1) {
      if (isID) {
        return (document.getElementById(objectID).style);
      } else if (isAll) {
        return (document.all[objectID].style);          
      } else if (isLayers) {
        return (document.layers[objectID].style);
      }
    }
  }

  function showObject(objectID) {
    domStyle = getDOM(objectID, 1);
    domStyle.visibility = "visible";
  }

  function hideObject(objectID) {
    domStyle = getDOM(objectID, 1);
    domStyle.visibility = "hidden";
  }

  function changePhoto(direction, newPhoto) {

    var changed = false;

    //run through array
    for (var i=0; (i < photoList.length) && !changed; i++) {

      domStyle = getDOM(photoList[i], 1);

      if (domStyle.visibility == "visible") {

        //Goto Previous Photo
        if (direction == "previous") {
          if (i > 0) {
            hideObject(photoList[i]);
            showObject(photoList[i-1]);
            changed = true;
          }

        //Goto Next Photo
        } else if (direction == "next") {
          if (i < photoList.length - 1) {
            hideObject(photoList[i]);
            showObject(photoList[i+1]);
            changed = true;
          }

        //Goto Submitted Photo
        } else if (direction == "jump") {
          hideObject(photoList[i]);
          showObject(newPhoto);
          changed = true;

        //Error!
        } else {
          alert("Invalid dirction!");
        }
      }
    } // end for loop
  }

