var ver=navigator.appVersion;
var dom=document.getElementById?1:0;
var iedom=(ver.indexOf("MSIE")>-1 && dom)?1:0;

var loginMachines = new Array(10);
loginMachines[0] = "http://www0.rtsports.com/php/fantasy-football.php";
loginMachines[1] = "http://www1.rtsports.com/php/fantasy-football.php";
loginMachines[2] = "http://www2.rtsports.com/php/fantasy-football.php";
loginMachines[3] = "http://www3.rtsports.com/php/fantasy-football.php";
loginMachines[9] = "http://www4.rtsports.com/php/fantasy-football.php";
loginMachines[4] = "http://www5.rtsports.com/php/fantasy-football.php";
loginMachines[5] = "http://www6.rtsports.com/php/fantasy-football.php";
loginMachines[6] = "http://www7.rtsports.com/php/fantasy-football.php";
loginMachines[7] = "http://www8.rtsports.com/php/fantasy-football.php";
loginMachines[8] = "http://www9.rtsports.com/php/fantasy-football.php";

function checkEntryButton(e) {
  // Submit the login form when Entry button is pressed
  var code = 0; 
  if (document.login_form) {
     if (iedom) 
        code = window.event.keyCode;
     else if (dom)
        code = e.keyCode;
     if (code == 13) loginFormSubmit();
  }
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function loginFormSubmit() {
  //Check the AccountID and Password for values
  if (trim(document.login_form.AccountID.value).length == 0)
  {
	alert ("You must enter an Account ID.  Please try again.");
	document.login_form.AccountID.select();
  	return;
  }
  if (trim(document.login_form.Password.value).length == 0)
  {
	alert ("You must enter a password.  Please try again.");
	document.login_form.Password.select();
  	return;
  }
  var index = Math.floor(Math.random() * loginMachines.length);
  document.login_form.action = loginMachines[index];
//  document.login_form.action = "http://ht.rtsports.com/php/fantasy-football.php";
//  if (iedom) {
//    try {
//      window.external.AutoCompleteSaveForm(login_form);
//    }
//    catch (err) {
//    }
//  }
  document.login_form.submit();
} 		