(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):n(jQuery)})(function(n){function i(n){return t.raw?n:encodeURIComponent(n)}function f(n){return t.raw?n:decodeURIComponent(n)}function e(n){return i(t.json?JSON.stringify(n):String(n))}function o(n){n.indexOf('"')===0&&(n=n.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{n=decodeURIComponent(n.replace(u," "))}catch(i){return}try{return t.json?JSON.parse(n):n}catch(i){}}function r(i,r){var u=t.raw?i:o(i);return n.isFunction(r)?r(u):u}var u=/\+/g,t=n.cookie=function(u,o,s){var y,a,h,v,c,p;if(o!==undefined&&!n.isFunction(o))return s=n.extend({},t.defaults,s),typeof s.expires=="number"&&(y=s.expires,a=s.expires=new Date,a.setDate(a.getDate()+y)),document.cookie=[i(u),"=",e(o),s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("");for(h=u?undefined:{},v=document.cookie?document.cookie.split("; "):[],c=0,p=v.length;c<p;c++){var w=v[c].split("="),b=f(w.shift()),l=w.join("=");if(u&&u===b){h=r(l,o);break}u||(l=r(l))===undefined||(h[b]=l)}return h};t.defaults={};n.removeCookie=function(t,i){return n.cookie(t)!==undefined?(n.cookie(t,"",n.extend({},i,{expires:-1})),!0):!1}}),function(n){n.fn.tipTip=function(t){var e={activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},i=n.extend(e,t);if(n("#tiptip_holder").length<=0){var r=n('<div id="tiptip_holder" style="max-width:'+i.maxWidth+';"><\/div>'),f=n('<div id="tiptip_content"><\/div>'),u=n('<div id="tiptip_arrow"><\/div>');n("body").append(r.html(f).prepend(u.html('<div id="tiptip_arrow_inner"><\/div>')))}else var r=n("#tiptip_holder"),f=n("#tiptip_content"),u=n("#tiptip_arrow");return this.each(function(){var t=n(this),s,e;if(s=i.content?i.content:t.attr(i.attribute),s!=""){i.content||t.removeAttr(i.attribute);e=!1;i.activation=="hover"?(t.hover(function(){h()},function(){i.keepAlive||o()}),i.keepAlive&&r.hover(function(){},function(){o()})):i.activation=="focus"?t.focus(function(){h()}).blur(function(){o()}):i.activation=="click"&&(t.click(function(){return h(),!1}).hover(function(){},function(){i.keepAlive||o()}),i.keepAlive&&r.hover(function(){},function(){o()}));function h(){var nt,tt,k,d;i.enter.call(this);f.html(s);r.hide().removeAttr("class").css("margin","0");u.removeAttr("style");var c=parseInt(t.offset().top),a=parseInt(t.offset().left),it=parseInt(t.outerWidth()),y=parseInt(t.outerHeight()),v=r.outerWidth(),l=r.outerHeight(),b=Math.round((it-v)/2),rt=Math.round((y-l)/2),p=Math.round(a+b),h=Math.round(c+y+i.edgeOffset),o="",w="",g=Math.round(v-12)/2;i.defaultPosition=="bottom"?o="_bottom":i.defaultPosition=="top"?o="_top":i.defaultPosition=="left"?o="_left":i.defaultPosition=="right"&&(o="_right");nt=b+a<parseInt(n(window).scrollLeft());tt=v+a>parseInt(n(window).width());nt&&b<0||o=="_right"&&!tt||o=="_left"&&a<v+i.edgeOffset+5?(o="_right",w=Math.round(l-13)/2,g=-12,p=Math.round(a+it+i.edgeOffset),h=Math.round(c+rt)):(tt&&b<0||o=="_left"&&!nt)&&(o="_left",w=Math.round(l-13)/2,g=Math.round(v),p=Math.round(a-(v+i.edgeOffset+5)),h=Math.round(c+rt));k=c+y+i.edgeOffset+l+8>parseInt(n(window).height()+n(window).scrollTop());d=c+y-(i.edgeOffset+l+8)<0;k||o=="_bottom"&&k||o=="_top"&&!d?(o=o=="_top"||o=="_bottom"?"_top":o+"_top",w=l,h=Math.round(c-(l+5+i.edgeOffset))):(d|(o=="_top"&&d)||o=="_bottom"&&!k)&&(o=o=="_top"||o=="_bottom"?"_bottom":o+"_bottom",w=-12,h=Math.round(c+y+i.edgeOffset));o=="_right_top"||o=="_left_top"?h=h+5:(o=="_right_bottom"||o=="_left_bottom")&&(h=h-5);(o=="_left_top"||o=="_left_bottom")&&(p=p+5);u.css({"margin-left":g+"px","margin-top":w+"px"});r.css({"margin-left":p+"px","margin-top":h+"px"}).attr("class","tip"+o);e&&clearTimeout(e);e=setTimeout(function(){r.stop(!0,!0).fadeIn(i.fadeIn)},i.delay)}function o(){i.exit.call(this);e&&clearTimeout(e);r.fadeOut(i.fadeOut)}}})}}(jQuery)