<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
$this->setFrameMode(true);
?>
<button type="button" class="btn btn_colored top_header_show_catalog">
    <i></i>
    <span>Все категории</span>
</button>
<div class="header_catalog_menu">
    <nav class="container header_catalog_menu_scroller"  itemscope="" itemtype="https://schema.org/SiteNavigationElement">
    <?
    $TOP_DEPTH = $arResult["SECTION"]["DEPTH_LEVEL"];
    $CURRENT_DEPTH = $TOP_DEPTH;
    foreach ($arResult["SECTIONS"] as $arSection):
    if ($CURRENT_DEPTH < $arSection["DEPTH_LEVEL"])
        echo "\n", str_repeat("\t", $arSection["DEPTH_LEVEL"] - $TOP_DEPTH), "<ul>";
    elseif ($CURRENT_DEPTH == $arSection["DEPTH_LEVEL"])
        echo "</li>";
    else {
        while ($CURRENT_DEPTH > $arSection["DEPTH_LEVEL"]) {
            echo "</li>";
            echo "\n", str_repeat("\t", $CURRENT_DEPTH - $TOP_DEPTH), "</ul>", "\n", str_repeat("\t", $CURRENT_DEPTH - $TOP_DEPTH - 1);
            $CURRENT_DEPTH--;
        }
        echo "\n", str_repeat("\t", $CURRENT_DEPTH - $TOP_DEPTH), "</li>";
    }
    echo "\n", str_repeat("\t", $arSection["DEPTH_LEVEL"] - $TOP_DEPTH);
    ?>

    <? if ($arSection['DEPTH_LEVEL'] == 1) { ?>
    <li class="header_catalog_menu_l1" itemscope="" itemtype="https://schema.org/ItemList">
        <a href="<?= $arSection["SECTION_PAGE_URL"] ?>" itemprop="url">
            <span style="background-image:url(<?= $arSection['ALT_PICTURE'] ?>) "></span>
            <strong>
                <?= $arSection["NAME"] ?>
                <small><?= $arSection["ELEMENT_CNT_TITLE"] ?></small>
            </strong>
            <meta itemprop="name" content="<?=$arSection["NAME"]?>"/>
        </a>
        <?
        } else {
        ?>
    <li class="header_catalog_menu_l2" itemscope="" itemtype="https://schema.org/ItemList">
        <a href="<?= $arSection["SECTION_PAGE_URL"] ?>" itemprop="url">
            <?= $arSection["NAME"] ?>
            <meta itemprop="name" content="<?=$arSection["NAME"]?>"/>
        </a>
        <?
        } ?>
        <?

        $CURRENT_DEPTH = $arSection["DEPTH_LEVEL"];
        endforeach;

        while ($CURRENT_DEPTH > $TOP_DEPTH) {
            echo "</li>";
            echo "\n", str_repeat("\t", $CURRENT_DEPTH - $TOP_DEPTH), "</ul>", "\n", str_repeat("\t", $CURRENT_DEPTH - $TOP_DEPTH - 1);
            $CURRENT_DEPTH--;
        }
        ?>
    </nav>
</div>
