!function(e){function t(a){var g,d=this,c=a.data||{};if(c.elem)d=a.dragTarget=c.elem,a.dragProxy=u.proxy||d,a.cursorOffsetX=c.pageX-c.left,a.cursorOffsetY=c.pageY-c.top,a.offsetX=a.pageX-a.cursorOffsetX,a.offsetY=a.pageY-a.cursorOffsetY;else if(u.dragging||c.which>0&&a.which!=c.which||e(a.target).is(c.not))return;switch(a.type){case"mousedown":return e.extend(c,e(d).offset(),{elem:d,target:a.target,pageX:a.pageX,pageY:a.pageY}),i.add(document,"mousemove mouseup",t,c),r(d,!1),u.dragging=null,!1;case!u.dragging&&"mousemove":if(o(a.pageX-c.pageX)+o(a.pageY-c.pageY)<c.distance)break;a.target=c.target,!1!==(g=n(a,"dragstart",d))&&(u.dragging=d,u.proxy=a.dragProxy=e(g||d)[0]);case"mousemove":if(u.dragging){if(g=n(a,"drag",d),s.drop&&(s.drop.allowed=!1!==g,s.drop.handler(a)),!1!==g)break;a.type="mouseup"}case"mouseup":i.remove(document,"mousemove mouseup",t),u.dragging&&(s.drop&&s.drop.handler(a),n(a,"dragend",d)),r(d,!0),u.dragging=u.proxy=c.elem=!1}return!0}function n(t,n,o){t.type=n;var a=e.event.handle.call(o,t);return!1!==a&&(a||t.result)}function o(e){return Math.pow(e,2)}function a(){return!1===u.dragging}function r(e,t){e&&(e.unselectable=t?"off":"on",e.onselectstart=function(){return t},e.style&&(e.style.MozUserSelect=t?"":"none"))}e.fn.drag=function(e,t,n){return t&&this.bind("dragstart",e),n&&this.bind("dragend",n),e?this.bind("drag",t||e):this.trigger("drag")};var i=e.event,s=i.special,u=s.drag={not:":input",distance:0,which:1,dragging:!1,setup:function(n){(n=e.extend({distance:u.distance,which:u.which,not:u.not},n||{})).distance=o(n.distance),i.add(this,"mousedown",t,n),this.attachEvent&&this.attachEvent("ondragstart",a)},teardown:function(){i.remove(this,"mousedown",t),this===u.dragging&&(u.dragging=u.proxy=!1),r(this,!0),this.detachEvent&&this.detachEvent("ondragstart",a)}};s.dragstart=s.dragend={setup:function(){},teardown:function(){}}}(jQuery),function(e){function t(t){var n=[].slice.call(arguments,1),o=0;return t=e.event.fix(t||window.event),t.type="mousewheel",t.wheelDelta&&(o=t.wheelDelta/120),t.detail&&(o=-t.detail/3),n.unshift(t,o),e.event.handle.apply(this,n)}var n=["DOMMouseScroll","mousewheel"];e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=n.length;e;)this.addEventListener(n[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery),function(e){e.plot.plugins.push({init:function(t){function n(e,n){var o=t.offset();o.left=e.pageX-o.left,o.top=e.pageY-o.top,n?t.zoomOut({center:o}):t.zoom({center:o})}function o(e,t){return n(e,t<0),!1}function a(e){if(1!=e.which)return!1;var n=t.getPlaceholder().css("cursor");n&&(s=n),t.getPlaceholder().css("cursor",t.getOptions().pan.cursor),u=e.pageX,g=e.pageY}function r(e){var n=t.getOptions().pan.frameRate;!d&&n&&(d=setTimeout(function(){t.pan({left:u-e.pageX,top:g-e.pageY}),u=e.pageX,g=e.pageY,d=null},1/n*1e3))}function i(e){d&&(clearTimeout(d),d=null),t.getPlaceholder().css("cursor",s),t.pan({left:u-e.pageX,top:g-e.pageY})}var s="default",u=0,g=0,d=null;t.zoomOut=function(e){e||(e={}),e.amount||(e.amount=t.getOptions().zoom.amount),e.amount=1/e.amount,t.zoom(e)},t.zoom=function(n){n||(n={});var o=n.center,a=n.amount||t.getOptions().zoom.amount,r=t.width(),i=t.height();o||(o={left:r/2,top:i/2});var s=o.left/r,u=o.top/i,g={x:{min:o.left-s*r/a,max:o.left+(1-s)*r/a},y:{min:o.top-u*i/a,max:o.top+(1-u)*i/a}};e.each(t.getAxes(),function(e,t){var n=t.options,o=g[t.direction].min,a=g[t.direction].max,r=n.zoomRange;if(!1!==r){if(o=t.c2p(o),a=t.c2p(a),o>a){var i=o;o=a,a=i}var s=a-o;r&&(null!=r[0]&&s<r[0]||null!=r[1]&&s>r[1])||(n.min=o,n.max=a)}}),t.setupGrid(),t.draw(),n.preventEvent||t.getPlaceholder().trigger("plotzoom",[t])},t.pan=function(n){var o={x:+n.left,y:+n.top};isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0),e.each(t.getAxes(),function(e,t){var n,a,r=t.options,i=o[t.direction];n=t.c2p(t.p2c(t.min)+i),a=t.c2p(t.p2c(t.max)+i);var s=r.panRange;!1!==s&&(s&&(null!=s[0]&&s[0]>n&&(n+=i=s[0]-n,a+=i),null!=s[1]&&s[1]<a&&(n+=i=s[1]-a,a+=i)),r.min=n,r.max=a)}),t.setupGrid(),t.draw(),n.preventEvent||t.getPlaceholder().trigger("plotpan",[t])},t.hooks.bindEvents.push(function(e,t){var s=e.getOptions();s.zoom.interactive&&(t[s.zoom.trigger](n),t.mousewheel(o)),s.pan.interactive&&(t.bind("dragstart",{distance:10},a),t.bind("drag",r),t.bind("dragend",i))}),t.hooks.shutdown.push(function(e,t){t.unbind(e.getOptions().zoom.trigger,n),t.unbind("mousewheel",o),t.unbind("dragstart",a),t.unbind("drag",r),t.unbind("dragend",i),d&&clearTimeout(d)})},options:{xaxis:{zoomRange:null,panRange:null},zoom:{interactive:!1,trigger:"dblclick",amount:1.5},pan:{interactive:!1,cursor:"move",frameRate:20}},name:"navigate",version:"1.3"})}(jQuery);