function ImgSize(ImgD,FitWidth,FitHeight,ShowFont,ImgStyle,FitSize){
var image = new Image();
image.src = ImgD.src;
if(image.width>0 && image.height>0){
	if(FitWidth!=null && FitHeight!=null){ //Ex:ImgSize(this,120,120)
         if(image.width/image.height>=FitWidth/FitHeight){
             if(image.width>FitWidth){
               ImgD.width = FitWidth;
               ImgD.height = (image.height*FitWidth)/image.width;
             }else{
               ImgD.width = image.width;
               ImgD.height = image.height;
             }
         }else{
             if(image.height>FitHeight){
               ImgD.height = FitHeight;
               ImgD.width = (image.width*FitHeight)/image.height;
             }else{
               ImgD.width = image.width;
               ImgD.height = image.height;
             }
         }
	}else{
		 if(FitWidth==null && FitHeight!=null){ //Ex:ImgSize(this,null,120)
			 ImgD.height = FitHeight;
		 }else if(FitWidth!=null && FitHeight==null){ //Ex:ImgSize(this,120,null)
			 ImgD.width = FitWidth;
		 }else if(FitWidth==null && FitHeight==null){ //Ex:ImgSize(this,null,null,'',0,120)
			 if(image.width/image.height<1){
			 	if(image.width>FitSize){ImgD.width = FitSize;
			 	}else{ImgD.width = image.width;}
			 }else{
			 	if(image.height>FitSize){ImgD.height = FitSize;
			 	}else{ImgD.height = image.height;}
			 }
		 }
	}
    if(ShowFont) ImgD.alt = ShowFont; //Ex:ImgSize(this,120,120,'ÏÔÊ¾')
    if(ImgStyle){ //Ex:ImgSize(this,120,120,'',1)
       ImgD.alt = "Í¼Æ¬¹æ¸ñ£º" + image.width + "¡Á" + image.height;
       ImgD.onclick = function(){window.open(this.src);}
       ImgD.style.cursor = "pointer";
	}
}
}
