function pathos_core_decrementLocationReference($loc, $section)
{
    return exponent_core_decrementLocationReference($loc, $section);
}
 function deleteLevel($parent)
 {
     global $db;
     $kids = $db->selectObjects('section', 'parent=' . $parent);
     foreach ($kids as $kid) {
         NavigationModule::deleteLevel($kid->id);
     }
     $secrefs = $db->selectObjects('sectionref', 'section=' . $parent);
     foreach ($secrefs as $secref) {
         $loc = exponent_core_makeLocation($secref->module, $secref->source, $secref->internal);
         exponent_core_decrementLocationReference($loc, $parent);
         foreach ($db->selectObjects('locationref', "module='" . $secref->module . "' AND source='" . $secref->source . "' AND internal='" . $secref->internal . "' AND refcount = 0") as $locref) {
             if (class_exists($locref->module)) {
                 $modclass = $locref->module;
                 $mod = new $modclass();
                 $mod->deleteIn(exponent_core_makeLocation($locref->module, $locref->source, $locref->internal));
             }
         }
         $db->delete('locationref', "module='" . $secref->module . "' AND source='" . $secref->source . "' AND internal='" . $secref->internal . "' AND refcount = 0");
     }
     $db->delete('sectionref', 'section=' . $parent);
     $db->delete('section', 'parent=' . $parent);
 }