function clickIE4(){if (event.button==2){return false;}}
function clickNS4(e){if (document.layers||document.getElementById&&!document.all){if (e.which==2||e.which==3){return false;}}}
function noRC(){if (document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;}else if (document.all&&!document.getElementById){document.onmousedown=clickIE4;}document.oncontextmenu=new Function("return false");}
function enableButtons(mb)
{if(typeof(Page_IsValid)!="undefined")
{	if(Page_IsValid)
	{if(mb != null)
{	mb.disabled=false;
	return true;}
	}
	else
	{return false;
	}}
else
{	if(mb != null)
	{mb.disabled=false;
return true;
	}}
}
function disableButtons(mb)
{if(typeof(Page_IsValid) !="undefined")
{	if(Page_IsValid)
	{if(mb != null)
{	mb.disabled=true;
	return true;}
	}
	else
	{return false;
	}}
else
{	if(mb != null)
	{mb.disabled=true;
return true;
	}}
}
function enableButtonsArray(mbs)
{if(typeof(Page_IsValid)!="undefined")
{	if(Page_IsValid)
	{for( i =0; i<mbs.length;i++)
{	if(mbs[i] != null)
	{mbs[i].disabled=false;
	}}
	}
	else
	{return false;
	}}
else
{	for( i =0; i<mbs.length;i++)
	{if(mbs[i] != null)
{	mbs[i].disabled=false;}
	}}
}
function disableButtonsArray(mbs)
{if(typeof(Page_IsValid)!="undefined")
{	if(Page_IsValid)
	{for(i =0; i<mbs.length;i++)
{	if(mbs[i] != null)
	{mbs[i].disabled=true;
	}}
}
else
{return false;
}}
else
{for( i =0; i<mbs.length;i++)
{if(mbs[i] != null)
{mbs[i].disabled=true;}
}}}
var dStartTime;
var tStartMils;
var bFirstPass;
var tTimeOutMils;
var tThresholdMils;
var wWarnWindow;
var idSessionTimeout = 0;
function initSessionTimeout()
{
	dStartTime = new Date();
	tStartMils = Date.parse(dStartTime.toLocaleString());
	bFirstPass = true;
	tTimeOutMils = tStartMils + (60000 * tTimeoutMinutes);
	tThresholdMils = (60000 * tWarningThresholdMinutes);
	if( idSessionTimeout == 0 )
		idSessionTimeout = setInterval('monitorSessionTimeout()', 10000);
}
function monitorSessionTimeout()
{
	var dCurrentTime = new Date();
	var tCurrentMils = Date.parse(dCurrentTime.toLocaleString());
	var tRemainingMils = tTimeOutMils - tCurrentMils;
	if((tRemainingMils < tThresholdMils) && (bFirstPass==true))
	{
		wWarnWindow =window.open(sOpenURL, "warning","toolbar=no,status=no,menubar=no,scrollbars=no,resize=no,width=380,height=225");
		if (!wWarnWindow)
		{
			var confirmed = window.confirm('Your session will timeout in ' + tWarningThresholdMinutes + ' minutes. Press OK to continue your session or Cancel to log out.\nIf you do not respond to this message within that time, you will be automatically logged out when you respond to this message.');
			if( confirmed )
				initSessionTimeout();
			else
				document.location.href=sLogoutURL;			
		}
		bFirstPass=false;
	}
	else
	{
		if((tRemainingMils<=0) && (bFirstPass==false))
		{
			if((wWarnWindow) && (!wWarnWindow.closed))
				wWarnWindow.close();
			document.location.href=sLogoutURL;
		}
	}
}
function af(event) {if (event.srcElement && event.srcElement.accessKey && event.altKey) event.srcElement.click();}
