        <!-- Use comment to hide from browsers not supporting JavaScript
        //========================================================================
        //
        //              Simple Simon v0.12
        //
        // Author:      Keith Drakard (kif@irt.org)
        // Date:        13th October 1997 (& 18-06-98 & 11-11-98)
        // Abstract:    A 'Simple Simon'-type game where you attempt to duplicate
        //              the random sequence of colours given by the computer.

        // Preload the images ////////////////////////////////////////////////////

        if (document.images) {
          snowflake0 = new Image(); snowflake0.src = "snowflake.gif";
          snowflake1 = new Image(); snowflake1.src = "snowflake2.gif";
          sled0 = new Image(); sled0.src = "sled.gif";
          sled1 = new Image(); sled1.src = "sled2.gif";
          snowman0 = new Image(); snowman0.src = "snowman.gif";
          snowman1 = new Image(); snowman1.src = "snowman2.gif";
          mittens0 = new Image(); mittens0.src = "mittens.gif";
          mittens1 = new Image(); mittens1.src = "mittens2.gif";
        }

        // Flash one of the quarters /////////////////////////////////////////////

        function flash_quarter(n) {
          // convert number to name of colour:
          if (n==1) colour= "snowflake"; if (n==2) colour= "sled";
          if (n==3) colour= "mittens"; if (n==4) colour= "snowman";

          document.images[colour].src = eval(colour + "1.src");
          setTimeout('document.images[colour].src = eval(colour + "0.src")', 80);
        }

        // The Central Randomizer 1.3 ////////////////////////////////////////////
        // (C)1997 by Paul Houle (houle@msc.cornell.edu)
        // See:  http://www.msc.cornell.edu/~houle/javascript/randomizer.html

        rnd.today=new Date(); rnd.seed=rnd.today.getTime();

        function rnd() {
          rnd.seed = (rnd.seed*9301+49297) % 233280;
          return rnd.seed/(233280.0);
        }

        function rand() {
          return Math.ceil(rnd()*4);
        }

        // Initialize global variables ///////////////////////////////////////////

        var count;                // how much we've completed of the current sequence
        var round_number;         // how long the current sequence is
        var difficulty;           // how long the maximum sequence can be
        var rounds= new Array;    // the total sequence of colours
        var interval= 500;        // the interval between flashes (lower is harder)
        var on;                   // are we playing the game at the moment?

        // Set up the game ///////////////////////////////////////////////////////

        function set_up() {
          count= 0; round_number= 0; on= 0;

          // find out the current difficulty level:
          var index= document.user.level.selectedIndex;
          difficulty= document.user.level.options[index].value;

          // create the sequence:
          for (var i=0; i<difficulty; i++) {
            rounds[i]= rand();
          }
        }

        // Show the sequence //////////////////////////////////////////////////////

        function start_round() {
          if (!document.images) {
            // if browser does not support JavaScript images then say so and end
            alert('Sorry, your browser does not support JavaScript Images');
            return;
          }

          document.user.area.value= ""; count= 0; on= 1;

          // but only up to the current step:
          for (var i=0; i<=round_number; i++) {
            setTimeout("flash_quarter(" + rounds[i] + ")", i*interval);
          }
        }

        // User input /////////////////////////////////////////////////////////////

        function user_play(button) {

          // check that we're playing the game:
          if (on) {

            // show the results of the click:
            flash_quarter(button);

            if (rounds[count]!= button) {
              // uh oh.. wrong colour:
              document.user.area.value= "Sorry, you lose.";
              set_up();
            }

            else if (count==round_number) {
              // right colour *and* we've completed the current sequence:
              round_number++;

              if (round_number==difficulty) {
                // the sequence is at an end so that's all folks:
                document.user.area.value= "You Win!!";
                set_up();
              }

              else {
                // right colour, but the sequence isn't completed yet:
                setTimeout("start_round()", 1000);
              }
            }

            // next step in the sequence:
            count++;
          }

          else {
            // we're not playing yet:
            document.user.area.value= "Click START to play";
            setTimeout("document.user.area.value=''", 400);
          }
        }

        //-->