function validateEmail2(){
	var err = new Array('The following error(s) occurred:');
	var i = 0;
	//email
	if(document.email_module.email.value != ''){ //there is something in there
	
		//regex for an email address
		var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
		var result = re.test(document.email_module.email.value);
		if(!result){
		i++
		err[i] = "\nThe EMAIL ADDRESS that you entered does not appear to be valid";
		document.email_module.email.focus();
		}
		
	}else{
	i++
		err[i] = "\nThe EMAIL ADDRESS must be filled in";
	
		}
	
	
	//Check for any errors. 'i' iterates at each error instance, so if it is equal to zero, there were no errors
	
	if(i == 0){
	//document.footer.submit();
	var action = document.email_module.action;
	var source = document.email_module.source.value;
	var email = document.email_module.email.value;
	var mailpref = document.email_module.mailpref.value;
	var url=action+"?source="+source+"&email="+email+"&mailpref="+mailpref;
	window.open(url);
	
	}else{
	//alert the entire error array
	alert(err);
	}
}

function validateEmail(){
	var err = new Array('The following error(s) occurred:');
	var i = 0;
	//email
	if(document.footer.email.value != ''){ //there is something in there
	
		//regex for an email address
		var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
		var result = re.test(document.footer.email.value);
		if(!result){
		i++
		err[i] = "\nThe EMAIL ADDRESS that you entered does not appear to be valid";
		document.footer.email.focus();
		}
		
	}else{
	i++
		err[i] = "\nThe EMAIL ADDRESS must be filled in";
	
		}
	
	
	//Check for any errors. 'i' iterates at each error instance, so if it is equal to zero, there were no errors
	
	if(i == 0){
	//document.footer.submit();
	var action = document.footer.action;
	var source = document.footer.source.value;
	var email = document.footer.email.value;
	var mailpref = document.footer.mailpref.value;
	var url=action+"?source="+source+"&email="+email+"&mailpref="+mailpref;
	window.open(url);
	
	}else{
	//alert the entire error array
	alert(err);
	}

}


function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;	
	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function
