
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(emailForm) {

			// check to see that a name has been entered


			if (emailForm.realname.value == "") {
				alert("Please enter your name!")
				emailForm.realname.focus()
				return false
			} 
			// check to see if the emailaddress's valid
			if (!validEmail(emailForm.emailaddress.value)) {
				alert("Invalid email address! Please re-enter.")
				emailForm.emailaddress.focus()
				emailForm.emailaddress.select()
				return false
			}
			
			
			guestNumbers = emailForm.guestno.selectedIndex
			if (emailForm.guestno.options[guestNumbers].value == "") {
				alert("You must enter the number of guests")
				emailForm.guestno.focus()
				return false
			}
			
	}

