var Calendar = Class.create(); Calendar.prototype = { title:'', event_count:'', vevent_container: Array(), add: function(vevent) { var container = document.createElement('div'); container.appendChild(vevent.draw()); this._element.appendChild(container); this.vevent_container[vevent.id] = container; this.event_count.increment(); }, remove: function(vevent) { container = this.vevent_container[vevent.id]; if(container) { this._element.removeChild(container); this.event_count.decrement(); } } } var Counter = Class.create(); Counter.prototype = { value: 0, increment: function() { this.value++; this.updateValue(); }, decrement: function() { this.value--; this.updateValue(); }, updateValue: function() { this._element.firstChild.innerHTML = this.value; } }