<!-- //

function validateForm(){

////////////////////////////////////////////////////////
//shorten the references to form field names 
// check if required form fields are empty
//////////////////////////////////////////////////////////////

	var Name = document.request.Prospect_Name;
	var Street = document.request.Street_Address;
	var City = document.request.City;
	var State = document.request.State;
	var Zip = document.request.Zip;
	var Phone = document.request.Phone; 
	var email = document.request.Email_address; 

	
	if(Name.value == ""){ 
		alert("Please tell us your name.") ;
		Name.focus();
		return false;
	}
	if(Street.value == ""){ 
		alert("Please type in your complete street address.") ;
		Street.focus();
		return false;
	}
	if(City.value == ""){ 
		alert("Please type in your city.") ;
		City.focus();
		return false;
	}
	if(State.value == ""){ 
		alert("Please select a state.") ;
		State.focus();
		return false;
	}	

	if((Zip.value==null)||(Zip.value == "")){ 
		alert("Please enter your 5 digit or 5 digit+4 zip code.") ;
		Zip.focus();
		Zip.select();		
		return false;
	}
// The zip code must be numeric and must be 5 or 10 digits in length

	if (Zip.value.length!=5 && Zip.value.length!=10) {
		alert("Please enter a valid 5 digit or 5 digit+4 zip code.");
		Zip.focus();
		Zip.select();		
		return false;
	}

	var valid = "0123456789-";
	var hyphencount = 0;
	var temp;

	for (var i=0; i < Zip.length; i++) {
		temp = "" + Zip.substring(i, i+1);
		if (temp == "-") hyphencount++;
		if (valid.indexOf(temp) == "-1") {
			alert("Invalid characters in your zip code. \n\n Please try again.");
			Zip.select();					
			return false;
		}

		if ((hyphencount > 1) || ((Zip.length==10) && ""+Zip.charAt(5)!="-")) {
			alert("The hyphen character should be used with a properly formatted 5 digit+four zip code: \n ex: '12345-6789'. \n  Please try again.");
			Zip.select();		
			return false;
	    }
	}

// end zip code validation

	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please enter a valid phone number.");
		Phone.focus();
		return false;
	}


// The phone number must be at least characters long : (xxx) xxx-xxxx format

	if (Phone.value.length!=12) {
		alert("Please enter a phone number in the format of '123-456-7890'.");
		Phone.focus();
		Phone.select();		
		return false;
	}
	

// check position of dashes and parens
	var hyphencount = 0;
	var temp="";
	var valid = "0123456789-()";
	
	for (var i=0; i < Phone.length; i++) {
		temp = "" + Phone.substring(i, i+1);
		if (temp == "-") hyphencount++;
		if (temp == "(") opencount++;
		if (temp == ")") closecount++;		

		if (valid.indexOf(temp) == "-1") {
			alert("Invalid characters in your phone number. \n Please try again.");
			Phone.select();					
			return false;
		}

		if ((hyphencount > 1) || ((Phone.length==12) && ""+Phone.charAt(4)!="-")) {
			alert("Please enter a valid format of the phone number: \n'123-456-7890'.");
			Phone.select();
			return false;
	    }
		if ((hyphencount > 1) || ((Phone.length==12) && ""+Phone.charAt(8)!="-")) {
			alert("Please enter a valid format of the phone number: \n'123-456-7890'.");
			Phone.select();
			return false;
	    }		

	}

// end phone number validation//////////////////////////////
//////////////////////////////////////////////////////////////
// CHECK select box values
////////////////////////////////////////////////////////////// 

	var ref = document.request.Referral; 
	var other_ref = document.request.Referral_other; 
	
	
if  (ref.value==""  ) {
			alert("Please tell us how you found our Web site.");
			ref.focus();
			return false;
}

if ( (ref[7].selected==true)  || (ref[9].selected==true)  ) {

	if(other_ref.value == "" )  {
			alert("Please tell us how you found our Web site 2.");
			other_ref.focus();
			return false;
		}

}

//if the emailAddrs does not contain the @ symbol or a full stop
// emailAddress = email.value
	 if( (email.value.indexOf('@')== -1)
		|| (email.value.indexOf('.')== -1) ) {
		alert("The email field requires a \"@\" and a \".\"be used. \n\nPlease enter a valid email address.") ;
		email.focus();
		email.select();
		return false;		
	}

// check that at least 2 characters follow the .
	if( (email.value.charAt(email.value.length-4) != '.')
		&& (email.value.charAt(email.value.length-3) != '.') ) {  
		alert("You have entered an invalid email extension. You must have 2 or 3 digits after the '.' Please enter a valid email.");
		email.focus();
		email.select();
		return false;
	} 

// check that at least 2 characters follow the .
	if (  
			(Email.value.charAt(Email.value.length-4) != '.') && 
			(Email.value.charAt(Email.value.length-3) != '.') 
	)  

	{	alert("You have entered an invalid email extension. You must have 2 or 3 digits after the '.' Please enter a valid email address.");
		Email.focus();
		Email.select();
		return false;
	} 

// end email validation

//////////////////////////////////////////////////////////////
//if the form passes the above conditions
//allow submission

 return true;

} 

//////////////////////////////////////////////////////////////
// end function -->