
	var _height = document.documentElement.clientHeight; //屏幕高
	var boxHeight = $(".loginbox-invite").height();
	$(".loginbox-invite").css({ top: (_height - boxHeight) / 2 +"px" });

	//验证手机号
	var phonePass = false;
	
	function phoneVal(){
		var phone= $("#phone").val();
		if(phone.length==0){
	        $(".msg1").text("请输入您的手机号码");
	    }else{
        	var hunPhone=/^1[3|4|5|7|8]\d{9}$/;
			if(hunPhone.test(phone.trim())){
				$(".msg1").text("");
				phonePass = true;
			}else{
				phonePass = false;
				$(".msg1").text("手机格式正确,请输入正确的手机号码");
			}
	    }
	    
	}
	//验证验证邀请码
	var codePass = false;
	function codeVal(){
		var code = $("#code").val();
		if(code.length==0){
			$(".msg2").text("请输入正确的邀请码");
			codePass = false;
		}else{
			$(".msg2").text("");
			codePass = true;
		}
	}	
	function loginSub(){
		phoneVal();
		codeVal();
		if(phonePass && codePass){
			$.ajax("../ajax/slogin",{
					type:"POST",
					 async: false,
					success:function(data){  

						if(data.success){
							if(data.data != "null" && data.data != null){
								if(data.data.auth == true){
									location.href="index.html";
								}else{
									location.href="login-first.html";
								}
							}else{
								$(".msg3").text("手机和邀请码不匹配,请确认后登录!");
							}
						}else{
							$(".msg3").text("系统异常!");
							// alert("系统异常!");
						}
					},
					error:function(){$.MsgBox.Alert('message','fail')},
					data:{"code":$("#code").val(),"mobile":$("#phone").val()},
				 	dataType: 'json'
				});
			}

	}
	function restSub(data) {  
         $(".msg3").text("");
     } 
