<!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={$CONFIG[charset]}" />
<title>修改资料_会员中心_{$SYSTEM[sitename]}</title>
	<link href="{IMG_URL}templates/{TEMPLATE}/css/style.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<link href="{IMG_URL}templates/{TEMPLATE}/css/content.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<!--[if IE 6]> 
		<link href="{IMG_URL}templates/{TEMPLATE}/css/ie6.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<![endif]-->
<script type="text/javascript" src="{IMG_URL}js/config.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.form.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/cmstop.validator.js"></script>
<script type="text/javascript">
function edit_ok(data) {
	alert(data.message);
}
$.validate.setConfigs({
	xmlPath:'apps/member/validators/'
});
$(document).ready(function() {
	$('#member_editProfile').validate({
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success: edit_ok,
				dataType:'json'
			});
		},
		infoHandler:function(jq,message,type){
			jq.siblings('em').remove();
			if(type == 'error') jq.after('<em class="warn"> '+message+'</em>');
		}
	});
	$("input").change(function(){
		$(this).siblings('em').remove();
	});
});
</script>
</head>
<body class="person-theme">
	<div class="person-wrap">
		<?php $menu['profile'] = 'class="person-current"'; $this->assign('menu',$menu); ?>
		<!--{template 'member/panel/header.html'}-->
		<div class="clear"></div>
		<div class="person-cont">
			<div class="hr-h10"></div>
			<form action="{url('member/panel/profile')}" method="POST" name="member_editProfile" id="member_editProfile">
				<ul class="formFormat">
					<li><span class="info f-l txt-r">昵称：</span><span>{$member['username']}</span></li>
					<li><span class="info f-l txt-r">性别：</span><input type="radio"  value="1" name="sex" {if $member['sex'] == 1} checked="checked" {/if}/> 男  <input type="radio" value="2" name="sex" {if $member['sex'] == 2} checked="checked" {/if}/> 女</li>
					<li><span class="info f-l txt-r">头像：</span>
					<img src="<?=element::member_photo($_userid,100,100)?>" alt="{$_username}" title="{$_username}" height="100" width="100" style="vertical-align:baseline;"/> <a href="{url('member/panel/avatar')}" class="cor-c00 fs-12">修改</a></li>
					<li><span class="info f-l txt-r">真实姓名：</span><input type="text" name="name" value="{$member['name']}" class="input-text f-l input-w160"/></li>
					<li><span class="info f-l txt-r">生日：</span>
						<select name="birthday[year]" id="year" style="width:60px"><option value="0">----</option></select>&nbsp;年 
						<select name="birthday[month]" id="month"><option value="0">----</option></select>&nbsp;月 
						<select name="birthday[day]" id="day"><option value="0">----</option></select>&nbsp;日
					</li>
					<li><span class="info f-l txt-r">Email：</span><span>{$member['email']}</span> <a href="{url('member/panel/email')}" class="cor-c00 fs-12">修改</a></li>
					<li><span class="info f-l txt-r">QQ：</span><input type="text" class="input-text age f-l input-w160" name="qq" value="{$member['qq']}"/></li>
					<li><span class="info f-l txt-r">MSN：</span><input type="text" class="input-text f-l input-w160"  name="msn" value="{$member['msn']}" /></li>
					<li><span class="info f-l txt-r">电话：</span><input type="text" class="input-text age f-l input-w160" name="telephone" value="{$member['telephone']}" /></li>
					<li><span class="info f-l txt-r">手机：</span><input type="text" class="input-text f-l input-w160" name="mobile" value="{$member['mobile']}"/></li>
					<li><span class="info f-l txt-r">职业：</span><input type="text" class="input-text age f-l input-w160" name="job" value="{$member['job']}" /></li>
					<li><span class="info f-l txt-r">联系地址：</span><input type="text" class="input-text age f-l input-w480" name="address" value="{$member['address']}" /></li>
					<li><span class="info f-l txt-r">邮编：</span><input type="text" class="input-text age f-l input-w160" name="zipcode" value="{$member['zipcode']}"  /></li>					
					<li class="ok-wrap"><input type="submit" id="button" value="保 存" class="zl-btn zl-ok f-l" /></li>
				</ul>
			</form>
			
		</div>
	</div>
<div class="hr-h10"></div>
<script language="JavaScript" type="text/JavaScript">
	var u_birthday = "{$member['birthday']}";
	var days = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	var selectStr = '<option value="0">----</option>';
	var check_m_d = false;
	function isLeap(year) {
		return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? true : false; 
	}
	function isDate(date) {
		var d = date.split('-');
		return (d[0] =='0000' || d[1] == '00' || d[2] == '00')?false:true;
	}
	function setYear(b) {
			var html = '';
			var now = new Date(); 
			var year = now.getFullYear(); 
			var select = '';
			var b_array =new Array();
			if(isDate(b)) {
				b_array = b.split('-');
				check_m_d = true;
			} else {
				b_array = [0,0,0];
			}
			
			for(var i=year;i>1909;i--) {
				select = (i ==b_array[0] )?' selected="selected"':'';
				html += '<option value="'+i+'" '+select+'>'+i+'</option>';
			}
			$("#year").append(html);
			if(check_m_d) {
				setMonth(b_array[1]);
				setDay(b_array[0],b_array[1],b_array[2]);
			}
	};
	function setMonth(m) {
		var html = selectStr;
		for(var i=1;i<13;i++) {
			i = (i>=10) ? i : '0' + i;
			select = (i ==m )?' selected="selected"':'';
			html += '<option value="'+i+'" '+select+'>'+i+'</option>';
		}
		$("#month").empty().append(html);
	}
	function setDay(y,m,d) {
		ds = days[m-1];
		if(isLeap(y) && (m == '02')) {
			ds++;
		}
		var html = selectStr;
		for(var i=1;i<=ds;i++) {
			i = (i>=10) ? i : '0' + i;
			select = (i == d )?' selected="selected"':'';
			html += '<option value="'+i+'" '+select+'>'+i+'</option>';
		}
		$("#day").empty().append(html);
	}
	$(document).ready(function(){
		var y = $("#year");
		var m = $("#month");
		var d = $("#day");
		var daySelect = function(){
			if(y.val() ==0 || m.val() == 0) {
				d.empty().append(selectStr);
				return;
			}
			setDay(y.val(),m.val(),1);
		};
		var daySelect2 = function() {
			if(y.val() == 0) {
				m.empty().append(selectStr);
				d.empty().append(selectStr);
				return;
			} else {
				var m_set = m.val()>1?m.val():1;
				setMonth(m_set);
				setDay(y.val(),m_set,1);
			}
		};
		y.change(daySelect2);
		m.change(daySelect);
		setYear(u_birthday);
	});
</script>
<!--{template 'system/footer.html'}-->
