(function($) {
    $.fn.dwTooltip = function(element, options) {
        var opts = $.extend({}, $.fn.dwTooltip.defaults, options);
        return this.each(function() {
            $this = $(this);
            element.hide();
            element.css("margin","0");
            $this.removeAttr("title");
            $this.removeAttr("alt");
            $this.hover(
                function() {
                    if (opts.html != "") element.html(opts.html);
                    if (opts.fade > 0) element.fadeIn(opts.fade);
                    else element.show();
                },
                function() {
                    element.hide();
                }
            );
            $this.mousemove(function(e) {
                element.css("left", e.pageX + opts.xpos);
                element.css("top", e.pageY + opts.ypos);
            });
        });
    };
    $.fn.dwTooltip.defaults = {
        html: "",
        xpos: 15,
        ypos: 15,
        fade: 0
    };
})(jQuery);
