function cookie_update (cookie) {
  // test if cookie of this name is recorded
  if (cookie.load()) {
   if (cookie.remember=="yes" && cookie.lastpage != this.location) {
     cookie.lastpage = this.location;
     cookie.store();
   }
  } 
}

function cookie_start (cookie) {
  // test if cookie of this name is recorded
  if (!cookie.load()) {
    if (confirm(cookie_question)) {
      cookie_yes(cookie);
    } else {
      cookie.remember="no";
    }
    cookie.store();
  }
}

function cookie_yes (cookie) {
  cookie.remember="yes";
  cookie.lastpage = this.location;
  cookie.email=prompt(email_question, "");
}


function click_email (cookie) {
  if (cookie.load() && cookie.email) {
    if (confirm(forget_question)) {
      cookie.remove();
      location.reload();      
    }
  } else {
    if (confirm(remember_question)) {
      cookie_yes(cookie);
      if (cookie.email.length > 5) {
	cookie.store();
	location.reload();
      }
    }
  }
}


function update_lastpage(cookie) {

  if (cookie.load()) {
    if (cookie.remember=="yes") {
      cookie.lastpage = this.location;
    }
  }
  return true;
}

function goto_lastpage(cookie) {
  if (msgcal.lastpage!=this.location) {
    location=msgcal.lastpage;
  }

}

