A little wrapper to dealing with intervals in JavaScript