(function($) {
	$.fn.tooltip = function(options) {
      var
        
        hideDelayTimer = '',
        hideDelay      = 400,
        time     = 250,
        trigger = $('.trigger_tooltip', this),
        beingShown = false,
        shown    = false,
        distance = 10;
        popup   = $('.popup_tooltip', this);

        $([trigger.get(0), popup.get(0)]).mouseover(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                // don't trigger the animation again
                return;
            } else {
                // reset position of info box
                beingShown = true;

                popup.css({
                    
                    'z-index': 4,
                    display: 'block'
                }).animate({
                    
                }, time, 'swing', function() {
                    beingShown = false;
                    shown = true;
                });

                trigger.addClass('.socialActive');
            }

            return false;
        }).mouseout(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function () {
                hideDelayTimer = null;
                popup.animate({
                    top: '-=' + distance + 'px',
                    display: 'none'
                }, time, 'swing', function () {
                    shown = false;
                    popup.css('display', 'none');
                });
                trigger.removeClass('socialActive');

            }, hideDelay);

            return false;
        });



	}

})(jQuery);
