      var forumMenu = new Ext.menu.Menu({
                                        items: [
                                                  {
                                                    id: 'mnu_item-edit_forumitem',
                                                    text: 'Properties'
                                                  },{
                                                    id: 'mnu_item-edit_forumdelete',
                                                    text: 'Delete Item'
                                                  }
                                                ],
                                        listeners: {
                                          itemclick: function(item) {
                                            var n = item.parentMenu.contextNode;
                                            switch (item.id) {
                                              case 'mnu_item-edit_forumitem':
                                                if (n.parentNode) {
                                                  setTimeout(function(){
                                                    callEditor({navigationContextNode: n, editorDataID: n.attributes.id, editorType: 'Forum', editorModal: true});
                                                  }, 100);
                                                }
                                                break;
                                              case 'mnu_item-edit_forumdelete':
                                                msgTitle = 'Delete Main Forum Category?';
                                                msgStr = 'You are about to delete a forum. This will also remove all sub-topics and posts. Are you sure you want to do this?';
                                                if (n.parentNode) {
                                                  Ext.Msg.show({
                                                    title: msgTitle,
                                                    msg: msgStr,
                                                    buttons: Ext.Msg.YESNO,
                                                    fn: function(btn){
                                                      if (btn == 'yes'){
                                                        n.attributes.deleted=true;
                                                        n.getUI().hide();
                                                      }
                                                    },
                                                    icon: Ext.MessageBox.QUESTION
                                                  });
                                                }
                                                break;
                                            }
                                          }
                                        }
                                      });
      function windowForumEditor(loadMode){
        if (!canEdit)
          return false;

        var tree2 = new Ext.tree.TreePanel({
              id : 'mainForumList_adder',
              useArrows:true,
              autoScroll:true,
              animate:true,
              height:200,
              region: 'center',
              enableDD:true,
              //tbar: [{text: 'Add'},{text: 'Rename'},{text: 'Delete'}],
              containerScroll: true,
              rootVisible: false,
              root: { nodeType: 'async', allowDrop: false},
              dataUrl : '/ajax/siteconfig/moduleList.cfm?mode=forum',
              listeners: {
                checkchange: function(node, checked){
                  if(checked){
                    node.getUI().addClass('complete');
                  }else{
                    node.getUI().removeClass('complete');
                  }
                }
              }
          });

        var tree = new Ext.tree.TreePanel({
              useArrows:true,
              id : 'mainForumList',
              autoScroll:true,
              animate:true,
              region: 'center',
              enableDD:true,
              containerScroll: true,
              rootVisible: false,
              root: { nodeType: 'async'},
              dataUrl : '/ajax/siteconfig/forum/forumNodes.cfm',
              //contextMenu: gcdMenu,
              listeners: {
                beforenodedrop: function(e){
                  if (e.source.tree.id!=e.tree.id){
                    var newEl = e.dropNode.clone();
                    newEl.leaf=false;
                    newEl.getUI().toggleCheck(true);                    
                    e.dropNode = newEl;
                    if (newEl.attributes.data_type=='header'){
                      setTimeout(function(){
                        callEditor({navigationContextNode: newEl, editorDataID: 0, editorType: 'Forum', editorModal: true});
                      }, 100);
                    }else if (newEl.attributes.data_type=='category'){
                      setTimeout(function(){
                        callEditor({navigationContextNode: newEl, editorDataID: 0, editorType: 'Forum', editorModal: true});
                      }, 100);
                    }
                  }
                },
                contextmenu: function(node, e) {
                  node.select();
                  var c = forumMenu;
                  c.contextNode = node;
                  c.showAt(e.getXY());
                },
                checkchange: function(node, checked){
                  if(checked){
                    node.getUI().addClass('complete');
                  }else{
                    node.getUI().removeClass('complete');
                  }
                }
              }
          });
        var treeLeft = new Ext.Panel({
          border: false,
          region: 'center',
          margins:'5 0 0 0',
          layout: 'border',
          items: [
            {
              region: 'north', 
              margins:'0 0 -1 0',
              baseCls: 'siteConfigHeaderTab',
              cmargins:'3 3 3 3', 
              border: true, 
              html: '<strong>Current Forum Configuration</strong>'
            },tree]
        });
        var treeRight = new Ext.Panel({
          border: false,
          region: 'east',
          layout: 'border',
          margins:'5 0 0 5',
          cmargins:'3 3 3 3',
          width: 230,
          items: [
            {
              region: 'north', 
              margins:'0 0 -1 0',
              baseCls: 'siteConfigHeaderTab',
              cmargins:'3 3 3 3', 
              border: true, 
              html: '<strong>Available Options</strong>'
            },{
              region: 'south', 
              margins:'10 10 10 10',
              cmargins:'3 3 3 3',
              baseCls: 'x-plain', 
              border: true, 
              html: '<strong>Drag & Drop above options</strong> to create and activate them.'
            },tree2]
        });
        var navInfo = 'Changes will be applied when you click \'Save\' below.';
        var treeHolder = new Ext.Panel({
          border: false,          
          layout: 'fit',
          bodyStyle: 'background: #DFE8F6',
          id: 'tabForumEditor',
          items: new Ext.Panel({
              border: false,          
              layout: 'border',
              items: [
                {
                  region: 'north',
                  border: true, 
                  html: '<div class="siteConfigInfo"><div class="siteConfigHeader">Organize your Forum Categories and Topics list here.</div><div class="siteConfigText">'+navInfo+'</div></div>'
                },
                treeLeft,
                treeRight]
            })
        });
        
        if (loadMode){
          treeHolder.title = 'Forum';
          return treeHolder;
        }
        /*  
        var winDepartmentEdit = new Ext.Window({
              width:500,
              height:550,
              title: gcdType == 'dept' ? 'Department Editor' : 'Class Editor',
              layout:'fit',
              closeAction:'close',
              modal:true,
              closable:false,
              border:false,
              maximizable:true,
              items: treeHolder,
              buttons: [{
                text: 'Save',
                handler: function(){
                  var tmpSerial = new Ext.tree.JsonTreeSerializer(tree, { nodeFilter: function(node) {
                      return true;
                    }});
                  new Ajax.Request('/ajax/siteconfig/gcd/updateSchools.cfm', {
                    postBody: 'schoolData=' + tmpSerial,
                    onSuccess: function(transport){
                      winDepartmentEdit.close();
                      window.location.reload(true);
                      Ext.Msg.wait('Saving your school configuration. This may take a few seconds.', 'Please wait...');
                    }
                  });
                }
              },{ text: 'Cancel', handler: function(){ winDepartmentEdit.close(); } }]
          });
        tree.getRootNode().expand(true);
        winDepartmentEdit.show(this);
        */
      }
      
reportingIn('forumTab');