Javascript for time slider