var Retirees = new Group('IBT7xiwU+8Y1FgIR3RYCEd');

DeclareUser('vsFeCL7BXgi//ck5d/3JOT','IBT7xiwU+8Y1FgIR3RYCEd',[Retirees,'RDpQmlBGAB']);
DeclareUser('ieMLWYXjC1mBX/TPTV/0zw','RHRMWEh0TFhQy+f3rMvn94',[Retirees,'xKVuPZBtmC']);
DeclareUser('cvdHjn73R45xq8ZCZavGQi','p2UBh69lAYe/O2Et1zthLc',[Retirees,'u0uoYQ5WBB']);
DeclareUser('QVjoYEFY6GBBkbmF+ZG5hf','iDdKpog3Sqa/sjdn37I3Z0',[Retirees,'PokO/FTdwD']);

// This keeps track of the users to they dont need to log in
// every time the load a new page
var S = new Session('my_session');
S.Callback = s_cb; // function s_cb defined below
// if the user doesn't come back after 48 hours, he'll need to login again:
S.nCookieExpirationDelay = .5;
S.bLocationLogin = true;

// Resource callback. Called before and after a resource gets decrypted
function r_cb(context,lparam)
{
  if(context == this.ccAfterDecrypt)
  {
    if(!lparam)
      document.all['cnt'].innerHTML = "Error!";
    else
      document.all['cnt'].innerHTML = lparam;
  } else if(context == this.ccInvallidMaster)
  {
    document.all['cnt'].innerHTML = "You do not have the right to view this page!";
  }
  return true;
}

// Session callback. Called on login / logout
function s_cb(context,lparam)
{
  switch(context)
  {
    case this.ccLogin:
      document.all['login'].style.display = 'none';
      document.all['logout'].style.display = '';
      document.all['access'].style.display = 'none';
      document.all['username'].value = '';
      document.all['password'].value = '';
      document.all['cnt'].innerHTML = "Loading...";
      document.all['curuser'].innerHTML = this.sUserName;
// Trick: use a setTimeout to decrypt the page content in order to let the browser
// update the page with the changes we made above before beginning decryption
      setTimeout("Content.DecryptResourceS(S)",0);
      break;
    case this.ccLogout:
      document.all['login'].style.display = '';
      document.all['logout'].style.display = 'none';
      document.all['access'].style.display = '';
      default_text();
  }
  return true;
}

function default_text()
{
  document.all['cnt'].innerHTML = "<p align='center'>"+"<font color='#FFFFFF' size='2'>"+"You must be logged in to view this content!"+"</font>"+"</p>";
  document.all['curuser'].innerHTML = "Log In";
}

function login() // called by 'login' button
{
  S.UserLogin(
	document.all['username'].value,
	document.all['password'].value,
	document.all['usecookies'].checked
  );
}

function logout() // called by 'logout' button
{
  S.Logout();
}
