
function check_fields () {
  if (document.authenticate.WebCT_ID.value == "") {
    alert("Please enter a User ID.");
    return;
  }
  if (document.authenticate.Password.value == "") {
    alert("Please enter a Password.");
    return;
  }
  if (document.authenticate.WebCT_ID.value.match(/^\d+$/) || document.authenticate.WebCT_ID.value.match(/^\d\d\d-\d\d-\d\d\d\d$/)) {
    alert("Please use your UDelNet ID -- not your User Number or SSN.  You can set or check your UDelNet ID at http://www.udel.edu/network");
    return;
  }
  if (document.authenticate.WebCT_ID.value.match(/@/)) {
     alert("Please use your UDelNet ID, not an email address.  \n\nYour UDelNet ID is the same as your central University of Delaware email address WITHOUT the @udel.edu.  For instance, if your udel email address were foobar@udel.edu your UDelNet ID would be foobar.\n\nYou can set or check your UDelNet ID at http://www.udel.edu/network");
     return;
  }
  document.authenticate.submit();
}

function check_enter_key(event, submit_form)
{
  // submit the given form if an enter key was pressed.
  var keycode = 0;
  if (event.which)
  {
   // if NS.
    keycode = event.which;
  }
  else if (typeof(window.event) != "undefined")
  {
    // if IE.
    keycode = window.event.keyCode;
  }
  // If enter key is pressed submit form.
  if (keycode == 13)
  {
    submit_form.submitbutton.click();
  }
  return true;
}

function getCookieVal (offset) {
  var cookie_data = document.cookie;
  var endstr = cookie_data.indexOf (";", offset);
  if (endstr == -1)
    endstr = cookie_data.length;
  return unescape(cookie_data.substring(offset, endstr));
};

//
// GetCookie, GetValue and DeleteCookie taken from the following:
//
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
///
function GetCookie (name) {
var cookie_data = document.cookie;
var arg = name + "=";
var alen = arg.length;
var clen = cookie_data.length;
var i = 0;
while (i < clen) {
  var j = i + alen;
  if (cookie_data.substring(i, j) == arg)
    return getCookieVal (j);
  i = cookie_data.indexOf(" ", i) + 1;
  if (i == 0) break; 
}
return null;
}
function GetValue (name, query_string) {
if (name && query_string) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = query_string.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (query_string.substring(i, j) == arg) {
      var endlen = query_string.indexOf("&", j);
      if (endlen == -1)
        endlen = query_string.length;
      return query_string.substring(j, endlen);
    }
    i = query_string.indexOf("&", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
return;
}

function DeleteCookie (name,path,domain) {
if (GetCookie(name)) {
  document.cookie = name + "=" +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "");
//   +
//  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
