
/* e-mail validation */

		function validEmail(emailaddress) {
			invalidChars = " /:,;"

			if (emailaddress == "") {						// cannot be empty
				return false
			}
			for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
				badChar = invalidChars.charAt(i)
				if (emailaddress.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = emailaddress.indexOf("@",1)			// there must be one "@" symbol
			if (atPos == -1) {
				return false
			}
			if (emailaddress.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
				return false
			}
			periodPos = emailaddress.indexOf(".",atPos)
			if (periodPos == -1) {					// and at least one "." after the "@"
				return false
			}
			if (periodPos+3 > emailaddress.length)	{		// must be at least 2 characters after the "."
				return false
			}
			return true
		}


/* name validation */

		function validName(inName) {					// Is a name entered?
			if (inName == "") {
				return true
			}
			return false
		}


/* validate all and warn */

		function submitIt(newsForm) {

			// check to see that a name has been entered


			if (newsForm.realname.value == "") {
				alert("Please enter your name!")
				newsForm.realname.focus()
				return false
			}
			

			// check to see if the emailaddress's valid
			if (!validEmail(newsForm.emailaddress.value)) {
				alert("Invalid email address! Please re-enter.")
				newsForm.emailaddress.focus()
				newsForm.emailaddress.select()
				return false
			}
			
	}


 