Javascript Formula Calculator