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
}

function psubmitIt(form) {
	if (!validEmail(form.pnewsAddr.value)) {
		alert("Invalid email address")
		form.pnewsAddr.focus()
		form.pnewsAddr.select()
		return false
	}
	return true
}
function wsubmitIt(form) {
	if (!validEmail(form.warriorAddr.value)) {
		alert("Invalid email address")
		form.warriorAddr.focus()
		form.warriorAddr.select()
		return false
	}
	return true
}

function doLogon(form) {
	if (form.postthread.value == "Submit") {
		if (form.logon.value.length < 3) {
			alert("Invalid Logon Name Entered, Minimum of 3 Characters in Name\nTo Register, Enter the Logon Name you want to use.");
			form.logon.focus();
			form.logon.select();
			return false;
		}
		if (form.passwd.value.length < 5) {
			alert("Invalid Password Entered. Minimum of 5 Characters\nTo Register, enter the Password you wish to use.");
			form.passwd.focus();
			form.passwd.select();
			return false;
		}
		if (form.ptitle.value.length<5) {
			alert("Please provide a short descriptive Title for your post (Minimum 5 Characters).");
			form.ptitle.focus();
			form.ptitle.select();
			return false;
		}
		if (form.ptitle.value.length>125) {
			alert("Your message Title exceeds the maximum length allowed (125 Characters)");
			form.ptitle.focus();
			form.ptitle.select();
			return false;
		}
		if (form.ptitle.value.length>4) {
			var htmltag = new RegExp("<|>","g");
			if (form.ptitle.value.match(htmltag)) {
				alert("HTML Tags not allowed im Message Title");
				form.ptitle.focus();
				form.ptitle.select();
				return false;
			}
		}
		if (form.newthread.value.length<5) {
			alert("No Message Body has been submitted.\nPosting only to the Message Title is not permitted.");
			form.newthread.focus();
			return false;
		}
	}
}
function submitName(form) {
	if (!validEmail(form.email.value)) {
		alert("Invalid email address")
		form.email.focus()
		form.email.select()
		return false;
	}
}

function provideName(form) {
	if (!validEmail(form.newemail.value)) {
		alert("Invalid email address")
		form.newemail.focus()
		form.newemail.select()
		return false;
	}
	if (form.newpasswd.value.length < 6) {
		alert("Invalid Password Entered");
		form.newpasswd.focus();
		form.newpasswd.select();
		return false;
	}
}

function confirmDelete(form) {
	if (form.admsub.value == "Delete") {
		if (confirm("Are you sure you want to delete these messages?")) {
			return true
		}
		else {
			return false
		}
	}
}
function checkLogon(form) {
	if (form.newlogon.value.length < 3) {
		alert("Invalid Logon Entered");
		form.newlogon.focus();
		form.newlogon.select();
		return false;
	}
	if (form.newpasswd.value.length < 6) {
		alert("Invalid Password Entered");
		form.newpasswd.focus();
		form.newpasswd.select();
		return false;
	}
	if (!validEmail(form.newemail.value)) {
		alert("Invalid email address")
		form.newemail.focus()
		form.newemail.select()
		return false;
	}
}
function showSpecial () {
	var myBars = 'directories=yes,location=yes,menubar=no,status=no';
	myBars += ',titlebar=yes,toolbar=yes';
	var myOptions ='scrollbars=yes,width=480,height=575,resizable=yes';
	var myFeatures = myBars + ',' + myOptions;
	var refWindow = open('../septemberspecial.html', 'ref_Win', myFeatures);
}

