var secs; var timerID = null; var timerRunning = false; var delay = 1000; var urlRedirect = null; function InitializeTimerHomePage(url) { // Set the length of the timer, in seconds secs = 3; urlRedirect = url; StopTheClockHomePage(); StartTheTimerHomePage(); } function StopTheClockHomePage() { if (timerRunning) clearTimeout(timerID); timerRunning = false; } function StartTheTimerHomePage() { if (secs == 0) { StopTheClockHomePage(); // Here's where you put something useful that's // supposed to happen after the allotted time. // For example, you could display a message: window.location = urlRedirect; } else { secs = secs - 1; timerRunning = true; timerID = self.setTimeout("StartTheTimerHomePage()", delay); } }