function DrawImage(ImgD , nWidth ,nHeight)
{
  var flag=false;
  var image=new Image();
  var nWidth = arguments[1]?arguments[1]:80;
  var nHeight= arguments[2]?arguments[2]:80;
  
  var ow;
  var oh;
  
  ow = ImgD.width;
  oh = ImgD.height;
    
  image.src=ImgD.src;
  if(image.width > 0 && image.height >0){
    flag=true;
    if(image.width/image.height >= nWidth/nHeight){
      if(image.width > nWidth){
        ImgD.width=nWidth;
        ImgD.height=(image.height*nHeight)/image.width;
      }
    else{
      ImgD.width=image.width;
      ImgD.height=image.height;
      }
    }
    else{
      if(image.height > nHeight){
        ImgD.height=nHeight;
        ImgD.width=(image.width*nHeight)/image.height;
        }
      else{
        ImgD.width=image.width;
        ImgD.height=image.height;
        }
      }
    }
    return{
        Width: ow,
        Height: oh
    };
}
