var secs
var timerID = null
var timerRunning = false
var delay = 500

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 5
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    var col
    timerRunning = true
    timerID = self.setTimeout("StartTheTimer()", delay)
    
    if (secs==0)
    {
    	col = "#FF0000"
    	secs=1
    }
    else
    {
    	col = "#000000"
    	secs=0
    }
    
    
    var theObjects = document.getElementsByTagName("span");
		for (var i = 0; i < theObjects.length; i++) 
		{
      if (theObjects[i].id == "error")
        {theObjects[i].style.color = col;}
    }
    //document.getElementById("error").style.color = col;
    
    /*var theObjects=document.getElementsByTagName("span");

    for (var i = 0; i < document.elements.length; i++)
    {
      if (form.elements[i].id == "error")
      {
        form.elements[i].style.color = col;
      }
    }*/
  

    
    //self.status = col
    //self.status = "Objects found "+i;
    /*if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        alert("You have just wasted 10 seconds of your life.")
        secs = 5
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }*/
}