added total calc js functions