function fcnValidateForm(objFormName) {
		// Instantiate the regular expression object so that we
		// can strip out HTML for all text-input boxes
		objRegExp = new RegExp("<{1}[/]*([A-Za-z0-9]|[^A-Za-z0-9>])*>{1}", "g");
		// Loop through all of the elements of the form object
		intPasswordFieldCount = 0;
		for (i=0;i<objFormName.elements.length;i++) {
		// select which type of element the form element is, and run the appropriate 
		// code to notify users of problems
		strFieldType = objFormName.elements[i].name.substring(0,3);
		strFieldName = objFormName.elements[i].name.substring(3);
		strFieldName = fcnSplitWords(strFieldName);
		switch (strFieldType) {
			case "txt":
				if (objFormName.elements[i].value == "") {
					alert("Your "+strFieldName+" cannot be left blank.");
					objFormName.elements[i].focus();
					return false;
				}
					objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
					break;
			case "eml":
				objFormName.elements[i].value = objFormName.elements[i].value.replace(/ /g, "");
				if (!(fcnIsEmailAddress(objFormName.elements[i]))) {
					alert("You must enter a valid email address: user@domain.com");
					objFormName.elements[i].focus();
					objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
					return false;
				}
					objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
					break;
			case "sel":
				if (objFormName.elements[i].selectedIndex == 0) {
					alert("You must select a "+strFieldName+".");
					objFormName.elements[i].focus();
					return false;
				}
				break;
			case "zip":
				if (objFormName.elements[i].value.length == 0) {
						alert("Please enter your zip code.");
						objFormName.elements[i].focus();
						return false;
				} else {
					if (!(fcnIsZipcode(objFormName.elements[i])))	{
						alert("Please input a valid zip code.");
						objFormName.elements[i].select();
						return false;
						}
				}
				objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
				break;
			case "phn":
				if (objFormName.elements[i].value.length == 0) {
						alert("Please enter your "+strFieldName+" phone.");
						objFormName.elements[i].focus();
						return false;
				} else {
					if (!(fcnIsPhoneNumber(objFormName.elements[i]))) {
						alert("Please enter a valid telephone number with area-code: e.g. (123) 456-7890");
						objFormName.elements[i].select();
						return false;
					}
				}
				objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
				break;
			case "pwd":
				intPasswordFieldCount++;
				if (objFormName.elements[i].value == "") {
					alert("Your "+strFieldName+" cannot be left blank.");
					objFormName.elements[i].focus();
					return false;
				}
				if (objFormName.elements[i].value.length < 5) {
					alert("Your password must be at least 5 characters long.");
					objFormName.elements[i].focus();
					return false;
				}
				if (intPasswordFieldCount == 2) {
					if (!(ComparePasswords(objFormName.elements[i-1], objFormName.elements[i]))) {
						return false;
					}
				}
				objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
				break;
			case "non":
				objFormName.elements[i].value = objFormName.elements[i].value.replace(objRegExp, "");
				break;
		}
	}
}

// Accepts a string object as input, checks to see if the string 
// contains '@' and '.'
function fcnIsEmailAddress(txtFieldName) {
	strSpecialCharCount = 0;
	objTempString = new String(txtFieldName.value);
	objTempSpring = txtFieldName;
	for (j=0;j<txtFieldName.value.length;j++) {
		switch (objTempString.charAt(j)) {
			case "@":
				strSpecialCharCount++;
				break;
			case ".":
				strSpecialCharCount++;
				break;
		}
	}
		if (strSpecialCharCount >= 2) {
			return true;
		} else {return false;}
}

// Accepts a string object as input, checks to see if there are at least
// 5 integers, and returns either true or false.
function fcnIsZipcode(txtFieldName) {
	strIntegerCount = 0;
	objTempZipString = new String(txtFieldName.value);
	objTempZipString.value = txtFieldName.value;
	for (j=0;j<txtFieldName.value.length;j++) {
		if (!(isNaN(objTempZipString.charAt(j)))) {
			strIntegerCount++;
		}
	}
	if ((strIntegerCount >= 5) && (strIntegerCount <= 10)) {
			return true;
		} else {
			return false;
		}
}

// Accepts a string object as input, checks to see if there are at least
// 10 integers, and returns either true or false.
function fcnIsPhoneNumber(txtFieldName) {
	strIntegerCount = 0;
	objTempPhoneString = new String(txtFieldName.value);
	objTempPhoneString.value = txtFieldName.value;
	for (j=0;j<txtFieldName.value.length;j++) {
		if (!(isNaN(objTempPhoneString.charAt(j)))) {
			strIntegerCount++;
		}
	}
	if ((strIntegerCount >= 10) && (strIntegerCount <= 17)) {
			return true;
		} else {
			return false;
		}
}

// Accepts a string as input, and returns that string with spaces inbetween
// words.  For example fcnSplitWords will take 'ThisSentenceHasNoSpaces' and
// returns 'This Sentence Has No Spaces'.
function fcnSplitWords(strFieldName) {
	objTempString = new String(strFieldName);
	objTempString.value = strFieldName;
	var strTemp;
	strTemp = "";
	for (j=0;j<objTempString.value.length;j++) {
		if (((objTempString.charCodeAt(j) >= 97) && (objTempString.charCodeAt(j) <= 122)) && ((objTempString.charCodeAt(j+1) >= 65) && (objTempString.charCodeAt(j+1) <= 90))) {
			strTemp = strTemp + objTempString.charAt(j);
			strTemp = strTemp+" ";
		} else {
			strTemp = strTemp + objTempString.charAt(j);
			}
	}
	objTempString = strTemp;
	strTemp = objTempString.toLowerCase();
	return strTemp;
	//return strTemp;
}

// Takes two password form fields, compares them, and returns whether they match or not
 function ComparePasswords(objFirstPassword, objSecondPassword) {
 	if (objFirstPassword.value != objSecondPassword.value) {
		alert("Your second password does not match the first. Note that passwords are case-sensitive.");
		objSecondPassword.select();
		return false;
	}
	if (objFirstPassword.value == objSecondPassword.value) {
		return true;
	}
 }

