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