<?php require APPPATH_MVC.'views/header.php'; ?>

<iframe name="filepost_iframe" id="filepost_iframe" style="width:1px;height:1px;display:none;"></iframe>
<script>
$(function(){
	
		var config = {
			starYear : 2014, //开始月份
			EndYear  : 1900  //结束月份
		}
		
		//$("#bor-select-a .selectSimulate-value").text(config.starYear)
	
        for(var i=config.starYear;i>config.EndYear+1;i--){
			$("#bor-select-a ul").append('<li rel='+i+'>'+i+'</li>')
        }
        for(var i=1;i<=12;i++){
			$("#bor-select-b ul").append('<li rel='+i+'>'+i+'</li>')
        }
        for(var i=1;i<=31;i++){
			$("#bor-select-c ul").append('<li rel='+i+'>'+i+'</li>')
        }    
        $("#bor-select-a ul li").click(function(){
            $("#bor-select-c ul").empty();
            getValue($("#bor-select-b .selectSimulate-value").text(),$("#bor-select-a .selectSimulate-value").text());           
        });    
        $("#bor-select-b ul li").click(function(){
             $("#bor-select-c ul").empty();
             getValue($(this).text(),$("#bor-select-a .selectSimulate-value").text());    
        }); 
        
    });
    function getValue(i,k){
        var k=k-0;
        switch(i){
            case "1":
            case "3":
            case "7":
            case "8":
            case "10":
            case "12":{
                AddValue(31);
                break;
            }
            
            case "2":{
                if(k%4==0){
                    AddValue(29);
                }else{
                    AddValue(28);
                }
                break;
            }
            
            case "4":
            case "5":
            case "6":
            case "9":
            case "11":{
                AddValue(30);
                break;
            }
            default:{
                //alert(i+"asdf"+k);
                break;
            }
        }
    }
    
    function AddValue(i){
        for(var k=1;k<=i;k++){
           $("#bor-select-c ul").append('<li rel='+k+'>'+k+'</li>')
        }   
    }    
</script> 
<script>
	/*$(function(){
    	//图片异步提交
	$(".fileInput").change(function(){
      		var file = $(this).val();
		if(file != "")
		{
			var patrn=/(.jpg|.JPG|.png|.PNG)$/;
			if (patrn.exec(file))
			{
				$(this).parents(".fileform").submit();
			}
			else
			{
				$("#jsUploadHeadPortrait").hide();
				$("#jsDialogE_msg").html("请选择jpg或png格式的图片上传。");
				openWin("jsDialogE");
				return false;
			}
		}

	})
    	//修改头像
	$("#jsAlter").hover(function(){
		$(this).addClass("alterHover");
	},function(){
		$(this).removeClass("alterHover");
	}).bind("click", function(){
		openWin("jsUploadHeadPortrait")
	});
})*/
</script> 
<!--会员中心主体 Start-->
<div class="w960 clearfix mt10 pepcenterBox">
		<?php require APPPATH_MVC.'views/left.php'; ?>
		<div class="user-main user-main02">
				<div class="hd-bar pos-r">
						<h2>修改资料</h2>
				</div>
				<div class="user-main" >
						<table  border="0" cellspacing="0" cellpadding="0" class="means-table">
						<tr>
										<th width="80">&nbsp;</th>
									<td>&nbsp;</td>	
						</tr>
					<!--			<tr>
										<th width="80">头像：</th>
										<td><div class="header-img"> <img src="<?php if(!empty($user_detail[0]['head_pic'])){echo $user_detail[0]['head_pic'];}else{echo '../images/pep.jpg';}?>" width="90" height="110" /> <a href="javascript:openWin('jsUploadHeadPortrait')" class="change-header">修改头像</a> </div></td>
								</tr>-->
				<script>
				function formFun(){
					var str = $("#inptEmail").val();
				var re = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
					if(re.test(str))
					{
						$("#inptEmailError").hide();
						return true
					}
					else
					{
							$("#inptEmailError").show();
						return false
					}
					
				}
				</script>
								<form onSubmit="return formFun()" name="editprofile" class="fileform" action="<?php echo USER_CENTER;?>user/edit_profile" method="post">
										<!--           <tr>
            <th>昵称：</th>
            <?php if(empty($user_detail[0]['username'])){?>
            <td><input type="text" class="inpt-style" name="username"/></td>
            <?php }else{?>
            <td><span class="saveVal"><?php echo $user_detail[0]['username'];?></span><span class="changeBox"><input type="text" class="inpt-style" name="username" datatype="n" nullmsg="请输入用户密码！" value="<?php echo $user_detail[0]['username'];?>" name="username"/></span> <a href="#" class="xiugai">修改</a></td>
            <?php }?>
          </tr> -->
										<tr>
												<th>邮箱：</th>
												<?php if(empty($user_detail[0]['email'])){?>
												<td><input type="text" id="inptEmail" class="inpt-style" name="email"/><span style="color:red; padding-left:20px; display:none;" id="inptEmailError">请正确填写邮箱地址</span></td>
												<?php }else{?>
												<td><span class="saveVal"><?php echo $user_detail[0]['email'];?></span><span class="changeBox">
														<input type="text" id="inptEmail" class="inpt-style"value="<?php echo $user_detail[0]['email'];?>" name="email"/><span style="color:red; padding-left:20px; display:none;" id="inptEmailError">请正确填写邮箱地址</span>
														</span> <a href="#" class="xiugai">修改</a></td>
												<?php }?>
										</tr>
										<tr>
												<th>性别：</th>
												<?php if(empty($user_detail[0]['sex'])){?>
												<td><p class="sex">
																<label>
																		<input name="sex" type="radio" id="man" value="1" >
																		男</label>
																<label>
																		<input type="radio" name="sex" value="2" id="girl">
																		女</label>
																<label>
																		<input type="radio" name="sex" value="3" id="baomi" checked>
																		保密</label>
														</p></td>
												<?php }else{?>
												<td><span class="saveVal">
														<?php if($user_detail[0]['sex']==1){echo '男';}elseif($user_detail[0]['sex']==2){echo '女';}else{ echo '保密';}?>
														</span><span class="changeBox">
														<p class="sex">
																<label>
																		<input name="sex" type="radio" id="man" value="1" <?php if($user_detail[0]['sex'] ==1 ) echo 'checked';?>>
																		男</label>
																<label>
																		<input type="radio" name="sex" value="2" id="girl" <?php if($user_detail[0]['sex'] ==2 ) echo 'checked';?>>
																		女</label>
																<label>
																		<input type="radio" name="sex" value="3" id="baomi" <?php if($user_detail[0]['sex'] ==3 ) echo 'checked';?>>
																		保密</label>
														</p>
														</span> <a href="#" class="xiugai">修改</a></td>
												<?php }?>
										</tr>
										<tr>
												<th>生日：</th>
												<?php if(empty($user_detail[0]['birthdate'])){?>
												<td><div id="bor-select-a" class="selectSimulate left mr10">
																<input type="hidden" name="year" class="selectSimulate-input" value="">
																<span  class="selectSimulate-value">年</span>
																<ul class="selectSimulate-list" style="display: none; height:270px; overflow-y:scroll ">
																</ul>
														</div>
														<span class="left mr10">-</span>
														<div id="bor-select-b" class="selectSimulate left mr10">
																<input type="hidden" name="month" class="selectSimulate-input" value="">
																<span  class="selectSimulate-value">月</span>
																<ul class="selectSimulate-list" style="display: none;">
																</ul>
														</div>
														<span class="left mr10">-</span>
														<div id="bor-select-c" class="selectSimulate left">
																<input type="hidden" name="day" class="selectSimulate-input" value="">
																<span  class="selectSimulate-value">日</span>
																<ul class="selectSimulate-list" style="display: none;height:270px; overflow-y:scroll ">
																</ul>
														</div></td>
												<?php }else{?>
												<td><span class="saveVal"><?php echo date("Y-m-d",$user_detail[0]['birthdate']);?></span> <span class="changeBox">
														<div id="bor-select-a" class="selectSimulate left mr10">
																<input type="hidden" name="year" class="selectSimulate-input" value="<?php echo date("Y",$user_detail[0]['birthdate']);?>">
																<span  class="selectSimulate-value"><?php echo date("Y",$user_detail[0]['birthdate']);?></span>
																<ul class="selectSimulate-list" style="display: none; height:270px; overflow-y:scroll ">
																</ul>
														</div>
														<span class="left mr10">-</span>
														<div id="bor-select-b" class="selectSimulate left mr10">
																<input type="hidden" name="month" class="selectSimulate-input" value="<?php echo date("m",$user_detail[0]['birthdate']);?>">
																<span  class="selectSimulate-value"><?php echo date("m",$user_detail[0]['birthdate']);?></span>
																<ul class="selectSimulate-list" style="display: none;">
																</ul>
														</div>
														<span class="left mr10">-</span>
														<div id="bor-select-c" class="selectSimulate left">
																<input type="hidden" name="day" class="selectSimulate-input" value="<?php echo date("d",$user_detail[0]['birthdate']);?>">
																<span  class="selectSimulate-value"><?php echo date("d",$user_detail[0]['birthdate']);?></span>
																<ul class="selectSimulate-list" style="display: none;height:270px; overflow-y:scroll ">
																</ul>
														</div>
														</span> <a href="#" class="xiugai">修改</a></td>
												<?php }?>
										</tr>
										<tr>
												<th>&nbsp;</th>
												<input type="hidden" value="<?php echo $_SESSION['token'];?>" name="token">
												<td><input type="submit" value="保 存" class="btn2" /></td>
										</tr>
								</form>
						</table>
				</div>
		</div>
		<!--会员右侧 End--> 
		
</div>
<!--会员中心主体 End-->
<style>
/*
.fileInput{ position:absolute; right:-3px; bottom:-3px; font-size:100px; cursor:pointer; opacity:0;filter:alpha(opacity=0);}
.upfileBtn .btn_2 {
    color: #666666;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: 34px;
    line-height: 34px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    text-align: center;
    width: 300px;
}*/
</style>
<!--
<div id="jsUploadHeadPortrait" class="pop" style="display:none; z-index:99">
		<div class="hd">
				<h2>上传头像</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<form name="fileform" class="fileform" action="<?php echo USER_CENTER;?>user/edit_headfile" enctype="multipart/form-data" target="filepost_iframe" method="post">
						<div class="upfileBtn"> <a class="btn_2" href="javascript:void(0)" ><span style="width:300px;position: absolute;left:0; top:0;height:34px;">本地照片上传</span>
								<input class="fileInput" name="headfile" type="file">
								</a>
								<input type="hidden" name="action" value="headfile" />
								<input type="reset" name="reset" style="display:none;" id="headpicformreset" />
						</div>
				</form>
				<div class="pic-area" id="headShowPic"> <img src="../images/upfile-bg.gif" width="339" height="219"/> </div>
				<form id="jsUploadHeadPortraitForm" name="jsUploadHeadPortraitForm" action="<?php echo USER_CENTER;?>user/edit_headfile" onSubmit="return checkCoords()" method="post" target="filepost_iframe">
						<div class="pop-btn-area">
								<input type="hidden" name="action" value="savehead" />
								<input type="hidden" id="headpic" name="headpic" value="" />
								<input type="hidden" id="x" name="x" />
								<input type="hidden" id="y" name="y" />
								<input type="hidden" id="w" name="w" />
								<input type="hidden" id="h" name="h" />
								<a href="javascript:void(0)" id="jsSaveHeadPortrait" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">保存</a><a href="javascript:void(0)" class="close-win"  style="background:#F5F5F5;color:#666;padding:7px 15px;margin:0 5px;border:1px solid #CCCCCC">取消</a></div>
				</form>
		</div>
</div>
<div id="warning" class="pop" style="display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(../images/pop-ico.gif)  0 -113px no-repeat;"></div>
						<p class="war-text">头像设置失败，请重试</p>
				</div>
				<div class="pop-btn-area"><a href="javascript:void(0)" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>
<div id="warning2" class="pop" style="display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(../images/pop-ico.gif) 0 -113px no-repeat;"></div>
						<p class="war-text">请在图片上选择一块区域再提交</p>
				</div>
				<div class="pop-btn-area"><a href="javascript:void(0)" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>
<div id="warning3" class="pop" style="display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(../images/pop-ico.gif) 0 -113px no-repeat;"></div>
						<p class="war-text">请上传一张图片</p>
				</div>
				<div class="pop-btn-area"><a href="javascript:void(0)" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>
<div id="upfile-ok" class="pop" style="display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(../images/pop-ico.gif) no-repeat;"></div>
						<p class="war-text">恭喜您，头像设置成功了！</p>
				</div>
				<div class="pop-btn-area"><a href="javascript:void(0)" onclick="location='<?php echo USER_CENTER;?>user/edit_profile';" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>-->
<script type="text/javascript">
	/*var jcrop_api;
	//var c0 = {"x":5,"y":5,"w":100,"h":75};

	$(function(){
		$('#cropbox').Jcrop({
			aspectRatio: 0.75,
			onSelect: updateCoords
			//bgFade: true,
			//setSelect: [c.x,c.y,c.x2,c.y2]
		},function(){
			jcrop_api=this;
		})
	});
	
	function jcSetImage()
	{
		var picurl = $("#cropbox").attr("src");
		jcrop_api.setImage(picurl);
	}

	function updateCoords(c)
	{
		$('#x').val(c.x);
		$('#y').val(c.y);
		$('#w').val(c.w);
		$('#h').val(c.h);
	};

	function checkCoords()
	{
		if (parseInt($('#w').val())) return true;
		$("#gTipsCoverjsUploadHeadPortrait").remove();
		openWin("warning2");
		return false;
	};

	function changeShowPic(objid)
	{
		$("#"+objid).css("background", "none");
	}

	$("#jsSaveHeadPortrait").live("click",function(){
		$("#jsUploadHeadPortrait").hide();
		if($("#headpic").val() != "")
		{
			$("#jsUploadHeadPortraitForm").submit();	
		}
		else
		{
			openWin("warning3");
			
		}
	})

	$("#idcardFormsubbutton").live("click",function(){
		if(!isCardID($("#jsNameInputN").val()))
		{
			$("#jsIdentityAuthentication").hide();
			if($("#idcardpic").val() != "")
			{
				$("#jsNameInputN").siblings(".error").hide();
				$("#idcardForm").submit();
			}
			else
			{
				openWin("jsDialogE");
				$("#jsDialogE_msg").html("请先选择一张图片。");
			}
		}
		else
		{
			$("#jsNameInputN").siblings(".error").show();
		}
	})

	$("#buscardFormsubbutton").live("click",function(){
		$("#jsBusinessCard").hide();
		if($("#buscardpic").val() != "")
		{
			$("#buscardForm").submit();
		}
		else
		{
			openWin("jsDialogE");
			$("#jsDialogE_msg").html("请先选择一张图片。");
		}
	})

	$("#accardFormsubbutton").live("click",function(){
		$("#jsAuthenticationProfession").hide();
		if($("#accardpic").val() != "")
		{
			$("#accardForm").submit();
		}
		else
		{
			openWin("jsDialogE");
			$("#jsDialogE_msg").html("请先选择一张图片。");
		}
	})

	
	$("#skillSave").live("click",function(){
		$(".skillform").submit();
	})

	function setHeadimgsrc(headpic)
	{
		$('#headShowPic').html("<img src='"+headpic+"' id='cropbox' />");

		$('#cropbox').Jcrop({
			aspectRatio: 0.75,
			onSelect: updateCoords
			//bgFade: true,
			//setSelect: [c.x,c.y,c.x2,c.y2]
		},function(){
			jcrop_api=this;
		});
		
		$("#headpicformreset").trigger("click");
	}*/
</script>
<style>
.Validform_right{ display:none;}
</style>


<?php
if($isa_website!=''){
?>
<script type="text/javascript">
	var isa_website = "<?=$isa_website?>";
	var isa_city = "<?=$isa_city?>";
	var isa_addones = "<?=$isa_addones?>";

	var _analyze365 = (('https:' == document.location.protocol) ? ' https://': ' http://');
	document.write(unescape('%3Cscript src="'+ _analyze365 + '<?=$isa_url?>" type="text/javascript"%3E%3C/script%3E'));
</script>
<?php
}
?>
<script type='text/javascript'>
	var website="2";
    var ga_city = "<?=$isa_city?>";
    var ga_channel = 'center';
    var ga_page= "/个人中心/资料修改";
</script>
<script language="javascript" src="http://stat.house365.com/365count.js"></script>

<?php require APPPATH_MVC.'views/footer.php'; ?>
