function validateForm() {
	if (document.contactMailingForm.action == 'message') {
		if((document.contactMailingForm.name.value.length==0) || (document.contactMailingForm.email.value.length==0) || (document.contactMailingForm.message.value.length==0)) {
			formError('message');
			return false;
		}
	} else if (document.contactMailingForm.action == 'mailingList') {
		if((document.contactMailingForm.name.value.length==0) || (document.contactMailingForm.email.value.length==0) || (document.contactMailingForm.address1.value.length==0)) {
			formError('mailingList');
			return false;
		}
	} else {
		document.contactMailingForm.submit();
	}
}

function formError(action) {
	if (action == 'message') {
		var input = new Array(document.contactMailingForm.name, document.contactMailingForm.email, document.contactMailingForm.message);
		var spans = new Array('nameLabel', 'emailLabel', 'messageLabel');
	} else if (action == 'mailingList') {
		var input = new Array(document.contactMailingForm.name, document.contactMailingForm.email, document.contactMailingForm.address1);
		var spans = new Array('nameLabel', 'emailLabel', 'addressLabel');
	}
	
	executeError(input, spans);
}

function executeError(input, spans) {
	for (var i=0; i<input.length; i++) {
		document.getElementById(spans[i]).style.color = "#000";
		if (input[i].value.length==0) {
			document.getElementById(spans[i]).style.color = "#f00";
		}
	}
}