<!--
var ocontactform, ofirstname, olastname, oaddress, ocity;
var ostate, ozip, ohomephone, oemail;

function getRefs(){
	if (!ofirstname){
		ocontactform = document.getElementById('contactform');
		ofirstname = document.getElementById('firstname');
		olastname = document.getElementById('lastname');
		oaddress = document.getElementById('address');
		ocity = document.getElementById('city');
		ostate = document.getElementById('state');
		ozip = document.getElementById('zip');
		ohomephone = document.getElementById('homephone');
		oemail = document.getElementById('email');
	}
}

function getRequiredFields(){
	//Return an array of elements and their required pattern.
	var requiredElements = new Array(
		new Array(ofirstname, new RegExp(/./)),
		new Array(olastname, new RegExp(/./)),
		new Array(oaddress, new RegExp(/./)),
		new Array(ocity, new RegExp(/./)),
		new Array(ostate, new RegExp(/./)),
		new Array(ozip, new RegExp(/\d{5}/)),
		new Array(ohomephone, new RegExp(/\d{10}/)),
		new Array(oemail, new RegExp(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/))
	);
	return requiredElements;
}

function submitForm(){
	getRefs();
	
	//Validate all fields.
	allValid = true; //optimism.
	//
	//Array of controls to valid along with how to validate.
	validateMe = getRequiredFields();
	for (LC=0; LC<validateMe.length; LC++){
		
		//Get P element for this field.
		oHL = validateMe[LC][0];
		while (oHL.tagName.toLowerCase()!='p'){
			oHL = oHL.parentNode;
		}
		
		//Valid or invalid?
		if (validateMe[LC][0].value.match(validateMe[LC][1])){
			//Valid. Remove highlight from TD.
			oHL.style.color = '';
		}
		else{
			//Not valid. Highlight TD.
			allValid = false;
			oHL.style.color = 'red';
		}
	}
	
	//Submit or show invalid msg.
	if (!allValid){
		alert('Unable to Submit.\nPlease complete required fields.');
		return false;
	}
	else{
		ocontactform.submit();
	}
}

-->
