// This JavaScript file is used by the login form.

var tryCount = 2;
var tryWord = " tries";

function validate(form)
{
   if (tryCount == 1) {tryWord = " try"}


   if (form.password.value == "farm") // This is where you hard-code the password
   {
      document.cookie = "rainbowaccess=true"
      document.location = "home.html"; // This should be the address of the page you want to load after login.  I have set this to home.html because this will maintain the current behaviour on your site.  Your server may require a forward slash: "/home.html".
   }
   else
   {
      if (tryCount >= 1) 
      {
         alert ("Invalid username and/or password.  You have " + tryCount + tryWord + " left.");
         form.username.value = "";
         form.password.value = "";
         tryCount --;
      }
      else 
      {
         alert ("Still incorrect! You have no more tries left!");
         form.username.value = "No more tries allowed!";
         form.password.value = "";
         form.username.disabled = true;
         form.password.disabled = true;
         return false;
      }
   }
}

