//--------------------------------------------------------------
// checkJoinList.js
// used by join mailing list routines
//--------------------------------------------------------------
	function isNum(passedValue) {
			if (passedValue=="") {
				return false
			}
			
			for (i=0; i<passedValue.length; i++) {
				if (passedValue.charAt(i) < "0") {
					return false
				}
				if (passedValue.charAt(i) > "9") {
					return false
				}
			}
			return true
	}
	
	// get the value of a radio button:
	function getRadioValue(radioObject)
	{
		var value = null
		for (var i=0; i<radioObject.length; i++)	{
			if (radioObject[i].checked)	{
				value = radioObject[i].value
				break
			}
		}
		return value
	}

	function validEmail(email) {
		invalidChars = " /:,;"

		if (email == "") {
			return false
		}
		
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) > -1) {
				return false
			}
		}
	
		atPos = email.indexOf("@",1)
		
		if (atPos == -1) {
			return false
		}
		
		if (email.indexOf("@",atPos+1) > -1) {
			return false
		}
		
		periodPos = email.indexOf(".",atPos)
		
		if (periodPos == -1) {
			return false
		}
		
		if (periodPos+3 > email.length)	{
			return false
		}
		
		return true
	}
	
/* check the Email send form from the website */
function checkJoinList(myForm)
{
		if (!validEmail(myForm.email.value)) {
			alert("You must enter a valid email address.")
			myForm.email.focus()
			return false
		}

		return true
}


