function DrawImage(ImgD,ImgDWidth,ImgDHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width/image.height>=ImgDWidth/ImgDHeight){
		if(image.width>ImgDWidth){
			ImgD.width=ImgDWidth;
			ImgD.height=(image.height*ImgDWidth)/image.width;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
	}else{
		if(image.height>ImgDHeight){
			ImgD.width=(image.width*ImgDHeight)/image.height;
			ImgD.height=ImgDHeight;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
	}
}

