/* Copyright 2006 por Connecty Networks. Todos os direitos reservados */
function Kernel() { this.connected = false; this.widgets = []; this.currentWid = 0; this.getUniqueId = function() { while(this.widgets[this.currentWid]) this.currentWid++; return this.currentWid;}
this.getWidget = function(id) { return this.widgets[id];}
this.addWidget = function(widget) { this.widgets[widget.id] = widget;}
this.freeWidget = function(id) { this.widgets[id] = null;}
this.runWidget = function(className, parent, id, profile) { var code = 'var w = new ' + className + '();'; eval(code); if(w) { profile = profile || false; id = id || false; w.open(parent, id, profile); return w;}
}
this.timers = []; this.processTimer = function(widgetId, period, noAction) { if(kernel.widgets[widgetId]) { if(noAction != true) { kernel.getWidget(widgetId).timerHandler();}
kernel.timers[widgetId] = setTimeout("kernel.processTimer("+widgetId+","+period+")", period);}
}
this.stopTimer = function(widgetId) { if(this.timers[widgetId] != undefined) { clearTimeout(this.timers[widgetId]); this.timers[widgetId] = undefined;}
}
}