(function(a,b){var c={init:function(c,d,e){var f=this,g;this.warning=g=a(c),this.resume=a(d),this.options=e,this.countdownOpen=!1,this.failedRequests=e.failedRequests,this._startTimer(),a.data(g[0],"idletimeout",this),a.idleTimer(e.idleAfter*1e3),a(document).bind("idle.idleTimer",function(){a.data(document,"idleTimer")==="idle"&&!f.countdownOpen&&(f._stopTimer(),f.countdownOpen=!0,f._idle())}),this.resume.bind("click",function(a){a.preventDefault(),b.clearInterval(f.countdown),f.countdownOpen=!1,f._startTimer(),f._keepAlive(!1),e.onResume.call(f.warning)})},_idle:function(){var a=this,c=this.options,d=this.warning[0],e=c.warningLength;c.onIdle.call(d),c.onCountdown.call(d,e),this.countdown=b.setInterval(function(){--e===0?(window.clearInterval(a.countdown),c.onTimeout.call(d)):c.onCountdown.call(d,e)},1e3)},_startTimer:function(){var a=this;this.timer=b.setTimeout(function(){a._keepAlive()},this.options.pollingInterval*1e3)},_stopTimer:function(){this.failedRequests=this.options.failedRequests,b.clearTimeout(this.timer)},_keepAlive:function(b){var c=this,d=this.options;typeof b=="undefined"&&(b=!0);if(!this.failedRequests){this._stopTimer(),d.onAbort.call(this.warning[0]);return}a.ajax({timeout:d.AJAXTimeout,url:d.keepAliveURL,error:function(){c.failedRequests--},success:function(b){a.trim(b)!==d.serverResponseEquals&&c.failedRequests--},complete:function(){b&&c._startTimer()}})}};a.idleTimeout=function(b,d,e){return c.init(b,d,a.extend(a.idleTimeout.options,e)),this},a.idleTimeout.options={warningLength:30,keepAliveURL:"",serverResponseEquals:"OK",idleAfter:600,pollingInterval:60,failedRequests:5,AJAXTimeout:250,onTimeout:a.noop,onIdle:a.noop,onCountdown:a.noop,onResume:a.noop,onAbort:a.noop}})(jQuery,window),function(a){a.idleTimer=function b(c){var d=!1,e=!0,f=3e4,g="mousemove keydown DOMMouseScroll mousewheel mousedown",h=function(){d=!d,b.olddate=+(new Date),a(document).trigger(a.data(document,"idleTimer",d?"idle":"active")+".idleTimer")},i=function(){e=!1,clearTimeout(a.idleTimer.tId),a(document).unbind(".idleTimer")},j=function(){clearTimeout(a.idleTimer.tId),e&&(d&&h(),a.idleTimer.tId=setTimeout(h,f))};b.olddate=b.olddate||+(new Date);if(typeof c=="number")f=c;else{if(c==="destroy")return i(),this;if(c==="getElapsedTime")return+(new Date)-b.olddate}a(document).bind(a.trim((g+" ").split(" ").join(".idleTimer ")),j),a.idleTimer.tId=setTimeout(h,f),a.data(document,"idleTimer","active")}}(jQuery)