function LoginTo ( address, eptime ) {
//
// We are being asked to log into the given page. Tack on the last login time to the end of the url.
//
   var target = address + "?set_session_variable=LASTLOGIN=" + GetLastLogin ( eptime );
   SetLastLogin ( eptime );
   window.location = target;
   }


function SetLastLogin ( eptime ) {
//
// Save the last login time given in the argument (in epoch seconds) in a cookie.
//
   var  expires = ( new Date ( ( eptime + 365 * 24 * 3600 ) * 1000 ) ) . toGMTString ( );

   document.cookie = "LASTLOGIN=" + eptime + "; path=/cgi-bin/bin/; expires=" + expires + ";";
   }


function GetLastLogin ( eptime ) {
//
// Get the last login time from a cookie.
// If we have never logged in before, use 30 days ago.
//
   var  allCookies = document.cookie.split ( ";" );

   for ( i = 0; i < allCookies.length; ++i ) {
      nameValue = allCookies[i].split ( "=" );
      if ( nameValue[0] == "LASTLOGIN" || nameValue[0] == " LASTLOGIN" ) {
         return ( nameValue[1] );
         }
      }

   return ( eptime - 30 * 24 * 60 * 60 );
   }