function validateQty() {
  with (document.ContactForm) {
    errorMsg = "";
    if (Quantity.value.length < 3)  errorMsg += "\nPlease enter a Quantity - Minimum order is 250 cards";
    else
    if (isNaN(Quantity.value))  errorMsg += "\nPlease enter a Number for Quantity - Minimum order is 250 cards";
    else
    if (Quantity.value < 250)  errorMsg += "\nMinimum order is 250 cards";
    else {
	    tempCost1 = "$" + ((1*Quantity.value-250)*.50)
		if(Quantity.value%2>0) tempCost1 = tempCost1+"0"
	    Cost1.value = tempCost1

	    tempCost = "$" + (247.50 + (1*Quantity.value-250)*.50)
		if(Quantity.value%2<1) tempCost = tempCost+"0"
	    Cost.value = tempCost

	    //Cost.value = "Cost: $" + (350 + (1*Quantity.value-250)*.50)
    }
	  if (errorMsg.length > 0) {
	    errorMsg = "The following errors must be corrected before submitting this form: \n" + errorMsg
	    alert (errorMsg);
	    return false;
	  }
  }
}

function validateContact() {

   var pattern = /\s*\w+@[^\.]+\.[^\.]+(\.[^\.])*\s*/;
   var letters = /[a-zA-Z]/;
   var numbers = /[0-9]/;
   legalChars = "~0123456789.-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@+";
   alphaNums = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
   errorMsg = "";

    with (document.ContactForm) {

    if (Product.selectedIndex < 1)  errorMsg += "\nPlease select a Product";
//    if (Quantity.selectedIndex < 1)  errorMsg += "\nPlease select a Quantity";

    if (Quantity.value.length < 3)  errorMsg += "\nPlease enter a Quantity - Minimum order is 250 cards";
    else
    if (isNaN(Quantity.value))  errorMsg += "\nPlease enter a Number for Quantity - Minimum order is 250 cards";
    else
    if (Quantity.value < 250)  errorMsg += "\nMinimum order is 250 cards";
    else {
	    tempCost = "Cost: $" + (247.50 + (1*Quantity.value-250)*.50)
		if(Quantity.value%2>0) tempCost = tempCost+"0"
	    Cost.value = tempCost

	    //Cost.value = "Cost: $" + (350 + (1*Quantity.value-250)*.50)
    }


    if (FromName.value.length < 2)  errorMsg += "\nPlease provide your name";
    if (FromCompany.value.length < 2) errorMsg += "\nCompany is required";
    if (FromPhone.value.length < 10)  errorMsg += "\nPhone Number is required";
//    if (FromCity.value.length < 2)    errorMsg += "\nCity is required";
//    if (FromState.value.length < 2)   errorMsg += "\nState is required";

  if (FromEmail.value.length < 7)
    errorMsg += "\nE-Mail address must be at least 7 characters";
  //Validate Email against pattern match
  if (FromEmail.value != "") {
      if(!pattern.test(FromEmail.value)) {
      errorMsg += "\nInvalid E-Mail Address."
      }
  }
  //This enhances the previous EMail check. This checks for legal values and returns illegal values
  if (FromEmail.value != "" && FromEmail.value.length > 1) {
      for(x=0; x < FromEmail.value.length; x++) {
    if (legalChars.indexOf(FromEmail.value.substring(x,x+1)) < 0)
        errorMsg += "\n" + "Illegal character '"+FromEmail.value.substring(x,x+1)+"' at position " +(x+1)+ " in E-Mail Address.";
      }
  }
//    }

  //FINAL CHECK FOR ERROR MESSAGES
  if (errorMsg.length > 0) {
    errorMsg = "The following errors must be corrected before submitting this form: \n" + errorMsg
    alert (errorMsg);
    return false;
  }

   }  //end WITH

return true;
}
