How to interupt javascript to flush events
<p>I have a function running on document load that copies the contents of a select object to other select boxes (to conserve network bandwidth).</p>

<p>The function is taking a few seconds to complete, so I wanted to mask the main div (to give the user the idea that something is happening).</p>

<p>Unfortunately, the mask is not showing up until after the function completes:</p>

<pre><code>    // I want the mask to show immediately here, but never gets shown
    $('#unassignedPunchResults').mask('Getting results');

    $('.employeeList').each(function (i) {
        // this is freezing the browser for a few seconds, the masking is not showing
        $('#employeeList option').clone().appendTo(this);  
    });

    $('#unassignedPunchResults').unmask();
</code></pre>

<p>How can I interrupt the javascript after the mask() call to flush that event and continue, so the user can see the mask while the longer processing (the each()) processes?</p>
