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

