Javascript event timer utility