    var lb_cost = 30;
    var us_std = 8;
    var intl_std =  40;
    var intl_std_cm =  21;
    var us_std_variance = 2; var intl_std_cm_variance = 3; var intl_std_variance = 5;

    var us_exp = 21;
    var intl_exp = 54;
    var intl_exp_cm = 32;
    var us_exp_variance = 3; var intl_exp_cm_variance = 4; var intl_exp_variance = 6;

    function recalc_subtotal() {
      var ca_tax = 0.0975
      var subtotal = 0;
      var qty = document.getElementById('x_quantity').value;
      if (qty <= 0) {
        document.getElementById('x_quantity').value = 1;
        qty = 1;
      }
      var tax = 0;
      var lunchbox_cost = lb_cost * qty;
      var lunchbox_subtotal = document.getElementById('lunchbox_subtotal');
      if (lunchbox_subtotal) {
        lunchbox_subtotal.innerHTML = lunchbox_cost;
      }
      subtotal = lunchbox_cost;
      var shipping_cost = 0;
      var country_select = document.getElementById('country');
      if (country_select) {
        var n = country_select.selectedIndex;    // Which menu item is selected
        var country = country_select[n].value;        // Return string value of menu item</pre>
        var method_select = document.getElementById('shipping');
        n = method_select.selectedIndex;    // Which menu item is selected
        var method = method_select[n].value;        // Return string value of menu item</pre>
        switch(country) {
        case 'USA': {
          shipping_cost += (method=='standard') ?  us_std : us_exp;
          shipping_cost += (qty * (method=='standard') ?  us_std_variance : us_exp_variance);
          break;
        }
        case 'Canada':
        case 'Mexico': {
          shipping_cost += (method=='standard') ? intl_std_cm : intl_exp_cm;
          shipping_cost += (qty * (method=='standard') ?  intl_std_cm_variance : intl_exp_cm_variance);
          break;
        }
        default: {
          shipping_cost += (method=='standard') ?  intl_std : intl_exp;
          shipping_cost += (qty * (method=='standard') ?  intl_std_variance : intl_exp_variance);
          break;
        }
       }
       subtotal += shipping_cost;
       document.getElementById('subtotal').innerHTML = subtotal;
       if (method=='standard') {
         document.getElementById('delivery_estimate').innerHTML = std_delivery_estimate;
       } else {
         document.getElementById('delivery_estimate').innerHTML = exp_delivery_estimate;
       }
      } else {
        var state_select = document.getElementById('state');
        var n = state_select.selectedIndex;    // Which menu item is selected
        var state = state_select[n].value;        // Return string value of menu item</pre>
        if (state=='CA') {
          tax = subtotal * ca_tax;
          tax = Math.round(tax*100)/100;
          document.getElementById('ca_tax_display').style.visibility = 'visible';
          document.getElementById('ca_tax').innerHTML = tax;
          document.getElementById('x_tax').value = tax;
        } else {
          document.getElementById('ca_tax_display').style.visibility = 'hidden';
          document.getElementById('x_tax').value = 0;
        }
        shipping_cost = parseFloat(document.getElementById('x_freight').value);
        var total = Math.round((parseFloat(subtotal) + parseFloat(shipping_cost) + parseFloat(tax))*100)/100;
        document.getElementById('x_amount').value = total;
        document.getElementById('total').innerHTML = total;
        cbaUpdateElement('fp_fields','/order/recalc.php?total='+total);
      }
    }

    function validate_coupon() {
      var coupon = document.getElementById('coupon').value;
      var divcontents = document.getElementById('postForm').innerHTML;
      //alert(divcontents);
      //cbaUpdateElement('postForm','/order/validate_coupon.php?coupon='+coupon);
    }
