<div class="col-sm-6 col-xs-12">

  <h4 class="breadcrumb">
    <% if @failed %>
      <%= t(:signin_failure) %>
    <% else %>
      <%= t(:signin_please) %>
    <% end %>
  </h4>

  <% if @failed %><%= t(:signin_try_again) %><br><br><% end %>
  <% if @mail_message.present? %><%= @mail_message %><br><br><% end %>

  <%= form_for @user_session, :url => user_session_path, :html => { :id => 'loginform', :class => 'form-horizontal' } do |f| %>
    <input name='userlogin' class='userlogin' />
    <%= f.hidden_field :remember_me, :value => false %>

    <div class="form-group">
      <label class="col-sm-4 col-xs-3 control-label"><%= t(:userid) %></label>
      <div class="col-sm-8 col-xs-9"><%= f.text_field :login, :value => cookies['user_id'], :class => 'form-control' %></div>
    </div>

    <div class="form-group">
      <label class="col-sm-4 col-xs-3 control-label"><%= t(:password) %></label>
      <div class="col-sm-8 col-xs-9">
        <%= f.password_field :password, :class => 'form-control' %>
        <%= link_to t(:forgot), forgot_password_path, :id => 'forgot_password' %>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-4 col-sm-8 col-xs-offset-3 col-xs-9">
        <div class="checkbox">
          <label>
            <%= f.check_box :remember_id, :checked => true %>
            <%= t(:remember_me) %>
          </label>
        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-4 col-sm-8 col-xs-offset-3 col-xs-9"><p class="form-control-static"><%= f.submit t(:signin), :class => 'btn btn-primary' %></p></div>
    </div>
  <% end %>

</div>


<script type="text/javascript">
  var login = document.getElementById('user_session_login');
  if (login.value.length == 0)
    login.focus();
  else
    document.getElementById('user_session_password').focus();
</script>