function CheckNewsSignup()
{
    alertmessage = "";
	
  if(document.NewsSignup.name.value == "")
  {
    alertmessage += "  - Name\n";
  }
	
  if(document.NewsSignup.email.value=="")
  {
    alertmessage += '  - Email\n';
  }

  if(document.NewsSignup.email.value!="")
  {
    alertmessage+= checkEmail(document.NewsSignup.email.value);
  }
	
  if(alertmessage=="")
  {
	  document.NewsSignup.submit();
	  return true;
  }
  else
  {
    TopMessage = "You have not entered the following form elements correctly: \n\n";
    BottomMessage = "\nPlease correct these fields to continue";
    alertmessage = TopMessage + alertmessage + BottomMessage;

    alert(alertmessage);
    return false;
  }
}


function checkEmail(mail)
{
  var email = mail;
  invalidChars = " /:,;?()"
  incorrect ='';
  var errormessage="";

  for (i=0; i<invalidChars.length; i++) 
  {
    badChar = invalidChars.charAt(i)

    if (email.indexOf(badChar,0) > -1) 
    {
      incorrect += '   - Invalid Email Address\n';
      break;
    }
  }
  atPos = email.indexOf("@",1)

  if (atPos == -1)
  {
    incorrect += '   - Invalid Email Address\n';
  }

  if (email.indexOf("@",atPos+1) > -1)
  {
    incorrect += '   - Invalid Email Address\n';
  }
  periodPos = email.indexOf(".",atPos)

  if (periodPos == -1)
  {
    incorrect += '   - Invalid Email Address\n';
  }

  if (periodPos+3 > email.length)
  {
    incorrect += '   - Invalid Email Address\n';
  }           

  if (incorrect != '')
  {
    errormessage += '   - Invalid Email Address\n';
  }
 return errormessage;
}