/**
 * @author Cientista
 */

function Delay() {
	var interval = null;
	var _this = this;
	
	this.onFinish = function() {} // should override
	
	this.time = 500;
	
	this.change = function() {
		if (interval != null) clearInterval(interval);
		interval = setInterval(_onFinish, _this.time);
	}
	
	function _onFinish() {
		clearInterval(interval);
		_this.onFinish();
	}
}
