//    This goes in the header of each game.
//    
//    function closeRemote() {
//        timer = setTimeout('window.close();', 10);
//    }
   // 
   //  
   // These methods support the concept of reqarding the user for good performance.
   //
   //

    function game(x) {
                                                     //
                                                     // x will specify the game length option information.
						     //   the input x value will be mapped to a number from 0 to 2.
						     //
        var the_game = new Array("tetris.htm","tetris.htm", "tetris.htm", "battle ship.htm","battle ship.htm", "battle ship.htm", "same game.html", "same game.html", "same game.html") ;
	var path     = "C:\\Documents and Settings\\Dave Rhodes\\My Documents\\WebMaker\\School\\Math Department\\Games\\" ;
	var adj  = 2.99 ;  // the_game.length ;
	
        selector = Math.floor(adj * Math.random()) + x ; // randomly choose the game, x chooses the duration of game.

        self.name = "main"; // names current window as "main"
        var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
            "menubar=0,scrollbars=0,resizable=1,width=400,height=500";

        OpenWindow = window.open(path+the_game[x], "_blank", windowprops); // open the game 
        OpenWindow.focus();
    }
  
    function reward() {
        //
        // This routine checks to see if more than 19 problems are correct and the percent
        // correct is at least 85%.    If we met the criteria, the system will reward the
        // user with various minutes of game playing.  85% == 2 minutes, 90% == 3 minutes and
        // 95% == 4 minutes.
        //
   
        if ((document.math.correct.value%19) == 0) {
                                                         // if we have done 19 problems
            if (document.math.percent.value > 84) {
                game(document.math.percent.value) ;
            }
        }
    }
 

