function goodName(string) { 
	if (!string) return false; 										// null string -- error
	var iChars = "*|,\":<>[]{}`~\';()@&$#%^/?_"; 					// unacceptable characters
	for (var i = 0; i < string.length; i++) { 							// loop through each character of the string
		if (iChars.indexOf(string.charAt(i)) != -1) return false;		// if any wrong'un, reject the name
	} 
	return true; 													// well, it's okay, then
} 
function goodEmail(string) { 
	if (!string) return false; 										// null string -- error
	var a = string.split("@");										// split it at the @
	if (a.length != 2) return false;									// if not two pieces, too bad
	var iChars = " *|,\":<>[]{}`~\';()@&$#%^/?";						// unacceptable characters in each piece
	for (var i = 0; i < a[0].length; i++) { 							// check out user name
		if (iChars.indexOf(a[0].charAt(i)) != -1) return false; 		// if any wrong character, tilt
	} 
	var b = a[1].split("\.");											// break domain name at dots
	if (b.length < 2) return false;									// if only one piece, too bad
	var c = b.length - 1;											// last piece index
	if (b[c].length < 2 || b[c].length > 3) return false;				// must end in .xxx or .xx
	for (var i = 0; i < a[1].length; i++) { 							// check out domain name
		if (iChars.indexOf(a[1].charAt(i)) != -1) return false; 		// if any wrong character, tilt
	} 
	return true;														// must be okay, I guess 
} 
function checkqform(form) { 
	if (goodName(form.qname.value) == false) {					// check for a valid user name
		alert("Please enter your name."); 
		form.qname.focus(); 
		return false; 
	} 
	if (goodEmail(form.qemail.value) == false) {					// check for a valid e-mail address
		alert("A valid e-mail address is required."); 
		form.qemail.focus(); 
		return false; 
	} 
	if (!form.qsubject.value) {
		alert("Please enter the subject of your question.");
		form.qsubject.focus();
		return false;
	}
	if (!form.qtext.value) {
		alert("Please enter your question in the box.");
		form.qtext.focus();
		return false;
	}
	return true;
}
//  End of script
