/**
 * Gets the height of current document and sets the height of the iframe to the same value
 * @param iframeId id of the iframe from the parent window
 */
function adjustHeightForIFrame(iframeObj) {
  // find the height of iframe's content
  var scrollHeight = document.body.scrollHeight;
  var offsetHeight = document.body.offsetHeight;
  // use greater one
  height = scrollHeight > offsetHeight ? scrollHeight : offsetHeight;
 
  if (iframeObj != null) {
    iframeObj.style.height = height + "px";
  }
}

/**
 * Gets the height of current document and sets the height of the iframe to the same value
 * @param iframeId id of the iframe from the parent window
 */
function adjustHeightForIFrameById(iframeId) {
  // find the iframe and set it's height
  if (parent != null && parent.document != null) {
    var iframe = parent.document.getElementById(iframeId);
    // change the height
    adjustHeightForIFrame(iframe);
  }
}