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