var immGetFFVersion = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
var immFFextraHeight = parseFloat(immGetFFVersion) >= 0.1 ? 16 : 0;  //extra height in px to add to iframe in FireFox 1.0+ browsers


function SetEmbedContentPluginSize(objectid)
{
    var frame = document.getElementById(objectid);
    if (frame && !window.opera)
    {
        if (frame.contentDocument && frame.contentDocument.body.offsetHeight) //ns6 syntax
        {
            frame.height = frame.contentDocument.body.offsetHeight + immFFextraHeight;
        }
        else if (frame.document && frame.document.body.scrollHeight) //ie5+ syntax
        {
            // START: IE specific code

            frame.height = frame.document.body.scrollHeight;

            // Use the "object" property as this is actually the document object when you embed html
            // in an object element
            var htmlElement = frame.object.getElementsByTagName("html")[0];
            var bodyElement = frame.object.getElementsByTagName("body")[0];
            htmlElement.style.overflow = "auto";
            htmlElement.style.border = "none";
            htmlElement.style.margin = "0";
            bodyElement.style.margin = "0";

            // END: IE specific code
        }
    }
}


function WaitForReadyStateChangeIfIE(objectid)
{
    // If the browser supports the readyState property then
    // wait for it to be "complete" before working out the
    // embedded website's height.
    if (document.readyState)
    {
        var timer = window.setInterval(function()
        {
            if (document.readyState == "complete")
            {
                window.clearInterval(timer);
                SetEmbedContentPluginSize(objectid);
            }
        }, 500);
    }
}
