sleep in JavaScript?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/758688/sleep-in-javascript">Sleep in Javascript</a>  </p>
</blockquote>



<p>I want to make a <strong>sleep</strong> function in JavaScript, I have to stop any code execution before the user performs an action (like the alert() behaviour)</p>

<p>What I need is exactly: what should I insert here to make it work?</p>

<pre><code>window.alert = function(message){
    var dialog = $('&lt;div&gt;'+message+'&lt;/div&gt;').dialog({
        title:'Alert',

        buttons:{
            'Ok': function(){
                $(this).dialog('close').data('open', false);
                $(this).remove();
            }
        }
    }).data('open', true);
    //What to insert here?
}
</code></pre>
