!function(t){var e={vertical:{x:!1,y:!0},horizontal:{x:!0,y:!1},both:{x:!0,y:!0},x:{x:!0,y:!1},y:{x:!1,y:!0}},o={duration:"fast",direction:"both"},r=/^(?:html)$/i,l=function(e,o){o=o||(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(e,null):e.currentStyle);var r=document.defaultView&&document.defaultView.getComputedStyle?!0:!1,l={top:parseFloat(r?o.borderTopWidth:t.css(e,"borderTopWidth"))||0,left:parseFloat(r?o.borderLeftWidth:t.css(e,"borderLeftWidth"))||0,bottom:parseFloat(r?o.borderBottomWidth:t.css(e,"borderBottomWidth"))||0,right:parseFloat(r?o.borderRightWidth:t.css(e,"borderRightWidth"))||0};return{top:l.top,left:l.left,bottom:l.bottom,right:l.right,vertical:l.top+l.bottom,horizontal:l.left+l.right}},i=function(e){var o=t(window),i=r.test(e[0].nodeName);return{border:i?{top:0,left:0,bottom:0,right:0}:l(e[0]),scroll:{top:(i?o:e).scrollTop(),left:(i?o:e).scrollLeft()},scrollbar:{right:i?0:e.innerWidth()-e[0].clientWidth,bottom:i?0:e.innerHeight()-e[0].clientHeight},rect:function(){var t=e[0].getBoundingClientRect();return{top:i?0:t.top,left:i?0:t.left,bottom:i?e[0].clientHeight:t.bottom,right:i?e[0].clientWidth:t.right}}()}};t.fn.extend({scrollintoview:function(l){l=t.extend({},o,l),l.direction=e["string"==typeof l.direction&&l.direction.toLowerCase()]||e.both;var c="";l.direction.x===!0&&(c="horizontal"),l.direction.y===!0&&(c=c?"both":"vertical");var n=this.eq(0),s=n.closest(":scrollable("+c+")");if(s.length>0){s=s.eq(0);var d={e:i(n),s:i(s)},h={top:d.e.rect.top-(d.s.rect.top+d.s.border.top),bottom:d.s.rect.bottom-d.s.border.bottom-d.s.scrollbar.bottom-d.e.rect.bottom,left:d.e.rect.left-(d.s.rect.left+d.s.border.left),right:d.s.rect.right-d.s.border.right-d.s.scrollbar.right-d.e.rect.right},a={};l.direction.y===!0&&(h.top<0?a.scrollTop=d.s.scroll.top+h.top:h.top>0&&h.bottom<0&&(a.scrollTop=d.s.scroll.top+Math.min(h.top,-h.bottom))),l.direction.x===!0&&(h.left<0?a.scrollLeft=d.s.scroll.left+h.left:h.left>0&&h.right<0&&(a.scrollLeft=d.s.scroll.left+Math.min(h.left,-h.right))),t.isEmptyObject(a)?t.isFunction(l.complete)&&l.complete.call(s[0]):(r.test(s[0].nodeName)&&(s=t("html,body")),s.animate(a,l.duration).eq(0).queue(function(e){t.isFunction(l.complete)&&l.complete.call(s[0]),e()}))}return this}});var c={auto:!0,scroll:!0,visible:!1,hidden:!1};t.extend(t.expr[":"],{scrollable:function(t,o,l){var i=e["string"==typeof l[3]&&l[3].toLowerCase()]||e.both,n=document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(t,null):t.currentStyle,s={x:c[n.overflowX.toLowerCase()]||!1,y:c[n.overflowY.toLowerCase()]||!1,isRoot:r.test(t.nodeName)};if(!s.x&&!s.y&&!s.isRoot)return!1;var d={height:{scroll:t.scrollHeight,client:t.clientHeight},width:{scroll:t.scrollWidth,client:t.clientWidth},scrollableX:function(){return(s.x||s.isRoot)&&this.width.scroll>this.width.client},scrollableY:function(){return(s.y||s.isRoot)&&this.height.scroll>this.height.client}};return i.y&&d.scrollableY()||i.x&&d.scrollableX()}})}(jQuery);