{if not $fromCache}
   <div class="container header-bottom">
      <nav class="header-sections" data-nav="top" data-tracking-click='{["event"=>"topMenu"]|json_encode}'>
         <ul class="level-0">
            {foreach $categories as $item}
               <li class="nav-item nav-item-{$item.id} {if $item.submenu and $item.virtual != 'Y'}has-submenu{/if}" data-navitem="{$item.id}">
                  <a href="{url s=category IDcat=$item.id}">
                     {$item.title_short}
                  </a>

                  {if $item.submenu and $item.virtual != 'Y'}
                     <div class="submenu">
                        <div class="submenu-wrapper">
                           <div class="column">
                              <p class="title-default">{t}Kategorie{/t}</p>
                              <ul class="level-{$item.level}">
                                 {$count = 0}
                                 {foreach $item.submenu as $subitem}
                                    {if $subitem.virtual == "Y"}
                                       {$has_virtual = true}
                                    {else}
                                       {$count = $count + 1}
                                       <li class="nav-item" data-navitem="{$subitem.id}">
                                          <a href="{url s=category IDcat=$subitem.id}">
                                             {$subitem.title_short}
                                          </a>
                                       </li>
                                    {/if}
                                    {if $count == 15}{break}{/if}
                                 {/foreach}

                                 <li><a href="{url s=category IDcat=$item.id}" class="all">{t}Všechny kategorie{/t}</a></li>
                              </ul>
                           </div>
                           <div class="column">
                              <p class="title-default">{t}Top značky{/t}</p>
                              <ul class="level-{$item.level}">
                                 {insert_producers assign="bestSellerProducers" category=$item.id count=7 best_sellers=true}
                                 {foreach $bestSellerProducers.producers as $producer}
                                    <li>
                                       <a href="{url s=category IDpd=$producer.id}">
                                          {$producer.name}
                                       </a>
                                    </li>
                                 {/foreach}

                                 <li><a href="{url s=producers}" class="all">{t}Všechny značky{/t}</a></li>
                              </ul>
                           </div>
                           {if $has_virtual}
                              <div class="column">
                                 <p class="title-default">{t}Speciální nabídka{/t}</p>

                                 <ul class="level-{$item.level}">
                                    {$count = 0}
                                    {foreach $item.submenu as $subitem}
                                       {if $subitem.virtual == "Y"}
                                          {$count = $count + 1}
                                          <li class="nav-item" data-navitem="{$subitem.id}">
                                             <a href="{url s=category IDcat=$subitem.id}">
                                                {$subitem.title_short}
                                             </a>
                                          </li>
                                       {/if}
                                       {if $count == 7}{break}{/if}
                                    {/foreach}
                                 </ul>
                              </div>
                           {/if}

                           {if $item.data.products}
                              {insert_products type="product" id=$item.data.products image=2 template="block.products.tpl"
                              no_pager=true topmenu=true catalog_class="col-xxs-12" count=1 listType="menu" listId=$item.id}
                           {/if}
                        </div>
                     </div>
                  {/if}
               </li>
            {/foreach}
         </ul>
      </nav>
   </div>
{else}
   <script>
      {foreach $selection as $item}
      (function() {
         var element = document.querySelector('[data-nav="top"] [data-navitem="{$item}"]');
         if (element) {
            element.classList.add("active");
         }
      })();
      {/foreach}
   </script>
{/if}
