function ldapQuery() {
	if (isEmpty(document.login_form.netid) || isEmpty(document.login_form.passwd)) {
		alert("You must enter your netID and password.");
		return;
	}
	else {
		url = "ldapQuery.php?netid="+document.login_form.netid.value+"&passwd="+document.login_form.passwd.value;
		document.getElementById("errorMessage").innerHTML="Validating . . .";
		sendAndLoad(url,handleLdapResult);
	}
}

function handleLdapResult() {
	console = document.getElementById("errorMessage");
	switch (this.req.responseText) {
			case "2":
				showEdit();
				break;
			case "1":
				console.innerHTML="You are not authorized to make administrative changes.";
				break;
			case "0":
				console.innerHTML="Unfortunately, that NetID/Password combination cannot be validated. Please try again.";
				break;
		}
}

function showEdit() {
	document.getElementById("login").style.display="none";
	document.getElementById("loginLinks").innerHTML="<h4>Administrative Links</h4><ul><li><a href=\"javascript:editInfo('resources');\">Edit Resource Links</a></li><li><a href=\"index.php\">Edit Program Assessment Status</a></li><li><a href=\"javascript:editAdmins();\">Edit Administrative Users</a></li></ul>";
	document.getElementById("errorMessage").innerHTML="<a href=\"logout.php\" class=\"admin\" style=\"margin-top:15px; color:#990000;\">Logout</a>";
	setStyleByClass('span', 'admin_edit', 'display', 'inline');
	sendAndLoad("getnetid.php",addLinks);
}

function includeDocs(id,value) {
	url="changeIncludeDocs.php?program="+id+"&switchto="+value;
	//alert(url);
	sendAndLoad(url,reportIncludeDocs);
}

function reportIncludeDocs() {	
}

function addLinks() {
	spanArray = document.getElementsByTagName("span");
	var j=0;
	for (i=0; i<spanArray.length;i++) {
		if (spanArray[i].className=='report') {
			j++;
			spanArray[i].innerHTML="<a target=\"_blank\" href=\"http://humanities.byu.edu/humcoll/getfacinfo.php?redirect=yes&netid="+this.req.responseText+"\"><img src=\"images/checkmark.png\" border=\"no\" width=\"15px\"/></a>";
		}
	}
}

function editInfo(info) {
	url = "edit.php?info="+info;
	location.replace(url);
}

function editAdmins() {
	url = "edit.php?info=admins";
	location.replace(url);
}



