function resizeIframeToFitContent(iframe) {
    // This function resizes an IFrame object
    // to fit its content.
    // The IFrame tag must have a unique ID attribute.
    if (document.frames)
    {
      var doc = document.frames[iframe.id].document;

      if (Math.max(doc.body.scrollHeight, doc.body.offsetHeight)+"px" === iframe.style.height) {return true;}

      iframe.style.height = (Math.max(doc.body.scrollHeight, doc.body.offsetHeight)+20) + "px";
    }
    else
    {
      iframe.style.height = Math.max(iframe.contentWindow.scrollMaxY,iframe.contentDocument.height) + 20 + "px";
    }
}
