/**
 * @class
 * Delegate
 **/
BLIP.Delegate =	{
	context: {},

	create: function(obj, func, args) {
		return function() {
			func.call(obj, args, arguments);
		};
	},
		
	createAsString: function(obj, func, args) {
		var rand = Math.floor(Math.random() * 1000000000);

		while (this.context[rand]) {
			rand = Math.floor(Math.random() * 1000000000);
		}

		this.context[rand] = this.create(obj, func, args);
		return "BLIP.Delegate.context["+rand+"]();";
	}
};

