(function($) {
	$.fn.nospam = function(callerSettings) {
		var settings = $.extend(true, {}, $.fn.nospam.settings, callerSettings);
		return this.each(function() {
			var n = $(this), r = new RegExp(settings.expr, 'gi');
			n.text(n.text().replace(r, settings.replace));
			if (!n.is('a') && settings.link) {
				n.wrapInner('<a />')
					.children(':first')
					.attr('href', 'mailto:' + n.text());
			} else if (n.is('a')) {
				n.attr('href', n.attr('href').replace(r, settings.replace));
			}
		});
	};
	$.fn.nospam.settings = {
		expr: '\\b(.*)\\[[^\\\]]+\\](.*)\\b',
		replace: '$1@$2',
		link: true
	};
})(jQuery);