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


function InitializeTimer(){
        // Set the length of the timer, in seconds        
        secs = 0;
        StopTheClock()
        StartTheTimer()
}			
function StopTheClock(){
        if(timerRunning)
                clearTimeout(timerID)
        timerRunning = false
}			
function StartTheTimer(){
        if (secs<=0){
                StopTheClock();
                jQuery('.clsStockPriceInfo').html('<img valign="absmiddle" src="images/stockUpdate.gif"/>Updating...<br/>');                
                jQuery('.clsStockPriceInfo').load('getQuote.php', function() {                        
                        secs=720;
                        self.status = secs
                        secs = secs - 1
                        timerRunning = true
                        timerID = self.setTimeout("StartTheTimer()", delay)					  
                });					
        }
        else{
                self.status = secs
                secs = secs - 1
                timerRunning = true
                timerID = self.setTimeout("StartTheTimer()", delay)
        }
}


