SD.calendar.addPopup('eventCategories', new Ext.Window({
	layout: 'fit',
	title: 'Event Categories',
	width: 570,
	height: 384,
	closeAction: 'hide',
	modal: true,
	plain: true,
	tools: [{
		id: 'help'
	}],
	tbar: [{
		text: 'Add Category',
		iconCls: 'add',
		handler: function() {
			grid = this.ownerCt.ownerCt.items.items[0];
			record = Ext.data.Record.create(grid.store.fields.items);
			rec = new record({
				infoDDisplay: true
			});
			grid.stopEditing();
			grid.store.insert(0, rec);
			grid.startEditing(0, 1);
		}
	},
	{
		text: 'Delete Category',
		iconCls: 'delete',
		handler: function() {
			catGrid = this.ownerCt.ownerCt.items.items[0];
			Ext.Msg.show({
				title: 'Warning!',
				msg: 'All associated events with the selected categories will be deleted.  Are you sure you want to continue?',
				buttons: Ext.Msg.YESNO,
				icon: Ext.MessageBox.WARNING,
				fn: function(btn) {
					if (btn == 'yes') {
						catGrid.store.batchRemove(catGrid.selModel.getSelections());
					}
				}
			});
		}
	}],
	items: [
	new SD.calendar.classes.categoryGrid([0, 1, 3], true, 'categories')],
	buttons: [{
		text: 'Close',
		handler: function(btn) {
			this.ownerCt.ownerCt.hide();
			this.ownerCt.ownerCt.items.items[0].store.save();
		}
	}],
	listeners: {
		show: function(popup) {
			popup.items.item(0).store.load();
		}
	}
})
);

