<% content_for :head do %>
  <%= javascript_include_tag :defaults %>
  <%= javascript_include_tag js_url(:action => "application") %>
<% end %>

<div class="sectionHeader">お客様情報入力</div>
<p><span class="must">※</span>は必ずご入力ください。</p>

<noscript>
  <p>JavaScriptが利用できない状態です。<br />一部のコンテンツが正常に動作しない可能性があります</p>
</noscript>

<%= flash[:notice] %>
<%= @temporary_customer && error_messages_for(:temporary_customer) %>
<%= @optional_address && error_messages_for(:optional_address) %>

<% form_tag({:action => 'delivery'}, {:name=>'form1'}) do %>
  <% fields_for :temporary_customer do |f| %>
    <table class="tb2">
      <tr>
        <td>お名前<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          姓<%= f.text_field :family_name, {:class=>"form_m m_left",:style=>"ime-mode:active"} %><br />
          名<%= f.text_field :first_name, {:class=>"form_m m_left",:style=>"ime-mode:active"} %>
        </td>
      </tr>
      <tr>
        <td>お名前（フリガナ）<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          セイ<%= f.text_field :family_name_kana, {:class=>"form_m m_left",:style=>"ime-mode:active"} %><br />
          メイ<%= f.text_field :first_name_kana, {:class=>"form_m m_left",:style=>"ime-mode:active"} %>
        </td>
      </tr>
      <tr>
        <td>郵便番号<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          〒<%= f.text_field :zipcode01, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} -%>-<%= f.text_field :zipcode02, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %>
          <%= link_to "郵便番号を調べる", "http://search.post.japanpost.jp/zipcode/", :target => "_blank" %><br />
          <input name="zipcode_input" value="住所自動入力" onclick="address_by_zip('temporary_customer_zipcode01','temporary_customer_zipcode02', null, 'temporary_customer_address_city', 'temporary_customer_address_detail', 'temporary_customer_prefecture_id', 'cart', '<%=h ActionController::Base.relative_url_root %>');" type="button" class="btn_s rounded rosy postCodeButton" />
          <div>※郵便番号を入力後、クリックしてください。</div>
        </td>
      </tr>
      <tr>
        <td>住所：都道府県<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.collection_select :prefecture_id, Prefecture.find(:all, :order=>:position), :id, :name, :class=>"form_s" %></td>
      </tr>
      <tr>
        <td>住所：市区町村<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :address_city, {:class=>"form_l",:style=>"ime-mode:active"} %><p>(例：千代田区神田神保町)</p></td>
      </tr>
      <tr>
        <td>住所：番地・ビル名<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :address_detail, {:class=>"form_l",:style=>"ime-mode:active"} %><p>(例：1-2-3○○○ビル)</p></td>
      </tr>
      <tr>
        <td>電話番号<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :tel01, {:class=>"form_s",:style=>"ime-mode:inactive"} %>-<%= f.text_field :tel02, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %>-<%= f.text_field :tel03, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %></td>
      </tr>
      <tr>
        <td>FAX番号</td>
	</tr>
	<tr>
        <td><%= f.text_field :fax01, {:class=>"form_s",:style=>"ime-mode:inactive"} %>-<%= f.text_field :fax02, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %>-<%= f.text_field :fax03, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %></td>
      </tr>
      <tr>
        <td>メールアドレス<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :email, {:class=>"form_m",:style=>"ime-mode:inactive"} %></td>
      </tr>
      <tr>
        <td>メールアドレス(確認)<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :email_confirm, {:class=>"form_m",:style=>"ime-mode:inactive"} %></td>
      </tr>
      <tr>
        <td>性別<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          <% [System::MALE, System::FEMALE].each do | value | %>
            <%- if @temporary_customer.sex == value %>
            <%= f.radio_button :sex, value, :checked => "checked" %>
            <%- else %>
            <%= f.radio_button :sex, value %>
            <%- end %>
            <%= content_tag :label, System::SEX_NAMES[value], :for => "customer_sex_%d" % value %>
          <% end %>
        </td>
      </tr>
      <tr>
        <td>職業</td>
	</tr>
	<tr>
        <td><%= f.collection_select :occupation_id, Occupation.find(:all, :order=>:position), :id, :name, :class=>"form_m" ,:prompt => "-"%></td>
      </tr>
      <tr>
        <td>生年月日</td>
	</tr>
	<tr>
        <td><%= f.birthday_select :birthday, :use_month_numbers => true,:start_year =>Time.now.year-70,:end_year=>Time.now.year-10,:default=>{:year=>1980,:montd=>1,:day=>1} %></td>
      </tr>
    </table>
      <%= hidden_field_tag "temporary_customer_flag","1"%>
  <% end %>

  <div id="delivery"><span id="bold" class="tb_t">配送先を指定 </span><br/>
  <div id="deliveryOption" class="m_top m_btm"><%= check_box_tag 'address_enable', "1", ((params[:back] == "1" or @error_back)&& !params[:address_enable].nil?)?true:false %>
  <em class="required"> ※</em>上記に入力されたご住所と同一の場合はチェックをいれると省略可能です。</div></div>
  <% fields_for :optional_address do |f| %>
    <table class="tb2">
      <tr>
        <td>お名前<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          姓<%= f.text_field :family_name, {:class=>"form_m m_left",:style=>"ime-mode:active"} %><br />
          名<%= f.text_field :first_name, {:class=>"form_m m_left",:style=>"ime-mode:active"} %>
        </td>
      </tr>
      <tr>
        <td>お名前（フリガナ）<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          セイ<%= f.text_field :family_name_kana, {:class=>"form_m m_left",:style=>"ime-mode:active"} %><br />
          メイ<%= f.text_field :first_name_kana, {:class=>"form_m m_left",:style=>"ime-mode:active"} %>
        </td>
      </tr>
      <tr>
        <td>郵便番号<span class="must">※</span></td>
	</tr>
	<tr>
        <td>
          〒<%= f.text_field :zipcode01, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} -%>-<%= f.text_field :zipcode02, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %>
          <%= link_to "郵便番号を調べる", "http://search.post.japanpost.jp/zipcode/", :target => "_blank" %><br />
          <input name="zipcode_input" value="住所自動入力" onclick="address_by_zip('optional_address_zipcode01','optional_address_zipcode02', null, 'optional_address_address_city', 'optional_address_address_detail', 'optional_address_prefecture_id', 'cart', '<%=h ActionController::Base.relative_url_root %>');" type="button" class="btn_s rounded rosy postCodeButton" />
         <div>※郵便番号を入力後、クリックしてください。</div>
        </td>
      </tr>
      <tr>
        <td>住所：都道府県<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.collection_select :prefecture_id, Prefecture.find(:all, :order=>:position), :id, :name, :class=>"form_s" %></td>
      </tr>
      <tr>
        <td>住所：市区町村<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :address_city, {:class=>"form_l",:style=>"ime-mode:active"} %><p>(例：千代田区神田神保町)</p></td>
      </tr>
      <tr>
        <td>住所：番地・ビル名<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :address_detail, {:class=>"form_l",:style=>"ime-mode:active"} %><p>(例：1-2-3○○○ビル)</p></td>
      </tr>
      <tr>
        <td>電話番号<span class="must">※</span></td>
	</tr>
	<tr>
        <td><%= f.text_field :tel01, {:class=>"form_s",:style=>"ime-mode:inactive"} %>-<%= f.text_field :tel02, {:class=>"form_s m_left" ,:style=>"ime-mode:inactive"}%>-<%= f.text_field :tel03, {:class=>"form_s m_left",:style=>"ime-mode:inactive"} %></td>
      </tr>
    </table>
  <% end %>
    <div class="my_btn4">
      <%= link_to '戻る', {:action => 'show'}, :class=>'rosy button' %>
      <%= submit_tag '次へ', :action => 'purchase', :class=>'rosy button' %>
    </div>
<% end %>
