

var sessionTimeout =20; //length of time until logged out (minutes)
var warningTime = 1; //length of time popup stays up for (minutes)
//popup opens sessionTimeout minus warningTime minutes after the page is opened
var thisTimer = null; //stop/start session timer
var thisWarningTimer = null; //stop/start warning timer

function startTimeoutTimer()
{
    thisTimer = setTimeout("closeSession()", sessionTimeout * 60000);
    thisWarningTimer = setTimeout("popupAsk()", (sessionTimeout - warningTime) * 60000);
}

function refreshSession()
{
    //ping server in iframe to restart session
//    refreshMe.document.location.href = "http://localhost/VTest/test1.aspx";
//	var w;
//	window.open('http://localhost/VTest/Test1.aspx','Window', 'width=440, height=250, toolbar=yes, scrollbars=yes, resizable=yes');
	
    //restart timers
    clearTimeout(thisTimer);
    clearTimeout(thisWarningTimer);
    startTimeoutTimer();
}

function closeSession()
{
    //redirect to login page with logged out message
    document.location.href="logout.aspx";
}

function popupAsk()
{
    //open popup window
    window.open('Popup.aspx','Window', 'width=450, height=125, location=no, toolbar=no, scrollbars=no, resizable=no');
}
