HTML/JavaScript energy calculator