exit;
}
$parent = isset($_GET['parent']) ? (int) $_GET['parent'] : 0;
if (isset($_GET['d'])) {
    $d = (int) $_GET['d'];
    if ($d > 0) {
        Region::delete($d);
    }
}
if (isset($_GET['o'])) {
    $o = (int) $_GET['o'];
    $r = (int) $_GET['r'];
    if ($r != 0) {
        $r = 1;
    }
    Region::set_order($o, $parent, $r);
}
$tct = Region::count(array('parent' => $parent));
//total count
$rpp = 10;
//row per page
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct, 'urlVar' => "pageID{$parent}", 'excludeVars' => array('o', 'r', 'd', 't', 'e'));
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$regions = Region::get_all(array('r.parent' => $parent), '', $from - 1 . ", {$rpp}");
include "page-header.php";
?>

<div id="wrapper">
	
	<?php