cambrient.SessionManager=function(){var session_extender_url=null;var self;var KEEP_ALIVE_PERIOD_MS=1000*60*15;var SERVER_TIMEOUT_MS=1000*60*29;var lastServerSighting=0;function constructorFn(){self=this;} constructorFn.prototype.setExtenderUrl=function(url){session_extender_url=cambrient.contextPath+url;if(session_extender_url!=null)setTimeout(self.keepAlive,KEEP_ALIVE_PERIOD_MS);} constructorFn.prototype.keepAlive=function(){if(session_extender_url==null)return;var now=new Date();if(lastServerSighting==0){lastServerSighting=new Date().getTime();} if(now.getTime()-lastServerSighting>SERVER_TIMEOUT_MS){cambrient.userMessaging.info('Have not heard from the server in '+(SERVER_TIMEOUT_MS/(1000*60))+' minutes.');} if(isFunction(session_extender_url.each)){session_extender_url.each(function(url){self.ajaxCall(url);})}else{self.ajaxCall(session_extender_url);} setTimeout(self.keepAlive,KEEP_ALIVE_PERIOD_MS);} constructorFn.prototype.ajaxCall=function(url){new Ajax.Request(session_extender_url,{onSuccess:function(reply){self.serverPing(reply);},onFailure:function(reply){cambrient.userMessaging.error('ERROR!! '+reply);}});} constructorFn.prototype.serverPing=function(reply){lastServerSighting=new Date().getTime();} return new constructorFn();} cambrient.sessionManager=new cambrient.SessionManager();