function ValidateForm()
	{
	document.ReturnValue = true
	document.ReturnValue = ( validateFld(document.getElementById('Name_First'),'','Y','First Name') &&
			 validateFld(document.getElementById('Name_Last'),'','Y','Last Name') &&
			 validateFld(document.getElementById('email'),'email','Y','Email Address') &&
			 validateFld(document.getElementById('phone'),'phone','N','Phone Number') &&
			 validateFld(document.getElementById('studentnumber'),'psuid','N','PSU ID') &&
			 validateSelect(document.getElementById('classification'),'Classification') &&
			 validateSelect(document.getElementById('category'),'Category') &&
			 validateFld(document.getElementById('question'),'txt','Y','Question') )
	}

function validateSelect(fld,nm)
	{
	if (fld.selectedIndex == 0)
		{
		fld.focus();
		alert(nm + ' is a required field');
		return false;
		}
	else
		return true;
	}

function validateFld(fld,typ,req,nm)
	{
	var myval = fld.value;
	var stripped = myval.replace(/[\ \n]/g, '');

	if (req == 'Y' && (myval.length == 0 || stripped.length == 0))
		{
		if (myval.length == 0)
			{
			fld.focus()
			alert(nm + ' is a required field');
			return false;
			}
		}
	else
		{
		if (typ == 'psuid')
			{
			if(myval.length != 0)
				{
				var stripped = myval.replace(/[\-\ ]/g, '');
				//strip out accepTABLE non-numeric characters
				if (isNaN(parseInt(stripped)))
					{
					fld.focus();
					alert('The PSU ID contains illegal characters.');
					return false;
					}
				else if (!(stripped.length == 9))
					{
					fld.focus();
					alert('The PSU ID is the wrong length.');
					return false;
					}
				else
					{
					fld.value = stripped;
					return true;
					}
				}
			else
				if (confirm('PSU ID is not required.  However, if you do not supply it, we may have difficulty finding your records to better answer your question.  Hit Cancel to go back and add your PSU ID or hit OK to continue without it.'))
					return true;
				else
					return false;
			}
		else if (typ == 'phone')
			{
			if (myval.length != 0)
				{
				var stripped = myval.replace(/[\(\)\.\-\ ]/g, '');
				//strip out accepTABLE non-numeric characters
				if (isNaN(parseInt(stripped)))
					{
					fld.focus();
					alert('The phone number contains illegal characters.');
					return false;
					}
				else if (!(stripped.length == 10))
					{
					fld.focus();
					alert('The phone number is the wrong length. Make sure you included an area code.');
					return false;
					}
				else
					{
					fld.value = stripped;
					return true;
					}
				}
			else
				return true;
			}
		else if (typ == 'email')
			{
			var emailFilter=/^.+@.+\..{2,3}$/;
			var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
			if (!(emailFilter.test(myval)))
				{
			fld.focus();
				alert('The email address is not formatted correctly.');
				return false;
				}
			else if (myval.match(illegalChars))
				{
				fld.focus();
				alert('The email address contains illegal characters.');
				return false;
				}
			else
				return true;
			}
		else
			return true;
		}
	}

