function resizeImage(img,w,h,rownum){
    var image=new Image();
    image.src=img.src;
    var rate1 = image.width/image.height;
    var rate2 = image.height/image.width;
    if(image.width!=w || image.height!=h) {
      if(rate1>0 && rate1<1) {
        var temp = image.height;
        var rate = rate2;
        img.height = temp  = (temp>h)  ? h:temp ;
        img.width  = Math.round(temp/rate);
      } else {
        var temp = image.width;
        var rate = rate1;
        img.width  = temp  = (temp>w)  ? w:temp ;
        img.height = Math.round(temp/rate);
      }
    }
    img.style.display = "inline";
  }

