function ValidateCert(){
 var pValue  = document.ProductSelect.p.options[document.ProductSelect.p.selectedIndex].value; 
 var pmValue = document.ProductSelect.PrintMail.options[document.ProductSelect.PrintMail.selectedIndex].value;
 var xValue = document.ProductSelect.x.value = pmValue; // hidden field. May be modified below.
  // AddOrderValidate.cfm sets url.x to form.x.  Url.x is used by Add2One and Add2All
 
 if (pValue=="85"){                                          // !!! ID of any amount cert
  if ( !ValidateCertAmt(document.ProductSelect.DollarAmount) ) return false;  
  xValue = xValue +"-"+ document.ProductSelect.DollarAmount.value;
 }
 document.ProductSelect.x.value = xValue;
 gValue = document.ProductSelect.g.options[document.ProductSelect.g.selectedIndex].value;

 if (gValue=="ADD2ORDER"){ // User hits Enter from DollarAmount field.
  alert("Please click on the Add to Order choice to select the person you would like to ship to.");
  // document.ProductSelect.g.focus();
  return false;
 }

 return true;
}

function ValidateForm(){
 if (! ValidateCert() ) return false;

 document.ProductSelect.submit();
 return true;
}

function ValidateCertAmt(theObj){
 if ( !ValidateNumber(theObj) ) return false;
 if (theObj.value <1){
  alert("Please enter an amount that is at least $1.00");
  theObj.focus();
  return false;
 }
 return true; 
}

function CheckDollarAmount(){
 if (document.ProductSelect.p.value=="85") {       // !!! ID of any amount cert
  document.getElementById("DollarDiv").style.visibility="visible";
  document.ProductSelect.DollarAmount.focus();
  
 }else{
  document.getElementById("DollarDiv").style.visibility="hidden"; 
  document.ProductSelect.DollarAmount.value="";
 }
 
 return true;
}
