As other said, setTimeout is your safest bet
But sometimes you cannot separate the logic to a new function then you can use Date.now() to get milliseconds and do the delay yourself....
function delay(milisecondDelay) {_x000D_
milisecondDelay += Date.now();_x000D_
while(Date.now() < milisecondDelay){}_x000D_
}_x000D_
_x000D_
alert('Ill be back in 5 sec after you click OK....');_x000D_
delay(5000);_x000D_
alert('# Im back # date:' +new Date());
_x000D_