function DrawImage(ImgD,w,h){
	var image=new Image();   
	image.src=ImgD.src;   
	if(image.width>0 && image.height>0){   

	  if(image.width/image.height>= w/h){   
	    ImgD.width=w;   
	    ImgD.height=(image.height*w)/image.width; 

	  }   
	  else{    
	    ImgD.height=h;   
	    ImgD.width=(image.width*h)/image.height;   

	  }   
}  
}  

