<?php require APPPATH_MVC.'views/header.php'; ?>
<style>
.Validform_right{ display:none;}
</style>
<!--会员中心主体 Start--> 
<div class="w960 clearfix mt10 pepcenterBox">
 <?php require APPPATH_MVC.'views/left.php'; ?>
    <!--会员左侧 End-->
     <div class="user-main user-main02">
			<div class="hd-bar pos-r">
        	 <h2>修改手机号码</h2>
        </div>
  	  <div class="user-main">
    	
        <form action="<?php echo USER_CENTER;?>user/edit_telno" method="post" id="edit_password" name="edit_password" class="form"> 
        <table  border="0" cellspacing="0" cellpadding="0" class="means-table">
          <tr>
            <th width="80">原手机号码：</th>
            <td><?php echo $user[0]['telno'];?></td>
            <input type="hidden" name="telnoold" value="<?php echo $user[0]['telno'];?>" id="telnoold">
            <td width="300">&nbsp;</td>
          </tr>
         
          <tr>
            <th>新手机号码：</th>
            <td><input type="text" class="inpt-style" name="telno" id="telno" datatype="/^1[0-9]{10}$/" nullmsg="请输入新手机号。" errormsg="请输入正确的手机号码。" /> 
            <input type="button" value="获取验证码" class="btn3 " id="getcode">
           </td>
            <td><div class="Validform_checktip" id="js_errorBox1"></div></td>
          </tr>
          <tr>
            <th>验证码：</th>
            <td><input type="text" class="inpt-style" name="validcode" id="validcode" datatype="*" nullmsg="请输入验证码。"/></td>
            <td><div class="Validform_checktip" id="js_errorBox"></div></td>
          </tr>
          <tr>
            <th>&nbsp;</th>
              <input type="hidden" name="kind" id="kind" value="5" >
			  <?php 
				$rand_num = md5(md5(rand(100000,200000).time()));
				$_SESSION[GB_CITY.'_register_num_2'] = $rand_num;
			 ?>
			<input  type="hidden" name="security_key_2" id='security_key_2' value="<?php echo $rand_num;?>">
            <td><input type="submit" value="提 交" class="btn2" /></td>
          </tr>
        </table>
        </form>
    </div>
	</div>
    <!--会员右侧 End-->
</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 0 no-repeat;"></div>
        	<p class="war-text" id="msg"></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>
<script>
var openWin = function(obj){
	var winHeght = $(document).height() ;
	var winElemt = $('#'+ obj);
	
	var win = {
		
		height : function(){
			return winElemt.outerHeight();
		},
		
		width : function(){
			return winElemt.outerWidth();
		},
		
		show : function(){
			winElemt.css({
				'position':'absolute',
				'z-index':'9999902',
				'left':'50%',
				'margin-left':'-' + win.width() / 2 + 'px',
				'top':$(window).height()/2 - (win.height()/2) + $(window).scrollTop() + 'px'
			}).show();
		},
		
		hide : function(){
			winElemt.hide();
		}
	
	};
	win.show();
	$('.close-win').click(function(){
		win.hide();
	});
};
</script>
<script type="text/javascript">
	function edit() {
           validcode = $("#validcode").val();
           telnoold = $("#telnoold").val();
           telno = $("#telno").val();
           kind = $("#kind").val();
		 $.ajax({
            type: 'post',
            url : '<?php echo USER_CENTER;?>user_zhou/edit_telno',
            data: 'validcode='+validcode+'&telnoold='+telnoold+'&kind='+kind+'&telno='+telno,
            dataType:'html',
            success: function(msg){
                switch(msg){
                    case '1':
                        $("#msg").html('修改手机成功。');
                        setTimeout("location.reload()",3000);
                        openWin("warning");
                        break;
                    case '2':
                        $("#js_errorBox").empty();
                        $("#js_errorBox").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox").html("请输入正确的验证码。");
                        break;
                    case '3':
                        $("#js_errorBox1").empty();
                        $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox1").html("您输入的手机已绑定其他账户。");
                        break;
                         openWin("warning");
                        break;
                    default:
                         $("#msg").html('修改手机失败。');
                         openWin("warning");
                        break;
                }
            }
        });
        return false;
        }
</script>
<script type="text/javascript">
$(function(){
	//$(".registerform").Validform();  //就这一行代码！;
	
	$(".form").Validform({
		tiptype:2,
        callback:function(form){
			edit();
			return false;
		}
	});
})
</script>
<script>
    //发送验证码
	$('#getcode').getVnum();
</script>
<?php require APPPATH_MVC.'views/footer.php'; ?>
