﻿// Validate email addresses submitted in forms
//
function validEmail(emailAddy)
	{
	var testEmail = /^.+@[^\.].*\.[a-z]{2,}$/;

	if (emailAddy.match(testEmail) == null) {
		return false;
		} else {
	return true;
		}
	}

// Validate ZIP code as either 5-digit, #####, or ZIP+$, #####-####
//
function validZip(zipCode)
	{
	var fiveDigit = /^\d{5}/;
	var plusFour = /^\d{5}[-]\d{4}/;
	if (zipCode.length == 5) {
		return fiveDigit.test(zipCode);
		}
	else if (zipCode.length == 10) {
		return plusFour.test(zipCode);
		}
	else { return false; }
	}
	
// Validate form entry as numeric
//
function notNumeric(n)
	{
	var finder = /\D/;
	return finder.test(n);
	}
// turn formButton on and off
//
function buttonOn() {
	var on = "images/DownloadFormOn.png";
	document.getElementById("formButton").src = on;
	}
function buttonOff() {
	var off = "images/DownloadFormOff.png";
	document.getElementById("formButton").src = off;
	}
