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