
/**
 * Functions for Autolinking and Mailto text on the selector of the function call
 */
jQuery.fn.autolink = function () {
    return this.each( function(){
        var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g;
        $(this).html( $(this).html().replace(re, '<a href="$1" rel="nofollow">$1</a> ') );
    });
};

jQuery.fn.mailto = function () {
    return this.each( function() {
        var re = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g
        $(this).html( $(this).html().replace( re, '<a href="mailto:$1">$1</a>' ) );
    });
};
