<html>
<head>
    <link rel="stylesheet" type="text/css" href="<%= cdnURL %>/css/juxt.css">
    <script src="<%= cdnURL %>/js/pjax.min.js"></script>
    <script src="<%= cdnURL %>/js/juxt.js"></script>
    <!-- Google Analytics -->
    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-195842548-1', 'auto');
        ga('send', 'pageview');
    </script>
    <!-- End Google Analytics -->
</head>
<body>
<%- include('nav_bar', { selection: 2 }); %>
<div id="main">
    <h1 class="page-header"><%= lang.global.communities %></h1>
    <div id="admin-announcements" class="communities-wrapper announcements-banner" data-pjax="/communities/announcements">
        <p class="announcements-banner-text"><%= lang.all_communities.ann_string %></p>
    </div>
    <div id="popular" class="communities-wrapper">
        <table>
            <tbody>
                <tr>
                    <td>
                        <h1 class="communities-header"><%= lang.all_communities.popular_places %></h1>
                    </td>
                    <td>
                        <div data-pjax="/communities/all">
                            <button class="outlined-button" style="    margin-top: -25px; right: 50px; position: absolute;"><%= lang.all_communities.show_all %></button>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table>
            <tbody>
            <tr>
                <% for(var i = 0; i < popularCommunities.length; i++) {%>
                    <td>
                        <div class="community-list-wrapper" data-pjax="/communities/<%= popularCommunities[i].community_id %>/new">
                            <img class="community-list-icon" src="<%= cdnURL %>/icons/<%= popularCommunities[i].community_id %>.png">
                            <h2 class="community-list-title"><%= popularCommunities[i].name %></h2>
                            <h4 class="community-list-followers" <%if(popularCommunities[i].name.length < 16) {%> style="margin-top: 45px" <%}%>><%= popularCommunities[i].followers %> followers</h4>
                        </div>
                    </td>
                    <% if( (i + 1) % 3 === 0) { %>
            </tr>
            <tr>
                <% } %>
                <% } %>
            </tr>
            </tbody>
        </table>
    </div>
    <div id="new" class="communities-wrapper">
        <h1 class="communities-header"><%= lang.all_communities.new_communities %></h1>
        <table>
            <tbody>
            <tr>
                <% for(var j = 0; j < newCommunities.length; j++) {%>
                    <td>
                        <div class="community-list-wrapper" data-pjax="/communities/<%= newCommunities[j].community_id %>/new">
                            <img class="community-list-icon" src="<%= cdnURL %>/icons/<%= newCommunities[j].community_id %>.png">
                            <h2 class="community-list-title"><%= newCommunities[j].name %></h2>
                            <h4 class="community-list-followers" <%if(newCommunities[j].name.length < 16) {%> style="margin-top: 45px" <%}%>><%= newCommunities[j].followers %> followers</h4>
                        </div>
                    </td>
                    <% if( (j + 1) % 3 === 0) { %>
            </tr>
            <tr>
                <% } %>
                <% } %>
            </tr>
            </tbody>
        </table>
    </div>
    <img src="" onerror="wiiuBrowser.showLoadingIcon(!1);window.scroll(0, 0);">
</div>
<body onload="stopLoading();">
</body>
</html>