//////////// Photos /////
var allPhotos = new Array();
function Photo(photoDir, photoName, photoLabel)
{ 
  if (photoDir != null)
 	photoDir += "/";
  else
    photoDir = "";

  this.photoDir	= photoDir;
  this.photoName = photoName;
  this.photoURL = photoDir + photoName;
  this.photoThumbImage = photoDir + "thumbs/" + photoName;
  this.photoLabel = photoLabel;
  
  allPhotos[allPhotos.length] = this;
}

function addPhotos(showFirst)
{
  var thumbRef;
  var thumbImage;
  var photo;
  var thumbnailCell = null;
  var thumbnailRow = document.getElementById("thumbnailRow");

  for (var i=0; i<allPhotos.length; i++)
  {
     photo = allPhotos[i];

	 thumbRef = document.createElement("A");
     thumbRef.photo = photo;
	 thumbRef.href = photo.photoURL;
     thumbRef.onclick = showPhoto;

     thumbImage = document.createElement("IMG");
	 thumbImage.border = 0;
 	 thumbImage.src = photo.photoThumbImage;

	 thumbRef.appendChild(thumbImage);
	 thumbnailCell = thumbnailRow.insertCell(i); //need index for Firefox
     thumbnailCell.appendChild(thumbRef);
  }

  if ((showFirst) && (allPhotos.length > 0))
    showPhotoGlobal(allPhotos[0].photoURL, allPhotos[0].photoLabel);
}

function showPhoto()
{
  var photo = this.photo;
  return showPhotoGlobal(photo.photoURL, photo.photoLabel);
}

function showPhotoGlobal(photo, text)
{
  var image = document.getElementById("photoDisplay"); 
  image.src=photo;

  var photoText = document.getElementById("photoText"); 
  photoText.innerHTML=text;

  return false;
}

function photoPopUp(URL, name) 
{
window.open(URL, name, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=608");
return false;
}