function resImg(id,what) {
  var ima = new Image();
  ima.src = what;
  h = ima.height;
  w = ima.width;
  obj = document.getElementById(id);
  if (w > h) {
  obj.style.width = "100px";
  dub = (w / 100);
  obj.style.height = (h / dub) + "px"; 
  } else if (w == h) {
  obj.style.width = "100px";
  obj.style.height = "100px";
  } else if ( w < h ) {
  obj.style.height = "100px";
  dubi = h / 100;
  obj.style.width = (w / dubi) + "px";
  }
}


