﻿(function ($) {
    $.fn.protectmail = function (options) {
        var settings = {
            atPattern: '(at)',
            dotPattern: '(dot)'
        };

        $.extend(settings, options);

        this.each(function () {
            var email = $(this).text().replace(settings.atPattern, '@').replace(settings.dotPattern, '.');
            $(this).replaceWith('<a href="mailto:' + email + '">' + email + '</a>');
        });
    };

})(jQuery);
