// JavaScript Document

var flag=false;
function DrawImage(ImgD,defaultw,defaulth){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
		if(image.width/image.height >= defaultw/defaulth){
			if(image.width>defaultw){ 
				ImgD.width=defaultw;
				ImgD.height=(image.height*defaultw)/image.width;
			}else{
				ImgD.width=image.width; 
				ImgD.height=image.height;
			}
			ImgD.alt=image.width+"×"+image.height;
		}
		else{
			if(image.height>defaulth){ 
				ImgD.height=defaulth;
				ImgD.width=(image.width*defaulth)/image.height; 
			}else{
				ImgD.width=image.width; 
				ImgD.height=image.height;
			}
			ImgD.alt=image.width+"×"+image.height;
		}
	}
}