<!DOCTYPE html>
<html>
<head>
<script src="tax.js"></script>
<script src="tax_ui.js"></script>
<!-- Tests are in tax.test.js -->
<style>
  td { padding: .5em; vertical-align: top}
  textarea { height: 12em; }
  textarea.small { height: 4em; }
  input { width: 7em }
  .output { padding: 1em; background-color: #eee; border: thin solid #888; width: max-content;  }
  .privacy_policy { margin-top: 5em; }
</style>
</head>
<body onload="calculate()">
<h1>Inverse income tax tool</h1>
<p>What before-tax salary is needed to provide a specified after-tax salary?</p>

<form>
<table>
<tr>
<td>
Federal deductible<br/><input id="deductible_1" value="27700" onchange="calculate()" oninput="calculate()"/>
</td>
<td>
State deductible<br/><input id="deductible_2" value="10404" onchange="calculate()" oninput="calculate()"/>
</td>
</tr>
<tr>
<td>
Federal tax table<br/>
<textarea id="tax_table_1" onchange="calculate()" oninput="calculate()">     0 10
 22000 12
 89450 22
190750 24
364200 32
462500 32
683750 35</textarea>
</td>
<td>
State tax table<br/>
<textarea id="tax_table_2" onchange="calculate()" oninput="calculate()">      0  1
  20198  2
  47884  4
  76576  6
 104910  8
 132590  9.3
 677278 10.3
 812728 11.3
1354550 12.3</textarea>
<br/>(Initial table is California's)
</td>
</tr>
<tr>
<td>
Social Security tax<br/>
<textarea id="tax_table_3" class="small" onchange="calculate()" oninput="calculate()">      0  6.2
 160200  0</textarea>
</td>
<td>
Medicare tax<br/>
<textarea id="tax_table_4" class="small" onchange="calculate()" oninput="calculate()">      0  1.45
 250000  2.35</textarea>
</td>
<td>
Business tax<br/>
<textarea id="tax_table_5" class="small" onchange="calculate()" oninput="calculate()">      0  0.427</textarea>
</td>
</tr>
<tr>
<td colspan="3">
Desired after-tax salary</br>
<input id="after_tax" value="100000" onchange="calculate()" oninput="calculate()">
</td></tr>
</table>
</form>

<p class="output">
  <strong><span id="before_tax"></span> before tax</strong>
  - <span id="tax_1"></span> federal tax
  - <span id="tax_2"></span> state tax
  - <span id="tax_3"></span> social security tax
  - <span id="tax_4"></span> medicare tax
  - <span id="tax_5"></span> business tax
  = <span id="after_tax_verification"></span> after tax.
</p>

<p class="privacy_policy">Privacy policy: All calculations are client-side; no figures are sent to any server.</p>
</body>
</html>