
var wtTimeElapsed = 0;
var wtWaitInterval;

function wtDisplayWait()
{
	var waitBlock = document.getElementById("waitBlock");
	if (waitBlock != null)
		waitBlock.style.display = "block";
}

function wtOnLoad(url, delay)
{
	var loc = window.location + '';
	var obj = false;
	if (document.getElementById("div-spl"))
	{
		obj = document.getElementById("div-spl");
	}
	if (loc.indexOf('?') > -1)
	{
		var param = loc.split('?')[2];
	//	if (delay==1001)
	//		obj.style.background = "";
		window.location.replace(url);
	//	if (delay==1001)
	//		obj.style.background = "url(image/circles-.gif)";
	}
	else
	{
	//	if (obj)
	//		obj.style.background = "";
		window.location.replace(url);
	//	if (delay==1001)
	//		obj.style.background = "url(image/circles-.gif)";
	}
	if (delay == 0)
		wtDisplayWait();
	else
		wtWaitInterval = window.setInterval("wtWaitStarted()", delay);
	window.setInterval("wtSecondElapsed()", 1000);
}

function wtWaitStarted()
{
	wtDisplayWait();
	window.clearInterval(wtWaitInterval);
}

function wtFormatTime(number)
{
	var result;
	if (number < 10) result = "0" + number; else result =  "" + number;
	return (result.substring(0, 2));
}

function wtSecondElapsed()
{
	wtTimeElapsed++;
	var loadTimer = document.getElementById("loadTimer");
	if (loadTimer != null)
		if (wtTimeElapsed >= 0)
		{
			var minutesElapsed = (wtTimeElapsed - wtTimeElapsed % 60) / 60;
			var secondsElapsed = wtTimeElapsed % 60;

			loadTimer.innerHTML = /*String.fromCharCode(0x041f, 0x0440, 0x043e, 0x0448, 0x043b,
				0x043e, 0x20, 0x0432, 0x0440, 0x0435, 0x043c, 0x0435, 0x043d, 0x0438) +*/
				": <B>" + wtFormatTime(minutesElapsed) + ":" + wtFormatTime(secondsElapsed) + "</B>";
		};
}