  // Replaces all PNG images in a document with images with the correct alpha transparency
  // Prevent an image from being replaced by adding a '.' to the end of the name ('img.png' => 'img.png.')
  // Function written by Thijs Houtenbos (www.thijshoutenbos.com)
  function replacePngAlpha() {
    // Only replace PNG images in IE, other browsers have native support.
    if ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1)) {
      for (e=0; e<document.images.length; e++) {
        var img = document.images[e];
        var imgsrc = String(document.images[e].lowsrc);
        if (imgsrc=="") { imgsrc = String(document.images[e].src); }
        var imgext = imgsrc.substr(imgsrc.length - 3);
        if (imgext=="png" && img.currentStyle.display != 'none') {
          // Get settings from original image
          var imgclass = img.className;
          var imgwidth = img.clientWidth;
          var imgheight = img.clientHeight;
          var imgtitle = img.title;
          var imgid = img.id;
          if (imgtitle=="") { imgtitle = img.alt; }

          // Create new object (from old object)
          obj = img;
          obj.src = "../../../../../images/pngalpha.gif";
          
          obj.style.width = imgwidth+"px";
          obj.style.height = imgheight+"px";
          obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgsrc+"', sizingMethod='scale', enabled=1)";

          // Replace image with alpha image object
          obj.id = imgid;

          // One image less
          // --e;
        }
      }
    }
  }
  
  