﻿
  
        function ResizeImg(ImgD,xx,yy){   
  
            var image=new Image();   
  
            image.src=ImgD.src;                 
  
            if(image.width>0 && image.height>0){         
  
                if(image.width/image.height>= xx/yy){   
  
                    if(image.width>xx){     
  
                        ImgD.width=xx;   
  
                        ImgD.height=(image.height*xx)/image.width;   
  
                    }   
  
                    else{   
  
                        ImgD.width=image.width;     
  
                        ImgD.height=image.height;   
  
                    }   
  
               
  
                }   
  
                else{   
  
                    if(image.height>yy){     
  
                        ImgD.height=yy;   
  
                        ImgD.width=(image.width*yy)/image.height;        
  
                    }   
  
                    else{   
  
                        ImgD.width=image.width;     
  
                        ImgD.height=image.height;   
  
                    }               
  
                }   
  
            }   
  
        }     
  
  