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