﻿// SessionTimeout.js


// Function gives warning when session time is about to expire.  For Section 508.
 
function setbasetime(systemtime)
{
	var basetime = systemtime - 0;
	
	if (basetime < 5)
	{
		var modifiedtime = basetime * 60000 - 60000;
		setTimeout(step1a(),modifiedtime);
	}
	else
	{
		var modifiedtime = basetime * 60000 - 180000;
		setTimeout(step1b(),modifiedtime);
	}	
}

function step1a() 
{
      return "step2a()";
}

function step1b() 
{
      return "step2b()";
}

function step2a() 
{
	var now = new Date();

    if (confirm("It is now:"+now+".  Your session will end in one minute.  Do you need more time?"))
		{
			
			document.forms[0].action = document.forms[0].action+"?timeout=return";
			document.forms[0].submit();
			return;
		}

}

function step2b() 
{
	var now = new Date();

    if (confirm("It is now:"+now+".  Your session will end in three minutes.  Do you need more time?"))
		{
			
			document.forms[0].action = document.forms[0].action+"?timeout=return";
			document.forms[0].submit();
			return;
		}

}

        function CallPrint(strid)
        {
       
         var prtContent = document.getElementById(strid);
         
         
       //  prtContent.style.display=''; 
      
         if (prtContent.innerHTML != "")
         {                         
            var WinPrint = window.open(null,null,'width=1,height=1,toolbar=no,scrollbars=no,status=yes,location=no');
             
           //  var errWnd = null;
                         //errWnd = window.open('blank.html', 'errWnd', 'height=400,width=500,alwaysRaised=yes,resizable=yes,scrollbars=yes');
             
           //  errWnd = window.open(''+self.location,'mywin','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
                       //  window.open("blank.html");
                        // WinPrint = window.open("blank.html",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
                         
          //  var d = errWnd.document;
          //  d.open("text/html");

                            // WinPrint = window.open("","Print","height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
          // prtContent.innerHTML='sdsd';
                              if (WinPrint != null)
                             {
                                 WinPrint.document.write(prtContent.innerHTML);
                                 WinPrint.document.close();
                              // WinPrint.focus();
                                 WinPrint.print();
                                 WinPrint.close();
                                 
                               prtContent.style.display='none';  
                            //   document.write('The parent window is: '+window.opener.location); 
                            
                             //  window.opener.focus();                           
                                               
                               };
             
             
        };  
         
        }
   