/**
 * @class	OnClickInputbox
 * @author	Marco Troost
 */
var OnClickInputbox = new Class({

	/**
	 * initialize
	 * @param	string	handler_id
	 * @param	string	input_value
	 * @return	void
	 */
	initialize: function(handler_id, input_value)
	{
		// nodes
		this.handler_node	= $(handler_id);

		// strings
		this.input_value		= input_value;
	},

	/**
	 * start
	 * @return	void
	 */
	start: function()
	{
		if (this.handler_node)
		{
			// set events
			this.setEvents();
		}
	},

	/**
	 * set events
	 * @return	void
	 */
	setEvents: function()
	{
		// set vars
		var _this = this;
		if (this.handler_node)
		{
			this.handler_node.removeEvents();
			this.handler_node.set('value', this.input_value);

			this.handler_node.addEvent('click',function()
			{
				var get_value = _this.handler_node.get('value');
				if (get_value == _this.input_value)
				{
					_this.handler_node.set('value', '');
					_this.handler_node.toggleClass('input_selected');
				}
			});

			this.handler_node.addEvent('blur',function()
			{
				var get_value = _this.handler_node.get('value');
				if (get_value == '')
				{
					_this.handler_node.set('value', _this.input_value);
					_this.handler_node.toggleClass('input_selected');
				}
			});
		}
	}

});
