<div id="seminar_items_index">
  <%= render 'index' %>
</div>

<!-- pageslide -->
<div id="pageslide">
  <div class="page-title clearfix">
    <a class="pull-right" href="javascript:$.pageslide.close()">
      <i class="icons-arrow-left-2"></i>
    </a>
    <span></span>
  </div>
  <div class="view-page">
    <div class="nano">
      <div class="content">
        <div id="add-tags">

          <div class="tab-content">

            <div class="set_new tab-pane fade active in">
              <%= form_for :seminar_item, url: nil, remote: true do |f| %>
                <fieldset>
                  <%= render :partial => "form", :locals => { :f => f } %>
                  <div class="form-actions">
                    <a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
                    <%= f.submit t(:submit), class: 'btn btn-primary btn-small', id: "tag_submit" %>
                  </div>
                </fieldset>
              <% end %>
            </div>

          </div>

        </div>
      </div>
    </div>
  </div>
</div>

<% content_for :page_specific_css do %>
  <%= stylesheet_link_tag "seminar_sets" %>
<% end %>
<% content_for :page_specific_javascript do %>
  <%= javascript_include_tag "check_seminar_set_items.js" %>
  <%= javascript_include_tag "seminar_sets.js" %>
<% end %>

<script type="text/javascript">
  var validate = function(dom){
    var valid = true;
    if($(dom).val()==""){
      valid=false;
      $(dom).parent().parent().addClass('error');
      $(dom).next().removeClass('hide');
    }else{
      $(dom).parent().parent().removeClass('error');
      $(dom).next().addClass('hide');
    }
    return valid;
  }

  $(function(){
    $.each($('.set_new form input:text'),function(){
      $(this).blur(function(){
        validate($(this));
      });
      $(this).keyup(function(){
        validate($(this));
      });
    });
  });

  $("#tag_submit").click(function(){
    var valid = true;
    $.each($(".set_new form input:text"),function(){
      if(!validate($(this))) valid=false;
    });
    if(!valid) return false;
  });
</script>
<!-- pageslide:end -->