<!-- nearby schools box tpl -->

<div class="nearby-schools">
    <div class="list-table main_table">
        <div class="header">
            <div>{$lang.rating_label}</div>
            <div>{$lang.grades_label}</div>
            <div>{$lang.distance_label}</div>       
        </div>
        {section loop=$schools name='school' max=$config.nbs_visible_schools}
            {if !$schools[school].gsRating || $schools[school].gsRating < 2}
                {assign var='badge_class' value='warning'}
            {elseif $schools[school].gsRating < 7}
                {assign var='badge_class' value='alert'}
            {else}
                {assign var='badge_class' value='success'}
            {/if}
            <div class="row">
                <div data-caption="{$lang.rating_label}">
                    <span class='badge {$badge_class}'>{if $schools[school].gsRating}{$schools[school].gsRating}{else}0{/if}</span> of 10
                    <a target="_blank" rel="nofollow" href="{$schools[school].overviewLink}">{$schools[school].name}</a></span>
                </div>
                <div data-caption="{$lang.grades_label}">{$schools[school].gradeRange}</div>
                <div data-caption="{$lang.distance_label}">{$schools[school].distance} {$lang.nbs_miles}</div>
            </div>
        {/section}
    </div>
    {if $schools|@count > $config.nbs_visible_schools}
        <div class="hidden-schools">
            <div class="list-table">
                {section loop=$schools name='school' start=$config.nbs_visible_schools}
                    {if !$schools[school].gsRating || $schools[school].gsRating < 2}
                        {assign var='badge_class' value='warning'}
                    {elseif $schools[school].gsRating < 7}
                        {assign var='badge_class' value='alert'}
                    {else}
                        {assign var='badge_class' value='success'}
                    {/if}
                    <div class="row">
                        <div data-caption="{$lang.rating_label}">
                            <span class='badge {$badge_class}'>{if $schools[school].gsRating}{$schools[school].gsRating}{else}0{/if}</span> of 10
                            <a target="_blank" rel="nofollow" href="{$schools[school].overviewLink}">{$schools[school].name}</a></span>
                        </div>
                        <div data-caption="{$lang.grades_label}">{$schools[school].gradeRange}</div>
                        <div data-caption="{$lang.distance_label}">{$schools[school].distance} {$lang.nbs_miles}</div>
                    </div>
                {/section}
            </div>
        </div>
        <div class="view-more-schools"><span class="link nbs-more">{$lang.nbs_view_more}</span><span class="link nbs-less">{$lang.nbs_hide_schools}</span></div>
    {/if}
</div>

<script class="fl-js-static">
{literal}

$(document).ready(function(){
    $('.view-more-schools > span.link').click(function() { 
        $('.nearby-schools').toggleClass('expand');
    });
});

{/literal}
</script>

<!-- nearby schools box tpl end -->