/*

 jquery.simpletip 1.3.1. A simple tooltip plugin

 Copyright (c) 2009 Craig Thompson
 http://craigsworks.com

 Licensed under GPLv3
 http://www.opensource.org/licenses/gpl-3.0.html

 Launch  : February 2009
 Version : 1.3.1
 Released: February 5, 2009 - 11:04am
*/
(function(){function j(f,a){var c=this,f=jQuery(f),d=jQuery(document.createElement("div")).addClass(a.baseClass).addClass(a.fixed?a.fixedClass:"").addClass(a.persistent?a.persistentClass:"").html(a.content).appendTo(f);a.hidden?d.hide():d.show();a.persistent?(f.click(function(b){b.target===f.get(0)&&(d.css("display")!=="none"?c.hide():c.show())}),jQuery(window).mousedown(function(b){d.css("display")!=="none"&&(a.focus?jQuery(b.target).parents(".tooltip").andSelf().filter(function(){return this===
d.get(0)}).length:0)===0&&c.hide()})):(f.hover(function(b){c.show(b)},function(){c.hide()}),a.fixed||f.mousemove(function(b){d.css("display")!=="none"&&c.updatePos(b)}));jQuery.extend(c,{getVersion:function(){return[1,2,0]},getParent:function(){return f},getTooltip:function(){return d},getPos:function(){return d.offset()},setPos:function(b,a){var g=f.offset();typeof b=="string"&&(b=parseInt(b)+g.left);typeof a=="string"&&(a=parseInt(a)+g.top);d.css({left:b,top:a});return c},show:function(b){a.onBeforeShow.call(c);
c.updatePos(a.fixed?null:b);switch(a.showEffect){case "fade":d.fadeIn(a.showTime);break;case "slide":d.slideDown(a.showTime,c.updatePos);break;case "custom":a.showCustom.call(d,a.showTime);break;default:case "none":d.show()}d.addClass(a.activeClass);a.onShow.call(c);return c},hide:function(){a.onBeforeHide.call(c);switch(a.hideEffect){case "fade":d.fadeOut(a.hideTime);break;case "slide":d.slideUp(a.hideTime);break;case "custom":a.hideCustom.call(d,a.hideTime);break;default:case "none":d.hide()}d.removeClass(a.activeClass);
a.onHide.call(c);return c},update:function(b){d.html(b);a.content=b;return c},load:function(b,f){a.beforeContentLoad.call(c);d.load(b,f,function(){a.onContentLoad.call(c)});return c},boundryCheck:function(b,a){var c=b+d.outerWidth(),e=a+d.outerHeight(),f=jQuery(window).width()+jQuery(window).scrollLeft(),j=jQuery(window).height()+jQuery(window).scrollTop();return[c>=f,e>=j]},updatePos:function(b){var i=d.outerWidth(),g=d.outerHeight();if(!b&&a.fixed)if(a.position.constructor==Array)e=parseInt(a.position[0]),
b=parseInt(a.position[1]);else if(jQuery(a.position).attr("nodeType")===1)b=jQuery(a.position).offset(),e=b.left,b=b.top;else{var b=f.offset(),e=f.outerWidth(),h=f.outerHeight();switch(a.position){case "top":var e=b.left-i/2+e/2,b=b.top-g;break;case "bottom":e=b.left-i/2+e/2;b=b.top+h;break;case "left":e=b.left-i;b=b.top-g/2+h/2;break;case "right":e=b.left+e;b=b.top-g/2+h/2;break;default:case "default":e=e/2+b.left+20,b=b.top}}else e=b.pageX,b=b.pageY;typeof a.position!="object"?(e+=a.offset[0],b+=
a.offset[1],a.boundryCheck&&(h=c.boundryCheck(e,b),h[0]&&(e=e-i/2-2*a.offset[0]),h[1]&&(b=b-g/2-2*a.offset[1]))):(typeof a.position[0]=="string"&&(e=String(e)),typeof a.position[1]=="string"&&(b=String(b)));c.setPos(e,b);return c}})}jQuery.fn.simpletip=function(f){var a=jQuery(this).eq(typeof f=="number"?f:0).data("simpletip");if(a)return a;var c={content:"A simple tooltip",persistent:!1,focus:!1,hidden:!0,position:"default",offset:[0,0],boundryCheck:!0,fixed:!0,showEffect:"fade",showTime:150,showCustom:null,
hideEffect:"fade",hideTime:150,hideCustom:null,baseClass:"tooltip",activeClass:"active",fixedClass:"fixed",persistentClass:"persistent",focusClass:"focus",onBeforeShow:function(){},onShow:function(){},onBeforeHide:function(){},onHide:function(){},beforeContentLoad:function(){},onContentLoad:function(){}};jQuery.extend(c,f);this.each(function(){var a=new j(jQuery(this),c);jQuery(this).data("simpletip",a)});return this}})();
