(function(A){AJS.contentHover=function(J,I,D,F,M){var B=A.extend(false,AJS.contentHover.opts,M);var H,L,C=A("#content-hover-"+I);if(!C.length){A(B.container).append(A('<div id="content-hover-'+I+'" class="ajs-content-hover"><div class="contents"></div></div>'));C=A("#content-hover-"+I);H=C.find(".contents");H.css("width",B.width+"px").mouseover(function(){clearTimeout(E.hideDelayTimer);C.unbind("mouseover")}).mouseout(function(){G()})}else{H=C.find(".contents")}var E=C[0];var K=function(){if(C.is(":visible")){return }E.showTimer=setTimeout(function(){if(!E.contentLoaded||!E.shouldShow){return }E.beingShown=true;var P=A(window),N=L.x-3,R=L.y+15;if(N+B.width+30>P.width()){C.css({right:"20px",left:"auto"})}else{C.css({left:N+"px",right:"auto"})}var O=(window.pageYOffset||document.documentElement.scrollTop)+P.height();if((R+C.height())>O){R=O-C.height()-5;C.mouseover(function(){clearTimeout(E.hideDelayTimer)}).mouseout(function(){G()})}C.css({top:R+"px"});var Q=A("#content-hover-shadow").appendTo(C).show();C.fadeIn(B.fadeTime,function(){E.beingShown=false});Q.css({width:H.outerWidth()+32+"px",height:H.outerHeight()+25+"px"});A(".b",Q).css("width",H.outerWidth()-26+"px");A(".l, .r",Q).css("height",H.outerHeight()-21+"px")},B.showDelay)};var G=function(){E.beingShown=false;E.shouldShow=false;clearTimeout(E.hideDelayTimer);clearTimeout(E.showTimer);clearTimeout(E.loadTimer);E.contentLoading=false;E.shouldLoadContent=false;E.hideDelayTimer=setTimeout(function(){C.fadeOut(B.fadeTime)},B.hideDelay)};A(J).mousemove(function(N){L={x:N.pageX,y:N.pageY};if(!E.beingShown){clearTimeout(E.showTimer)}E.shouldShow=true;if(!E.contentLoaded){if(E.contentLoading){if(E.shouldLoadContent){var O=(L.x-E.initialMousePosition.x)*(L.x-E.initialMousePosition.x)+(L.y-E.initialMousePosition.y)*(L.y-E.initialMousePosition.y);if(O>(B.mouseMoveThreshold*B.mouseMoveThreshold)){E.contentLoading=false;E.shouldLoadContent=false;clearTimeout(E.loadTimer);return }}}else{E.initialMousePosition=L;E.shouldLoadContent=true;E.contentLoading=true;E.loadTimer=setTimeout(function(){if(!E.shouldLoadContent){return }H.load(D,function(){E.contentLoaded=true;E.contentLoading=false;F.call(C,I);K()})},B.loadDelay)}}clearTimeout(E.hideDelayTimer);if(!E.beingShown){K()}}).mouseout(function(){G()});H.click(function(N){N.stopPropagation()});A("body").click(function(){E.beingShown=false;clearTimeout(E.hideDelayTimer);clearTimeout(E.showTimer);C.hide()});return C};AJS.contentHover.opts={fadeTime:100,hideDelay:500,showDelay:700,loadDelay:50,width:300,mouseMoveThreshold:10,container:"body"};AJS.toInit(function(){A("body").append(A('<div id="content-hover-shadow"><div class="tl"></div><div class="tr"></div><div class="l"></div><div class="r"></div><div class="bl"></div><div class="br"></div><div class="b"></div></div>'));A("#content-hover-shadow").hide()})})(jQuery);if(typeof AJS.followCallbacks=="undefined"){AJS.followCallbacks=[]}if(typeof AJS.favouriteCallbacks=="undefined"){AJS.favouriteCallbacks=[]}AJS.toInit(function(A){A(self).bind("hover-user.follow",function(E,D){for(var B=0,C=AJS.followCallbacks.length;B<C;B++){AJS.followCallbacks[B](D.username)}})});
