<!--
var flag=false;
function DrawImagee_small(ImgD,Imgwidth,Imgheight){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 1){
if(image.width>Imgwidth){ 
ImgD.width=Imgwidth;
ImgD.height=(image.height*Imgwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
else{
if(image.height>Imgheight){ 
ImgD.height=Imgheight;
ImgD.width=(image.width*Imgheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
}
} 

function  DrawImage(ImgD,iwidth,iheight)
{   
  var  image=new  Image();   
  image.src=ImgD.src;   
  if(image.width>0 && image.height>0){   
  flag=true;   
  if(image.width/image.height>=iwidth/iheight){   
  if(image.width>iwidth){             
  ImgD.width=iwidth;   
  ImgD.height=(image.height*iwidth)/image.width;   
  }else{   
  ImgD.width=image.width;             
  ImgD.height=image.height;   
  }   
  //ImgD.alt=image.width+"กม"+image.height;   
  }   
  else{   
  if(image.height>iheight){             
  ImgD.height=iheight;   
  ImgD.width=(image.width*iheight)/image.height;     
  }else{   
  ImgD.width=image.width;             
  ImgD.height=image.height;   
  }   
 // ImgD.alt=image.width+"กม"+image.height;   
  }   
  }   
}         


function cimagewh(imageid)
{
  var originImage=new Image();
  originImage.src=imageid.src;
  originalwidth=OriginImage.width;
  originalheight=OriginImage.height;
  div1=originalwidth/originalheight;
  div2=originalheight/originalwidth;
  n1=0;
  n2=0;
  maxwidth=100;
  maxheight=100;
  if(originalwidth>maxwidth){
  n1=originalwidth/maxwidth;
  }else{
  n1=0;
  newwidth=originalwidth;
  }
  
  if(originalheight>maxheight){
  n2=originalheight/maxheight;
  }else{
  n2=0;
  newheight=originalheight;
  }
  
  if(n1!=0||n2!=0){
  if(n1>n2){
  newwidth=maxwidth;
  newheight=maxwidth*div2;
  }else{
  newwidth=maxheight*div1;
  newheight=maxheight;
  }
  }
  
  imageid.width=newwidth;
  imageid.height=newheight;
}

//-->