	var resFormValidation = new Array(
		new Array("firstName", "string", "First Name", true),
		new Array("lastName", "string", "Last Name", true),
		new Array("email", "email", "Email Address", true),
		new Array("phone", "phone", "Phone Number", true),
		new Array("zip", "integer", "Postal Code", true),
		new Array("subCatID", "select", "Project Specialty", true),
		new Array("brief_desc", "string", "Description", true)
    );
	
	function validateMe() {
	
		var failureStr = "";
		
		if( document.resForm.cityOptions.value == "")
		{
			var cityOps = document.getElementById("cityOptionsId");
			
			if( cityOps.style.display != "none" )
			{
				failureStr += "City is a required field.\n";
			}
		}
		
		if(failureStr != "")
		{
			alert(failureStr);
			
			return false;
		}
		
		document.resForm.cityId.value = document.resForm.cityOptions.value;
		
		return validate2();
	}
	
	function validate2() {
		if(secondCheck() && washYourMouthOut()) { 
			var fname = document.resForm.firstName.value;
				document.resForm.firstName.value = fname.substring(0,1).toUpperCase() + fname.substring(1,fname.length).toLowerCase()
			var lname = document.resForm.lastName.value;
				document.resForm.lastName.value = lname.substring(0,1).toUpperCase() + lname.substring(1,lname.length).toLowerCase()
			var phone = document.resForm.phone.value;
				document.resForm.phone.value = formatPhone(phone);
			return true; 
		} else { 
			return false; 
		}
	}
	
	function secondCheck() {
		var str = document.resForm.zip.value.replace(/^\s*|\s*$/g,"");
		if(str.length < 5) {
			alert("Please enter a full 5 digit zip code.");
			return false;
		} else {
			return true;
		}
	}
	
	function otherCheck() {
		var str = "";
		var doCheck = false;
		if(document.resForm.other.checked) {  doCheck = true; str = document.resForm.other_text.value;  }
		if(doCheck && str == "") {
			alert("If you choose Other, please fill in the Other box to describe the project.");
			return false;
		} else {
			return true;
		}
	}
	
	var bad=["shit","piss","fuck","cunt","cocksucker","motherfucker","tits","asshole"];
	function washYourMouthOut() {
		var str = document.resForm.brief_desc.value;
		var detected=[];
		for(var i=0;i<bad.length;i++) {
			if(str.indexOf(bad[i])!=-1) {
				detected.push(bad[i]);
				continue;
			}
		}
		if(detected.length>=1) {
			//alert("The following curse word(s) were found in your entry: " + detected.join(", "));
			alert("Do you kiss your mother with that mouth?\nPlease clean up the following word(s) before submitting your post:\n\n" + detected.join("\n"));
			return false; 
		} else {
			return true;
		}
	}
	
	function formatPhone(arg) {
		var str = arg.replace(/[^\d]/g,'');
		str = "(" + str.substring(0,3) + ") " + str.substring(3,6) + "-" + str.substring(6,10);
		return str;
	}
	
	function emailLower() {
		var email = document.resForm.email.value;
		document.resForm.email.value = email.toLowerCase();
	}