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
	if (!document.getElementById('iVJX_wait')) { return; }
	iVJX_secs = document.getElementById('iVJX_wait').value;
	
	self.setTimeout("iVJX_StartTheTimer()", iVJX_delay);
}

function iVJX_StartTheTimer()
{
	try {
		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);
	}
	catch (e) {
		// iVJX_wait not found?? Probably imgViewJX content include not available on this page
	}
}

window.onload = iVJX_InitializeTimer;
