window.onload = SetFocus;

function SetFocus() {
	document.form1.your_name.focus();
}

function Validate(frmName) {
//	alert("Start validation");
	var strErrors="";

//	validate name - must be 2-100 characters
	var your_name = trim(document.form1.your_name.value);
	document.form1.your_name.value = your_name;
	if	((your_name.length < 2) || (your_name.length > 100)){
		if (strErrors=="") { document.form1.your_name.focus(); }
		strErrors = strErrors + "* Please enter your name\n";
	}

//	validate query - must be 2-200 characters
	var your_query = trim(document.form1.your_query.value);
	document.form1.your_query.value = your_query;
	if	((your_query.length < 2) || (your_query.length > 200)){
		if (strErrors=="") { document.form1.your_query.focus(); }
		strErrors = strErrors + "* Please enter your query (maximum 200 characters)\n";
	}

//	validate email address - must be 6-70 characters
	var your_email = trim(document.form1.your_email.value);
	document.form1.your_email.value = your_email;
	if	((your_email.length < 6) || (your_email.length > 70)){
		if (strErrors=="") { document.form1.your_email.focus(); }
		strErrors = strErrors + "* Please enter a valid email address\n";
	}

//	alert("End validation");

	if (strErrors!="") {
		alert ("Please correct the following errors:\n\n" + strErrors);
		return false;
	}
			
	return true;
}

function trim(arg)
{
  return arg.replace(/(^\s+)|(\s+$)/g, "");
}

