﻿function autoIframe(frameId, optScrollHeight, optScrollWidth){
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
//objToResize = (frame.style) ? frame.style : frame;
objToResize = frame;
if (innerDoc.body.scrollHeight < 300 || innerDoc.body.scrollWidth < 400)
{
    if (innerDoc.title == "Forest tax rate lookup")
    {
        objToResize.height = 500; 
        objToResize.width = 737;
    }
    else if(innerDoc.title == "Utilities Apportionment Lookup Tool")
    {
        objToResize.height = 576; 
        objToResize.width = 536;
    }
    else if(innerDoc.title == "Sales Tax Lookup Tool")
    {
        objToResize.height = 527; 
        objToResize.width = 535;
    }
    else
    {
        objToResize.height = 500; 
        objToResize.width = 540;
    } 
}
else
{
    if ((typeof optScrollHeight == 'undefined') || (typeof optScrollWidth == 'undefined')) {
        
        // fix for FF:  setting the height and width to 0 will give us the real scrollHeight/Width
        // down below
        //objToResize.height = 0;
        //objToResize.width = 0;
        
        // note:  this is the old code from before.  This code does not work as intended in any
        // of the browsers (except it works in FF after the objToResize.width = 0 code executes...)
        objToResize.height = innerDoc.body.scrollHeight + 40;
        objToResize.width = innerDoc.body.scrollWidth + 20;
        
    } else {
        // since the above code is buggy in everything but FF (could not find a solution for
        // IE and Safari) we'll just resort to using hardcoded values which are passed in to this
        // function
        
        objToResize.height = optScrollHeight + 40;
        objToResize.width = optScrollWidth + 20;
    }
}

}

