var thumbObj = null;
var photoObj = null;
var photoImg = null;
var blankImg = null;
var currentPhoto = null;
var loaded = false;

function init()
{
  //alert('init()');

  if (document.layers)
  {
    thumbDiv = document.layers['placer'].document.layers['thumbs'];
    photoDiv = document.layers['placer'].document.layers['photo'];
    photoImg = document.layers['placer'].document.layers['photo'].document.images['photoimg'];
    thumbDiv.visibility = 'show';
    photoDiv.visibility = 'hide';
  }
  else if (document.all)
  {
    thumbDiv = document.all['thumbs'].style;
    photoDiv = document.all['photo'].style;
    photoImg = document.all['photoimg'];
    thumbDiv.visibility = 'visible';
    photoDiv.visibility = 'hidden';
  }

  loaded = true;
}

function swap(imagename, newimage)
{
  if (!loaded)
    return;

  if (document.layers)
    thumbDiv.document.images[imagename].src=newimage;
  else
    document.images[imagename].src=newimage;
}

function showPhoto(url)
{
  //alert('showPhoto(' + url + ')');

  if (!loaded)
    return;

  currentPhoto = url;
  photoImg.src = url;
  thumbDiv.visibility = (document.layers ? 'hide' : 'hidden');
  photoDiv.visibility = (document.layers ? 'show' : 'visible');
}
  
function showThumbs()
{
  //alert('showThumbs()');

  if (!loaded)
    return;

  currentPhoto = null;
  photoImg.src = '/wsw/common/images/blank.gif';
  photoDiv.visibility = (document.layers ? 'hide' : 'hidden');
  thumbDiv.visibility = (document.layers ? 'show' : 'visible');
}

function resize()
{
  //alert('resize()');

  if (!loaded)
    return;

  if (document.layers && currentPhoto)
  {
    showPhoto(currentPhoto);
  } 
}

