function toggle(id) {
	if (document.getElementById(id).height == 0) {
		document.getElementById(id).height = 150;
	}
	else {
		document.getElementById(id).height = 0;
	}
}

function toggleFiles(divID,id) {
	if (document.getElementById(id).value == "limited_user") {
		document.getElementById(divID).style.display = "inline";
		document.getElementById(divID).style.position = "relative";
	} else {
		document.getElementById(divID).style.display = "none";
	}
}

function popUp(id) {
	with (document.getElementById(id).style) {
		if (display == "none") {
			display = "block";
			position = "relative";
		} else {
			display = "none";
		}
	}
}

function validatePasswds(id1,id2) {
	var pw1 = document.getElementById(id1).value;
	var pw2 = document.getElementById(id2).value;
	if (pw1.indexOf(' ') > -1) {
		alert("Spaces are not allowed in passwords.");
		return false;
	} else if ((pw1 == '') || (pw2 == '')) {
		alert("Please enter the new password twice.");
		return false;
	} else if ((pw1.length < 6) || (pw1.length > 12)) {
		alert("The new password length is invalid.");
		return false;
	} else if (pw1 != pw2) {
		alert("You did not enter the same new password twice.");
		return false;
	}
	return true;
}

function validateLoginName(id) {
	var loginName = document.getElementById(id).value;
	if (loginName.indexOf(' ') > -1) {
		alert("Spaces are not allowed in login names.");
		return false;
	} else if (loginName == '') {
		alert("Please enter a login name.");
		return false;
	}
	return true;
}

function checkOldPasswd(id) {
	if (document.getElementById(id).value == '') {
		alert("Please enter your current password.");
		return false;
	}
	return true;
}

function checkUser(id) {
	if (document.getElementById(id).value == '') {
		alert("Please select a user.");
		return false;
	}
	return true;
}

function checkCat(id) {
	if (document.getElementById(id).value == '') {
		alert("Please select a category.");
		return false;
	}
	return true;
}

function changeAction(id,action) {
	document.getElementById(id).action = action;
}
