<!DOCTYPE html >
<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 $config.featured_articles%><%set featured_articles_loop = Plugins::UI::fetch_links(ids => $config.featured_articles)%><%endif%>
                <%~if featured_articles_loop.length%>
                <section class="section featured home">
                <%loop featured_articles_loop%>
                <%if row_num > 1%><%lastloop%><%endif%>
                <%~rewrite_detail_url%>
                <div class="home-featured grid">
                    <div class="col-1-2">
                        <a href="<%detailed_url%>">
                          <%~if thumbnail_url%>
                          <div class="crop-3"><img src="<%thumbnail_url.large || $thumbnail_url.medium%>" class="img-responsive"></div>
                          <%--
                          srcset="<%thumbnail_url.largest%> 620w, <%thumbnail_url.large%> 900w"
                          class="img-responsive">
                          --%>
                          <%~else%>
                          <img src="<%config.build_static_url%>/images/default_470x260.png">
                          <%~endif%>
                        </a>
                    </div>
                    <div class="col-1-2">
                        <div class="featured-hero">
                            <a href="<%URL%>" class="label label-category"><%escape_html Name%></a>
                            <h1><a href="<%detailed_url%>"><%Title%></a></h1>
                            <div class="excerpt briefy">
                                <a href="<%detailed_url%>" class="no-underline" Title="Read more">
                                  <span style="font-size: 15px; font-family: Open Sans, sans-serif" class="post-meta">
                                    <%shorten_it($Description, 150)%>
                                  </span>
                                </a>
                            </div>
                            <div class="post-meta light-grey">
                                <i class="icon sprite-slowtwitch"></i>
                                <span class="author"><%Contact_Name%></span>
                            </div>
                        </div><!-- end featured-content -->
                    </div><!-- end col-6-12 -->
                    
                </div><!-- end grid grid-pad -->
                <%~endloop%>

                <!-- Latest Headlines -->
                <div class="section-has-widgets remove-sidebar clearfix">
                    <div class="sidebar-b">
                        <%~set adsize = '300x600'%>
                        <%include include_ad.html%>
                    </div><!-- end sidebar -->
                    <div class="content content-has-sidebar">
                        <div class="grid">
                            <%~set skip_first = 1%><%~set show_ad = 4%><%set show_category = 1%>
                            <%include include_featured_articles.html%>
                            <%~set show_category = 0%>
                        </div>
                    </div><!-- end content -->
                </div>
                </section><!-- end section: featured articles -->
                <div class="section-divider"></div>
                <%~endif%>

                <%~set widgets_loop = Plugins::UI::fetch_widgets('home')%>
                <section class="section section-has-widgets list clearfix latest-headlines section-reverse">
                <div class="sidebar-b">
                  <%~set widget_start = 1%><%set widget_end = 3%>
                  <%include include_widgets.html%>
                </div>
                <div class="content content-has-widgets">
                    <div class="grid">
                        <!-- latest articles -->
                        <div class="list-column col-6-12 show-3">
                            <%~set row_index = 0%>
                            <%~set latest_news = Plugins::UI::fetch_links(max_hits => 21)%>
                            <%~set list_view   = 'latest'%>
                            <%~if latest_news.length%>
                            <%~loop latest_news%>

                                <%~if row_index == 10%>
                                    </div>
                                    <div class="list-column col-6-12">
                                        <%~set adsize = '300x250_1'%>
                                        <%include include_ad.html%>
                                        <script type="text/javascript">
                                            if (winWidth <= 1024) { document.write('<div style="padding-bottom: 20px;">' + '</div>'); }
                                            else { document.write('<div style="padding-bottom: 48px;">' + '</div>'); }
                                        </script>
                                <%~endif%>

                                <%~set local_id = $ID %>
                                <%~set is_featured = 0 %>
                                <%~loop featured_articles_loop%>
                                    <%~if $local_id == $ID %> 
                                        <%~set is_featured = 1 %>
                                    <%~endif%> 
                                <%~endloop%>
                            <%~if not is_featured%>
                                <%include link.html%>
                                <%~set row_index += 1%> 
                            <%~endif%>              
                            <%~endloop%>
                            <%~endif%>
                        </div>

                    </div><!-- end grid -->

                    <div class="section-divider mobile"></div>

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

                <!--section class="section advert-large"-->
                <div class="content content-has-widgets">
                    <%~set adsize = '970x250'%>
                    <%include include_ad.html%>
                </div>
                <!--/section-->

                <div class="section-divider mobile tablet"></div>

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