implement timer in javascript rather than css