var _s = Interval = function() {}
_s.set = function(scope, method, args, time, amount) {
	if (amount == null || amount > 0) {
		if (!args) {
			args = [];
		}
		if (!this.content) {
			this.content = [];
			this.count = 0;
		}
		var id = this.count++;
		var obj = {};
        window.setTimeout("Interval.execute("+id+");", time);
		obj.scope = scope;
		obj.method = method;
		obj.args = args;
        obj.time = time;
		obj.amount = amount;
        obj.finished = false;
		this.content[id] = obj;
		return id;
	}
}
_s.clear = function(id) {
	if (this.content[id]) {
        this.content[id].finished = true;
	}
}
_s.execute = function(id) {
	var exec = this.content[id];
	if (exec != null) {
        if (exec.finished) {
            delete this.content[id];
        } else {
            if (isNaN(exec.amount) || exec.amount == null || exec.amount > 0) {
                exec.scope[exec.method].apply(exec.scope, exec.args);
                //window.setTimeout("Interval.execute("+id+");", exec.time);
            }
            if (exec.amount > 0) {
                exec.amount--;
            }
        }
	}
}