<!DOCTYPE html >
<%convert_nl_br%>
<html lang="en">
<head>
  <title><%site_title%></title>
<%include include_common_head.html%>
</head>
<body id="home">
  <%~if ad_wallpaper%>
  <%ad_wallpaper%>
  <%~endif%>
  <div class="container">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <%~if in.video%>
        <%~set media = Plugins::UI::fetch_links(link_type => 'video', max_hits => $config.search_maxhits)%>
        <%~set title_loop = Links::Build::build('title', 'Videos')%>
        <%~else%>
        <%~set media = Plugins::UI::fetch_links(link_type => 'photo', max_hits => $config.search_maxhits)%>
        <%~set title_loop = Links::Build::build('title', 'Photo Galleries')%>
        <%~endif%>
        <%include include_breadcrumb.html%>
        <%~set paging = $media.paging%>
        <%~set featured_articles_loop = $media.features%>

        <%~if paging and paging.current_page == 1%>
        <section class="section featured section-has-widgets fixed-height remove-sidebar">
        <div class="sidebar-b hide-on-mobile">
          <%~set adsize = '300x600'%>
          <%include include_ad.html%>
        </div><!-- end sidebar -->
        <div class="content content-has-sidebar">
          <div class="grid">
            <div class="col-1-1">
              <h1><%if in.video%>Videos<%else%>Photo Galleries<%endif%></h1>
            </div>

            <%~if featured_articles_loop.length%>
            <!-- featured articles -->
            <%~set show_ad = 3%><%~set show_category = 1%>
            <%include include_featured_articles.html%>
            <%~set show_category = 0%>
            <%~endif%>
          </div>
        </div><!-- end content -->
        </section><!-- end section -->

        <div class="section-divider"></div>
        <%~endif%>


        <%~set list_view = ''%>
        <section class="section section-has-widgets section-reverse">
        <div class="sidebar-b">
          <%~set widgets_loop = Plugins::UI::fetch_widgets('category', $ID)%>
          <%~set widget_end   = $widgets_loop.length%>
          <%include include_widgets.html%>
        </div>

        <div class="content content-has-widgets">
          <div class="grid">
            <div class="col-1-1<%if paging.current_page > 1%> relative<%endif%>">
              <%~if paging.current_page > 1%>
              <h1><%if in.video%>Videos<%else%>Photos<%endif%></h1>
              <div class="col-1-1 absolute-top right">
                  <%include include_paging.html%>
              </div>
              <%~endif%>

              <%~set show_category = 1%>
              <%~loop media.loop%>
              <%include link.html%>
              <%~if row_num == $num_page_break%><%lastloop%><%endif%>
              <%~endloop%>
              <%~if paging.max_hits < $paging.num_hits%>
              <div class="col-1-1 right">
                <%~set page_button = 'page_button2'%>
                <%include include_paging.html%>
              </div>
              <%~endif%>
            </div>

          </div>
          <div class="section-divider mobile"></div>
        </div><!-- end content -->
        </section><!-- end section -->

        <div class="section-spacer"></div>

      </div><!-- End contentwrapper -->
    </div>
    <%include include_footer.html%>
  </div>
</body>
<%~include include_global_js.html%>
