var iVJX_secs;
var iVJX_timerID = null;
var iVJX_timerRunning = false;
var iVJX_delay = 1000;

function iVJX_InitializeTimer()
{
    // Set the length of the timer, in seconds
    iVJX_secs = 1;
	// don't play if wait is 0 or less
	//if (document.getElementById('iVJX_wait').value != '0') {
		iVJX_StartTheTimer();
	//}
}

function iVJX_StartTheTimer()
{
    if (iVJX_secs == 0)
    {
	    iVJX_secs = document.getElementById('iVJX_wait').value;
        xajax_iVJX_newImage(document.getElementById('iVJX_currentImageID').value);
    }
    iVJX_secs = iVJX_secs - 1;
    iVJX_timerRunning = true;
    iVJX_timerID = self.setTimeout("iVJX_StartTheTimer()", iVJX_delay);
}

iVJX_InitializeTimer();