function validateSubPlat() {

if (isEmpty(document.SubPlat.PltBk.value)) {
	alert("Please enter a three-digit number for the Plat Book.");
	document.SubPlat.PltBk.focus();
	return false;
} else {
	if (isNumeric(document.SubPlat.PltBk.value)) {
		if (isNumeric(document.SubPlat.PltPg.value)) {
			return true;
		} else {
			alert("Subdivision Page is not required, but if you do enter one, it must be numeric.");
			document.SubPlat.PltPg.focus();
			return false;
		}
	} else {
		alert("Please enter a numeric three-digit value for the Subdivision Book.");
	}
}
return false;

}

function validateSubName() {
var chk = parseInt(checkLen(document.SubName.SubName.value));


if (chk < 3) {
	alert("Please enter at least three characters in the Subdivision Name field.");
	document.SubName.SubName.focus();
	return false;
	}
return true;
}


function validateSubRec() {
//If it was Recdate and Daily, just need to have Recdate in proper format.  If Daily
//is provided, it needs to be numeric.
if (isDate(document.SubRec.RecDate.value)) {
	if (isNumeric(document.SubRec.Daily.value)) {
		return true;
	}
} else {
	document.SubRec.RecDate.focus();
	return false;
}
return true;
}


function isEmpty(inputStr) { //from JavaScript Bible p. 752
	if (inputStr == null || inputStr =="") {
		return true;
	}
	return false;
}

function isNumeric(inputVal) { //from JavaScript bible, p. 754, modified
	inputStr = inputVal.toString();
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i);
		if (oneChar <"0" || oneChar > "9") {
			return false;
		}
	}
		return true;
}

function checkLen(inputStr) {
var strValue = inputStr;
return strValue.length;
}



function isDate(fieldname) {
//pass it a text field and it determines if it's the date - with a teeny bit of help from the JavaScript Bible
	
var thisYear = (new Date()).getYear();
thisYear = (thisYear <= 1900)? thisYear + 1900: thisYear

// Set variables so that you can separate mm, dd, and yyyy to check each for validity.
var mm = parseInt(fieldname.substring(0, 2));
var dd = parseInt(fieldname.substring(3,5));
var yyyy = parseInt(fieldname.substring(6,10));
var char3 = fieldname.substring(2,3);
var char6 = fieldname.substring(5,6);

	//Check on each if these if they're valid
if (yyyy < 1800 || yyyy > thisYear)  {
	alert("Please enter the date in format mm/dd/yyyy where mm, dd, and yyyy are all numeric.");
	return false;
}

if (!isNumeric(yyyy) || !isNumeric(dd) || !isNumeric(mm)) {
	alert("Please enter the date in format mm/dd/yyyy where mm, dd, and yyyy are all numeric.");
	return false;
}


if (mm > 12) {
	alert("You can't have a month that's greater than 12 or not numeric; please re-enter your date!");
	return false;
	}

if (dd > 31) {
	alert("You can't have a day that's greater than 31 or not numeric; please re-enter your date!");
	return false;
}

if (char3 !="/" || char6 !="/") {
	alert("Please enter the date in format mm/dd/yyyy.");
	return false;
	}

return true;
}


