'use strict';

function setupSessionMonitor(secondsBeforeExpire) {
	
	window.sessionMonitor = new TimerMonitor({
	    delay   : 1000 * (secondsBeforeExpire - 120),
	    timeout : 60000,
	    timer   : "#temporizador",
	    mouse   : false,
	    start   : function () {
	        PF('sessionExpiringWv').show();
	        PF('bloquearTelaWidget').unblock();
	    },
	    
	    success : function () {
	        keepSession();
	    },
	    
	    failure : function () {
	        $(".alternaSessaoInativa").toggle("escondido");
	        killSession();
	    },
	    
	    counter : function (t) {
	        if (11000 > t) {
	            var tt = $(this.timer); 
	            if (!tt.hasClass("mensagemAtencao")) {
	                tt.addClass("mensagemAtencao");
	            }
	        }
	    }
	});
	
}