Why is this function not working?
<p>I had this code:</p>

<pre><code>var frames = document.getElementsByTagName("iFrame");
var auto_resize_timer = window.setInterval("autoresize_frames()", 400);
function autoresize_frames() {
    for (var i = 0; i &lt; frames.length; ++i) {
        if (frames[i].contentWindow.document.body) {
            var frames_size = frames[i].contentWindow.document.body.offsetHeight;
            if (document.all &amp;&amp; !window.opera) {
                frames_size = frames[i].contentWindow.document.body.scrollHeight;
            }
            frames[i].style.height = frames_size + 'px';
        }
    }
}
</code></pre>

<p>That was working fine.</p>

<p>Then, I decided to put it in its own module:</p>

<pre><code>function autoResizeFrames() {
    var frames = document.getElementsByTagName("iFrame");
    window.setInterval("autoresize_frames(frames)", 400);
}

function autoresize_frames(frames) {

    for (var i = 0; i &lt; frames.length; ++i) {
        if (frames[i].contentWindow.document.body) {
            var frames_size = frames[i].contentWindow.document.body.offsetHeight;
            if (document.all &amp;&amp; !window.opera) {
                frames_size = frames[i].contentWindow.document.body.scrollHeight;
            }
            frames[i].style.height = frames_size + 'px';
        }
    }
}
</code></pre>

<p>And run it in the page like so:</p>

<pre><code>&lt;script type="text/javascript"&gt;

    $(document).ready
(
     function () {
         autoResizeFrames();
     }

    );

&lt;/script&gt;
</code></pre>

<p>But now it does not work? Any ideas why?</p>

<p>Thanks</p>
