<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<tpl>$nc_charset</tpl>" />
<title><tpl>if $flag eq add</tpl><tpl>$shopping_address_title_add</tpl><tpl>else</tpl><tpl>$shopping_address_title_modify</tpl><tpl>/if</tpl>-<tpl>$site_name</tpl> - Powered by ShopNC</title>
<meta content="<tpl>$shop_keywords</tpl>" name="keywords">
<meta content="<tpl>$shop_description</tpl>" name="description">
<link href="<tpl> $template_dir </tpl>/css/default.css" rel="stylesheet" type="text/css" />
<link href="<tpl> $template_dir </tpl>/css/headfoot.css" rel="stylesheet" type="text/css" />
<link href="<tpl> $template_dir </tpl>/css/login.css" rel="stylesheet" type="text/css" />
<link href="<tpl> $template_dir </tpl>/css/usercenter.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<tpl> $template_dir </tpl>/js/jquery.js"></script>
<script type="text/javascript" src="<tpl> $site_url </tpl>/js/jquery/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("input").focus(function() {
		$(this).addClass("curfocus")
	});
	$("input").blur(function() {
		$(this).removeClass("curfocus")
	});
	
	
	<tpl>if $country_select != ''</tpl>
	$("#country_select").html('<tpl>$country_select</tpl>');
	<tpl>/if</tpl>
	<tpl>if $province_select != ''</tpl>
	$("#province_select").html('<tpl>$province_select</tpl>');
	<tpl>/if</tpl>
	<tpl>if $city_select != ''</tpl>
	$("#city_select").html('<tpl>$city_select</tpl>');
	<tpl>/if</tpl>
	<tpl>if $county_select != ''</tpl>
	$("#county_select").html('<tpl>$county_select</tpl>');
	<tpl>/if</tpl>
	
	/* 对输入内容进行校验 */
	$("#shopping_save").validate({
		errorClass: "wrong",
		rules: {
			txt_other_true_name		: {required:true,minLength:2,maxLength:30},
			txt_other_email			: {required:true,email:true,maxLength:30},
			txt_other_address		: {required:true,minLength:2,maxLength:30},
			txt_other_zip			: {required:true,ZIP:true},
			txt_other_mobilephone	: {required:true,Mobile:true},
			txt_other_phone			: {Phone:true},
			txt_other_otherphone	: {Phone:true}
		},
		messages: {
			txt_other_true_name		: {required:"<tpl>$shopping_address_true_name_is_null</tpl>",minLength:"<tpl>$shopping_address_string_min</tpl>",maxLength:"<tpl>$shopping_address_string_max</tpl>"},
			txt_other_email			: {required:"<tpl>$shopping_address_email_is_null</tpl>",email:"<tpl>$shopping_address_email_error</tpl>",maxLength:"<tpl>$shopping_address_string_max</tpl>"},
			txt_other_address		: {required:"<tpl>$shopping_address_address_is_null</tpl>",minLength:"<tpl>$shopping_address_string_min</tpl>",maxLength:"<tpl>$shopping_address_address_max</tpl>"},
			txt_other_zip			: {required:"<tpl>$shopping_address_zip_is_null</tpl>",ZIP:"<tpl>$shopping_address_zip_error</tpl>"},
			txt_other_mobilephone	: {required:"<tpl>$shopping_address_mobilphone_null</tpl>",Mobile:"<tpl>$shopping_address_mobilphone_error</tpl>"},
			txt_other_phone			: {Phone:"<tpl>$shopping_address_phone_error</tpl>"},
			txt_other_otherphone	: {Phone:"<tpl>$shopping_address_phone_error</tpl>"}
		}
	});
	
	/*
	* 下拉菜单点击事件
	* select_top_name	为点击菜单
	* select_name		为子菜单
	*/
	var	area_change=function(select_top_name,select_name){
	$('#'+select_top_name).change(function(){
			var item_value	= $("select[@name="+select_top_name+"] option[@selected]").val();
			var	option_top	= "<option value=\"0\" selected=\"selected\"><tpl>$modify_userinfo_select</tpl></option>";
			/* ajax传值 */
			$.post('../admin/admin_module_region.php',{'action':'ajax_area','area_id':item_value},function(data) {
			/* 当选择为第一或是第二菜单的时候，情况第三，第四菜单 */
			if(select_top_name == 'select0') {
				/* 隐藏下面id的下拉菜单 */
				$("#select2,#select3,#select1").css("display","none");
				/* 获取选中值 */
				var	item_country = $("select[@name='select0'] option[@selected]").text();	
			} else if (select_top_name == 'select1') {
				/* 隐藏下面id的下拉菜单 */
				$("#select2,#select3").css("display","none");
				/* 获取选中值 */
				var	item_country = $("select[@name='select0'] option[@selected]").text();
				var item_province= $("select[@name='select1'] option[@selected]").text();
			} else if (select_top_name == 'select2') {
				$("#select3").css("display","none");
				/* 获取选中值 */
				var	item_country = $("select[@name='select0'] option[@selected]").text();
				var item_province= $("select[@name='select1'] option[@selected]").text();
				var item_city	 = $("select[@name='select2'] option[@selected]").text();
			} else if (select_top_name == 'select3') {
				/* 获取选中值，此中缺少一个地区，也就是第四级地区（如果加入，对应其他地方也需要修改） */
				var item_province= $("select[@name='select1'] option[@selected]").text();
				var item_city	 = $("select[@name='select2'] option[@selected]").text();
				var	item_country = $("select[@name='select0'] option[@selected]").text();
			}
			if(select_name != 0) {
			/* 如果下级菜单有值，显示下级菜单内容 */
				if(data != '') {
					$("#"+select_name).css("display","");
					$("#"+select_name).empty();
					$("#"+select_name).append(option_top+data);
					
				}
			}
			});
		});
	};
	/* 调用下拉点击函数 */
	area_change('select0','select1');
	area_change('select1','select2');
	area_change('select2','select3');
	area_change('select3',0);
});
</script>
</head>
<body>
<!-- 头部:START -->
<tpl>include_php file ='../header.php'</tpl><!-- 头部信息header -->
<!-- 头部:END -->
<div class="clear" style="margin-top:6px;">&nbsp;</div>
<!-- 用户中心:START -->
<div id="usercenter" class="width-all">
  <!--用户中心内容:START-->
  <div class="sideright">
    <div class="top">&nbsp;</div>
    <div class="content">
      <div class="title">
        <h3 id="addres"><tpl>$shopping_address</tpl><!-- 收货地址 --></h3>
      </div>
      <div class="inside">
        <form name="shopping_save" id="shopping_save" action="user_center.php?action=shopping_save" method="post">
		<input type="hidden" name="flag" value="<tpl>$flag</tpl>"/>
		<input type="hidden" name="other_id" value="<tpl>$other_id</tpl>"/>
          <div class="inside-tit"><tpl>if $flag eq add</tpl><tpl>$shopping_address_add</tpl><tpl>else</tpl><tpl>$shopping_address_modify</tpl><tpl>/if</tpl></tpl><!-- 添加收货地址 --></div>
          <div class="inside-content">
            <dl id="userinfo_form">
              <dt><tpl>$shopping_address_true_name|escape:html</tpl><!-- 真实姓名 -->:</dt>
              <dd>
                <input type="text" name="txt_other_true_name" id="txt_other_true_name" value="<tpl>$address_info.other_true_name</tpl>" class="textinput" style="width:150px;"/>&nbsp;<span style="color:red">*</span>
				<div class="check-error">
              	<label style="display:none" for="txt_other_true_name" class="wrong" metaDone="true" generated="true"></label>
              		</div>
              </dd>
              <dt><tpl>$shopping_address_email</tpl><!-- 电子邮箱 -->:</dt>
              <dd>
                <input type="text" name="txt_other_email" id="txt_other_email" value="<tpl>$address_info.other_email</tpl>" class="textinput"  style="width:150px;"/>&nbsp;<span style="color:red">*</span>
				<div class="check-error">
                		<label style="display:none" for="txt_other_email" class="wrong" metaDone="true" generated="true"></label>
              		</div>
              </dd>
              <dt><tpl>$shopping_address_area</tpl><!-- 所在地区 -->:</dt>
              <dd>
					<span id="country_select"><select name="select0" id="select0">
						  <option value="0" selected="selected"><tpl>$modify_userinfo_select</tpl><!-- 请选择... --></option>
						  <tpl>section name=list loop=$top_region</tpl>
							<option value="<tpl>$top_region[list].area_id</tpl>"><tpl>$top_region[list].area_name</tpl></option>
							<tpl>/section</tpl>
						  </select>
					</span>
					<span id="province_select">
				    <select name="select1" id="select1" style="display:none">
						  </select>
					</span>
					<span id="city_select">
					<select name="select2" id="select2" style="display:none">
						  </select>
					</span>
					<span id="county_select">
					<select name="select3" id="select3" style="display:none">
						  </select>
					</span>
              </dd>
              <dt><tpl>$shopping_address_address</tpl><!-- 具体地址 -->:</dt>
              <dd>
                <input type="text" name="txt_other_address" id="txt_other_address" value="<tpl>$address_info.other_address|escape:html</tpl>" class="textinput" style="width:300px;"/>&nbsp;<span style="color:red">*</span>
				<div class="check-error">
                		<label style="display:none" for="txt_other_address" class="wrong" metaDone="true" generated="true"></label>
              		</div>
              </dd>
              <dt><tpl>$shopping_address_zip</tpl><!-- 邮政编码 -->:</dt>
              <dd>
                <input name="txt_other_zip" id="txt_other_zip" type="text" value="<tpl>$address_info.other_zip</tpl>" class="textinput" style="width:150px;"/>&nbsp;<span style="color:red">*</span>
				<div class="check-error">
                		<label style="display:none" for="txt_other_zip" class="wrong" metaDone="true" generated="true"></label>
              		</div>
              </dd>
              <dt><tpl>$shopping_address_mobilephone</tpl><!-- 移动电话 -->:</dt>
              <dd>
                <input type="text" name="txt_other_mobilephone" id="txt_other_mobilephone" value="<tpl>$address_info.other_mobilephone</tpl>" class="textinput" style="width:150px;"/>&nbsp;<span style="color:red">*</span>
				<div class="check-error">
                		<label style="display:none" for="txt_other_mobilephone" class="wrong" metaDone="true" generated="true"></label>
              		</div>
              </dd>
              <dt><tpl>$shopping_address_phone</tpl><!-- 固定电话 -->:</dt>
              <dd>
                <input type="text" name="txt_other_phone" id="txt_other_phone" value="<tpl>$address_info.other_phone</tpl>" class="textinput" style="width:150px;"/>
				<div class="check-error">
                	<label style="display:none" for="txt_other_phone" class="wrong" metaDone="true" generated="true"></label>
              </dd>
              <dt><tpl>$shopping_address_otherphone</tpl><!-- 其他电话 -->:</dt>
              <dd>
                <input type="text" name="txt_other_otherphone" id="txt_other_otherphone" value="<tpl>$address_info.other_otherphone</tpl>" class="textinput" style="width:150px;"/>
				<div class="check-error">
                		<label style="display:none" for="txt_other_otherphone" class="wrong" metaDone="true" generated="true"></label>
              </dd>
            </dl>
            <div class="formbtns" >
              <input name="submit_button" type="submit" class="inputbutton"value="<tpl>if $flag eq add</tpl><tpl>$shopping_address_affirm_add</tpl><tpl>else</tpl><tpl>$shopping_address_affirm_modify</tpl><tpl>/if</tpl>" />
              <input name="reset_button" type="reset" class="inputbutton"value="<tpl>$shopping_address_cancel</tpl>" />
            </div>
          </div>
        </form>
      </div>
      <div class="clear" style="height:12px;">&nbsp;</div>
    </div>
    <div class="bottom">&nbsp;</div>
  </div>
  <!-- 用户中心内容:END -->
  <!-- 用户中心菜单:START -->
  	<tpl>include file ='user_center_menu.html'</tpl>
  <!-- 用户中心菜单:END -->
  <div class="clear" style="height:6px;">&nbsp;</div>
</div>
<!-- 用户中心:END -->
<!-- 底部内容:START -->
<tpl>include_php file ='../footer.php'</tpl><!-- 底部信息footer -->
<!-- 底部内容:END -->
</body>
</html>
