var  flag=false;  
function  DrawImage(ImgD, DispWidteh, DispHeight){  
     var  image=new  Image();  
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0){  
       flag=true;  
       if(image.width/image.height>=  DispWidteh/DispHeight){  
         if(image.width>DispWidteh){      
         ImgD.width=DispWidteh;  
         ImgD.height=(image.height*DispWidteh)/image.width;  
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         ImgD.alt=image.width+"กม"+image.height;  
         }  
       else{  
         if(image.height>DispHeight){      
         ImgD.height=DispHeight;  
         ImgD.width=(image.width*DispHeight)/image.height;            
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         ImgD.alt=image.width+"กม"+image.height;  
         }  
       }  
}