/**
 * @author Cientista
 */

function q_Delay(delay, callback) {
	var interval = null;
	var _this = this;
	
	this.snooze = function() {
		if (interval != null) clearInterval(interval);
		interval = setInterval(onFinish, delay);
	}
	
	this.doNow = function() {
		_this.stop();
		onFinish();
		_this.snooze();
	}
	
	this.stop = function() {
		clearInterval(interval);
	}
	
	function onFinish() {
		_this.stop();
		callback();
	}
}
