(function(n){n.fn.extend({showx:function(n){function e(r,u){if(r=="mouseenter")switch(u){case"down":n.css({left:"0px",top:i}).stop(!0,!0).animate({top:"0px"},"500");break;case"up":n.css({left:"0px",top:-i}).stop(!0,!0).animate({top:"0px"},"500");break;case"right":n.css({left:t,top:"0px"}).stop(!0,!0).animate({left:"0px"},"500");break;case"left":n.css({left:-t,top:"0px"}).stop(!0,!0).animate({left:"0px"},"500")}else switch(u){case"down":n.stop(!0,!0).animate({top:i},"500");break;case"up":n.stop(!0,!0).animate({top:-i},"500");break;case"right":n.stop(!0,!0).animate({left:t},"500");break;case"left":n.stop(!0,!0).animate({left:-t},"500")}}var t=this.width(),i=this.height(),u=t/2,f=i/2,r="";t>i?n.css({position:"absolute",top:this.width()}):t<=i&&n.css({position:"absolute",top:this.height()});this.css({overflow:"hidden",position:"relative"});this.on("mouseenter mouseleave",function(n){var s=n||event,i=s.offsetX,o=s.offsetY,t=Math.atan((i-u)/(o-f))*180/Math.PI;t>-45&&t<45&&o>f&&(r="down");t>-45&&t<45&&o-90&&t<-45||t>45&&t<90)&&i>u&&(r="right");(t>-90&&t<-45||t>45&&t<90)&&ii?n.css({position:"absolute",top:this.width()}):t<=i&&n.css({position:"absolute",top:this.height()});this.css({overflow:"hidden",position:"relative"});this.on("mouseenter mouseleave",function(n){var s=n||event,i=s.offsetX,o=s.offsetY,t=Math.atan((i-u)/(o-f))*180/Math.PI;t>-45&&t<45&&o>f&&(r="down");t>-45&&t<45&&o-90&&t<-45||t>45&&t<90)&&i>u&&(r="right");(t>-90&&t<-45||t>45&&t<90)&&i>>0,t=Number(arguments[1])||0;for(t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=i);t1){for(h=t.length-n,o=!1,u=0;u=0&&r<=h&&(e=f(r,n),o?e[1]i.numOfCol&&n.data("size",i.numOfCol);t=c(n.data("size"));r=u*n.data("size")-(n.outerWidth()-n.width());n.css({width:r-i.offsetX*2,left:t[0]*u,top:t[1],position:"absolute"});f=n.outerHeight();h(t[0],n.data("size"));e(n.attr("id"),t[0],t[1],n.data("size"),f)};n.fn.BlocksIt=function(e){e&&typeof e=="object"&&n.extend(i,e);r=n(this);u=r.width()/i.numOfCol;s();r.children(i.blockElement).each(function(t){l(n(this),t)});var o=f(0,t.length);return r.height(o[1]+i.offsetY),this}}(jQuery),function(n){n.fn.extend({slimScroll:function(i){var r=n.extend({width:"auto",height:"250px",size:"6px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"4px",railBorderRadius:"4px"},i);return this.each(function(){function g(t){var t,i,f;l&&(t=t||window.event,i=0,t.wheelDelta&&(i=-t.wheelDelta/120),t.detail&&(i=t.detail/3),f=t.target||t.srcTarget||t.srcElement,n(f).closest("."+r.wrapperClass).is(u.parent())&&h(i,!0),t.preventDefault&&!o&&t.preventDefault(),o||(t.returnValue=!1))}function h(n,t,i){var s,l,h;o=!1;s=n;l=u.outerHeight()-f.outerHeight();t&&(s=parseInt(f.css("top"))+n*parseInt(r.wheelStep)/100*f.outerHeight(),s=Math.min(Math.max(s,0),l),s=n>0?Math.ceil(s):Math.floor(s),f.css({top:s+"px"}));e=parseInt(f.css("top"))/(u.outerHeight()-f.outerHeight());s=e*(u[0].scrollHeight-u.outerHeight());i&&(s=n,h=s/u[0].scrollHeight*u.outerHeight(),h=Math.min(Math.max(h,0),l),f.css({top:h+"px"}));u.scrollTop(s);u.trigger("slimscrolling",~~s);tt();c()}function ot(n){window.addEventListener?(n.addEventListener("DOMMouseScroll",g,!1),n.addEventListener("mousewheel",g,!1)):document.attachEvent("onmousewheel",g)}function nt(){a=Math.max(u.outerHeight()/u[0].scrollHeight*u.outerHeight(),et);f.css({height:a+"px"});var n=a==u.outerHeight()?"none":"block";f.css({display:n})}function tt(){if(nt(),clearTimeout(it),e==~~e){if(o=r.allowPageScroll,rt!=e){var n=~~e==0?"top":"bottom";u.trigger("slimscroll",n)}}else o=!1;if(rt=e,a>=u.outerHeight()){o=!0;return}f.stop(!0,!0).fadeIn("fast");r.railVisible&&s.stop(!0,!0).fadeIn("fast")}function c(){r.alwaysVisible||(it=setTimeout(function(){r.disableFadeOut&&l||y||p||(f.fadeOut("slow"),s.fadeOut("slow"))},1e3))}var l,y,p,it,w,a,e,rt,b="
<\/div>",et=30,o=!1,u=n(this),v,k,d,ut;if(u.parent().hasClass(r.wrapperClass)){if(v=u.scrollTop(),f=u.siblings("."+r.barClass),s=u.siblings("."+r.railClass),nt(),n.isPlainObject(i)){if("height"in i&&i.height=="auto"?(u.parent().css("height","auto"),u.css("height","auto"),k=u.parent().parent().height(),u.parent().css("height",k),u.css("height",k)):"height"in i&&(d=i.height,u.parent().css("height",d),u.css("height",d)),"scrollTo"in i)v=parseInt(r.scrollTo);else if("scrollBy"in i)v+=parseInt(r.scrollBy);else if("destroy"in i){f.remove();s.remove();u.unwrap();return}h(v,!1,!0)}return}if(!n.isPlainObject(i)||!("destroy"in i)){r.height=r.height=="auto"?u.parent().height():r.height;ut=n(b).addClass(r.wrapperClass).css({position:"relative",overflow:"hidden",width:r.width,height:r.height});u.css({overflow:"hidden",width:r.width,height:r.height});var s=n(b).addClass(r.railClass).css({width:r.size,height:"100%",position:"absolute",top:0,display:r.alwaysVisible&&r.railVisible?"block":"none","border-radius":r.railBorderRadius,background:r.railColor,opacity:r.railOpacity,zIndex:90}),f=n(b).addClass(r.barClass).css({background:r.color,width:r.size,position:"absolute",top:0,opacity:r.opacity,display:r.alwaysVisible?"block":"none","border-radius":r.borderRadius,BorderRadius:r.borderRadius,MozBorderRadius:r.borderRadius,WebkitBorderRadius:r.borderRadius,zIndex:99}),ft=r.position=="right"?{right:r.distance}:{left:r.distance};s.css(ft);f.css(ft);u.wrap(ut);u.parent().append(f);u.parent().append(s);r.railDraggable&&f.bind("mousedown",function(i){var r=n(document);return p=!0,t=parseFloat(f.css("top")),pageY=i.pageY,r.bind("mousemove.slimscroll",function(n){currTop=t+n.pageY-pageY;f.css("top",currTop);h(0,f.position().top,!1)}),r.bind("mouseup.slimscroll",function(){p=!1;c();r.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(n){return n.stopPropagation(),n.preventDefault(),!1});s.hover(function(){tt()},function(){c()});f.hover(function(){y=!0},function(){y=!1});u.hover(function(){l=!0;tt();c()},function(){l=!1;c()});u.bind("touchstart",function(n){n.originalEvent.touches.length&&(w=n.originalEvent.touches[0].pageY)});u.bind("touchmove",function(n){if(o||n.originalEvent.preventDefault(),n.originalEvent.touches.length){var t=(w-n.originalEvent.touches[0].pageY)/r.touchScrollStep;h(t,!0);w=n.originalEvent.touches[0].pageY}});nt();r.start==="bottom"?(f.css({top:u.outerHeight()-f.outerHeight()}),h(0,!0)):r.start!=="top"&&(h(n(r.start).position().top,null,!0),r.alwaysVisible||f.hide());ot(this)}}),this}});n.fn.extend({slimscroll:n.fn.slimScroll})}(jQuery)