/***/

function RedrawMainMenu ()
{
  try {
    var objHome = document.getElementById ("a-home");
  } catch (e) {
    alert (e.message);
  }

}

/************************* THUMBS ********************************/

function ExpandThumb (idThumb, idLarge)
{
  try {
    var objThumb = document.getElementById (idThumb);
    var path = objThumb.src;

    var objLarge = document.getElementById (idLarge);
    objLarge.src = path;
  } catch (e) {
    alert (e.message);
  }
}

/************************* POPUPS ********************************/

// use static variable so that we can close window before opening a 2nd one.
var winLargePhoto = null;

function CloseLargePhoto ()
{
  try {
    if (winLargePhoto != null && !winLargePhoto.closed)
    {
      winLargePhoto.close();
    }
  }
  catch(e)
  {
    alert (e.message);
  }
}

function DisplayLargePhoto (objPhoto)
{
  try {
    // get screen size
    var width = screen.availWidth;
    var height = screen.availHeight;

    var photoWidth = objPhoto.width;
    var photoHeight = objPhoto.height;
    if (photoWidth == 0) photoWidth = 1200;
    if (photoHeight == 0) photoHeight = 800;
    if (photoWidth > width) photoWidth = width;
    if (photoHeight > height) photoHeight = height;

    // deterine window pos - centered on screen
    var left = Math.round ((width - photoWidth) / 2);
    var top = Math.round ((height - photoHeight) / 2);

    // open new window
    var specs = "height=" + photoHeight + ", width=" + photoWidth +
                ", left=" + left + ", top=" + top +
                ", directories=no, menubar=no, status=no, toolbar=no, copyhistory=no";

    CloseLargePhoto ();
    winLargePhoto = window.open (objPhoto.src, "_blank", specs);
  }
  catch(e)
  {
    alert (e.message);
  }
}

function PopupLargePhoto(idSourcePhoto)
{
  try {
    var objSourcePhoto = document.getElementById (idSourcePhoto);
    var iLastDash = objSourcePhoto.src.lastIndexOf ("-");
    var fileLargePhoto = objSourcePhoto.src.substring (0,iLastDash+1) + "large.jpg";

    // get photo size and adjust to be <= screen size
    var objLargePhoto = new Image();
    objLargePhoto.src = fileLargePhoto;

    DisplayLargePhoto (objLargePhoto);

    // return to browser - image will display asynchronously
  }  catch(e)  {
    alert (e.message);
  }
}

