// JavaScript Document
var  flag=false;  
function  DrawImage(ImgD,i,j){  
     var  image=new  Image();  
	 var img_w=i;
	 var img_h=j
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0){  
       flag=true;  
       if(image.width/image.height>=  img_w/img_h){  
         if(image.width>img_w){      
         ImgD.width=img_w;  
         ImgD.height=(image.height*img_w)/image.width;  
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         //ImgD.alt=image.width+"กม"+image.height;  
         }  
       else{  
         if(image.height>img_h){      
         ImgD.height=img_h;  
         ImgD.width=(image.width*img_h)/image.height;            
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         //ImgD.alt=image.width+"กม"+image.height;  
         }  
       }  
}    

function SetCwinHeight()
{
	var cwin=document.getElementById("webproductfrm");
	if (document.getElementById){
		if (cwin && !window.opera){
			if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
				cwin.height = cwin.contentDocument.body.offsetHeight; 
			else if(cwin.Document && cwin.Document.body.scrollHeight)
				cwin.height = cwin.Document.body.scrollHeight; 
		}
	}
}
