(function(c){jQuery.fn.mbTooltip=function(d){return this.each(function(){this.options={live:true,opacity:0.9,wait:2000,timePerWord:70,cssClass:"default",hasArrow:true,imgPath:"images/",hasShadow:true,shadowColor:"black",shadowLeft:1,ancor:"mouse",shadowTop:1,mb_fade:200};c.extend(this.options,d);if(this.options.live){c("[title]").live("mouseover",function(){c(this).mbTooltip(d)})}var i=c(this).is("[title]")?c(this):c(this).find("[title]");var g=this.options.wait;var f=this.options.hasShadow;var h=this.options.mb_fade;var e=this.options;c(i).each(function(){c(this).attr("tooltip",c(this).attr("title"));c(this).removeAttr("title");c(this).attr("tooltipEnable","true");var l=c(this);var k=l.attr("tooltip");var j=c.browser.msie?"mouseenter":"mouseover";c(this).bind(j,function(m){if(e.ancor=="mouse"){c().mb_getXY()}c(this).one("mouseout",function(){c(this).stopTime();c(this).deleteTooltip(f,h)}).one("click",function(){c(this).stopTime();c(this).deleteTooltip(f,h)});c(this).oneTime(g,function(){if(c(this).attr("tooltipEnable")=="true"){c(this).buildTooltip(k,e,m)}})})})})};var b=0;var a=0;c.fn.extend({mb_getXY:function(){c().bind("mousemove",function(d){b=d.pageX;a=d.pageY});return{x:b,y:a}},buildTooltip:function(d,e){this.options={};c.extend(this.options,e);var g=c(this);c("body").append("<div id='tooltip'></div>");var j=this.options.imgPath+"up.png";c("#tooltip").html(d);c("#tooltip").addClass(this.options.cssClass);if(this.options.hasArrow){c("#tooltip").prepend("<img id='ttimg' src='"+j+"'>");c("#ttimg").css({position:"absolute",opacity:0.5});c("#ttimg").addClass("top")}c("#tooltip").css({position:"absolute",top:this.options.ancor=="mouse"?c().mb_getXY().y-40:g.offset().top+(g.outerHeight()),left:this.options.ancor=="mouse"?c().mb_getXY().x+7:g.offset().left,opacity:0});c("#tooltip").findBestPos(g,this.options.imgPath,this.options.ancor);if(this.options.ancor=="mouse"){c().unbind("mousemove")}if(this.options.hasShadow){c("#tooltip").dropShadow({left:this.options.shadowLeft,top:this.options.shadowTop,blur:2,opacity:0.3,color:this.options.shadowColor});c(".dropShadow").css("display","none");c(".dropShadow").mb_BringToFront();c(".dropShadow").fadeIn(this.options.mb_fade)}c("#tooltip").mb_BringToFront();c("#tooltip").fadeTo(this.options.mb_fade,this.options.opacity,function(){});var h=3000+d.length*this.options.timePerWord;var f=this.options.hasShadow;var i=this.options.mb_fade;c(this).oneTime(h,function(){c(this).deleteTooltip(f,i)})},deleteTooltip:function(d,f){var e=d?"#tooltip,.dropShadow":"#tooltip";c(e).fadeOut(f,function(){c(e).remove()})},findBestPos:function(j,h,i){var d=c(this);var g=c(window).width()+c(window).scrollLeft();var e=c(window).height()+c(window).scrollTop();var k=d.outerWidth();d.css({width:k});var m=((d.offset().top+d.outerHeight(true))>e)?d.offset().top-(i!="mouse"?j.outerHeight():0)-d.outerHeight()-20:d.offset().top;m=m<0?0:m;var f=((d.offset().left+k)>g-5)?d.offset().left-(k-(i!="mouse"?j.outerWidth():0)):d.offset().left;f=f<0?0:f;if(d.offset().top+d.outerHeight(true)>e){c("#ttimg").attr("src",h+"bottom.png");c("#ttimg").removeClass("top").addClass("bottom")}d.css({width:k,top:m,left:f})},disableTooltip:function(){c(this).find("[tooltip]").attr("tooltipEnable","false")},enableTooltip:function(){c(this).find("[tooltip]").attr("tooltipEnable","true")}});jQuery.fn.mb_BringToFront=function(){var d=10;c("*").each(function(){if(c(this).css("position")=="absolute"){var e=parseInt(c(this).css("zIndex"));d=e>d?parseInt(c(this).css("zIndex")):d}});c(this).css("zIndex",d+=100)};c(function(){c("select[title]").each(function(){var d=c("<span></span>");d.attr("title",c(this).attr("title"));c(this).wrapAll(d);c(this).removeAttr("title")})})})(jQuery);
$(function(){
    $("[title]").mbTooltip({ // also $([domElement]).mbTooltip  >>  in this case only children element are involved
      opacity : .97,       //opacity
      wait:200,           //before show
      cssClass:"default",  // default = default
      timePerWord:70,      //time to show in milliseconds per word
      hasArrow:false,			// if you whant a little arrow on the corner
      hasShadow:true,
      imgPath:"images/",
      ancor:"mouse", //"parent"  you can ancor the tooltip to the mouse position or at the bottom of the element
      shadowColor:"black", //the color of the shadow
      mb_fade:200 //the time to fade-in
    });
  });