<%= call_hook :view_account_login_top %>
<table id="login_form_container">
  <tr>
    <td>
      <div id="easy_quote_container" style="display:none">

      </div>
      <div id="login-form">
        <%= form_tag(signin_path, onsubmit: 'return keepAnchorOnSignIn(this);') do %>
          <%= hidden_field_tag(:load_iframe, true) if params[:load_iframe] || User.current.in_iframe %>
          <%= back_url_hidden_field_tag %>
          <table>
            <tr>
              <td>
                <div><label for="username" class="icon-user"><%#=l(:field_login)%></label></div>
              </td>
              <td>
                <div><%= text_field_tag 'username', params[:username], :tabindex => '1' %></div>
              </td>
            </tr>
            <tr>
              <td>
                <div><label for="password" class="icon-lock"><%#=l(:field_password)%></label></div>
              </td>
              <td style="text-align:left;">
                <div><%= password_field_tag 'password', nil, :tabindex => '2' %></div>
              </td>
            </tr>
            <% if Setting.openid? %>
            <tr>
              <td>
                <div><label for="openid_url" class="icon-linux"><%#=l(:field_identity_url)%></label></div>
              </td>
              <td style="text-align:left;">
                <div><%= text_field_tag "openid_url", nil, :tabindex => '3' %></div>
              </td>
            </tr>
            <% end %>
            <% if Setting.autologin? %>
            <tr id="autologin_field">
              <td colspan="2"><%= check_box_tag 'autologin', 1, false, :tabindex => 4 %>
                <%= label_tag(:autologin, l(:label_stay_logged_in)) %>
              </td>
            </tr>
            <% end -%>
            <tr id="login_submit_field" class="centered-fields">
              <td colspan="2">
                <button type="submit" name="login" value="" tabindex="5"><i class="icon icon-unlock"></i> <%=l(:button_login)%></button>
              </td>
            </tr>
            <tr id="lost_password_field" class="centered-fields">
              <td colspan="2">
                <%= link_to( l(:label_password_lost), lost_password_path) if Setting.lost_password? %>
                <% if Setting.login_required? && Setting.self_registration? %>
                  <%= link_to( l(:label_register), register_path) %>
                <% end %>
              </td>
            </tr>
          </table>
        <% end %>
        <div id="easy_quote_container" style="display:none">

        </div>
      </div>
      <%= call_hook :view_account_login_bottom %>
    </td>
  </tr>
</table>

<% if params[:username].present? %>
  <%= javascript_tag "$('#password').focus();" %>
<% else %>
  <%= javascript_tag "$('#username').focus();" %>
<% end %>
<% unless EasySetting.value(:hide_login_quotes) %>
  <script type="text/javascript">
    $(document).ready(function(){
      $.ajax({url: '<%= login_quotes_path(:format => 'text') %>', type:'GET', noLoader: true, success: function(response) {
          $("#easy_quote_container").show().html($("<blockquote/>").append(response));
        }
      });
    });
  </script>
<% end -%>
<%= call_hook :view_account_login_page_bottom %>
