// formstuff3.js Copyright ©1999-2000 David Whittington, The Kelly Company(SM), all rights reserved.

// check entered email address for invalid chars, i.e.,
// ()<>,;:\"[] and (chars < !) and (chars > ~)
// also, allow only one @ at-sign

var sCharCheck = "\\()<>,;:\"[]";

function CheckAndPopup(formObj, sPopupDest) {
	var iAtCount = 0;
	var iDotCount = 0;
	var sEMail = "" + formObj.email.value;
	if (sEMail.length < 6) {
		alert('A valid e-mail address is required.');
		return false;
	}
	for (var i = 0; i < sEMail.length; i++) {
		if ((sEMail.charAt(i) < "!") ||
				(sEMail.charAt(i) > "~")) {
			alert('Invalid character(s) in e-mail address.');
			return false;
		}
		if (sEMail.charAt(i) == "@") {
			iAtCount += 1;
		}
		if (iAtCount > 1) {
			alert('Too many \"@\" characters in e-mail address.');
			return false;
		}
		if (sEMail.charAt(i) == ".") {
			iDotCount += 1;
		}
		for (var j = 0; j < sCharCheck.length; j++) {
			if (sEMail.charAt(i) == sCharCheck.charAt(j)) {
				alert('Invalid character(s) in e-mail address.');
				return false;
			}
		}
	}
	if ((iAtCount < 1) || (iDotCount < 1)) {
		alert('Missing \"@\" or "." characters in e-mail address.');
		return false;
	}
	if (formObj.sendbtn) {
		formObj.sendbtn.value = "Please Wait...";
	}
	if (sPopupDest.length > 0) {
		FollowOnWin(sPopupDest);
	}
	return true;
}

function FollowOnWin(sURL) {
	window.open(sURL, "FollowOn", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=565,height=420");
}
