(function(){var e=function(e){var t=this,n=function(){var t=e;(function(e){function t(t,n){function g(){return r.update(),b(),r}function y(){var e=h.toLowerCase();f.obj.css(c,p/u.ratio),o.obj.css(c,-p),v.start=f.obj.offset()[c],u.obj.css(e,a[n.axis]),a.obj.css(e,a[n.axis]),f.obj.css(e,f[n.axis])}function b(){m?s.obj[0].ontouchstart=function(e){1===e.touches.length&&(w(e.touches[0]),e.stopPropagation())}:(f.obj.bind("mousedown",w),a.obj.bind("mouseup",S)),n.scroll&&window.addEventListener?(i[0].addEventListener("DOMMouseScroll",E,!1),i[0].addEventListener("mousewheel",E,!1)):n.scroll&&(i[0].onmousewheel=E)}function w(t){var n=parseInt(f.obj.css(c),10);v.start=l?t.pageX:t.pageY,d.start=n=="auto"?0:n,m?(document.ontouchmove=function(e){e.preventDefault(),S(e.touches[0])},document.ontouchend=x):(e(document).bind("mousemove",S),e(document).bind("mouseup",x),f.obj.bind("mouseup",x))}function E(t){if(o.ratio<1){var r=t||window.event,i=r.wheelDelta?r.wheelDelta/120:-r.detail/3;p-=i*n.wheel,p=Math.min(o[n.axis]-s[n.axis],Math.max(0,p)),f.obj.css(c,p/u.ratio),o.obj.css(c,-p);if(n.lockscroll||p!==o[n.axis]-s[n.axis]&&p!==0)r=e.event.fix(r),r.preventDefault()}}function S(e){o.ratio<1&&(m?d.now=Math.min(a[n.axis]-f[n.axis],Math.max(0,d.start+(v.start-(l?e.pageX:e.pageY)))):d.now=Math.min(a[n.axis]-f[n.axis],Math.max(0,d.start+((l?e.pageX:e.pageY)-v.start))),p=d.now*u.ratio,o.obj.css(c,-p),f.obj.css(c,d.now))}function x(){e(document).unbind("mousemove",S),e(document).unbind("mouseup",x),f.obj.unbind("mouseup",x),document.ontouchmove=document.ontouchend=null}var r=this,i=t,s={obj:e(".viewport",t)},o={obj:e(".overview",t)},u={obj:e(".scrollbar",t)},a={obj:e(".track",u.obj)},f={obj:e(".thumb",u.obj)},l=n.axis==="x",c=l?"left":"top",h=l?"Width":"Height",p=0,d={start:0,now:0},v={},m="ontouchstart"in document.documentElement?!0:!1;return this.update=function(e){s[n.axis]=s.obj[0]["offset"+h],o[n.axis]=o.obj[0]["scroll"+h],o.ratio=s[n.axis]/o[n.axis],u.obj.toggleClass("disable",o.ratio>=1),a[n.axis]=n.size==="auto"?s[n.axis]:n.size,f[n.axis]=Math.min(a[n.axis],Math.max(0,n.sizethumb==="auto"?a[n.axis]*o.ratio:n.sizethumb)),u.ratio=n.sizethumb==="auto"?o[n.axis]/a[n.axis]:(o[n.axis]-s[n.axis])/(a[n.axis]-f[n.axis]),p=e!=="relative"||o.ratio>1?0:Math.min(o[n.axis]-s[n.axis],Math.max(0,p)),p=e!=="bottom"||o.ratio>1?isNaN(parseInt(e,10))?p:parseInt(e,10):o[n.axis]-s[n.axis],y()},g()}e.tiny=e.tiny||{},e.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:!0,lockscroll:!0,size:"auto",sizethumb:"auto"}},e.fn.tinyscrollbar=function(n){var r=e.extend({},e.tiny.scrollbar.options,n);return this.each(function(){e(this).data("tsb",new t(e(this),r))}),this},e.fn.tinyscrollbar_update=function(t){return e(this).data("tsb").update(t)}})(t)};n(),t.resolveWith(n)};dispatch("tinyscrollbar").containing(e).to("Foundry/2.1 Modules")})();