function checkfield () {

      if (document.form1.login.value.indexOf(' ', 0) != -1) {
         alert ('No spacing is allowed for Login Name');
         return false;
      }
      if (document.form1.password.value.indexOf(' ', 0) != -1) {
         alert ('No spacing is allowed for Password');
         return false;
      }
      if (document.form1.password2.value.indexOf(' ', 0) != -1) {
         alert ('No spacing is allowed for Confirm Password');
         return false;
      }

      mystring = document.form1.login.value;
      if (mystring.length < 5) {
         alert("Please use 5-15 alpha numeric for your Login Name!");
         return false;
      }
      mystring1 = document.form1.password.value;
      if (mystring1.length < 5) {
         alert("Please use 5-15 alpha numeric for your Password!");
         return false;
      }
      mystring2 = document.form1.password2.value;
      if (mystring2.length < 5) {
         alert("Please use 5-15 alpha numeric for your Confirm Password!");
         return false;
      }

}


function redirectPage (url) {

  document.location = url;

}


function alertMsg (field, msg) {

  alert(msg);
  field.focus();
  field.select();

}


function check_special (field, search_type, alert_msg) {

  var r, re
  var s = field.value

  re = new RegExp(search_type,"i")
  if (!re.test(s)) {
     alertMsg(field, alert_msg);
     return false;
  }

  return true;
}


function check_empty (field,alert_msg) {

  if (empty(field.value)) {
     alertMsg(field, alert_msg);
     return false;
  }

  return true;
}


function validatesecurelogin () {

  with (document.form1) {
     if (!check_special(login, "^[\\w]+\\@*$", "Please do not use special characters !")) {
        return false;
     }

     if (!check_empty(login, "The User Id field cannot be blank !")) {
        return false;
     }
  }

  return true;
}


function NewLocation(frm,page,varName) {

  var nGetIndex = frm.selectedIndex;
  var nGetValue = frm.options[nGetIndex].value;

  document.location  = page + '?' + varName + '=' + nGetValue;

}

function checkAll() {

  for (var i=0; i<document.form1.elements.length; i++) {
     var e = document.form1.elements[i];

     if (e.name != 'checkall') {
        e.checked = document.form1.checkall.checked;
     }
  }

}

function highlight (s) {

  if ("INPUT" == event.srcElement.tagName) {
     event.srcElement.className = s;
  }
  
}