<!--
//图片按比例缩放
var flag=false;
function DrawImage(ImgD,id){
var image=new Image();
if(id==1){
var iwidth =120; //定义允许图片宽度
var iheight = 100; //定义允许图片高度
}
else if(id==3){
var iwidth =413; //定义允许图片宽度
var iheight = 345; //定义允许图片高度
}
else
{
var iwidth =148; //定义允许图片宽度
var iheight = 118; //定义允许图片高度
}
//alert("宽度"+iwidth+"长度"+iheight);
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
}

if(image.width>iwidth&&image.width>=image.height){ 
	ImgD.width=iwidth;
	ImgD.height=(image.height*iwidth)/image.width;
	if(ImgD.height>iheight){
		ImgD.height=iheight;
	   	ImgD.width=(image.width*iheight)/image.height;
	}
}else if(image.height>iheight&&image.height>=image.width){ 
	ImgD.height=iheight;
	ImgD.width=(image.width*iheight)/image.height;
	if(ImgD.width>iwidth){
	 ImgD.width=iwidth;
	ImgD.height=(image.height*iwidth)/image.width;
	}
}else{
	ImgD.width=image.width; 
	ImgD.height=image.height;
}

} 
//调用：<img src="图片" onload="javascript:DrawImage(this)">
//-->
