(function ($) {

    $.extend($.fn, {

        isExternal: function () {
            var docHost, linkHost;
            // Is it a link to begin with?
            if (this.attr('tagName').toLowerCase() == "a") {
                // A mailto link is not external
                if (this.attr('protocol') != "mailto:") {
                    // If the second-level domain matches the current one, it's not an external link
                    docHost = document.location.hostname.match(/\w+\.\w+$/);
                    linkHost = this.attr('hostname').match(/\w+\.\w+$/);
                    if (docHost && linkHost && docHost[0] != linkHost[0]) {
                            if (linkHost == "facebook.com") { return false }
                       
                        return true;
                    }
                }
            }
            return false;
        }

    });

})(jQuery);
