
var objUpdateInterval = null;
function onUpdateResponse(resultObject, responseXML)
{
	if (resultObject.ErrorCode == undefined)	// do Logout if the session doesn’t exist
	{
		NgbLogin.Logout();
	}
	else if (resultObject.ErrorCode == CommonError.NoError)		// OK
	{
		window.clearInterval(objUpdateInterval);
// After ExpireLimit(Second), do UpdateSession
		objUpdateInterval = setInterval("doUpdateSession()", resultObject.UpdateInterval * 1000);	
}
	else if (resultObject.ErrorCode == AuthSystemError.Disconnected)
	{
// Replace the following line to a custom code
		alert("Disconnected by other session.");
		NgbLogin.Logout();
	}
	else
	{
// Replace the following line to a custom code
		alert("Disconnected.");
		NgbLogin.Logout();
	}
}
function doUpdateSession()
{
	AuthSystem.UpdateSession(onUpdateResponse);
}
function startUpdateSession()
{
	setTimeout("doUpdateSession()", 1);
}
startUpdateSession();