iFrame that contains jQuery Tree Table with alert

Has an iFrame that contains a jQuery Tree Table. The Tree Table alerts it's content size every time a branch is displayed or hidden.

by Donavon Lerman

HTML

<iframe src="http://fiddle.jshell.net/djlerman/yLb25dy9/show/light/"
        width  = "100%"
        id     = "iFrameID"
        onload = "setIframeHeight('iFrameID');">
  <p>Your browser does not support iframes.</p>
</iframe>

JavaScript

function getDocHeight(doc) {
    doc = doc || document;
    // stackoverflow.com/questions/1145850/
    var body = doc.body, html = doc.documentElement;
    var height = Math.max( body.scrollHeight, body.offsetHeight, 
        html.clientHeight, html.scrollHeight, html.offsetHeight );
    return height;
}

function setIframeHeight(id) {
    var ifrm = document.getElementById(id);
    var doc = ifrm.contentDocument? ifrm.contentDocument: 
        ifrm.contentWindow.document;
    ifrm.style.visibility = 'hidden';
    ifrm.style.height = "10px"; // reset to minimal height ...
    // IE opt. for bing/msn needs a bit added or scrollbar appears
    ifrm.style.height = getDocHeight( doc ) + 4 + "px";
    ifrm.style.visibility = 'visible';
}