var price = 0;

function calc_price() {
  var form = document.getElementById('orderForm');
  var customPrice = document.getElementById('customPrice');

  price = 0;
  if (form.feature0.checked) {
    price = price + 15;
  }
  if (form.feature1.checked) {
    price = price + 15;
  }
  if (form.feature2.checked) {
    price = price + 10;
  }
  if (form.feature3.checked) {
    price = price + 20;
  }
  if (form.feature4.checked) {
    price = price + 20;
  }
  if (form.feature5.checked) {
    price = price + 20;
  }
  if (form.feature6.checked) {
    price = price + 20;
  }
  if (form.feature7.checked) {
    price = price + 20;
  }
  if (form.feature8.checked) {
    price = price + 20;
  }
  if (form.feature9.checked) {
    price = price + 20;
  }
  if (form.feature10.checked) {
    price = price + 20;
  }
  if (form.feature11.checked) {
    price = price + 20;
  }
  if (form.feature12.checked) {
    price = price + 20;
  }
  if (form.feature13.checked) {
    price = price + 20;
  }
  if (form.feature14.checked) {
    price = price + 20;
  }
  if (form.feature15.checked) {
    price = price + 20;
  }
  if (form.feature16.checked) {
    price = price + 60;
  }
  if (form.feature17.checked) {
    price = price + 60;
  }

  customPrice.innerText = '$' + price;
}

function calc_price_upgrade() {
  var form = document.getElementById('orderForm');
  var customPrice = document.getElementById('customPrice');

  price = 0;
  if (form.feature0.checked && !form.feature0.disabled) {
    price = price + 15;
  }
  if (form.feature1.checked && !form.feature1.disabled) {
    price = price + 15;
  }
  if (form.feature2.checked && !form.feature2.disabled) {
    price = price + 10;
  }
  if (form.feature3.checked && !form.feature3.disabled) {
    price = price + 20;
  }
  if (form.feature4.checked && !form.feature4.disabled) {
    price = price + 20;
  }
  if (form.feature5.checked && !form.feature5.disabled) {
    price = price + 20;
  }
  if (form.feature6.checked && !form.feature6.disabled) {
    price = price + 20;
  }
  if (form.feature7.checked && !form.feature7.disabled) {
    price = price + 20;
  }
  if (form.feature8.checked && !form.feature8.disabled) {
    price = price + 20;
  }
  if (form.feature9.checked && !form.feature9.disabled) {
    price = price + 20;
  }
  if (form.feature10.checked && !form.feature10.disabled) {
    price = price + 20;
  }
  if (form.feature11.checked && !form.feature11.disabled) {
    price = price + 20;
  }
  if (form.feature12.checked && !form.feature12.disabled) {
    price = price + 20;
  }
  if (form.feature13.checked && !form.feature13.disabled) {
    price = price + 20;
  }
  if (form.feature14.checked && !form.feature14.disabled) {
    price = price + 20;
  }
  if (form.feature15.checked && !form.feature15.disabled) {
    price = price + 20;
  }
  if (form.feature16.checked && !form.feature16.disabled) {
    price = price + 60;
  }
  if (form.feature17.checked && !form.feature17.disabled) {
    price = price + 60;
  }

  customPrice.innerText = '$' + price;
}

function make_order(bundle) {
//  if (bundle == 'custom') {
//    alert('This bundle is not available for purchase at this time.\nPlease excuse us for any inconvenience and stay tuned. It should be available in couple of weeks.\n\nYou can contact us at sales@ocommunity.net for any questions regarding orders.');
//    return;
//  }
  var form = document.getElementById('orderForm');

  form.product_bundle.value = bundle;
  form.product_price.value = price;

  form.submit();
}

function make_order_upgrade(bundle) {
  if (price == 0) {
    alert('Please choose at least one feature to add to your account.');
    return;
  }
  var form = document.getElementById('orderForm');

  form.product_bundle.value = bundle;
  form.product_price.value = price;

  form.submit();
}
