
var secs, index
var timerID = null
var timerRunning = false
var delay = 1000


function InitializeTimer()
{
    // Set the length of the timer, in seconds
	index = 0
    document.getElementById("thequote").innerHTML = quotes[index]
	document.getElementById("quoteby").innerHTML = by[index]
    secs = 0
    StopTheClock()
    StartTheTimer()
	
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==15)
    {
	    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 5 seconds of your life.")
		index = index + 1
		if(index >= total) {
			index = 0
		}
		document.getElementById("thequote").innerHTML = quotes[index]
		document.getElementById("quoteby").innerHTML = by[index]
    	StartTheTimer()
    }
    else
    {
        //document.getElementById("countdown").innerHTML = minutes+":"+seconds
        secs = secs + 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}
