Fire event after all Javascript has finished executing
<p>I have a page that uses a lot of javascript calculations when the page loads. This can lock the page up for a few minutes depending on how many calculations are performed.</p>

<p>I can open a jquery modal box on page load. The calculation functions then fire and then then once they are finished they modal box should close. </p>

<p>The problem the box is closing almost immediately after it is shown. The code I am using is here:</p>

<pre><code>// In page startup functions
$(document).ready(function() {
    // Initialise Modal
    $('#dialog').jqm({ modal: true });
    // Show Modal box
    $('#dialog').jqmShow();
    // Call all the startup functions and then hide the modal box
    // once they have all completed.
    StartUpCall((function() { $('#dialog').jqmHide(); })())
});
</code></pre>

<p>Is there an event that jQuery fires once all javascript has been completed? That would be first prize for me.</p>

<p>Edit: I am using jqModal - <a href="http://dev.iceburg.net/jquery/jqModal/" rel="nofollow">http://dev.iceburg.net/jquery/jqModal/</a></p>
