var flag=false;
function DrawImage(ImgD,size){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
  flag=true;
  if(image.width/image.height>= size/size){
   if(image.width>size){
    ImgD.width=size;
    ImgD.height=(image.height*size)/image.width;
   }else{
    ImgD.width=image.width;
    ImgD.height=image.height;
   }
   /*ImgD.alt="bigpic"  */
  }
  else{
   if(image.height>size){
    ImgD.height=size;
    ImgD.width=(image.width*size)/image.height;
   }else{
    ImgD.width=image.width;
    ImgD.height=image.height;
   }
    /*ImgD.alt="bigpic"  */
  }
}
}