{% load i18n %}

  <ul class="nav nav-tabs">
  <li class="active">
    <a href="#" style="font-weight:bold;">
      {% if sh_icon %}
        <i class="{{ sh_icon }}"></i>
      {% endif %}
      {{ sh_title }}
      {% if rss_url %}
        &nbsp;<button class="btn btn-mini" id="rss_btn{{ rss_btn_id }}">RSS <i class="icon-rss"></i></button>
        <script>
          $('#rss_btn{{ rss_btn_id }}').click(function() {
            location.href = '{{ rss_url }}';
          });
        </script>
      {% endif %}
      </a>
      
  </li>
    <li style="float:right;">
      <div class="btn-group" id="ome_btn_group_{{ id_addon }}" data-toggle="buttons-radio">
      <button class="btn btn-small{% if not only_main %} active{% endif %}" id="ome_all">{% trans "All" %}</button>
      <button class="btn btn-small{% if only_main %} active{% endif %}" id="ome_selected">{% trans "Only main events" %}</button>
    </div>
    </li>
</ul>

<script>
  $(document).ready(function() {
    
    $('#ome_btn_group_{{ id_addon }} #ome_all').click(function() {
      $('.events_{{ id_addon }} .no_events_tr').css('display', 'none');
      if ($('.events_{{ id_addon }} .tr_normal_event').is("div")) {
        $('.events_{{ id_addon }} .tr_normal_event').css('display', 'block');
      } else {
        $('.events_{{ id_addon }} .tr_normal_event').css('display', 'table-row');
      }
    });
    $('#ome_btn_group_{{ id_addon }} #ome_selected').click(function() {
      $('.events_{{ id_addon }} .tr_normal_event').css('display', 'none');
      var num_visible_trs = 0;
      $('.events_{{ id_addon }} .type_table tr').each(function() {
        if($(this).css('display') != 'none') {
          num_visible_trs += 1;
        }
      });
      $('.events_{{ id_addon }} .type_div').each(function() {
        if($(this).css('display') != 'none') {
          num_visible_trs += 1;
        }
      });
      if(num_visible_trs == 0) {
        if ($('.events_{{ id_addon }} .no_events_tr').is("div")) {
          $('.events_{{ id_addon }} .no_events_tr').css('display', 'block');
        } else {
          $('.events_{{ id_addon }} .no_events_tr').css('display', 'table-row');
        } 
      }
    });
    
    {% if not only_main %}
      $('#ome_btn_group_{{ id_addon }} #ome_all').trigger('click');
    {% else %}
      $('#ome_btn_group_{{ id_addon }} #ome_selected').trigger('click');
    {% endif %}
  });
  
</script>



















