﻿var timeCounter;
var timerID;
var ifr;
var time=300;
function SaveSession()
{	
    AddIframe();
    //AddTextfield();	
    SessionTimer();
}

function SessionTimer() 
{ 
	timeCounter=TimeCounter()+1;
	if (document.getElementById("timerDebug")!=null)
	{
	    document.getElementById("timerDebug").value=timeCounter;
	}
	if ((time) <= timeCounter && document.getElementById("ifrSessionRefresh") != null)
    {
	    document.getElementById("ifrSessionRefresh").src = path + "ResetSession.aspx";
	    timeCounter = 0;
	    timerID = setTimeout("SessionTimer()", 1000);
	}
	else
	    timerID = setTimeout("SessionTimer()", 1000);
}
function AddIframe()
{
    ifr = document.createElement('IFRAME');
    ifr.id="ifrSessionRefresh";
    ifr.width="100px";
    ifr.height="100px";
    ifr.style.display="none";
    document.body.appendChild(ifr);	

}
function AddTextfield()
{
	txt = document.createElement('input');
	txt.type="text";
	txt.id="timerDebug";
	txt.name="timerDebug";
	document.body.appendChild(txt);	

}
   
function TimeCounter()
{   
    if (isNaN(timeCounter))
        {timeCounter=0;}
    return timeCounter;
}