function checkEmail(thevalue){
var str=thevalue;
//This pattern should be on one line
var filter =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if(filter.test(str)){
emailResults = true;}
else{
alert("Please enter a valid email address!");
emailResults = false;}
return(emailResults);
}

function saveEmail() {
	  if(checkEmail(document.news.email.value)) {
		  var expDate = new Date();
      //set expiration of 10 minutes from the current time
      expDate.setTime(expDate.getTime() + (10*60*1000)); 
	    setCookie('news',document.news.email.value,expDate,'/');
		  location.reload();
	  }
	// If the email is invalid the checkEmail function will inform the user.
	// No need to do anything here.
	}