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