// -------------------------------------------------------------  VALIDATE FORM -----------------------------------------------------------------------------------
function  validateForm(thisVal)
{
	// we also only want to lock the submit button if the user is continuing, not going back
	if (whichButton == "cmdSubmit")
	{
		if (document.frmMain.submitreq){
			
			if  (!hasValue(thisVal.txtCompany, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtCompany, thisVal.txtCompany.value, "Please enter the Company Name"))
				{
					scrollTo(50,50);
					thisVal.txtCompany.style.background="#FCF141";
					thisVal.txtCompany.focus();
					return false;
				}
			}
			else { thisVal.txtCompany.style.background="#ffffff"; }
		
			if  (!hasValue(thisVal.txtContact, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtContact, thisVal.txtContact.value, "Please enter the Contact Person"))
				{
					scrollTo(50,50);
					thisVal.txtContact.style.background="#FCF141";
					thisVal.txtContact.focus();
					return false;
				}
			}
			else { thisVal.txtContact.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtPhone, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtPhone, thisVal.txtPhone.value, "Please enter the Telephone Number xxx-xxx-xxxx format."))
				{
					scrollTo(150,150);
					thisVal.txtPhone.style.background="#FCF141";
					thisVal.txtPhone.focus();
					return false;
				}
			}
			else { thisVal.txtPhone.style.background="#ffffff"; }
		
			if  (!checkphone(thisVal.txtPhone.value))
			{
				if  (!onError(thisVal, thisVal.txtPhone, thisVal.txtPhone.value, "The Telephone Number must be in xxx-xxx-xxxx format."))
				{
					scrollTo(150,150);
					thisVal.txtPhone.style.background="#FCF141";
					thisVal.txtPhone.focus();
					return false;
				}
			}
			else { thisVal.txtPhone.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtFax, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtFax, thisVal.txtFax.value, "Please enter the Fax Number xxx-xxx-xxxx format."))
				{
					scrollTo(150,150);
					thisVal.txtFax.style.background="#FCF141";
					thisVal.txtFax.focus();
					return false;
				}
			}
			else { thisVal.txtFax.style.background="#ffffff"; }
		
			if  (!checkphone(thisVal.txtFax.value))
			{
				if  (!onError(thisVal, thisVal.txtFax, thisVal.txtFax.value, "The Fax Number must be in xxx-xxx-xxxx format."))
				{
					scrollTo(150,150);
					thisVal.txtFax.style.background="#FCF141";
					thisVal.txtFax.focus();
					return false;
				}
			}
			else { thisVal.txtFax.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtEmail, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtEmail, thisVal.txtEmail.value, "Please enter Email Address."))
				{
					scrollTo(150,150);
					thisVal.txtEmail.style.background="#FCF141";
					thisVal.txtEmail.focus();
					return false;
				}
			}
			else { thisVal.txtEmail.style.background="#ffffff"; }
			
			if(!thisVal.txtEmail.value == ""){
				var re;
				re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
				if  (!checkregex(thisVal.txtEmail.value, re))
				{
					if  (!onError(thisVal, thisVal.txtEmail, thisVal.txtEmail.value, "Email: " + thisVal.txtEmail.value + "\nIs not a valid format."))
					{
						scrollTo(200,200);
						thisVal.txtEmail.style.background="#FCF141";
						thisVal.txtEmail.focus();
						return false;
					}
				}
				thisVal.txtEmail.style.background="#ffffff";
			}
			else { thisVal.txtEmail.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtPUCity, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtPUCity, thisVal.txtPUCity.value, "Please enter the Pick-Up City."))
				{
					scrollTo(150,150);
					thisVal.txtPUCity.style.background="#FCF141";
					thisVal.txtPUCity.focus();
					return false;
				}
			}
			else { thisVal.txtPUCity.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.selPUState, "SELECT" ))
			{
				if  (!onError(thisVal, thisVal.selPUState, thisVal.selPUState.value, "Please select the Pick-Up State"))
				{
					scrollTo(50,50);
					thisVal.selPUState.style.background="#FCF141";
					thisVal.selPUState.focus();
					return false;
				}
			}else { thisVal.selPUState.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtDelCity, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtDelCity, thisVal.txtDelCity.value, "Please enter the Delivery City."))
				{
					scrollTo(150,150);
					thisVal.txtDelCity.style.background="#FCF141";
					thisVal.txtDelCity.focus();
					return false;
				}
			}
			else { thisVal.txtDelCity.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.selDelState, "SELECT" ))
			{
				if  (!onError(thisVal, thisVal.selDelState, thisVal.selDelState.value, "Please select the Delivery State"))
				{
					scrollTo(50,50);
					thisVal.selDelState.style.background="#FCF141";
					thisVal.selDelState.focus();
					return false;
				}
			}else { thisVal.selDelState.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.selProd, "SELECT" ))
			{
				if  (!onError(thisVal, thisVal.selProd, thisVal.selProd.value, "Please select the Product"))
				{
					scrollTo(50,50);
					thisVal.selProd.style.background="#FCF141";
					thisVal.selProd.focus();
					return false;
				}
			}else { thisVal.selProd.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.selTrailerType, "SELECT" ))
			{
				if  (!onError(thisVal, thisVal.selTrailerType, thisVal.selTrailerType.value, "Please select the Trailer Type"))
				{
					scrollTo(50,50);
					thisVal.selTrailerType.style.background="#FCF141";
					thisVal.selTrailerType.focus();
					return false;
				}
			}else { thisVal.selTrailerType.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.txtLoadCount, "TEXT" ))
			{
				if  (!onError(thisVal, thisVal.txtLoadCount, thisVal.txtLoadCount.value, "Please enter the Number of Loads"))
				{
					scrollTo(50,50);
					thisVal.txtLoadCount.style.background="#FCF141";
					thisVal.txtLoadCount.focus();
					return false;
				}
			}
			else { thisVal.txtLoadCount.style.background="#ffffff"; }
			
			if  (!hasValue(thisVal.selLoadFreq, "SELECT" ))
			{
				if  (!onError(thisVal, thisVal.selLoadFreq, thisVal.selLoadFreq.value, "Please select the Load Frequency - Day, Week, Month or Year"))
				{
					scrollTo(50,50);
					thisVal.selLoadFreq.style.background="#FCF141";
					thisVal.selLoadFreq.focus();
					return false;
				}
			}else { thisVal.selLoadFreq.style.background="#ffffff"; }

		}
		//************************* END SECTION 3 ******************************//
		
	}
	return preventDoublePosts()
}