// ---------------------------------------------------------------------------­-- 
// The following bit of code runs on every page, and alters ASP's session cookie 
// so that it saves to disk instead of just in memory.  That way, if we open a 
// new browser window during the lifetime of the session, it will return to the 
// original session, instead of creating a new one.  It expires at the same time 
// that the server session expires. 
// 
// Author:  Matt Johnson (MCP) Cunningham Consulting - mjohn...@ctg-inc.net 
// Public and private re-use/distribution granted. 
// 


// Since we can't get Session.Timeout from this environment, we'll just hard- 
// code it.  Just make sure that if we change it, we update it here. 
var timeout = 20; 


// This function gives us the current session cookie 
function getSessionCookie() { 
   var search = "ASPSESSIONID"; 
   if (document.cookie.length > 0) { 
      offset = document.cookie.indexOf(search); 
      if (offset != -1) { 
         end = document.cookie.indexOf(";", offset); 
         if (end == -1) 
            end = document.cookie.length; 
         return unescape(document.cookie.substring(offset, end)); 
       } 
   } 



} 


// Now persist the session 
var today = new Date(); 
var expire = new Date(); 
expire.setTime(today.getTime() + 1000*60*timeout); 
document.cookie = getSessionCookie() + "; expires=" + expire.toGMTString(); 

// ---------------------------------------------------------------------------­-- 

