﻿var flag=false;
function ReDrawImage(ImgD,X,Y){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= X/Y){
     if(image.width>X){  
     ImgD.width=X;
     ImgD.height=(image.height*X)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    else{
     if(image.height>Y){  
     ImgD.height=Y;
     ImgD.width=(image.width*Y)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    }
}

function DrawImageX618_Y468(ImgD,X,Y)
{
   var image=new Image();
   image.src=ImgD.src;
   
   if(image.width>618 && image.height>468)
   {
        flag=true;
        if(image.width/image.height>= X/Y)
        {
            if(image.width>X)
            {  
                ImgD.width=X;
                ImgD.height=(image.height*X)/image.width;
            }
            else
            {
                ImgD.width=image.width;  
                ImgD.height=image.height;
            }
            ImgD.alt=image.width+"×"+image.height;
        }
        else
        {
            if(image.height>Y)
            {  
                ImgD.height=Y;
                ImgD.width=(image.width*Y)/image.height;     
            }
            else
            {
                ImgD.width=image.width;  
                ImgD.height=image.height;
            }
            ImgD.alt=image.width+"×"+image.height;
        }
    }
} 