the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.AdminGroupQueries.php";
$groupId = $_POST['groupId'];
$plugin = $_POST['plugin'];
$adminGroupQueries = new AdminGroupQueries();
$adminGroupQueries->addPluginToGroup($groupId, $plugin);
$pluginList = $adminGroupQueries->getPluginList($groupId);
// The HTML must match what is in the manageAdminGroups.php file
?>
<span id="pluginTables-<?php 
echo $groupId;
?>
">
<?php 
// Now create each plugin table
foreach ($pluginList as $plugin) {
    $flags = $adminGroupQueries->getGroupPluginPowers($groupId, $plugin->getId());
    ?>
  <table id="pluginSection-<?php 
    echo $groupId;
    ?>
if ($fullPower) {
    $adminGroupQueries = new AdminGroupQueries();
    $error = false;
    // If this is set, then that means a AdminGroup is being added
    if (isset($_POST['submitAdd'])) {
        $newGroupId = $adminGroupQueries->addAdminGroup($_POST['groupName'], $_POST['description']);
        if ($newGroupId < 0) {
            $error = true;
        }
    }
    // If a AdminGroup is being deleted
    if (isset($_POST['deleteAdminGroup'])) {
        $adminGroupQueries->deleteAdminGroup($_POST['adminGroupId']);
    }
    if (isset($_POST['addPlugin'])) {
        $adminGroupQueries->addPluginToGroup($_POST['addPluginGroupId'], $_POST['plugin']);
    }
    // Get list of admin group objects
    $groups = $adminGroupQueries->getAdminGroups();
    ?>
<script type="text/javascript">
  $(window).bind("load",function(){
	 $('#adminGroupList').accordion({autoHeight: false });
  });
  
  $(document).ready(function(){
    // When focus is lost, update the group name field
    $("input[id^='groupName-']").blur(function() {
      var id = $(this).attr("id");
      var splitId = id.split("-");
      var groupId = splitId[1];