function sizeTo(layerName, img, iHeight, iWidth, animate) {
   var ie4 = (document.all)
   if (ie4) {
     var targetLayer = document.all[layerName]
     // Locate the image to resize
     var el = targetLayer.children.tags("IMG")[0]
     // Add a clip sub-object. This is used to hide browser differences.
     el.clip = new Object      
   }
   else {
     // You can't just resize the image. In Netscape we manipulate
     // the positioned DIV the image is displayed within.
     var el = document.layers[layerName]
     // Add a style object. This is used to hide browser differences
     el.style = new Object
     // Store current height and width in IE compatible properties
     el.style.pixelHeight = el.offsetHeight = el.clip.height 
     el.style.pixelWidth = el.offsetWidth = el.clip.width
   }
   if (!animate) { // No animation, just change image size
      if (ie4) { 
        // Change image size directly in IE
        el.style.pixelWidth = iWidth; el.style.pixelHeight = iHeight
      }
      else {
        // Create new image with new size in Netscape
        el.document.write("<img src='" + img + "' width="+iWidth+" height="+iHeight+">");
        el.document.close();   
      }
   }
   else
   if ((el.offsetHeight != iHeight) || (el.offsetWidth != iWidth)) {
      // Notice we set both the style and clip sub-objects. The clip
      // object is used in Netscape, the style object is used in IE.
      // By setting both directly we do not need to distinguish between
      // browsers.
      if (el.offsetHeight < iHeight) 
        el.style.pixelHeight = el.clip.height = el.offsetHeight + 1;
      if (el.offsetWidth < iWidth) 
        el.style.pixelWidth = el.clip.width = el.offsetWidth + 1;
      if (el.offsetHeight > iHeight) 
        el.style.pixelHeight = el.clip.height = el.offsetHeight - 1;
      if (el.offsetWidth > iWidth) 
        el.style.pixelWidth = el.clip.width = el.offsetWidth  - 1;
      // IE already resized the image when we set the style properties
      // In Netscape we need to write out a new image with the new size
      if (!ie4) {
        el.document.write("<img src='" + img + "' width="+el.style.pixelWidth+" height="+el.style.pixelHeight+">");
        el.document.close();
      }
      // Continue animation
      setTimeout('sizeTo("' + layerName + '","'+img+'",'+iHeight+','+iWidth+','+animate+')',10);
  } 
}
