/*************************************/
/******* VALIDATE SERVICE FORM *******/
/*************************************/

function Service_Validator(theForm)
{
	if (theForm.Company_Name.value == "")
	{
		alert("Please enter a value for the \"Company Name\" field.");
		theForm.Company_Name.focus();
		return (false);
	}
	
	if (theForm.Contact.value == "")
	{
		alert("Please enter a value for the \"Contact\" field.");
		theForm.Contact.focus();
		return (false);
	}
	
	if (theForm.Address.value == "")
	{
		alert("Please enter a value for the \"Address\" field.");
		theForm.Address.focus();
		return (false);
	}
	
	if (theForm.City.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.City.focus();
		return (false);
	}
	
	if (theForm.State.value == "")
	{
		alert("Please enter a value for the \"State\" field.");
		theForm.State.focus();
		return (false);
	}
	
	if (theForm.Zip_Code.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.Zip_Code.focus();
		return (false);
	}
	
	if (theForm.Phone_Number.value == "")
	{
		alert("Please enter a value for the \"Phone Number\" field.");
		theForm.Phone_Number.focus();
		return (false);
	}
	
	if (theForm.Email_Address.value == "")
	{
		alert("Please enter a value for the \"Email Address\" field.");
		theForm.Email_Address.focus();
		return (false);
	}
	
	if (theForm.Machine_Make.value == "")
	{
		alert("Please enter a value for the \"Machine Make\" field.");
		theForm.Machine_Make.focus();
		return (false);
	}


	if (theForm.Model.value == "")
	{
	  alert("Please enter a value for the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	/*
	if (theForm.Model.value.length < 10)
	{
	  alert("Please enter at least 10 characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	if (theForm.Model.value.length > 15)
	{
	  alert("Please enter at most 15 characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	var checkOK = "0123456789-.";
	var checkStr = theForm.Model.value;
	var allValid = true;
	var validGroups = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	  if (ch == ".")
	  {
	    allNum += ".";
	    decPoints++;
	  }
	  else
	    allNum += ch;
	}
	if (!allValid)
	{
	  alert("Please enter only digit characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	if (decPoints > 1 || !validGroups)
	{
	  alert("Please enter a valid number in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	*/
	
	if (theForm.Serial_Number.value == "")
	{
		alert("Please enter a value for the \"Serial Number\" field.");
		theForm.Serial_Number.focus();
		return (false);
	}
	
	if (theForm.Service_Problem.value == "")
	{
		alert("Please enter a value for the \"Service Problem\" field.");
		theForm.Service_Problem.focus();
		return (false);
	}
	
	if (theForm.Type_Of_Request.value == "")
	{
		alert("Please enter a value for the \"Type of Request\" field.");
		theForm.Type_Of_Request.focus();
		return (false);
	}
	  
  return (true);
}



/***********************************/
/******* VALIDATE PARTS FORM *******/
/***********************************/

function Parts_Validator(theForm)
{
	if (theForm.Company_Name.value == "")
	{
		alert("Please enter a value for the \"Company Name\" field.");
		theForm.Company_Name.focus();
		return (false);
	}
	
	if (theForm.Contact.value == "")
	{
		alert("Please enter a value for the \"Contact\" field.");
		theForm.Contact.focus();
		return (false);
	}
	
	if (theForm.Billing_Address.value == "")
	{
		alert("Please enter a value for the \"Billing Address\" field.");
		theForm.Billing_Address.focus();
		return (false);
	}
	
	if (theForm.Shipping_Address.value == "")
	{
		alert("Please enter a value for the \"Shipping Address\" field.");
		theForm.Shipping_Address.focus();
		return (false);
	}
	
	if (theForm.City.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.City.focus();
		return (false);
	}
	
	if (theForm.State.value == "")
	{
		alert("Please enter a value for the \"State\" field.");
		theForm.State.focus();
		return (false);
	}
	
	if (theForm.Zip_Code.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.Zip_Code.focus();
		return (false);
	}
	
	if (theForm.Phone_Number.value == "")
	{
		alert("Please enter a value for the \"Phone Number\" field.");
		theForm.Phone_Number.focus();
		return (false);
	}
	
	if (theForm.Email_Address.value == "")
	{
		alert("Please enter a value for the \"Email Address\" field.");
		theForm.Email_Address.focus();
		return (false);
	}
	
	if (theForm.Machine_Make.value == "")
	{
		alert("Please enter a value for the \"Machine Make\" field.");
		theForm.Machine_Make.focus();
		return (false);
	}

	/*
	if (theForm.Model.value == "")
	{
	  alert("Please enter a value for the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	if (theForm.Model.value.length < 10)
	{
	  alert("Please enter at least 10 characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	if (theForm.Model.value.length > 15)
	{
	  alert("Please enter at most 15 characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	var checkOK = "0123456789-.";
	var checkStr = theForm.Model.value;
	var allValid = true;
	var validGroups = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	  if (ch == ".")
	  {
	    allNum += ".";
	    decPoints++;
	  }
	  else
	    allNum += ch;
	}
	if (!allValid)
	{
	  alert("Please enter only digit characters in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	
	if (decPoints > 1 || !validGroups)
	{
	  alert("Please enter a valid number in the \"Model\" field.");
	  theForm.Model.focus();
	  return (false);
	}
	*/
	
	if (theForm.Serial_Number.value == "")
	{
		alert("Please enter a value for the \"Serial Number\" field.");
		theForm.Serial_Number.focus();
		return (false);
	}
	
	if (theForm.Part_Number.value == "")
	{
		alert("Please enter a value for the \"Part Number\" field.");
		theForm.Part_Number.focus();
		return (false);
	}
	
	if (theForm.Shipping_Method.value == "")
	{
		alert("Please enter a value for the \"Shipping Method\" field.");
		theForm.Shipping_Method.focus();
		return (false);
	}
	
	if (theForm.Inquiry_Type.value == "")
	{
		alert("Please enter a value for the \"Inquiry Type\" field.");
		theForm.Inquiry_Type.focus();
		return (false);
	}
	  
  return (true);
}



/*************************************/
/******* VALIDATE CONTACT FORM *******/
/*************************************/

function Contact_Validator(theForm)
{
	if (theForm.Company_Name.value == "")
	{
		alert("Please enter a value for the \"Company Name\" field.");
		theForm.Company_Name.focus();
		return (false);
	}
	
	if (theForm.Contact.value == "")
	{
		alert("Please enter a value for the \"Contact\" field.");
		theForm.Contact.focus();
		return (false);
	}
	
	if (theForm.Address.value == "")
	{
		alert("Please enter a value for the \"Address\" field.");
		theForm.Address.focus();
		return (false);
	}
	
	if (theForm.City.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.City.focus();
		return (false);
	}
	
	if (theForm.State.value == "")
	{
		alert("Please enter a value for the \"State\" field.");
		theForm.State.focus();
		return (false);
	}
	
	if (theForm.Zip_Code.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.Zip_Code.focus();
		return (false);
	}
	
	if (theForm.Phone_Number.value == "")
	{
		alert("Please enter a value for the \"Phone Number\" field.");
		theForm.Phone_Number.focus();
		return (false);
	}
	
	if (theForm.Email_Address.value == "")
	{
		alert("Please enter a value for the \"Email Address\" field.");
		theForm.Email_Address.focus();
		return (false);
	}
	
	if (theForm.Interests.value == "")
	{
		alert("Please enter a value for the \"Interests\" field.");
		theForm.Interests.focus();
		return (false);
	}
	
  return (true);
}