<div class="eject_con">
  <div id="warning" class="alert alert-error"></div>
  <form method="post" action="{:url('/home/sellerdeliverset/daddress_add',['address_id'=>$address_info.address_id])}" id="address_form" target="_parent">
    <input type="hidden" name="form_submit" value="ok" />
    <input type="hidden" value="<?php echo $address_info['city_id'];?>" name="city_id" id="_area_2">
    <input type="hidden" value="<?php echo $address_info['area_id'];?>" name="area_id" id="_area">
    <input type="hidden" name="address_id" value="<?php echo $address_info['address_id'];?>" />
    <dl>
      <dt><i class="required">*</i>{$Think.lang.store_daddress_receiver_name} {$Think.lang.ds_colon}</dt>
      <dd>
        <input type="text" class="text" name="seller_name" value="<?php echo $address_info['seller_name'];?>"/>
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>{$Think.lang.store_daddress_location}{$Think.lang.ds_colon}</dt>
      <dd>
        <div>
          <input type="hidden" name="region" id="region" value="<?php echo $address_info['area_info'];?>"/>
        </div>
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>{$Think.lang.store_daddress_address}{$Think.lang.ds_colon}</dt>
      <dd>
        <input class="text w300" type="text" name="address" value="<?php echo $address_info['address'];?>"/>
        <p class="hint">{$Think.lang.store_daddress_not_repeat}</p>
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>{$Think.lang.store_daddress_phone_num}{$Think.lang.ds_colon}</dt>
      <dd>
        <input type="text" class="text" name="telphone" value="<?php echo $address_info['telphone'];?>"/>
      </dd>
    </dl>
    <dl>
      <dt class="required">{$Think.lang.store_daddress_company}{$Think.lang.ds_colon}</dt>
      <dd>
        <input type="text" class="text" name="company" value="<?php echo $address_info['company'];?>"/>
      </dd>
    </dl>
    <div class="bottom">
      <label class="submit-border"><input type="submit" nctype="address_add_submit" class="submit" value="{$Think.lang.ds_common_button_save}" /></label>
    </div>
  </form>
</div>
<script>
var SITE_URL = "{$Think.config.url_domain_root}";
$(document).ready(function(){
    
	$("#region").nc_region();
	$('input[nctype="address_add_submit" ]').click(function(){
		if ($('#address_form').valid()) {
			ajaxpost('address_form', '', '', 'onerror');
		}
	});
    $('#address_form').validate({
        errorLabelContainer: $('#warning'),
        invalidHandler: function(form, validator) {
           var errors = validator.numberOfInvalids();
           if(errors)
           {
               $('#warning').show();
           }
           else
           {
               $('#warning').hide();
           }
        },
        rules : {
            seller_name : {
                required : true
            },
            region : {
            	checklast: true
            },
            address : {
                required : true
            },
            telphone : {
                required : true,
                minlength : 6
            }
        },
        messages : {
            seller_name : {
                required : '<i class="icon-exclamation-sign"></i>{$Think.lang.store_daddress_input_receiver}'
            },
            region : {
                checklast : '<i class="icon-exclamation-sign"></i>请将地区选择完整'
            },
            address : {
                required : '<i class="icon-exclamation-sign"></i>{$Think.lang.store_daddress_input_address}'
            },
            telphone : {
                required : '<i class="icon-exclamation-sign"></i>{$Think.lang.store_daddress_phone_rule}',
                minlength: '<i class="icon-exclamation-sign"></i>{$Think.lang.store_daddress_phone_rule}'
            }
        }
    });
});
</script> 
