// JavaScript Document
function validateEmpty(fld, title) {
    var error = "";
    if (fld.value.length == 0) {
        error = title+", a required field, has not been filled in.\n"
    }
	return error;  
}
function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        error = "The email address contains illegal characters.\n";
    }
    return error;
}
function validateZip(fld) {
    var error="";
	if (fld.value != "") {
		if ((input - 0) != input )
			error = "You didn't enter a valid zip code.\n";
	}
    return error;
}

