(function($){ 
  $.fn.extend({ 
  
    //TOOLTIP FUNCTION
    tooltip: function(options) {
    
      //default options
      o = $.extend({
        effect: 'toggle',
        sticky: 'off',
        posY: -128,
        posX: -103,
        effectTimer: 1200
      },options);
      
      var tt = $(".tooltip");

      //applying the options
      //apply mouseover
      this.bind('mouseover', function(){
        tt.html($(this).attr('rel'));
        if(o.sticky == 'on'){
          tt.css({left:$(this).position().left+o.posX, top:$(this).position().top+o.posY});
        }
        switch(o.effect){
          case 'fade': tt.stop(true, true).fadeIn(o.effectTimer); break;
          case 'slide': tt.stop(true, true).slideDown(o.effectTimer); break;
          default: tt.show();
        }
      });
      
      //apply mouse follow if sticky == off
      if(o.sticky == 'off'){
        this.bind('mousemove', function(kmouse){
          tt.css({left:kmouse.pageX+o.posX, top:kmouse.pageY+o.posY});
        });
      }
      
      //apply mouse out
      this.bind('mouseout', function(){
        switch(o.effect){
          case 'fade': tt.stop(true, true).hide(); break;
          case 'fade': tt.stop(true, true).hide(); break;
          default: tt.hide();
        }
      });
       
      return this;
    }
  });
})(jQuery);