ONLINE_CHECK_INTERVAL=30000;onlinechecker=null;function getOnlineChecker(){if(onlinechecker==null)onlinechecker=new OnlineChecker();return onlinechecker;} function OnlineChecker(){this.observer=new Array();this.observed=new Object();this.addObserver=function(obj,callback){this.observer.push(new Array(obj,callback,new Object()));return(this.observer.length-1)} this.addObserved=function(ticket,id){this.observer[ticket][2][id]=id;if(typeof(this.observed)=="undefined")this.observed[id]=0;this.observed[id]++;} this.removeObserved=function(ticket,id){delete this.observer[ticket][2][id];this.observed[id]--;if(this.observed[id]==0) delete this.observed[id];} this.onlineTimer=setInterval(jQuery.proxy(function(){var ids=new Array();for(var prop in this.observed)ids.push(prop);new Request(7,1).addArgument("id",ids).sendRequest(jQuery.proxy(function(req){var objs=req.getResponse().objects;for(var obs in this.observer){var mess=new Array();for(var obj in objs){if(typeof(this.observer[obs][2][objs[obj].id])=="undefined")continue;mess.push(objs[obj]);} this.observer[obs][1](mess);}},this));},this),ONLINE_CHECK_INTERVAL);}