function zoomImages (factor) {

// loop through document.images array

for (var loop = 0; loop < document.images.length; loop++)
{
  var image = document.images[loop]
  if (document.layers) {
    var currentWidth = image.currentWidth ? image.currentWidth : image.width;
    var currentHeight = image.currentHeight ? image.currentHeight : image.height;
  }
  else {
    var currentWidth = image.width;
    var currentHeight = image.height;
  }
  var width = parseInt(currentWidth * factor);
  var height = parseInt(currentHeight * factor);
  resizeImage(image, width, height);
}  
// end loop
}



function fitAllInWindow () {

    var h = getWindowHeight();
    var w = getWindowWidth();
    var targetH = 0.80 * h;
    var targetW = 0.80 * w;
    var width = 0;
    var height = 0;
    var factor = 0;
    
    // loop through document.images array
    for (var loop = 0; loop < document.images.length; loop++)
    {
      var image = document.images[loop]
      if (document.layers) {
        var currentWidth = image.currentWidth ? image.currentWidth : image.width;
        var currentHeight = image.currentHeight ? image.currentHeight : image.height;
      }
      else {
        var currentWidth = image.width;
        var currentHeight = image.height;
      }
      if ((currentWidth > w) || (currentHeight > h)) {
          if (currentWidth > currentHeight) {
              width = targetW;
              factor = targetW / currentWidth;
              height = parseInt(currentHeight * factor);
          } else {
              height = targetH;
              factor = targetH / currentHeight;
              width = parseInt(currentWidth * factor);  	
          }
          resizeImage(image, width, height);
      }
    
    // end loop
    }
}

function getWindowWidth()
{
  var winW = 630;

  if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
     }
  }
  return (winW);
}

function getWindowHeight()
{
  var winH = 460;

  if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winH = document.body.offsetHeight;
     }
  }
  return (winH);
}

function resizeImage (imageOrImageName, width, height) {
  var image = typeof imageOrImageName == 'string' ?
                document[imageOrImageName] : imageOrImageName;
  if (document.layers) {
    image.currentWidth = width;
    image.currentHeight = height;
    var layerWidth = image.width > width ? image.width : width;
    var layerHeight = image.height > height ? image.height : height;
    if (!image.overLayer) {
      var l = image.overLayer = new Layer(layerWidth);
    }
    var l = image.overLayer;
    l.bgColor = document.bgColor;
    l.clip.width = layerWidth; 
    l.clip.height = layerHeight;
    l.left = image.x;
    l.top = image.y;
    var html = '';
    html += '<IMG SRC="' + image.src + '"';
    html += image.name ? ' NAME="overLayer' + image.name + '"' : '';
    html += ' WIDTH="' + width + '" HEIGHT="' + height + '">';
    l.document.open();
    l.document.write(html);
    l.document.close();
    l.visibility = 'show';
  }
  else {
    image.width = width;
    image.height = height;
  }
}

function showImageSizes () {

// loop through document.images array
var report;
report = '<table>';
report = report + '<tr>';
report = report + '<td><b>#</b></td><td><b>Width</b></td><td><b>Height</b></td>';
report = report + '</tr>';

for (var loop = 0; loop < document.images.length; loop++)
{
  var image = document.images[loop]
  if (document.layers) {
    var currentWidth = image.currentWidth ? image.currentWidth : image.width;
    var currentHeight = image.currentHeight ? image.currentHeight : image.height;
  }
  else {
    var currentWidth = image.width;
    var currentHeight = image.height;
  }
  report = report + '<tr>';
  report = report + '<td>';
  report = report + loop;
  report = report + '</td>';
  report = report + '<td>';
  report = report + currentWidth;
  report = report + '</td>';
  report = report + '<td>';
  report = report + currentHeight;
  report = report + '</td>';
  report = report + '</tr>';
}  

// end loop

report = report + '</table>';
document.write(report);
}

