Object.extend(PeriodicalExecuter.prototype, {
     initialize: function(callback, frequency) {
         this.callback = callback;
         this.frequency = frequency;
         this.currentlyExecuting = false;
         this.timer = null;
         //this.start();
     },
 
     isAlive: function() {
        return (this.timer != null) ? true : false;
     },
     
     start: function() {
         this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
     },
 
     pause: function() {
         clearInterval(this.timer);
         this.timer = null;
     },
 
     reset: function() {
        this.pause();
        this.start();
     },
     
     setFrequency: function(f) {
         this.frequency = f;
         if (this.timer != null) {
             this.reset();
         }
     }
 });

