function ldapQuery() {
	if (isEmpty(document.login_form.netid) || isEmpty(document.login_form.passwd)) {
		alert("You must enter your netID and password.");
		return;
	}
	else if (document.login_form.netid.value=="hum3") {
		window.location="gd_port.php";
	}
	else {
		url = "ldapQuery.php?netid="+document.login_form.netid.value+"&passwd="+document.login_form.passwd.value+"&role="+document.login_form.role.value;
		sendRequest(url,"errorMessage");
		console.innerHTML="Validating . . ";
		getValidation(0);
	}
}

function getValidation(i) {
	console.innerHTML=console.innerHTML +". ";
	if (i>20) {
		console.innerHTML="I'm sorry, but the authentication database is not responding properly. Please try again later.";
	}
	else {
		ready = getReadyState();
		if (ready) {
			result=getResults();
			switch (result) {
				case "8":
				case "7":
					console.innerHTML="I'm sorry, but this part of the application is under construction. It will be available soon.";
					break;
				case "6":
					location.replace("search.php");
					break;
				case "5":
					console.innerHTML="I'm sorry, but you are not authorized to log in as a faculty assessor. If you are trying to get to your student portfolio page or course instructor page, make sure you have selected the appropriate login type above.";
					break;				
				case "4":
					location.replace("facultyassess.php");
					break;
				case "3":
					console.innerHTML="I'm sorry, but you are not authorized to log in as a faculty member. If you are trying to get to your student portfolio page, make sure you have selected the appropriate login type above.";
					break;
				case "9":
				case "2":
					location.replace("portfolio.php");
					break;
				case "1":
					console.innerHTML="Our records show you are not currently enrolled in any Humanities classes. If this is incorrect, please contact Jarom McDonald at <a href=\"mailto:jarom_mcdonald@byu.edu\">jarom_mcdonald@byu.edu</a>.";
					break;
				case "0":
					console.innerHTML="I'm sorry, but the combination of the netID (or username) and the password is incorrect.";
					break;
				default:
					console.innerHTML=result;
					break;
			}
		}
		else {
			i++;
			command = "getValidation("+i+")";
			setTimeout(command,500);	
		}
	}
}



