<!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> $NCharset </tpl>" />
<link href="<tpl> $template_dir </tpl>/member/css/layout.css" rel="stylesheet" type="text/css" />
<tpl>include file ='../head.config.html'</tpl>
<script language='javascript'>
// JavaScript Document
$(function(){
	$('#receive').find('a.mobi').click(function(){
		receives=$(this).parent().parent().find('span').map(function(){return $(this).html();}).get().join("|||");
		receivearry=receives.split('|||');
		for(i=0;i<receivearry.length;i++){
			receivearry[i] = ltrim(receivearry[i]);
		}
		$('#txtReceiveName').val(receivearry[0]);
		if(receivearry[10] != ''){//地区ID不能为空的时候
			if(receivearry[1] != ''){
				$("<option value='' selected='selected'>"+receivearry[1]+"</option>").appendTo("#c1");
			}
			if(receivearry[2] != ''){
				$("<option value='' selected='selected'>"+receivearry[2]+"</option>").appendTo("#c2");
			}
			if(receivearry[3] != ''){
				$("<option value='' selected='selected'>"+receivearry[3]+"</option>").appendTo("#c3");
			}
			if(receivearry[3] != ''){
				$("<option value='' selected='selected'>"+receivearry[4]+"</option>").appendTo("#c4");
			}
		}
		$('#txtAddress').val(receivearry[5]);
		$('#txtZip').val(receivearry[6]);
		$('#txtPhone').val(receivearry[7]);
		$('#txtMobilephone').val(receivearry[8]);
		$('#receive_id').val(receivearry[9]);
		$('#area_id').val(receivearry[10]);
		$('.table_thC6ECF8_tdF6F6F6').find('caption').html('<tpl> $langRAmendAddress </tpl>');
		$('#form_receive').attr('action','own_receive.php?action=modisave');
		$('#che').val('<tpl> $langRSave </tpl>');
		$('#add').css('display','inline');
	});
	
	$("#form_receive").validate({
		errorClass: "error",
		rules: {
			txtReceiveName: {required:true},
			area_id: {required:true},
			txtAddress: {required:true},
			txtZip: {required:true,number: true},
			txtPhone: {number: true},
			txtMobilephone: {number: true}
		},
		messages: {
			txtReceiveName: {required: "<tpl> $langRConsigneeNameNotNull </tpl>"},
			area_id: {required: "<tpl> $langRLocalityNotNull </tpl>"},
			txtAddress: {required: "<tpl> $langRParticularAddressNotNull </tpl>"},
			txtZip: {required: "<tpl> $langRPostalcodeNotNull </tpl>",number: "<tpl> $langRPostalcodeIsNumber </tpl>"},
			txtPhone: {number: "<tpl> $langRPhoneIsNumber </tpl>"},
			txtMobilephone: {number: "<tpl> $langRMobileTelephoneIsNumber </tpl>"}		
		}
	});
	//地区选择
	tonext('#c1');
});

function ltrim(str) 
{ 
	return str.replace(/(^\s*)|(\s*$)/g, ""); 
} 
//地区选择
function tonext(whos) {
	$(whos).change(
		function(){
			var valarray=$(this).val().split('||');	
			$('#area_id').val(valarray[0]);
			if (valarray[1]=='1') {
				$(this).next().attr('disabled','true').html('<option value="" selected="selected"><tpl> $langCDataToLoading </tpl></option>');
				$.get(
					'../home/tohtml.php',
					{action:'get_area',id:valarray[0],random_number:Math.random()},
					function(data){
						DataArray = data.split("|||");
						var a='';
						for (var i = 0; i<DataArray.length-1; i++) {
							att=DataArray[i].split("||");
							id=att[0];
							cla=att[2];
							a+='<option value="'+id+'||'+cla+'">'+att[1]+((cla=='1')?' ->':'')+'</option>';
						}
						
					$(whos).next().removeAttr('disabled').html('<option value="" selected="selected"></option>'+a).nextAll().html('');
					tonext($(whos).next());
					}
				)
			} else {
				$(whos).nextAll().html('').attr('disabled','true');
			};
		}
	)
};
</script>
</head><body> <tpl>include file ='../header.html'</tpl>
<div id="container761">
   <div class="own_member_main">
 <tpl>include file ='own_menu.html'</tpl>
  <div class="member_right">
  <div class="new_main_left">
		<div class="new_main_left1">
			<h1 class="new_text">
			  <tpl> $langRAddress </tpl></h1>
  <div class="form_with_text"> 
  <i></i>
  <tpl> $langRSetupYouBuyAddress </tpl>
  <b></b>
  </div>
  <i></i>
		</div>
		<b></b></div>
<div id="own_main_rightop">
<span class="font999"><tpl> $langRMostSave5AvailabilityAddress </tpl></span>
</div>

<div id="own_main_rightop_line" style="margin-top:-3px;">
	  <b class="b4"></b>
	  <b class="b3"></b>
	  <b class="b2"></b>
	  <b class="b1"></b>
	  </div>
    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#DDE0E3" class="table_thF5F5F5_tdfff" id="receive" style="margin-top:10px">
      <tr>
        <th height="25" align="center" valign="middle"><tpl> $langRConsignee </tpl></th>
        <th height="25" align="center" valign="middle"><tpl> $langRLocality </tpl></th>
        <th height="25" align="center" valign="middle"><tpl> $langRParticularAddress </tpl></th>
        <th height="25" align="center" valign="middle"><tpl> $langRPostalcode </tpl></th>
        <th height="25" align="center" valign="middle"><tpl> $langRPhoneOrMobileTelephone </tpl></th>
        <th height="25" align="center" valign="middle"><tpl> $langCOperation </tpl></th>
      </tr>
      <tpl> section name=i loop=$receive_array </tpl>
      <tr>
        <td height="25" align="center" valign="middle" style="text-align:center"><span>
        <tpl> $receive_array[i].receive_name </tpl></span> </td>
        <td height="25" align="center" valign="middle">
			<span><tpl> $receive_array[i].area[0].area_name </tpl></span>
			<span><tpl> $receive_array[i].area[1].area_name </tpl></span>
			<span><tpl> $receive_array[i].area[2].area_name </tpl></span>
			<span><tpl> $receive_array[i].area[3].area_name </tpl></span>
		</td>
        <td height="25" align="center" valign="middle"><span>
        <tpl> $receive_array[i].address </tpl></span></td>
        <td height="25" align="center" valign="middle"><span>
        <tpl> $receive_array[i].zip </tpl></span></td>
        <td height="25" align="center" valign="middle"><span>
          <tpl> $receive_array[i].phone </tpl></span><br />
        <span><tpl> $receive_array[i].mobilephone </tpl></span></td>
        <td height="25" align="center" valign="middle" style="text-align:center; width:60px">
		<span style="display:none"><tpl> $receive_array[i].receive_id </tpl></span>
		<span style="display:none"><tpl> $receive_array[i].receive_area_id </tpl></span>
		<a href="javascript:;" class="mobi"><tpl> $langCmodi </tpl></a>|<a href="javascript:;" onclick="if(confirm('<tpl> $langRConfirmDel </tpl>')){window.location='own_receive.php?action=del&receiveid=<tpl> $receive_array[i].receive_id </tpl>';}else{return false;}"><tpl> $langCdele </tpl></a> 
		</td>
      </tr>
      <tpl> /section </tpl>
    </table>
    <form action="own_receive.php?action=addsave" method="post" name="form_receive" id="form_receive">
	  <table border="1" cellpadding="0" cellspacing="0" bordercolor="#DEEBEF" class="table_thC6ECF8_tdF6F6F6">
        <caption class="fontsize14 b" style="line-height:2em">
        <tpl> $langRAddAddress </tpl>
        </caption>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style="font-size:12px; text-align: center;"><tpl> $langRConsigneeName </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
            <input name="txtReceiveName" type="text" id="txtReceiveName" class="new_input" value="" />
          <span class="fontred">*</span>
		   <label style="display:none" for="txtReceiveName" class="wrong" metaDone="true" generated="true"></label>
		  </td>
        </tr>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style="font-size:12px; text-align: center;"><tpl> $langRLocalityZone </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
		  	<input type="hidden" name="area_id" id="area_id" />
            <select id="c1" class="searchformselect" name="c1" style="width: 120px">
				<option valus="" selected></option>
				<tpl> foreach item = parent from = $area_array </tpl>
				<option value="<tpl>$parent.area_id</tpl>||<tpl>$parent.is_parent</tpl>"><tpl> $parent.area_name </tpl></option>
				<tpl> /foreach </tpl>
			</select>
			<select class="searchformselect" id="c2" style="width: 120px" name="c2">
			</select>
			<select class="searchformselect" id="c3" style="width: 120px" name="c3">
			</select>
			<select class="searchformselect" id="c4" style="width: 120px" name="c4">
			</select>
          	<label for="area_id"></label>
			<span class="fontred">*</span></td>
        </tr>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style=" font-size:12px; text-align: center;"><tpl> $langRParticularAddress </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
            <textarea name="txtAddress" cols="50" id="txtAddress" class="new_input_shurukuang"></textarea>
          <span class="fontred">*</span><span class="font999" style=" color:#FF6600"><tpl> $langRNotNeedFillInProvinceTownZone </tpl></span><label for="txtAddress"></label></td>
        </tr>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style="font-size:12px; text-align: center;"><tpl> $langReceivePostalcode </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
            <input name="txtZip" type="text"class="new_input" id="txtZip" maxlength="8" value="" />
          <span class="fontred">*</span><label for="txtZip"></label></td>
        </tr>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style="font-size:12px; text-align: center;"><tpl> $langRPhone </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
          <input name="txtPhone" type="text" id="txtPhone"class="new_input" value="" /></td>
        </tr>
        <tr>
          <th height="30" align="right" bgcolor="#F5F9FA" style="font-size:12px; text-align: center;"><tpl> $langRMobileTelephone </tpl>:</th>
          <td height="30" align="left" bgcolor="#FCFEFE">　
          <input name="txtMobilephone" type="text" id="txtMobilephone"class="new_input" value="" /></td>
        </tr>
      </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="49%" height="80" align="right">
      <input name="che" type="submit" id="che" class="new_anniu" value="<tpl> $langCsubmit </tpl>"/>
</td>
    <td width="1%" align="right"></td>
    <td width="50%" align="left">   <a id="add" href="own_receive.php" style="display:none;height:50px; padding:4px 8px 3px 24px;*padding:4px 8px 3px 24px;_padding:3px 8px 2px 24px; font-weight:100"  class="new_anniu">        
      <tpl> $langRAddAddress </tpl></a>
      <input name="receive_id" type="hidden" id="receive_id" /></td>
  </tr>
</table>
    </form>
  </div>
  <tpl> include file ='../../../html/footer.html' </tpl> </div>
  </div>
</body>
</html>
