		function validateFormOnSubmit(theForm) {
		var reason = "";
		var docrootURL = '<hc:getDocroot />';
		  reason += validateEmpty(theForm.FNAME);
		  reason += validateEmail(theForm.email);
		  reason += validateTerms(theForm.REGISTRATION_TYPE);


		  if (reason != "") {
		    alert("Some fields need correction:\n" + reason);
		    return false;
		  }
		var tellMe =  theForm.re.value + "?subscriber=" + theForm.FNAME.value;
		 theForm.re.value = tellMe;

	  	return true;

	}
	function validateEmpty(fld) {
	    var error = "";

	    if (fld.value.length == 0) {
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtn2Left-error.gif)';
	        error = "Please enter your name.\n"
	    } else {
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtnLeft.gif)';
	    }
	    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 == "") {
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtn2Left-error.gif)';
	        error = "You didn't enter an email address.\n";
	    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtn2Left-error.gif)';
	        error = "Please enter a valid email address.\n";
	    } else if (fld.value.match(illegalChars)) {
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtn2Left-error.gif)';
	        error = "The email address contains illegal characters.\n";
	    } else {
	        fld.style.backgroundImage = 'url(' + docrootURL + 'images/formBtnLeft.gif)';
	    }
	    return error;
	}
	function validateTerms(fld){
		if (fld.checked !== true) {
			error = "You must agree to the terms. \n";

		}
		else {
			error="";
		}
		return error;
	}
