(function(f){f.fn.colorTip=function(b){var c={color:"yellow",timeout:1};var a=["red","green","blue","white","yellow","black"];b=f.extend(c,b);return this.each(function(){var n=f(this);if(!n.attr("title")){return true}var i=new e();var m=new d(n.attr("title"));n.append(m.generate()).addClass("colorTipContainer");var o=false;for(var p=0;p<a.length;p++){if(n.hasClass(a[p])){o=true;break}}if(!o){n.addClass(b.color)}n.hover(function(){m.show();i.clear()},function(){i.set(function(){m.hide()},b.timeout)});n.removeAttr("title")})};function e(){}e.prototype={set:function(b,a){this.timer=setTimeout(b,a)},clear:function(){clearTimeout(this.timer)}};function d(a){this.content=a;this.shown=false}d.prototype={generate:function(){return this.tip||(this.tip=f('<span class="colorTip">'+this.content+'<span class="pointyTipShadow"></span><span class="pointyTip"></span></span>'))},show:function(){if(this.shown){return}this.tip.css("margin-left",-this.tip.outerWidth()/2).fadeIn("fast");this.shown=true},hide:function(){this.tip.fadeOut();this.shown=false}}})(jQuery);
