
(function($){var
helper,tTitle,tBody,tUrl,current,oldTitle,tID,plugin=$.fn.Tooltip=function(settings){settings=$.extend($.extend({},arguments.callee.defaults),settings||{});if(!helper){helper=$('<div id="tooltip"><h3></h3><p class="body"></p><p class="url"></p></div>').hide().css({position:'absolute',zIndex:3000}).appendTo('body');tTitle=$('h3',helper);tBody=$('p:eq(0)',helper);tUrl=$('p:eq(1)',helper);}
$(this).filter('[@title]').each(function(){this.tSettings=settings;}).bind("mouseover",save).bind(settings.event,handle);return this;},handle=function(event){if(this.tSettings.delay)
tID=setTimeout(show,this.tSettings.delay);else
show();if(this.tSettings.track)
$('body').bind('mousemove',update);update(event);$(this).bind('mouseout',hide);},save=function(){if(this==current||!this.title)
return;current=this;var source=$(this),settings=this.tSettings;oldTitle=title=source.attr('title');source.attr('title','');if(settings.showBody){var parts=title.split(settings.showBody);tTitle.html(parts.shift());tBody.empty();for(var i=0,part;part=parts[i];i++){if(i>0)
tBody.append("<br/>");tBody.append(part);}
if(tBody.html())
tBody.show();else
tBody.hide();}else{tTitle.html(title);tBody.hide();}
href=(source.attr('href')||source.attr('src'));if(settings.showURL&&href)
tUrl.html(href.replace('http://','')).show();else
tUrl.hide();if(settings.extraClass){helper.addClass(settings.extraClass);}
if(settings.fixPNG&&$.browser.msie){helper.each(function(){if(this.currentStyle.backgroundImage!='none'){var image=this.currentStyle.backgroundImage;image=image.substring(5,image.length-2);$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"});tPNGfix=true;}});}},show=function(){tID=null;helper.show();},update=function(event){if(current==null){$('body').unbind('mousemove',update);return;}
function pos(c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;}
helper.css({top:pos('Y')+15+'px',left:pos('X')+15+'px'});},hide=function(){if(tID)
clearTimeout(tID);current=null;helper.hide();if(this.tSettings.extraClass){helper.removeClass(this.tSettings.extraClass);}
$(this).attr('title',oldTitle).unbind('mouseout',hide);if(this.tSettings.fixPNG&&$.browser.msie){helper.each(function(){$(this).css({'filter':'',backgroundImage:''});});}};plugin.defaults={delay:250,event:"mouseover",track:false,showURL:true,showBody:null,extraClass:null,fixPNG:false};})(jQuery);