var resultstr = "";

function checklogin(ip) {

	 // alert( "ip address is " + ip );

	 // Check if ip address is permitted
	 if (ip.search(/192\.168\.[3-5]\./) != -1 ||				// Internal MS vpn and workstations
	 	  ip.search(/172\.30\.1\./) != -1 ||					// Internal Cisco vpn
	 	  ip.search(/70\.61\.250\.1[3,5]0/) != -1 ||			// External vpn
	 	  ip.search(/10\.100\./) != -1 ||				// Hardware clients
	 	  ip.search(/24\.248\.24\./) != -1 ||				// Riverside temporary access
	 	  ip == "159.140.254.10" ||					// Joan with new laptop
  		  ip.search(/67\.142\.130\./) != -1 ) {					// Kevin					

		  // Verify that username and password were entered
		  if (document.frm_login.txt_name.value == "") {
			  alert ("The user name is blank!");
			  document.frm_login.txt_name.focus();
			  return false;
		  } else if (document.frm_login.txt_password.value == "") {
			  alert ("The password is blank!");
			  document.frm_login.txt_password.focus();
			  return false;
		  } else {
			  return true;
		  }

    } else {

    	  // Invalid ip address
    	  alert ("Access from your IP address (" + ip + ") is not permitted!" );
    	  return false;

    }
}

function browsertype(){
   if (navigator.appName.search("Explorer") != -1) {
      resultstr = "explorer";
   } else {
      resultstr = "netscape";
   }
   if (document.getElementById( 'hdn_browsertype' ) ) {
   	document.frm_login.hdn_browsertype.value = resultstr;
   }
}

function ClearLogin(){

   if (document.getElementById( 'txt_name' ) ) {
		document.frm_login.txt_name.value='';
   }
   if (document.getElementById( 'txt_password' ) ) {
		document.frm_login.txt_password.value='';
   }
   if (document.getElementById( 'txt_name' ) ) {
		document.frm_login.txt_name.focus();
   }

}


