Move stat formulas into javascript.

In order to calculate values for splits dynamically client side.