// function getFocus sets page focus to the first available formfield, if any
// function validate checks form submission data
<!--
function getFocus()
	{ 
		if (document.forms.length)
			{
			document.forms[0].elements[0].focus();
			return false;
			}
	}
function countInstances(string, word) {
  var substrings = string.split(word);
  return substrings.length - 1;
}
function validate()
	{
	var lettersonly = /^([a-zA-Z])+$/;
	if (document.forms[0].firstname.value == "")
		{
			alert("Please enter your First Name.");
			document.forms[0].firstname.focus();
			document.forms[0].firstname.select();
			return false;
		}
	if (document.forms[0].lastname.value == "")
		{
			alert("Please enter your Last Name.");
			document.forms[0].lastname.focus();
			document.forms[0].lastname.select();
			return false;
		}
	if (document.forms[0].firstname.value.length < 2)
		{
			alert("Please enter at least 2 characters in the First Name field.");
			document.forms[0].firstname.focus();
			document.forms[0].firstname.select();
			return false;
		}
	if (document.forms[0].lastname.value.length < 2)
		{
			alert("Please enter at least 2 characters in the Last Name field.");
			document.forms[0].lastname.focus();
			document.forms[0].lastname.select();
			return false;
		}
	if (!lettersonly.test(document.forms[0].firstname.value))
		{
			alert("Only letters are allowed in the First Name field.");
			document.forms[0].firstname.focus();
			document.forms[0].firstname.select();
			return false;
		}
	if (!lettersonly.test(document.forms[0].lastname.value))
		{
			alert("Only letters are allowed in the Last Name field.");
			document.forms[0].lastname.focus();
			document.forms[0].lastname.select();
			return false;
		}
	if (document.forms[0].companyname.value == "")
		{
			alert("Please tell us your company name or enter none if not applicable.");
			document.forms[0].companyname.focus();
			document.forms[0].companyname.select();
			return false;
		}
	if (countInstances(document.forms[0].companyname.value,'@') > 0)
		{
			alert("The @ character is not allowed in the Company Name field.");
			document.forms[0].companyname.focus();
			document.forms[0].companyname.select();
			return false;
		}
	if (document.forms[0].email.value == "")
		{
			alert("Please specify a valid e-mail address. Format: me@myisp.com");
			document.forms[0].email.focus();
			document.forms[0].email.select();
			return false;
		}
	if (countInstances(document.forms[0].email.value,'@') > 1)
		{
			alert("Please specify a valid e-mail address. Format: me@myisp.com");
			document.forms[0].email.focus();
			document.forms[0].email.select();
			return false;
		}
	if (!document.forms[0].email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
		{
			alert("Please specify a valid e-mail address. Format: me@myisp.com");
			document.forms[0].email.focus();
			document.forms[0].email.select();
			return false;
		}
	if (document.forms[0].comments.value == "")
		{
			alert("Please tell us how we can help you.");
			document.forms[0].comments.focus();
			document.forms[0].comments.select();
			return false;
		}
	if (countInstances(document.forms[0].comments.value,'@') > 0)
		{
			alert("The @ character is not allowed in the Questions/Comments field.");
			document.forms[0].comments.focus();
			document.forms[0].comments.select();
			return false;
		}
	if (document.forms[0].email.value == "me@myisp.com")
		{
			alert("Haha. Very funny.");
			document.forms[0].email.value = "";
			document.forms[0].email.focus();
			document.forms[0].email.select();
			return false;
		}
	if (document.forms[0].firstname.value.length > 26)
		{
			alert("Please limit your entry to 26 characters.");
			document.forms[0].firstname.focus();
			document.forms[0].firstname.select();
			return false;
		}
	if (document.forms[0].lastname.value.length > 26)
		{
			alert("Please limit your entry to 26 characters.");
			document.forms[0].lastname.focus();
			document.forms[0].lastname.select();
			return false;
		}
	if (document.forms[0].email.value.length > 40)
		{
			alert("Please limit your entry to 40 characters.");
			document.forms[0].email.focus();
			document.forms[0].email.select();
			return false;
		}
	if (document.forms[0].companyname.value.length > 30)
		{
			alert("Please limit your entry to 30 characters.");
			document.forms[0].companyname.focus();
			document.forms[0].companyname.select();
			return false;
		}
	if (document.forms[0].comments.value.length > 400)
		{
			alert("Please limit your entry to 400 characters.");
			document.forms[0].comments.focus();
			document.forms[0].comments.select();
			return false;
		}
	
}
// -->