function fixPNG(img) {
    if (!window.ie6) return;
    var imgName = img.src.toUpperCase()
    if (!img.parentElement) return;
    if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
        var span=document.createElement('SPAN');
        if (img.title) span.title=img.title;
        if (img.id) span.id=img.id;
        if (img.className) span.className=img.className;
        var str="display:inline-block;"+img.style.cssText+';';
        if (img.align=='left') {
            str+='float:left;';
        } else if (img.align=='right') {
            str+='float:right;';
        }
        if (img.parentElement.href) {
            str+='cursor:pointer;';
        }
        if (img.height) {
            str+='height:'+img.height+'px;';
        }
        if (img.width) {
           str+='width:'+img.width+'px;';
        }
        str+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', sizingMethod='crop');";
        span.style.cssText=str;
        img.parentNode.replaceChild(span,img);
    }
}

function correctPNG() {
    if (!window.ie6) return;
    var max=document.images.length;
    for(var i=0; i<=max; i++) {
        var img = document.images[i];
        if (img) {
        var imgName = img.src.toUpperCase();
           if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
              //alert(i+'='+img.src);
              if (img.style.display!='none') {
                fixPNG(img);
                i--;
              }
           }
        }
    }
}
