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