<!-- contact form validation script -->

 function trim(inStr) {

	var i =0;
	var s=inStr;
	var sOut= "";
	for (i =0; i<s.length; i++) {
		if (s.substr(i, 1) != " " )
			sOut = sOut + s.substr(i, 1);
	}
	
	return sOut;
 }

 function checkData() {
 
 
	if (trim(document.form1.realname.value) == "") {
		alert("Please enter your name.");
		document.form1.realname.focus();
		return false;
	}
	
	if (trim(document.form1.agencyname.value) == "") {
		alert("Please enter your agency.");
		document.form1.agencyname.focus();
		return false;
	}
	
	if (trim(document.form1.address.value) == "") {
		alert("Please enter your address.");
		document.form1.address.focus();
		return false;
	}
	
	if (trim(document.form1.city.value) == "") {
		alert("Please enter your city.");
		document.form1.city.focus();
		return false;
	}
	
	if (trim(document.form1.state.value) == "") {
		alert("Please enter your state.");
		document.form1.state.focus();
		return false;
	}
	
	if (trim(document.form1.zip.value) == "") {
		alert("Please enter your zip code.");
		document.form1.zip.focus();
		return false;
	}
	
	if (trim(document.form1.phone.value) == "") {
		alert("Please enter your phone number.");
		document.form1.phone.focus();
		return false;
	}
	
	var sEmail;
	sEmail = trim(document.form1.email.value);
	
	if (sEmail == "") {
		alert("Please enter your email address.");
		document.form1.email.focus();
		return false;
	}
	
	if (sEmail.indexOf("@") == -1) {
		alert("Your forgot the @ symbol in your email address.");
		document.form1.email.focus();
		return false;
	}
	
	if (sEmail.indexOf(".") == -1) {
		alert("Your forgot the . symbol in your email address.");
		document.form1.email.focus();
		return false;
	}
	
	if (trim(document.form1.product.value) == "none") {
		alert("Please select a product.");
		document.form1.product.focus();
		return false;
	}
	
	if (document.form1.contact[1].checked == true & trim(document.form1.referred.value) == "") {
		alert("Please enter the referring agents name.");
		document.form1.referred.focus();
		return false;
	}
	
	if (document.form1.contact[2].checked == true & trim(document.form1.products.value) == "") {
		alert("Please enter the product name.");
		document.form1.products.focus();
		return false;
	}
	
//if (trim(document.form1.comments.value) == "") {
//		alert("Please enter your comments.");
//		document.form1.comments.focus();
//		return false;
//	}

	return true;
 }
 

