function size_iframe(the_frame, max_height)
{
        var x = document.getElementById(the_frame);
        var y = eval("frames." + the_frame + ".document.body");

        var isIframeNotEmpty =  y.innerHTML.toLowerCase().indexOf("script") > 0;

        if (isIframeNotEmpty) { 
                x.style.display = '';
 
                // IE problem; wont show clientHeight if style height hasn't been set 
                if (document.all) 
                        {
                                y.style.height = "0px";
                                y.style.width = "0px";
                        }

                margin = 3;
                x.style.height = (parseInt(y.scrollHeight,10)+margin) + "px";
                x.style.width = (parseInt(y.scrollWidth,10)+margin) + "px";
        } 
} 	