//透明png
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle        
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }

function transimg(imgobj) 
   {
if(getOs = "MSIE"){
      var img = imgobj//document.getElementById(imgid)
      var imgName = img.src.toUpperCase()
      
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle        
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
      }
   }

function getOs() 
{ 
var OsObject = ""; 
if(navigator.userAgent.indexOf("MSIE")>0) { 
return "MSIE"; 
} 
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
return "Firefox"; 
} 
if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
return "Safari"; 
} 
if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
return "Camino"; 
} 
if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
return "Gecko"; 
} 

} 
//if(getOs = "MSIE"){
//	window.attachEvent("onload", correctPNG);
//	}

function ImgAutoSize(imgD,FitWidth,FitHeight) 
{ 
var image1=new Image(); 
image1.onload = function () 
{ 
if(this.width>0 && this.height>0) 
{ 
if(this.width/this.height>= FitWidth/FitHeight) 
{ 
//if(this.width>FitWidth) 
//{ 
imgD.width=FitWidth; 
imgD.height=(this.height*FitWidth)/this.width; 
//} 
//else 
//{ 
//imgD.width=this.width; 
//imgD.height=this.height; 
//} 
} 
else 
{ 
//if(this.height>FitHeight) 
//{ 
imgD.height=FitHeight; 
imgD.width=(this.width*FitHeight)/this.height; 
//} 
//else 
//{ 
//imgD.width=this.width; 
//imgD.height=this.height; 
//} 
} 
} 
image1 = null; 
} 
image1.src=imgD.src; 
imgD.style.cursor = 'hand'; 
//imgD.onclick= function(){openWin(this.src,'imgphoto',600,400)}; 
//imgD.title = "点击在新窗口中查看原图"; 
} 
<!-- 
var flag=false; 
function DrawImage(ImgD){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= 105/80){ 
   if(image.width>105){
    ImgD.width=105; 
    ImgD.height=(image.height*105)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   ImgD.alt="点击查看详细信息..."; 
  } 
  else{ 
   if(image.height>80){
    ImgD.height=80; 
    ImgD.width=(image.width*80)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   ImgD.alt="点击查看详细信息..."; 
  } 
 }
}
