function validate_paymentinfo(theForm)
{

  if (theForm.payment_entity_name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.payment_entity_name.focus();
    return (false);
  }
  
  if (theForm.payment_address_line_1.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.payment_address_line_1.focus();
    return (false);
  }
  
  if (theForm.payment_city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.payment_city.focus();
    return (false);
  }
  
  if (theForm.payment_state_or_province.value == "")
  {
    alert("Please enter a value for the \"State/Province\" field.");
    theForm.payment_state_or_province.focus();
    return (false);
  }
  
  if (theForm.payment_postal_code.value == "")
  {
    alert("Please enter a value for the \"Zip/Postal Code\" field.");
    theForm.payment_postal_code.focus();
    return (false);
  }  
  
  if (theForm.payment_phone.value == "")
  {
    alert("Please enter a value for the \"Telephone number\" field.");
    theForm.payment_phone.focus();
    return (false);
  }  
  
  if (theForm.payment_email_address.value == "")
  {
    alert("Please enter a value for the \"eMail Address\" field.");
    theForm.payment_email_address.focus();
    return (false);
  }  
  
  if (theForm.payment_email_address_confirm.value == "")
  {
    alert("Please enter a value for the \"eMail Address Confirmation\" field.");
    theForm.payment_email_address_confirm.focus();
    return (false);
  }  
  
  var email1 = theForm.payment_email_address.value;
  var email2 = theForm.payment_email_address_confirm.value;
  if (email1 !=  email2)
  {
    alert("Please make sure both email addresses are the same.");
    theForm.payment_email_address.focus();
    return (false);
  } 
  
  if (theForm.referred_by.value == "")
  {
    alert("Please enter the name of the Doctor who referred you to this site.");
    theForm.referred_by.focus();
    return (false);
  }   

  if (theForm.payment_card_type.value == "")
  {
    alert("Please select the type of credit card.");
    theForm.payment_card_type.focus();
    return (false);
  }   
  
  if (theForm.payment_card_number.value == "")
  {
    alert("Please enter a value for the \"Credit Card Number\" field.");
    theForm.payment_card_number.focus();
    return (false);
  }   
  
  if (theForm.payment_expiration_month.value == "" || theForm.payment_expiration_year.value == "")
  {
    alert("Please enter a value for the \"Expiration Date\" fields.");
    theForm.payment_expiration_month.focus();
    return (false);
  }
  
  if (theForm.payment_name_on_card.value == "")
  {
    alert("Please enter your name as it appears on your credit card.");
    theForm.payment_name_on_card.focus();
    return (false);
  }
  
  return (true);
}

function validate_shippinginfo(theForm)
{
  if (theForm.shipping_entity_name.value == "" && !theForm.ShippingAddress.checked)
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.shipping_entity_name.focus();
    return (false);
  }
  
  if (theForm.shipping_address_line_1.value == ""  && !theForm.ShippingAddress.checked)
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.shipping_address_line_1.focus();
    return (false);
  }
  
  if (theForm.shipping_city.value == "" && !theForm.ShippingAddress.checked)
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.shipping_city.focus();
    return (false);
  }  
  
  if (theForm.shipping_state_or_province.value == "" && !theForm.ShippingAddress.checked)
  {
    alert("Please enter a value for the \"State/Province\" field.");
    theForm.shipping_state_or_province.focus();
    return (false);
  }    
  if (theForm.shipping_postal_code.value == "" && !theForm.ShippingAddress.checked)
  {
    alert("Please enter a value for the \"Zip/Postal Code\" field.");
    theForm.shipping_postal_code.focus();
    return (false);
  }   
}

