}
// INITIALIZE FIELD OBJECT
$field = new se_field($type);
// Flush cached stuff
if (!empty($_GET['cat_id']) && is_object($cache_object)) {
    $cache_object->remove('site_profile_categories_' . $_GET['cat_id']);
}
// SAVE CATEGORY
if ($task == "savecat") {
    $cat_id = $_GET['cat_id'];
    $cat_title = $_GET['cat_title'];
    $cat_dependency = $_GET['cat_dependency'];
    // IF CAT TITLE IS BLANK, DELETE
    if ($cat_title == "") {
        if ($cat_id != "new") {
            $field->cat_delete($cat_id);
        }
        // SEND AJAX CONFIRMATION
        echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
        echo "window.parent.removecat('{$cat_id}');";
        echo "</script></head><body></body></html>";
        exit;
        // SAVE CHANGES
    } else {
        $newcat_id = $field->cat_modify($cat_id, $cat_title, $cat_dependency);
        // SEND AJAX CONFIRMATION
        echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
        echo "window.parent.savecat_result('{$cat_id}', '{$newcat_id}', '{$cat_title}', '{$cat_dependency}');";
        echo "</script></head><body></body></html>";
        exit;
    }