
//.................news FORM CHECK ..................


	function formCheck() {
    	if (news_form.Name.value == "") {
	alert("Please insert your Name");
	news_form.Name.focus();
	return(false);
		
		}
	if (news_form.Email.value == "") {
	alert("Please insert your Email ");
	news_form.Email.focus();
	return(false);
		}
		
			
// **************************************
	// Email Check
	// **************************************



	emailStr = news_form.Email.value;
	if (emailStr != "" )  {
		// Begin code for validation of email
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var firstChars=validChars
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom="(" + firstChars + validChars + "*" + ")"
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			alert("The Email address seems to be wrong. Please check the @ and . characters.")
			news_form.Email.focus();
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]

		if (user.match(userPat)==null) {
			alert("The username part before the @ seems to be wrong.")
			news_form.Email.focus();
			return false
		}
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			  for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("The IP address seems to be wrong.")
					news_form.Email.focus();
				return false
				}
			}
			return true
		}

		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			alert("The domain seems to be wrong.")
			news_form.Email.focus();
			return false
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 ||
			domArr[domArr.length-1].length>3) {
			alert("The email address needs to end with 3 characters that state the domain, or 2 characters that state the country.")
			news_form.Email.focus();
		   return false
		}

		if (domArr[domArr.length-1].length==3 && len<2) {
			var errStr="The hostname is missing."
			alert(errStr)
			news_form.Email.focus();
		   return false
		}


	}
	// End code for validation of email
}