Possible Duplicate:
Sleep in Javascript
I want to make a sleep function in JavaScript, I have to stop any code execution before the user performs an action (like the alert() behaviour)
What I need is exactly: what should I insert here to make it work?
window.alert = function(message){
var dialog = $('<div>'+message+'</div>').dialog({
title:'Alert',
buttons:{
'Ok': function(){
$(this).dialog('close').data('open', false);
$(this).remove();
}
}
}).data('open', true);
//What to insert here?
}