if (trim($_POST['categoryname']) == "") {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You may not enter a blank category name.<br>";
 }
 // Check Section
 if (!is_numeric($_POST['section']) || $_POST['section'] >= $menuXML->info->section->count() || $_POST['section'] < 0) {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid menu section.<br>";
 }
 // Check Header Type
 if (!in_array($_POST['headertype'], $arrCheckType)) {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid header type.<br>";
 }
 // Check Display Order
 $menuCatObj->setCategoryKeyValue($_POST['section']);
 $intNewOrderNum = $menuCatObj->validateOrder($_POST['displayorder'], $_POST['beforeafter']);
 if ($intNewOrderNum === false) {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid header type.<br>";
 }
 if ($_POST['accesstype'] != "0" && $_POST['accesstype'] != "1" && $_POST['accesstype'] != "2") {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid access type.<br>";
 }
 if ($_POST['hidecategory'] != "1") {
     $_POST['hidecategory'] = 0;
 }
 if ($_POST['headertype'] == "customcode") {
     $headerImageURL = $_POST['headercustomcode'];
 } elseif ($_POST['headertype'] == "customformat") {
     $arrDispSectionNames[$x] = $menuXML->info->section[$x];
 }
 echo "<table class='formTable' style='margin-top: 0px; border-spacing: 0px'><tr><td colspan='5' class='dottedLine'></td></tr>";
 $intSection = "";
 $result = $mysqli->query("SELECT * FROM " . $dbprefix . "menu_category ORDER BY section, sortnum");
 while ($row = $result->fetch_assoc()) {
     if ($intSection != $row['section']) {
         $intSection = $row['section'];
         $counter = 0;
         echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='dottedLine main manageList' style='padding-top: 5px; text-decoration: underline; font-weight: bold'>\n\t\t\t\t\t\t\t" . $arrDispSectionNames[$intSection] . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='dottedLine main manageList' colspan='4' align='center'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $intAddMenuCatCID . "&sectionID=" . $intSection . "'><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/add.png' class='manageListActionButton' title='Add menu category to " . $arrDispSectionNames[$intSection] . "'></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
     }
     $addCSS = "";
     if ($counter % 2 == 1) {
         $addCSS = " alternateBGColor";
     }
     $menuCatObj->setCategoryKeyValue($intSection);
     $intHighestSortNum = $menuCatObj->getHighestSortNum();
     if ($counter == 0) {
         $dispUpArrow = "<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/transparent.png' class='manageListActionButton'>";
     } else {
         $dispUpArrow = "<a href='javascript:void(0)' onclick=\"moveCat('up', '" . $row['menucategory_id'] . "')\"><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/uparrow.png' class='manageListActionButton' title='Move Up'></a>";
     }
     if ($counter + 1 == $intHighestSortNum) {
         $dispDownArrow = "<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/transparent.png' class='manageListActionButton'>";
     } else {
         $dispDownArrow = "<a href='javascript:void(0)' onclick=\"moveCat('down', '" . $row['menucategory_id'] . "')\"><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/downarrow.png' class='manageListActionButton' title='Move Down'></a>";
     }
     echo "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='dottedLine main manageList" . $addCSS . "' style='font-weight: bold; padding-left: 10px; width: 76%'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $intEditMenuCatCID . "&mcID=" . $row['menucategory_id'] . "&action=edit'>" . filterText($row['name']) . "</a></td>\n\t\t\t\t\t<td class='dottedLine main manageList" . $addCSS . "' style='width: 6%' align='center'>" . $dispUpArrow . "</td>\n\t\t\t\t\t<td class='dottedLine main manageList" . $addCSS . "' style='width: 6%' align='center'>" . $dispDownArrow . "</td>\n\t\t\t\t\t<td class='dottedLine main manageList" . $addCSS . "' style='width: 6%' align='center'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $intEditMenuCatCID . "&mcID=" . $row['menucategory_id'] . "&action=edit'><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/edit.png' class='manageListActionButton' title='Edit Category'></a></td>\n\t\t\t\t\t<td class='dottedLine main manageList" . $addCSS . "' style='width: 6%' align='center'><a href='javascript:void(0)' onclick=\"deleteCat('" . $row['menucategory_id'] . "')\"><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/delete.png' class='manageListActionButton' title='Delete Category'></a></td>\n\t\t\t\t</tr>\n\t\t\t";
     $counter++;
 }
 if ($result->num_rows == 0) {