function sleep(seconds) {
// Delay for a given number of seconds
//
// version: 901.2514
// discuss at: http://phpjs.org/functions/sleep
// + original by: Christian Doebler
// + bugfixed by: Brett Zamir
// % note: For study purposes. Current implementation could lock up the user's browser.
// % note: Consider using setTimeout() instead.
// * example 1: sleep(1);
// * returns 1: 0
var start = new Date().getTime();
while (new Date() < start + seconds*1000);
return 0;
}