﻿function DoNotPostBack()
{
	return false;
}


function validateform()
{
	var sElement = "";
	var lProblem = 0;

	if(document.theForm.company_name.value + "" == "")
	{ sElement = "Company Name";
	  lProblem=1;
	}		
	
	else if(document.theForm.company_area_code.value + "" == "")
	{ sElement = "Area Code";
	  lProblem=1;
	}	
	else if(isNaN(document.theForm.company_area_code.value))
	{ sElement = "Area Code";
	  lProblem=2;
	}
	else if(document.theForm.company_phone_begin.value + "" == "")
	{ sElement = "Company Phone";
	  lProblem=1;
	}	
	else if(isNaN(document.theForm.company_phone_begin.value))
	{ sElement = "Company Phone";
	  lProblem=2;
	}
	else if(document.theForm.company_phone_end.value + "" == "")
	{ sElement = "Company Phone";
	  lProblem=1;
	}		
	else if(isNaN(document.theForm.company_phone_end.value))
	{ sElement = "Company Phone";
	  lProblem=2;
	}
	else if(document.theForm.address1.value + "" == "")
	{ sElement = "Address";
	  lProblem=1;
	}	
	else if(document.theForm.city.value + "" == "")
	{ sElement = "City";
	  lProblem=1;
	}
	else if(document.theForm.state.value + "" == "")
	{ sElement = "State";
	  lProblem=1;
	}	
	else if(isNaN(document.theForm.zip.value))
	{ sElement = "Zip";
	  lProblem=2;
	}
	else if(document.theForm.zip.value + "" == "")
	{ sElement = "Zip";
	  lProblem=1;
	}
	else if(document.theForm.fname.value + "" == "")
	{ sElement = "First Name";
	  lProblem=1;
	}
	else if(document.theForm.lname.value + "" == "")
	{ sElement = "Last Name";
	  lProblem=1;
	}
	else if(document.theForm.p_area_code.value + "" == "")
	{ sElement = "Primary Contact Area Code";
	  lProblem=1;
	}	
	else if(isNaN(document.theForm.p_area_code.value))
	{ sElement = "Primary Contact Area Code";
	  lProblem=2;
	}
	else if(document.theForm.p_telephone_begin.value + "" == "")
	{ sElement = "Primary Contact Phone";
	  lProblem=1;
	}	
	else if(isNaN(document.theForm.p_telephone_begin.value))
	{ sElement = "Primary Contact Phone";
	  lProblem=2;
	}
	else if(document.theForm.p_telephone_end.value + "" == "")
	{ sElement = "Primary Contact Phone";
	  lProblem=1;
	}		
	else if(isNaN(document.theForm.p_telephone_end.value))
	{ sElement = "Primary Contact Phone";
	  lProblem=2;
	}
	else if(document.theForm.p_email.value + "" == "")
	{ sElement = "Primary Contact Email";
	  lProblem=1;
	}			  
	if(lProblem==0)
	{return true;
	}
	else if(lProblem==1)
	{alert("The fields names in bold print are required in order to process your request.\nClick 'OK' and fill in the " + sElement + " field.");
	 return false;
	}
	else if(lProblem==2)
	{alert("Use only numbers for your " + sElement + ".");
	 return false;
	}
	else
	{return true;
	}
}
