// JavaScript Document

// *** timer function

var secs
var timerID = null
var timerRunning = false
var delay = 1000
var dest;

function myTimer(obj){
	dest = obj;
	InitializeTimer()

}

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 3
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function redirect(URLStr) { location = URLStr; }

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
		
		redirect(dest);
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

