function validateForm(form)
{


	var email = document.form1.email.value;
	var companyname = document.form1.companyname.value;
	var companywebsite = document.form1.companywebsite.value;
	var billingaddress = document.form1.billingaddress.value;
	var billingcity = document.form1.billingcity.value;
	var billingstate = document.form1.billingstate.value;
	var billingzip = document.form1.billingzip.value;
	var contactperson = document.form1.contactperson.value;
	var contactphone = document.form1.contactphone.value;

	
	paymentmethod = document.form1.paymentmethodbox.options[document.form1.paymentmethodbox.selectedIndex].value;
	
	
	var shippingmethod = document.form1.shippingmethodbox.options[document.form1.shippingmethodbox.selectedIndex].value;
	var orderemail = document.form1.orderemail.value;


	var merchandisetype = document.form1.merchandisetype.value;
	var transmitorders = document.form1.transmitordersbox.options[document.form1.transmitordersbox.selectedIndex].value;
	var monthlyorders = document.form1.monthlyorders.value;


	var specialpackaging = document.form1.specialpackaging.value;
	var sortlabelassembleinstructions = document.form1.sortlabelassembleinstructions.value;
	var returnaddress = document.form1.returnaddress.value;

	var receivereturns = document.form1.receivereturnsbox.options[document.form1.receivereturnsbox.selectedIndex].value;
	var customerreturnsinstructions = document.form1.customerreturnsinstructions.value;
	var returnsprocessing = document.form1.returnsprocessing.value;

	var referral = document.form1.referral.value;
	var comments = document.form1.comments.value;

	email = trim(email);

	companyname = trim(companyname);
	companywebsite = trim(companywebsite);
	billingaddress = trim(billingaddress);
	billingcity = trim(billingcity);
	billingstate = trim(billingstate);
	billingcity = trim(billingcity);
	billingzip = trim(billingzip);
	contactperson = trim(contactperson);
	contactphone = trim(contactphone);
	paymentmethod = trim(paymentmethod);
	shippingmethod = trim(shippingmethod);


	orderemail = trim(orderemail);
	merchandisetype = trim(merchandisetype);
	transmitorders = trim(transmitorders);
	monthlyorders = trim(monthlyorders);

	specialpackaging = trim(specialpackaging);
	sortlabelassembleinstructions = trim(sortlabelassembleinstructions);
	returnaddress = trim(returnaddress);
	receivereturns = trim(receivereturns);

	customerreturnsinstructions = trim(customerreturnsinstructions);
	returnsprocessing = trim(returnsprocessing);
	referral = trim(referral);
	comments = trim(comments);

	var errorStr = "";

	if(companyname == "")
	errorStr = "Company Name\n";

	if(billingaddress == "")
		errorStr = errorStr +  "Billing Address\n";

	if(billingcity == "")
	errorStr = errorStr +  "Billing City\n";

	if(billingstate == "")		errorStr = errorStr + "Billing State\n";
	if(billingzip == "")		errorStr = errorStr + "Billing Zip\n";
	if(contactperson == "")		errorStr = errorStr + "Contact Person\n";

	if(contactphone == "")		errorStr = errorStr + "Contact Phon\ne";
	if(paymentmethod == "" || paymentmethod == "-- Select One --" )		errorStr = errorStr + "Payment Method\n";
	if(shippingmethod == "" || shippingmethod == "-- Select One --" )		errorStr = errorStr + "Shipping Method\n";

	if(orderemail == "")		errorStr = errorStr + "Confirmation Email\n";
	if(merchandisetype == "")		errorStr = errorStr + "Merchandise Type\n";
	if(transmitorders == "" || transmitorders  == "-- Select One --" )		errorStr = errorStr + "Transmit Orders?\n";

	if(monthlyorders == "")		errorStr = errorStr + "Number of Monthly Orders\n";

	if(returnaddress == "")		errorStr = errorStr + "Return Address\n";
	if(receivereturns == "" || receivereturns== "-- Select One --" )		errorStr = errorStr + "Receive Returns?\n";
	if(customerreturnsinstructions == "")		errorStr = errorStr + "Customer Return Instructions\n";
	if(returnsprocessing == "")		errorStr = errorStr + "Returns Processing\n";

	if(errorStr != "")
	{
		alert("Please Fill in the Following Fields: \n" + errorStr);
		return false;
	}


	if(!validEmail(orderemail) )	{		return false;	}
	if(!validEmail(email) )	{		return false;	}


	document.form1.submit;

}



function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

}

function validEmail(str)
{
  //var field = form.email; // email field
 // var str = field.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid

  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid

    return true;
  }
  alert("\"" + str + "\" Is An Invalid Email");

  return false;
}
