// images list for pre-loading
var loadImages = new Array();
loadImages["home"] = new Array(
                           "header.jpg",
                           "home_tile.gif",
                           "photos_tile.gif",
                           "guestbook_tile.gif",
                           "loader_msg_photos.jpg",
                           "loader_msg_home.jpg",
                           "loader_msg_guestbook.jpg",
                           "loader_msg_default.jpg",
                           "btnPhotos0.jpg",
                           "btnPhotos1.jpg",
                           "btnHome0.jpg",
                           "btnHome1.jpg",
                           "btnGuestbook0.jpg",
                           "btnGuestbook1.jpg",
                           "bk_tile.jpg",
                           "header_tile.jpg"
                     );
loadImages["photos"] = new Array(
                         "ssLeftFrame.gif",
                         "ssPanelLeft.jpg",
                         "btnPlayLeft0.jpg",
                         "btnPlayLeft1.jpg",
                         "btnLeftPlay0.jpg",
                         "btnLeftPlay1.jpg",
                         "btnLeftPause0.jpg",
                         "btnLeftPause1.jpg",
                         "thumbLoader.gif",
                         "ssPanelCenter.jpg",
                         "ssCenterFrame.gif",
                         "mImgLoaderTile.jpg",
                         "ssPanelRight.jpg",
                         "btnPlayRight0.jpg",
                         "btnPlayRight1.jpg",
                         "btnThumbRight0.jpg",
                         "btnThumbRight1.jpg",
                         "btnCloseThumb0.jpg",
                         "btnCloseThumb1.jpg",
                         "ssRightFrame.gif"
                       );
loadImages["guestbook"] = new Array("btnSignGb1.jpg","btnRefresh1.jpg","btnClose1.jpg","btnSign1.jpg");

// loads a given page
function load(myPgName)
{
  // if a prent exists, load the page
  if (window.parent.objPage)
  {
    // load the images for this page
    preLoadImages(myPgName);
    // set the parent to show that the page is ready to display
    window.parent.objPage.actioning = 0;
    window.parent.currPage = myPgName;
  } 
  // send the user to the home page if they load this page directly
  else window.location = ".";
}

// image roll over
function rollMe(who,willing)
{
  document.getElementById(who).src = "images/" + who + willing + ".jpg";
}

// pre-loads images
function preLoadImages(pgName)
{
  // create an array to load the images into
  var docImages = new Array(loadImages["guestbook"].length);
  // load all specified images
  for (var i=0; i<loadImages["guestbook"].length; i++)
  {
    docImages[i] = new Image();
    docImages[i].src = 'images/' + loadImages["guestbook"][i];
  }
  // destroy the images array as it is no longer needed
  docImages = null;

}
