var interval = "";
var th = 0;
var tm = 0;
var ts = 0;

function startInterval(a,b,c,e)
{
//	stopInterval()
	th=0;
	tm=0;
	ts=0;
	th=a;
	tm=b;
	ts=c;
		interval = window.setInterval("STimer('"+e+"')",1000);
}
function stopInterval()
{
	window.clearInterval (interval);
	interval="";
}

function STimer(e)
{
	if (th <= 0 && tm <= 0 && ts <= 0)
	{
		stopInterval();
		document.getElementById('disptime').value = 0;
	window.close();
	}
	else
	{
		if (ts == 0)
		{
			ts=59;
			tm--;
		}
		if(tm<0)
		{
			tm=59;
			th--
		}
		ts--;
		document.getElementById('disptime').value = th*60+tm;
			}
}

