/*
**  jquery.extlink.js -- jQuery plugin for external link annotation
**  Copyright (c) 2007 Ralf S. Engelschall <rse@engelschall.com> 
**  Licensed under GPL <http://www.gnu.org/licenses/gpl.txt>
**
**  $LastChangedDate: 2007-04-01 11:15:51 +0200 (Sun, 01 Apr 2007) $
**  $LastChangedRevision: 22 $
*/

(function($) {
    $.fn.extend({
        extlink: function (color, prefix) {
            if (typeof color === "undefined")
                color = "grey";
            var site = String(document.location)
                .replace(/^(https?:\/\/[^:\/]+).*$/, "$1");
            $("a", this).filter(function (i) {
                return ($(this).attr("href").match(RegExp("^("+site+"|(https?:)?/)")) != null);
            }).each(function () {
                $(this)
                    .css("backgroundImage",    "url('"+prefix+"jquery.extlink.d/extlink-" + color + ".gif')")
                    .css("backgroundRepeat",   "no-repeat")
                    .css("backgroundPosition", "right center")
                    .css("padding-right",      "11px");
            });
        }
    });
})(jQuery);

