function frmMaint_List_Cancel() {
	location.href="admin_menu.asp";
}

function frmMaint_Maint_Cancel() {
	location.href="maint_list.asp";
}

function frmMaint_Maint_Focus() {
	var strAction = document.frmMaint_Maint.strAction.value;

	if (strAction == "D") {
		return true;
	}

	document.frmMaint_Maint.strEmp_Password.focus();
}

function frmEmp_In_Focus() {
	document.frmEmp_In.strEmp_User_Id.focus();
}

function frmEmp_In_Val(theForm) {
	var strEmp_User_Id = null;
	var strEmp_Password = null;

	theForm.strEmp_User_Id.value = stripBlanks(theForm.strEmp_User_Id.value);
	theForm.strEmp_Password.value = stripBlanks(theForm.strEmp_Password.value);

	strEmp_User_Id = theForm.strEmp_User_Id.value;
	strEmp_Password = theForm.strEmp_Password.value

	if (strEmp_User_Id.length == 0) {
		alert("User id is required.");
		theForm.strEmp_User_Id.focus();
		return false;
	}
	
	if (strEmp_Password.length == 0) {
		alert("Password is required.");
		theForm.strEmp_Password.focus();
		return false;
	}
	
}

function frmAdmin_In_Focus() {
	document.frmAdmin_In.strAdmin_User_Id.focus();
}

function frmAdmin_In_Val(theForm) {
	var strAdmin_User_Id = null;
	var strAdmin_Password = null;

	theForm.strAdmin_User_Id.value = stripBlanks(theForm.strAdmin_User_Id.value);
	theForm.strAdmin_Password.value = stripBlanks(theForm.strAdmin_Password.value);

	strAdmin_User_Id = theForm.strAdmin_User_Id.value;
	strAdmin_Password = theForm.strAdmin_Password.value

	if (strAdmin_User_Id.length == 0) {
		alert("User id is required.");
		theForm.strAdmin_User_Id.focus();
		return false;
	}
	
	if (strAdmin_Password.length == 0) {
		alert("Password is required.");
		theForm.strAdmin_Password.focus();
		return false;
	}
	
}

function frmAdmin_Maint_Focus() {
	var strAction = document.frmAdmin_Maint.strAction.value;

	if (strAction == "D") {
		return true;
	}

	document.frmAdmin_Maint.strAdmin_User_Id.focus();
}

function frmAdmin_Maint_Cancel() {
	location.href="admin_list.asp";
}

function frmAdmin_Maint_Menu() {
	location.href="admin_menu.asp";
}

function frmMaint_Maint_Val(theForm) {
	var validator = new Validate();
	var strEmp_Password = null;
	var strEmp_User_Id = null;
	var strEmp_Name_First = null;
	var strEmp_Name_Last = null;
	var dtmEmp_Week_Ending = null;
	var lngEmp_YTD_Hours_Worked = null;
	var blnEmp_401K = null;
	var blnEmp_Medical = null;
	var dtmEmp_Vacation_Pay = null;
	var strAction = theForm.strAction.value;

	if (strAction == "D") {
		return true;
	}

	theForm.strEmp_Password.value = stripBlanks(theForm.strEmp_Password.value);
	theForm.strEmp_User_Id.value = stripBlanks(theForm.strEmp_User_Id.value);
	theForm.strEmp_Name_First.value = stripBlanks(theForm.strEmp_Name_First.value);
	theForm.strEmp_Name_Last.value = stripBlanks(theForm.strEmp_Name_Last.value);
	theForm.dtmEmp_Week_Ending.value = stripBlanks(theForm.dtmEmp_Week_Ending.value);
	theForm.lngEmp_YTD_Hours_Worked.value = stripBlanks(theForm.lngEmp_YTD_Hours_Worked.value);
	theForm.dtmEmp_Vacation_Pay.value = stripBlanks(theForm.dtmEmp_Vacation_Pay.value);

	strEmp_Password = theForm.strEmp_Password.value;
	strEmp_User_Id = theForm.strEmp_User_Id.value;
	strEmp_Name_First = theForm.strEmp_Name_First.value;
	strEmp_Name_Last = theForm.strEmp_Name_Last.value;
	dtmEmp_Week_Ending = theForm.dtmEmp_Week_Ending.value;
	lngEmp_YTD_Hours_Worked = theForm.lngEmp_YTD_Hours_Worked.value;
	dtmEmp_Vacation_Pay = theForm.dtmEmp_Vacation_Pay.value;

//	Password (Candidate id)
	if (strEmp_Password.length == 0) {
		alert("Candidate id is required.");
		theForm.strEmp_Password.focus();
		return false;
	}

	if (strEmp_Password.length != 8) {
		alert("Candidate id must be exactly 8 digits long.");
		theForm.strEmp_Password.focus();
		return false;
	}

	if (validator.isOnlyNumeric(strEmp_Password)) {
	}
	else {
		alert("Candidate id must be numeric.");
		theForm.strEmp_Password.focus();
		return false;
	}

//	User id
	if (strEmp_User_Id.length == 0) {
		alert("User id is required.");
		theForm.strEmp_User_Id.focus();
		return false;
	}

	if (validator.isOnlyAlphaNumericNoSpace(strEmp_User_Id)) {
	}
	else {
		alert("User id must not contain spaces and be made\nup of only alphabetic and numeric characters.");
		theForm.strEmp_User_Id.focus();
		return false;
	}

//	First name
	if (strEmp_Name_First.length == 0) {
		alert("First name is required.");
		theForm.strEmp_Name_First.focus();
		return false;
	}

//	Last name
	if (strEmp_Name_Last.length == 0) {
		alert("Last name is required.");
		theForm.strEmp_Name_Last.focus();
		return false;
	}

//	Week ending date
	if (dtmEmp_Week_Ending.length == 0) {
		alert("As of week ending date is required.");
		theForm.dtmEmp_Week_Ending.focus();
		return false;
	}

	if (validateDate(dtmEmp_Week_Ending, "Long")) {
	}
	else {
		theForm.dtmEmp_Week_Ending.focus();
		return false;
	}

//	YTD hours worked
	if (lngEmp_YTD_Hours_Worked.length == 0) {
		alert("YTD hours worked is required.");
		theForm.lngEmp_YTD_Hours_Worked.focus();
		return false;
	} 

	if (validator.isValidFloatingPoint(lngEmp_YTD_Hours_Worked)) {
	}
	else {
		alert("YTD hours is invalid.");
		theForm.lngEmp_YTD_Hours_Worked.focus();
		return false;
	}

//	Vacation pay date
	if (dtmEmp_Vacation_Pay.length > 0) {
		if (validateDate(dtmEmp_Vacation_Pay, "Long")) {
		}
		else {
			theForm.dtmEmp_Vacation_Pay.focus();
			return false;
		}
	}

}

function frmAdmin_Maint_Val(theForm) {
	var validator = new Validate();
	var strAdmin_User_Id = null;
	var strAdmin_Password = null;
	var intAdmin_Access_Level = null;
	var intAdmin_Page_Rows = null;
	var strAction = theForm.strAction.value;

	if (strAction == "D") {
		return true;
	}

	theForm.strAdmin_User_Id.value = stripBlanks(theForm.strAdmin_User_Id.value);
	theForm.strAdmin_Password.value = stripBlanks(theForm.strAdmin_Password.value);
	theForm.intAdmin_Page_Rows.value = stripBlanks(theForm.intAdmin_Page_Rows.value);

	strAdmin_User_Id = theForm.strAdmin_User_Id.value;
	strAdmin_Password = theForm.strAdmin_Password.value;
	intAdmin_Access_Level = theForm.intAdmin_Access_Level.value;
	intAdmin_Page_Rows = theForm.intAdmin_Page_Rows.value;

//	User id
	if (strAdmin_User_Id.length == 0) {
		alert("User id must be present.")
		theForm.strAdmin_User_Id.focus();
		return false;
	}

//	Password
	if (strAdmin_Password.length == 0) {
		alert("Password must be present.")
		theForm.strAdmin_Password.focus();
		return false;
	}

//	Access level
	if (intAdmin_Access_Level == "NS") {
		alert("Please select an access level from the pull down menu.");
		theForm.intAdmin_Access_Level.focus();
		return false;
	}

//	Page rows
	if (intAdmin_Page_Rows.length == 0) {
		alert("Page rows must be present.")
		theForm.intAdmin_Page_Rows.focus();
		return false;
	}

	if (validator.isOnlyNumeric(intAdmin_Page_Rows)) {
		}
	else {
		alert("Page rows must be numeric.")
		theForm.intAdmin_Page_Rows.focus();
		return false;
	}

	return true;
}
