function DrawImage(ImgD,FitWidth,FitHeight){

	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		var rate = (FitWidth/image.width < FitHeight/image.height)?FitWidth/image.width:FitHeight/image.height;
		if(rate <= 1){
			ImgD.width = image.width*rate;
			ImgD.height =image.height*rate;
		}
		else
		{
			ImgD.width = image.width;
			ImgD.height =image.height;
		}
	}
	
}

