/*
 * jQuery Tooltip plugin 1.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 *
 * Copyright (c) 2006 Jvrn Zaefferer, Stefan Petre
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.tooltip.js 2237 2007-07-04 19:11:15Z joern.zaefferer $
 *
 */
(function($){var d={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.Tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15,titleWrapper:"h3"},block:function(){$.Tooltip.blocked=!$.Tooltip.blocked}};$.fn.extend({Tooltip:function(a){a=$.extend({},$.Tooltip.defaults,a);createHelper(a);return this.each(function(){this.tSettings=a;this.tooltipText=this.title;$(this).removeAttr("title");this.alt=""}).hover(save,hide).click(hide)},fixPNG:IE?function(){return this.each(function(){var b=$(this).css('backgroundImage');if(b.match(/^url\(["']?(.*\.png)["']?\)$/i)){b=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+b+"')"}).each(function(){var a=$(this).css('position');if(a!='absolute'&&a!='relative')$(this).css('position','relative')})}})}:function(){return this},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]()})},url:function(){return this.attr('href')||this.attr('src')}});function createHelper(a){if(d.parent)return;d.parent=$('<div id="tooltip"><'+a.titleWrapper+'></'+a.titleWrapper+'><div class="body"></div><div class="url"></div></div>').hide().appendTo('body');if($.fn.bgiframe)d.parent.bgiframe();d.title=$(a.titleWrapper,d.parent);d.body=$('div.body',d.parent);d.url=$('div.url',d.parent)}function handle(a){if(this.tSettings.delay)tID=setTimeout(show,this.tSettings.delay);else show();track=!!this.tSettings.track;$('body').bind('mousemove',update);update(a)}function save(){if($.Tooltip.blocked||this==current||!this.tooltipText)return;current=this;title=this.tooltipText;if(this.tSettings.bodyHandler){d.title.hide();d.body.html(this.tSettings.bodyHandler.call(this)).show()}else if(this.tSettings.showBody){var a=title.split(this.tSettings.showBody);d.title.html(a.shift()).show();d.body.empty();for(var i=0,part;part=a[i];i++){if(i>0)d.body.append("<br/>");d.body.append(part)}d.body.hideWhenEmpty()}else{d.title.html(title).show();d.body.hide()}if(this.tSettings.showURL&&$(this).url())d.url.html($(this).url().replace('http://','')).show();else d.url.hide();d.parent.addClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)d.parent.fixPNG();handle.apply(this,arguments)}function show(){tID=null;d.parent.show();update()}function update(a){if($.Tooltip.blocked)return;if(!track&&d.parent.is(":visible")){$('body').unbind('mousemove',update)}if(current==null){$('body').unbind('mousemove',update);return}var b=d.parent[0].offsetLeft;var c=d.parent[0].offsetTop;if(a){b=a.pageX+current.tSettings.left;c=a.pageY+current.tSettings.top;d.parent.css({left:b+'px',top:c+'px'})}var v=viewport(),h=d.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){b-=h.offsetWidth+20+current.tSettings.left;d.parent.css({left:b+'px'})}if(v.y+v.cy<h.offsetTop+h.offsetHeight){c-=h.offsetHeight+20+current.tSettings.top;d.parent.css({top:c+'px'})}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()}}function hide(a){if($.Tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;d.parent.hide().removeClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)d.parent.unfixPNG()}})(jQuery);