// You may use this script freely as long
    // as you credit me for it...
    var usermulcode=32768        // This is to validate the code. In this case
        // the code is 1234 so the mul =8*8*8*8 = 4096 
        // Change this value for your own code
        // If your code is 2415 it will be
        // usermulcode = 40 (2*4*1*5)
    var code=0   // the entered code
    var mul=1    // the multiplied digits
    var digit=0  // number of digits entered so far
    var fails=0  // number of tries done

    function Enter_code(number)
    {
     
      code=code*10+number         // Add the digit to the code
      mul=mul*number              // Update mul-value
      document.codepad.thecode.value=code  // Show code
      digit++                     // Increase digit
      
      if (digit==5)               // Four digits entered
      {
        if (mul==32768)              // This is to validate
                                  // the code. In this case
                                  // the code is 1234 so the
                                  // mul = 8*8*8*8 = 4096
                                  // Change this value for
                                  // your own code
        {
          location=code+".htm"
        }
        else
        {
          fails++                 // Increase fails
          code=0                  // Reset values
          mul=1
          digit=0
          if (fails<3)            
          {
            if (fails==1)
            {document.codepad.thecode.value="riprova"}
            if (fails==2)
            {document.codepad.thecode.value="ultima volta"}
          }
          else                    // To many tries = worp back 
          {
            location="errore.htm"
            document.codepad.thecode.value="A presto!"
          } 
        }
      }
    }

    function keycodepad(mulcode)
    {
      usermulcode=mulcode
      document.write("<form name=\"codepad\">");
      document.write("<input type=\"button\" value=\" 1 \" onClick=\"Enter_code(1)\">");
      document.write("<input type=\"button\" value=\" 2 \" onClick=\"Enter_code(2)\">");
      document.write("<input type=\"button\" value=\" 3 \" onClick=\"Enter_code(3)\"><br>");
      document.write("<input type=\"button\" value=\" 4 \" onClick=\"Enter_code(4)\">");
      document.write("<input type=\"button\" value=\" 5 \" onClick=\"Enter_code(5)\">");
      document.write("<input type=\"button\" value=\" 6 \" onClick=\"Enter_code(6)\"><br>");
      document.write("<input type=\"button\" value=\" 7 \" onClick=\"Enter_code(7)\">");
      document.write("<input type=\"button\" value=\" 8 \" onClick=\"Enter_code(8)\">");
      document.write("<input type=\"button\" value=\" 9 \" onClick=\"Enter_code(9)\"><br>");
      document.write("<input type=\"text\" name=\"thecode\" size=10 value=\"\"><br>");
      document.write("</form>");
    }
  // Key-code script by Bart Jellema -->

//-->

