// JavaScript Document 
//demo <img src="" width="150" height="113"  onLoad="DrawImage(this,150,113)">

<!-- 
var flag = false; 
function DrawImage(ImgD,imgW,imgH){ 
	var image = new Image();
	image.src = ImgD.src; 
	if(image.width > 0 && image.height > 0){
		flag = true;
		if(image.width/image.height >= imgW/imgH){ 
			if(image.width > imgW){ 
				ImgD.width	= imgW;
				ImgD.height	= (image.height * imgW) / image.width; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			//ImgD.alt=image.width+"กม"+image.height; 
		}else{ 
			if(image.height>imgH){ 
				ImgD.height	= imgH;
				ImgD.width	= (image.width * imgH) / image.height; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			}
			//ImgD.alt=image.width+"กม"+image.height; 
		}
	} 
} 
//--> 