function change_iframe_height(id) {
  var iframe;
  var height;
  var width;
  var body;
  if (document.getElementById && !(document.all)) {
    iframe = document.getElementById(id);
    body   = iframe.contentDocument.body;
  } else if (document.all) {
    iframe = document.frames(id);
    body   = iframe.document.body;
  }


  height = body.scrollHeight;
  if (body.offsetHeight > height) {
    height = body.offsetHeight;
  }

  // avoiding scrollbars if possible
  if (iframe && height) {
    iframe.height = height * 1.01;

    // IE6 has both properties and we need to make sure that the height is set
    // on the element returned by getElementById, not on the object returned
    // from document.frames.

    if (document.getElementById && document.all) {
      document.getElementById(id).height = iframe.height;
    }
  }
}
