{if not $fromCache}
   {$topMenuLimit = $cfg.topMenuLimit|default:4}

   {foreach $categories|array_slice:0:$topMenuLimit as $item}
      <li class="nav-item nav-item-{$item.id} {if $item.submenu}has-submenu{/if}">
         <a href="{url s=category IDcat=$item.id}" class="nav-link">
            {$item.title_short}
         </a>

         {if $item.submenu}
            <div class="submenu">
               <div class="submenu-wrapper">
                  <ul class="menu-list-2">
                     {foreach array_slice($item.submenu, 0, 5) as $subitem}
                        {if $subitem.virtual == "Y" or ($item.id == 2 and $subitem@index == 4)}{continue}{/if} {* nezobrazovat VK a darkove poukazy *}
                        <li class="menu-item">
                           <a href="{url s=category IDcat=$subitem.id}" class="menu-link">{$subitem.title_short}</a>

                           {if $subitem.photo}
                              <img src="{get_photo photo=$subitem.photo size=section}" alt="{$subitem.title}" class="section-img">
                           {/if}

                           {if $subitem.submenu}
                              <ul class="menu-list-3">
                                 {foreach array_slice($subitem.submenu, 0, 5) as $subsubitem}
                                    <li class="menu-item">
                                       <a href="{url s=category IDcat=$subsubitem.id}"
                                          class="menu-link">{$subsubitem.title}</a>
                                    </li>
                                 {/foreach}
                              </ul>
                              <a href="{url s=category IDcat=$subitem.id}"
                                 class="btn btn-link">{t}Celý sortiment{/t}</a>
                           {/if}

                        </li>
                     {/foreach}
                  </ul>

                  {if $item.id == 1}
                     {insert_menu menu_id=2 template="block.topsections.campaigns.tpl" gender="female" skip_cache=1}
                  {/if}

                  {if $item.id == 2}
                     {insert_menu menu_id=3 template="block.topsections.campaigns.tpl"  gender="male" skip_cache=1}
                  {/if}
               </div>
            </div>
         {/if}
      </li>
   {/foreach}
{else}
   <script>
      wpj.onReady.push(function() {
         {if $selection}
         {foreach $selection as $item}
         $("[data-nav=\"top\"] .nav-item-{$item}").addClass('active');
         {/foreach}
         {/if}
         {if $ctrl.currUrl.Rel == "/"}
         $('[data-nav="top"] .nav-item.home').addClass('active');
         {/if}
      });
   </script>
{/if}
