function validatenewsletter(theForm) 
{
  
  var reason = "";
  
  reason += validatename(theForm.name);
  reason += validatename1(theForm.email);
  if (reason != "") {
	alert("Some fields need correction:\n" + reason);
	return false;
  }
  return true;
}
function validatename1(fld) 
{
	var error = "";
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	if (fld.value.length == 0) {
		fld.style.background = 'yellow'; 
		error = "Enter the name\n"
	} else {
		fld.style.background = 'White';
	}
    if (!emailFilter.test(fld.value))
	{              
		fld.style.background = 'yellow';
		error = "Please enter a valid email address.\n";
	}
	return error;  
}
function validatename(fld) {
   var error = "";
 
	if (fld.value.length == 0) {
		fld.style.background = 'yellow'; 
		error = "Enter the name\n"
	} else {
		fld.style.background = 'White';
	}
	return error;  
}
function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

