//让图片不变形，修改图片的最大高和宽值

function DrawImage(ImgD,MaxWidth,MaxHeight){ 
var image=new Image(); 
image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		if(image.width/image.height>= MaxWidth/MaxHeight){ 
			if(image.width>MaxWidth){
			ImgD.width=MaxWidth; 
			ImgD.height=(image.height*MaxWidth)/image.width; 
			}else{ 
			ImgD.width=image.width;
			ImgD.height=image.height; 
			} 
			//ImgD.alt="点击新窗口中查看大图..."; 
		} 
		else{ 
			if(image.height>MaxHeight){
			ImgD.height=MaxHeight; 
			ImgD.width=(image.width*MaxHeight)/image.height; 
			}else{ 
			ImgD.width=image.width;
			ImgD.height=image.height; 
			} 
			//ImgD.alt="点击新窗口中查看大图..."; 
		} 
	}
}