function validate_form(form) {

      if (!check_empty(document.forminvoice.name.value))  {
        alert("Please enter the Client's name");
        document.forminvoice.name.focus();
        return false;  
      }

      if (!check_empty(document.forminvoice.address1.value))  {
        alert("Please enter Client's address");
        document.forminvoice.address1.focus();
        return false;  
      }

      if (!check_empty(document.forminvoice.city.value))  {
         alert("Please enter the Client's city");
         document.forminvoice.city.focus(); 
         return false;
      }

      if (!check_empty(document.forminvoice.country.value))  {
         alert("Please enter the Client's country");
         document.forminvoice.country.focus(); 
         return false;
      }

      if ((!check_empty(document.forminvoice.buyeremail.value)) && (document.forminvoice.sendmail.checked))  {
         alert("Please enter Client's Email address if checking the Send Email box.");
         document.forminvoice.buyeremail.focus(); 
         return false;
      }
            
      if (!check_empty(document.forminvoice.itemname.value))  {
         alert('Please enter the service performed for the Client');
         document.forminvoice.itemname.focus(); 
         return false;
      }

      if (!check_empty(document.forminvoice.price.value))  {
         alert('Please enter the price for the services (xxxx.xx)');
         document.forminvoice.price.focus(); 
         return false;
      }
      
      if (document.forminvoice.spamcheck.value != "right")  {
        alert("Correct answer to the mandatory question is 'right', small letters without the quotes");
        document.forminvoice.spamcheck.focus();
        document.forminvoice.spamcheck.select();
        return false;  
      }

   return true;

   }

function check_empty(text) {
  return (text.length > 0); // returns false if empty
}

function submitPPform() {
  document.ppbuyform.submit();
}

function validate_form2(form) {
      if (!check_empty(document.formpayment.itemnumber.value))  {
        alert('Please enter your Invoice Number');
        document.formpayment.itemnumber.focus();
        return false;  
      }
      if (document.formpayment.spamcheck.value != "right")  {
        alert("Correct answer to the mandatory question is 'right', small letters without the quotes");
        document.formpayment.spamcheck.focus();
        document.formpayment.spamcheck.select();
        return false;  
      }
 return true;
}

function validate_form3(form) {
      if (!check_empty(document.paymentmade.gross2.value))  {
        alert('Please enter the amount paid in USD.');
        document.paymentmade.gross2.focus();
        return false;  
      }
      if (!check_empty(document.paymentmade.method2.value))  {
        alert("Please enter the payment method from selections.");
        document.paymentmade.method2.focus();
        return false;  
      }
 return true;
}

function makePayment(n) {
   if (n==0) {
      document.payment.item_number.value = document.payment.payitem.value;
   } else {
       document.payment.item_number.value = document.payment.payitem[n].value;
     }
   document.payment.action.value = "submit1";
   document.payment.submit();   
}