<!--

  /**
   *
   *  Original Author: GoblinWarren (c) 2002
   *  Permissions:  You are free to use/modify this code as long
   *  as you leave the this comment block include this comment
   *  block unmodified.  Enjoy!
   *
   */

  var myTotal = 0;
  var expiresIn = 999;

  function initialize () {
    for (i = 0; i < cardTotal; i++) { cardList [i] = "0"; }
    var data = getCookie (cookieName);
    if (data != null) {
      for (i = 0; i < cardTotal; i++) {
        var c = data.charAt (i);
        if (c == "1") {
          cardList [i] = c;
          var box = eval("document." + cardPrefix + ".c" + (i + firstCard));
          box.checked = true;
          isCompleteSet ();
        }
      }
    }
  }

  function isCompleteSet () {
    myTotal++;
    if (myTotal == cardTotal) {
      alert (allCardsMsg);
    }
  }

  function getCookie (name) {
    if (document.cookie.length > 0) {
      begin = document.cookie.indexOf (name + "=");
      if (begin != -1) {
        begin += name.length + 1;
        end = document.cookie.indexOf (";", begin);
        if (end == -1) end = document.cookie.length;
          return unescape (document.cookie.substring (begin, end));
      }
    } else {
      return null;
    }
  }

  function createCookie (name, value, expiredays) {
    var ExpireDate = new Date ();
    ExpireDate.setTime (ExpireDate.getTime() + expiredays * 24 * 3600000);
    document.cookie = name + "=" + escape (value) + "; expires=" + ExpireDate.toGMTString();
  }

  function editList (name) {
    var box = eval("document." + cardPrefix + "." + name);
    if (box.checked == true) {
      isCompleteSet ();
      cardList [name.substring (1, name.length) - firstCard] = "1";
    } else {
      myTotal--;
      cardList [name.substring (1, name.length) - firstCard] = "0";
    }
    writeCookie ();
  }

  function writeCookie () {
    var dataString = "";
    for (i = 0; i < cardTotal; i++) {
      dataString += cardList [i];
    }
    createCookie (cookieName, dataString, expiresIn);
  }

  function rightClick (e) {
    if ((navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) ||
        (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))) {
      alert ("You have " + myTotal + "/" + cardTotal + " cards.");
      return false;
    }
    return true;
  }
  document.onmousedown = rightClick;
  document.onmouseup = rightClick;
  if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  if (document.layers) window.captureEvents(Event.MOUSEUP);
  window.onmousedown = rightClick;
  window.onmouseup = rightClick;
//-->
