<!--
var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;
var whichOne = 1;


function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 5;
    StopTheClock();
    StartTheTimer();
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheTimer()
{
    if (secs==0)
    {	   
        StopTheClock();
        swapTab(this,panels[whichOne],tabTitle[whichOne]);
        whichOne++;
        if (whichOne < panels.length) ;//alert('passed') ;
        else whichOne = 0;
        InitializeTimer();
    }
    else
    {
        //self.status = secs; //displays seconds remaining in status bar
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}

function switchPausePlay()
{
    //alert(document.getElementById("pausePlayLink").alt);
    
    var pausePlayButton = document.getElementById("pausePlayLink");
    
    if (pausePlayButton.alt == 'Pause') {
	   StopTheClock();	   
	   //alert("switching to Play button");
	   pausePlayButton.src = '/media/1pix.gif';
	   pausePlayButton.alt = 'Play';
    }
    else if (pausePlayButton.alt == 'Play') {
	   StartTheTimer();
	   //alert("switching to Pause button");
	   pausePlayButton.src = '/media/1pix.gif';
	   pausePlayButton.alt = 'Pause';
    }
}

function clickNumber(thisNumber)
{
    StopTheClock();
    //alert(thisNumber + "," + panels.length);
    if (thisNumber < panels.length) whichOne = thisNumber;
    else whichOne = 1;
    secs = 0;
    //alert(whichOne);   
    var pausePlayButton = document.getElementById("pausePlayLink");
    if (pausePlayButton.alt == 'Pause') {
	   pausePlayButton.src = '/media/1pix.gif';
	   pausePlayButton.alt = 'Play';
    }
}

//-->

function swapTab(tab,name,title) 
 {
	selectedTab = tab; // swaps selected Pic
	for (i = 0; i < panels.length; i++) {document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';}

	selectedTitle = title; // Swaps Title
	for (i = 0; i < tabTitle.length; i++) {document.getElementById(tabTitle[i]).style.display = (title == tabTitle[i]) ? 'block':'none';}		 

	//return false;
 }

window.onload = InitializeTimer;
//window.onload = StartTheTimer;