

var Timer = {
    func_call:  '',
    timeout:    0,
    
    init: function(func_call, timeout, cycle) {
        this.func_call = func_call;
        this.timeout = timeout;
        //this.cycle = cycle!=''&&cycle!=null&&cycle!=undefined?cycle:false;
        this.cycle=cycle;
    },
    start: function() {
        if (this.cycle===true) {
            if (this.running === true) { this.stop(); }
            this.intervalId = setInterval(this.func_call,this.timeout);
            this.running = true;
        }
        else {
            this.timeOutId = setTimeout(this.func_call,this.timeout)
        }
    },
    stop: function() {
        clearInterval(this.intervalId);
    }

}