if(typeof Util == "undefined"){ Util = {}; }

Util.Handler = function(options)
{
	this.options = new Util.Options(options);
	this.handler = this.options.get("handler");
	this.scope = this.options.get("scope");
	this.id = 0;
	this.on = {};
	this.init();
}

Util.Handler.prototype = {
	
	init: function()
	{
		if(this.scope)
		{
			this.on = this.scope;
		}
		if(this.handler)
		{
			while(eval("typeof this.on.handler_"+this.id) != "undefined")
			{
				this.id++;
			}
			eval("this.on.handler_"+this.id+"= this.handler");	
		}
	},
	
	execute: function()
	{
		var args = new Array();
		
		var tmp = arguments;
		for(var i = 0; i  < arguments.length; i++)
		{
			args.push("arguments["+i+"]");
		}
		//alert(eval("this.on.handler_"+this.id));
		return eval("this.on.handler_"+this.id+"("+args.join(",")+");");
	}
		
}

