var Tooltip = {
	selector: null,
	init: function (selector) {
		this.selector = selector;
		this.injectRowHtml();
		this.bindEvents();
	},
	injectRowHtml: function() {
		$(this.selector).each(function () {
			$(this).append('
');
		});
	},
	bindEvents: function() {
		$(this.selector).find('input, .selectboxit').focus(this.show);
		$(this.selector).find('input, .selectboxit').blur(this.hide);
	},
	show: function() {
		var $this = $(this);
		var $tooltipElement = $this.parents('.row').find('.row-tooltip');
		if (!$this.attr('data-tooltip-text')) return;
		var html = $this.attr('data-tooltip-text');
		if ($this.attr('data-tooltip-title')) html = '' + $this.attr('data-tooltip-title') + ': ' + html;
		$tooltipElement.children('div').html(html);
		$tooltipElement.show();
	},
	hide: function() {
		$(this).parents('.row').find('.row-tooltip').hide();
	}
};