
function	trim(strSource)	{
	re = /^\s+|\s+$/g;
	return strSource.replace(re, '');
}

function check_form()	{
	var f = document.form1;
	var chk = 1, msg = "Check the following entry(ies).\n\n";

	f.regclassno.className = "formok";
	f.regfirstname.className = "formok";
	f.reglastname.className = "formok";
	f.age.className = "formok";
	f.countrycode.className = "formok";
	f.stemail.className = "formok";
	f.address.className = "formok";
	f.city.className = "formok";
	f.zipcode.className = "formok";
	f.cellphone.className = "formok";
	f.homephone.className = "formok";
	f.jobno.className = "formok";
	f.languagecode.className = "formok";
	f.refno.className = "formok";
	f.securityCode.className = "formok";


	f.regfirstname.value = trim(f.regfirstname.value);
	f.reglastname.value = trim(f.reglastname.value);
	f.stemail.value = trim(f.stemail.value);
	f.address.value = trim(f.address.value);
	f.city.value = trim(f.city.value);
	f.zipcode.value = trim(f.zipcode.value);
	f.homephone.value = trim(f.homephone.value);
	f.cellphone.value = trim(f.cellphone.value);
	f.securityCode.value = trim(f.securityCode.value);

	if(f.regclassno.options[0].selected == true)	{
		msg = msg + "      Class\n"
		chk = 0
		f.regclassno.className = "formerror";
	}

	if(f.regfirstname.value == "")	{
		msg = msg + "      First Name\n";
		chk = 0
		f.regfirstname.className = "formerror";
	}

	if(f.reglastname.value == "")	{
		msg = msg + "      Last Name\n";
		chk = 0
		f.reglastname.className = "formerror";
	}

	if(f.age.options[0].selected == true)	{
		msg = msg + "      Age\n"
		chk = 0
		f.age.className = "formerror";
	}

	if(f.countrycode.options[0].selected == true)	{
		msg = msg + "      Ethnic Group\n"
		chk = 0
		f.countrycode.className = "formerror";
	}

	if(f.stemail.value == "")	{
		msg = msg + "      E-Mail\n";
		chk = 0
		f.stemail.className = "formerror";
	}

	if(f.address.value == "")	{
		msg = msg + "      Street\n";
		chk = 0
		f.address.className = "formerror";
	}

	if(f.city.value == "")	{
		msg = msg + "      City\n";
		chk = 0
		f.city.className = "formerror";
	}

	if(f.zipcode.value == "")	{
		msg = msg + "      Zip Code\n";
		chk = 0
		f.zipcode.className = "formerror";
	}

	if(f.cellphone.value == "")	{
		msg = msg + "      Mobile Phone\n";
		chk = 0
		f.cellphone.className = "formerror";
	}

	if(f.jobno.options[0].selected == true)	{
		msg = msg + "      Occupation\n"
		chk = 0
		f.jobno.className = "formerror";
	}

	if(f.languagecode.options[0].selected == true)	{
		msg = msg + "      Language\n"
		chk = 0
		f.languagecode.className = "formerror";
	}

	if(f.refno.options[0].selected == true)	{
		msg = msg + "      How did you hear us?\n"
		chk = 0
		f.refno.className = "formerror";
	}

	if(f.securityCode.value == "")	{
		msg = msg + "      Verification Code\n";
		chk = 0
		f.securityCode.className = "formerror";
	}

	if(chk == 0)
		alert(msg);
	else
		f.submit();
}
