// Support functions

// FUNCTION: newWindow
//   Setup and open popup Window
var agreeWindow;
function newWindow(fname) {
    agreeWindow = window.open(fname, 'assistWin', 'width=630,height=430,status=yes,resizable=yes,scrollbars=yes');
}

// FUNCTION: editAssist
//   Display online help
function editAssist(anchorName) {
    if (anchorName=='')
    {
      newWindow('/editAssist.html');
    }
    else
    {
      // This isn't working right now...
      // newWindow('/editAssist.html#'+anchorName);
      newWindow('/editAssist.html');
    }
    agreeWindow.focus();
}

// FUNCTION: hideButtons
//   Hides buttons after form submit
var submitted = false;
function hideButtons(theform)
{
  if (submitted)
  {
    return false;
  }
  else
  {
    if (document.all || document.getElementById)
    {
      for (i = 0; i < theform.length; i++)
      {
        var tempobj = theform.elements[i];
        if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
        {
          tempobj.style.visibility = 'hidden';
        }
        if (tempobj.value == "Please Wait ...")
        {
          tempobj.style.visibility = 'visible';
        }
      }
    }
    submitted = true;
    return true;
  }
}

// FUNCTION: enablePasswordFields
//   Enable/disable Change Password fields
function enablePasswordFields(enableFlag) {
  if (enableFlag == "yes")
  {
    document.userPreferences.CurrentPassword.disabled = false;
    document.userPreferences.NewPassword.disabled = false;
    document.userPreferences.VerifyPassword.disabled = false;
    document.userPreferences.CurrentPassword.focus();
  }
  else
  {
    document.userPreferences.CurrentPassword.disabled = true;
    document.userPreferences.NewPassword.disabled = true;
    document.userPreferences.VerifyPassword.disabled = true;
  }
  if (document.userPreferences.ChallengeID1.value != "0")
  {
    document.userPreferences.OtherQuestion1.style.visibility = 'hidden';
  }
  if (document.userPreferences.ChallengeID2.value != "0")
  {
    document.userPreferences.OtherQuestion2.style.visibility = 'hidden';
  }
  return 1;
}


// FUNCTION: setChallengeVisble
//   Enable/disable "other" Challenge question fields
function setChallengeVisble(fieldNum, fieldValue) {
  if (fieldValue=="0")
  {
    if (fieldNum=="2")
    {
      document.userPreferences.OtherQuestion2.style.visibility = 'visible';
      document.userPreferences.OtherQuestion2.focus();
    }
    else
    {
      document.userPreferences.OtherQuestion1.style.visibility = 'visible';
      document.userPreferences.OtherQuestion1.focus();
    }
  }
  else
  {
    if (fieldNum=="2")
    {
      document.userPreferences.OtherQuestion2.style.visibility = 'hidden';
      document.userPreferences.ChallengeAnswer2.focus();
    }
    else
    {
      document.userPreferences.OtherQuestion1.style.visibility = 'hidden';
      document.userPreferences.ChallengeAnswer1.focus();
    }
  }
  return 1;
}

// e m a i l FUNCTIONS
function aclick(e) { document.location = g0() + e; }
function statview(e) { self.status = 'Click to send e-mail to: ' + e; return true; }
function statclear() { self.status = ''; return true; }
function p1(e) { return '\x40' + e + '.' + '\x63' + '\x6f' + '\x6d'; }
function p2(e) { return '\x40' + e + '.' + '\x6e' + '\x65' + '\x74'; }
function p3(e) { return '\x40' + e + '.' + '\x6f' + '\x72' + '\x67'; }
function p4(e) { return '\x40' + e + '.' + '\x65' + '\x64' + '\x75'; }
function p5(e) { return '\x40' + e + '.' + '\x75' + '\x73'; }
function p6(e) { return '\x40' + e + '.' + '\x63' + '\x61'; }
function g0() {
  var m1 = '\x6d';  var m2 = '\x3a';
  return m1 + '\x61\x69\x6c\x74\x6f' + m2;
}
function webmaster() { var c1 = 'info'; return c1 + p1('versity'); }
function info() { var c1 = 'info'; return c1 + p1('versity'); }
function lampson() { var c1 = 'lampson'; return c1 + p1('versity'); }


