var  flag=false;
var maxW=500;
var maxH=700;
function  DrawImage(ImgD){
     var  image=new  Image();
     image.src=ImgD.src;
     if(image.width>0  &&  image.height>0){
       flag=true;
       if(image.width/image.height>=maxW/maxH){
         if(image.width>maxW){
         ImgD.width=maxW;
         ImgD.height=(image.height*maxW)/image.width;
         }else{
         ImgD.width=image.width;
         ImgD.height=image.height;
         }
         //ImgD.alt=image.width+"×"+image.height;
         }
       else{
         if(image.height>maxH){
         ImgD.height=maxH;
         ImgD.width=(image.width*maxH)/image.height;
         }else{
         ImgD.width=image.width;
         ImgD.height=image.height;
         }
        // ImgD.alt=image.width+"×"+image.height;
         }
       }
}
