 var form = document.forms[0];

  function taksa(x) {
    if(x <= 3000) return 100;
    if(x <= 10000) return 100 + 0.03 * (x - 3000);
    if(x <= 30000) return 310 + 0.02 * (x - 10000);
    if(x <= 60000) return 710 + 0.01 * (x - 30000);
    if(x <= 1000000) return 1010 + 0.004 * (x - 60000);
    if(x <= 2000000) return 4770 + 0.002 * (x - 1000000);
    if(x <= 2000000) {
      x = 4770 + 0.005 * (x - 2000000);
      return x > 10000 ? 10000 : x;
    }
  }

  form.onsubmit = function(e) {
    e.preventDefault();
    var price = parseInt(this.price.value);
    var currency = 1; //parseInt(this.currency.value);
    var prowizja = parseFloat(this.prowizja.value) / 100.0;
    var wniosek = parseInt(this.wniosek.value);
      
    this.podatek.value = 0.02 * price;
    this.oplata.value = this.type[1].checked ? 200 : 0;
    this.taksa.value = this.type[1].checked ? taksa(price) : 0.5 * taksa(price);
    this.vat.value = 0.22 * (this.type[1].checked ? taksa(price) : 0.5 * taksa(price));
    this.prowizja_agencji.value = price * prowizja;
    var suma = 0.02 * price + (this.type[1].checked ? 200 : 0) + 1.22 * taksa(price) *(this.type[1].checked ? 1 : 0.5) + price*prowizja + wniosek;
    this.wypisy.value = suma;
    this.razem.value = price + suma;
    return false;
  }
