move some js functions to finance.js