InlineHelp = {
	init: function(e) {
		$('[help]').each(function(index, el) {
			el = $(el);
			el.focus(InlineHelp.focus);
			el.blur(InlineHelp.blur);
			el.closest("form").submit(InlineHelp.focus);
			el.addClass('inline-helped');
			InlineHelp.treatBlur(el);
		});
	},
	focus: function() {
		InlineHelp.treatFocus($(this));
	},
	treatFocus: function(el) {
		if (el.attr('help') == el.val()) {
			el.removeClass('inline-helped-passive');
			el.val('');
		}
	},
	blur: function() {
		InlineHelp.treatBlur($(this));
	},
	treatBlur: function(el) {
		if (!el.val()) {
			el.addClass('inline-helped-passive');
			el.val(el.attr('help'));
		}
	}
};
$(window).load(function() {
	InlineHelp.init();
});


