
if (document.addEventListener) 
{  
document.addEventListener("DOMContentLoaded", InitializeTimer, false);
}
function st2new(n)
{
	for(i=1;i<=3;i++)
	{
		tabnm=document.getElementById('headTab'+ i);		
		if (n==i)
		{
			tabnm.className="headbacksel";			
			showdiv('dd'+n);
			
		}
		else
		{			
			tabnm.className="headback";			
			hidediv('dd'+i);
			
		}
		
	}
}


function showdiv(divnm)
{
		document.getElementById(divnm).style["display"]="block" ;
		document.getElementById(divnm).style["visibility"]="visible" ;
		
}


function hidediv(divnm)
{
		document.getElementById(divnm).style["display"]="none" ;
		document.getElementById(divnm).style["visibility"]="hidden" ;		
}



var secs,secs2,secs3
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    secs = 3
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()     
		st2new('2')
		InitializeTimer2()
    }
    else
    {      
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function InitializeTimer2()
{
    secs2 = 3
    StopTheClock2()
    StartTheTimer2()
}

function StopTheClock2()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer2()
{
    if (secs2==0)
    {
        StopTheClock2()   
		st2new('3')
		InitializeTimer3()
    }
    else
    {
        secs2 = secs2 - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer2()", delay)
    }
}


function InitializeTimer3()
{
    secs3 = 3
    StopTheClock3()
    StartTheTimer3()
}

function StopTheClock3()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer3()
{
    if (secs3==0)
    {
        StopTheClock3()   
		st2new('1')
		InitializeTimer4()
    }
    else
    {
        secs3 = secs3 - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer3()", delay)
    }
}

window.onload=InitializeTimer



