
function validate_mailer(x)
{
	submitOK		= "True";
	var message 	= "Form incomplete, please:\n\n";

	if (!isValidEmailMailer (trimMailer(x.Email4Mailer.value))) 
	{message 		+= "- Enter a correct email address\n";							submitOK="False"; }

	if (submitOK=="False") {
 		alert(message)
 		return false;
 	}

	return true;



} <!-- end of function -->



function isValidEmailMailer(address)
{
   		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   		if(reg.test(address) == false) {
      		return false;
   		}
   		return true;
		
} <!-- end of function -->


function trimMailer (strText) {
 
    		// this will get rid of leading spaces 
    		while (strText.substring(0,1) == ' ') 
        		strText = strText.substring(1, strText.length);

    		// this will get rid of trailing spaces 
    		while (strText.substring(strText.length-1,strText.length) == ' ')
        		strText = strText.substring(0, strText.length-1);

   		return strText;

} <!-- end of function -->


