$arSites[$arRes['ID']] = '(' . $arRes['ID'] . ') ' . $arRes['NAME'];
    if ($arRes['DEF'] == 'Y') {
        $default_site = $arRes['ID'];
    }
}
$bShowPathForSites = true;
if (count($arSites) <= 1) {
    $bShowPathForSites = false;
}
if ($REQUEST_METHOD == "POST" && isset($_REQUEST['save_type']) && $_REQUEST['save_type'] == 'Y' && check_bitrix_sessid()) {
    //CUtil::JSPostUnEscape();
    $APPLICATION->RestartBuffer();
    if (isset($_REQUEST['del_type']) && $_REQUEST['del_type'] == 'Y') {
        $xmlId = trim($_REQUEST['type_xml_id']);
        if ($xmlId != '') {
            CCalendarType::Delete($xmlId);
        }
    } else {
        $bNew = isset($_POST['type_new']) && $_POST['type_new'] == 'Y';
        $xmlId = trim($bNew ? $_POST['type_xml_id'] : $_POST['type_xml_id_hidden']);
        $name = trim($_POST['type_name']);
        if ($xmlId != '' && $name != '') {
            $XML_ID = CCalendarType::Edit(array('NEW' => $bNew, 'arFields' => array('XML_ID' => $xmlId, 'NAME' => $name, 'DESCRIPTION' => trim($_POST['type_desc']))));
            if ($XML_ID) {
                $arTypes_ = CCalendarType::GetList(array('arFilter' => array('XML_ID' => $XML_ID)));
                if ($arTypes_[0]) {
                    OutputTypeHtml($arTypes_[0]);
                }
            }
        }
    }