var Abort = Class.create();

Abort.prototype = {
	abort_callback: false,
	is_busy: false,
	is_abortable: true,
	initialize: function() {},
// param: function- callback-function on abort, boolean: true - not interruptable
	registerTask: function() {
		this.abort_callback = arguments[0];
		this.is_busy = true;
	},
	deleteTask: function() {
		this.abort_callback = false;
		this.is_busy = false
	},
	abort: function() {
		if (this.is_busy) {
			if (this.abort_callback === true) 
				return false;
				
			var res;
			try {
				res=this.abort_callback.apply(null);
			}
			catch(e){
				res=false;
			}
			this.deleteTask();
			return res;
		}
		return true;
	}
};

