
	// Saves a cookie on the users computers containing their email address and password that expires in one months time.
    function saveCookie()
    {
      if (document.forms.loginForm.rememberMe.checked)
      {
        createCookie('kingsRotaEmail', document.forms.loginForm.email.value, 31);
        createCookie('kingsRotaPassword', document.forms.loginForm.password.value, 31);
      }
      return true;
    }

	// Called to check whether they have a cookie set containing their username and password. If they do,
	// and loginNow is set to true then we log them in!
    function checkCookie(loginNow)
    {
      var userName = readCookie('kingsRotaEmail');
      var password = readCookie('kingsRotaPassword');
      if (userName != null && password != null)
      {
        document.forms.loginForm.email.value = userName;
        document.forms.loginForm.password.value = password;
        if (loginNow)
        {
          document.forms.loginForm.rememberMe.checked = true;
          document.forms.loginForm.submit();
        }
      }
    }

	// Erases any cookies set by this site.
    function clearCookies()
    {
      eraseCookie('kingsRotaEmail');
      eraseCookie('kingsRotaPassword');
    }

