<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title><?php echo $title;?></title>
<link rel="stylesheet" type="text/css" href="<?php echo USER_CENTER;?>css/all.css"/>
<script type="text/javascript" src="<?php echo USER_CENTER;?>js/jquery-1.7.1.min.js"></script>

<script type="text/javascript" src="<?php echo USER_CENTER;?>js/code_login.js"></script>
<!--[if lt IE 9]> 
<style>
.new_login_form {/*IE9以下版本可识别*/
	border: 1px solid #dcdcdc;
}
</style>
<![endif]-->
<style>
.new_header {
	height: 55px; margin-top:3%;
	padding-top: 31px;
}
.new_logo {
	margin-left: 3px;
	_display: inline;
	float: left;
	width: 150px;
	height: 55px;
	overflow: hidden;
}
.new_login_tex {
	float: left;
	height: 43px;
	line-height: 43px;
	border-left: 1px solid #eaeaea;
	font-size: 24px;
	font-family: \5FAE\8F6F\96C5\9ED1;
	color: #0081cc;
	padding: 0 31px;
	margin-left: 22px;
	_display: inline;
}
.new_login_box {
	padding: 56px 3px 70px;
}
.new_login_box .ad_pic {
	width: 520px;
	height: 315px;
	overflow: hidden;
	float: left;
	margin-left: 52px;
	display: inline;
}
.new_login_form {
	float: right;
	width: 320px;
	height: 320px;
	border-top: 4px solid #ed6d00;
	-moz-box-shadow: 0 0 10px #dcdcdc;
	-ms-box-shadow: 0 0 10px #dcdcdc;
	-o-box-shadow: 0 0 10px #dcdcdc;
	-webkit-box-shadow: 0 0 10px #dcdcdc;
	box-shadow: 0 0 10px #dcdcdc;
}
.new_login_form .hd {
	font-family: \5FAE\8F6F\96C5\9ED1;
	font-size: 18px;
	color: #333333;
	padding: 5px 25px 0;
	height: 50px;
	line-height: 50px;
	overflow: hidden;
}
.new_login_form .item {
	position: relative;
	height: 34px;
	padding: 0 0 15px 0;
	margin-left: 25px;
}
.new_login_form .item02 {
	padding-bottom: 0;
}
.new_login_form .item03 {
	height: 43px;
	padding: 15px 0 0 11px;
}
.new_login_form .inputText {
	position: absolute;
	left: 0;
	top: 0;
	line-height: 32px;
	height: 32px;
	border: 1px solid #cccccc;
	width: 230px;
	padding: 0 6px 0 33px;
	background: #fff url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 0 -99999px;
}
.new_login_form .inputTextError {
	border-color: #ff5050;
}
.new_login_form .inputTextOn {
	border-color: #ff9638;
}
 @media screen and (-webkit-min-device-pixel-ratio:0) {
.new_login_form .inputText {
	line-height: normal;
}
}
.new_login_form .label {
	display: block;
	top: 0;
	left: 0;
	height: 34px;
	line-height: 34px;
	overflow: hidden;
	padding-left: 34px;
	cursor: text;
	position: absolute;
	color: #999999;
}
.new_login_form .checkbox_label {
	float: left;
	color: #0061e5;
}
.new_login_form .get_code {
	float: left;
	margin-left: 167px;
	width: 104px;
	height: 34px;
	text-align: center;
	background: url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 0 0;
	border: none;
	cursor: pointer;
	color: #666;
}
.new_login_form .get_code_none {
	cursor: default;
	background-position: 0 -35px;
	color: #c1c1c1;
}
#new_login_code {
	_margin: -3px 0 0 0;
}
#new_login_name {
	background-position: 9px -175px;
}
#new_login_password {
	background-position: 9px -217px;
}
#new_login_code_input {
	width: 120px;
	background-position: 9px -217px;
}
#checkbox_tip {
	position: relative;
	margin-left: 9px;
	width: 16px;
	height: 16px;
	float: left;
}
#checkbox_tip .ico {
	width: 16px;
	height: 16px;
	overflow: hidden;
	text-indent: -999px;
	background: url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat -88px -132px;
}
#checkbox_tip .inner {
	position: absolute;
	display: none;
	top: -4px;
	left: 0;
	padding-left: 20px;
	width: 152px;
	height: 43px;
	overflow: hidden;
}
#checkbox_tip .sj {
	float: left;
	width: 6px;
	height: 43px;
	overflow: hidden;
	background: url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 0 -118px;
}
#checkbox_tip .text {
	color: #666;
	height: 41px;
	border: 1px solid #ff9734;
	border-left: none;
	background: #fff5ed;
	line-height: 20px;
	padding: 0 6px 0 9px;
	float: left;
	width: 130px;
}
#new_login_submit {
	float: left;
	width: 90px;
	height: 33px;
	border: none;
	background: url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 0 -70px;
	overflow: hidden;
	text-indent: -999px;
	cursor: pointer;
}
.new_login_submit_text {
	float: left;
	height: 33px;
	line-height: 33px;
	padding: 0 0 0 15px;
	color: #cccccc;
}
.new_login_submit_text .link {
	color: #666;
}
#new_login_error {
	height: 32px;
	border: 1px solid #ff5050;
	padding-left: 33px;
	padding-right: 6px;
	line-height: 32px;
	width: 230px;
	background: #fff0f1 url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 10px -256px;
	color: #ff3737;
}
#new_login_btn_none{display:none;overflow:hidden; text-indent:-999px; background:#fff url(images/027.gif) no-repeat center;	width:90px;height:33px; position:absolute; left:0; top:0; filter:alpha(opacity=50);opacity:0.5;}
</style>
<!--[if lt IE 8]> 
<style>
.new_login_form .label {/*IE8以下版本可识别*/
	 line-height:37px;
}
#new_login_error{line-height:35px;}
</style>
<![endif]-->
<script type="text/javascript" src="<?php echo USER_CENTER;?>js/jquery-1.7.1.min.js"></script>
</head>

<body>
<div class="w960 clearfix new_header" >
		<div class="new_logo"><a href="<?php echo GB_SELL_URL;?>"><img alt="" src="<?php echo USER_CENTER;?>images/logo_detail_150_55.jpg"></a></div>
		<div class="new_login_tex">用户登录</div>
</div>
<div class="w960">
		<div class="clearfix new_login_box" >
				<div class="ad_pic"><a href="<?php echo GB_MOBLIE_URL;?>" target="_blank"><img alt="" src="<?php echo USER_CENTER;?>images/03.png"></a></div>
				<div class="new_login_form">
						<div class="hd">登录</div>
						<div class="item" style="display:none">
								<div id="new_login_error"></div>
						</div>
						<div class="item">
								<input type="text" class="inputText" id="new_login_name" autocomplete="off" name="telno">
								<label class="label" for="new_login_name"  id="new_login_name_label">请输入手机号或用户名</label>
						</div>
						<div class="item item02" id="new_login_password_item">
								<input type="password" class="inputText" name="password" id="new_login_password" autocomplete="off" onkeydown=KeyDown(event)>
								<label class="label" for="new_login_password">请输入密码</label>
						</div>
						<div class="item item02" id="new_login_code_item" style="display:none">
								<input type="text" class="inputText"  name="telcode" id="new_login_code_input" autocomplete="off" onkeydown=KeyDown(event)>
								<label class="label" for="new_login_code_input">请输入验证码</label>
                                <div>
                                    <input  id="getcode" class="get_code"type="button" value="获取验证码" >
                                    <input  type="hidden" name="kind" id="kind" value="1">
                                    <input  type="hidden" name="yztelno" id="yztelno" value="1">
                                    <?php 
                                        $rand_num = rand(100000,200000);
                                        $_SESSION[GB_CITY.'_register_num'] = $rand_num;
                                    ?>
                                    <input  type="hidden" name="security_key" id='security_key' value="<?php echo md5('HOUSE365_Reg_KEY_'.$rand_num);?>">
                                </div>
						</div>


						<div class="item item03">
								<label class="checkbox_label" for="new_login_code">
										<input type="checkbox" id="new_login_code" name="loginkind" value="1">
										动态密码登录 </label>
								<div id="checkbox_tip">
										<div class="ico">?</div>
										<div class="inner">
												<div class="sj">&nbsp;</div>
												<div class="text">手机接收6位随机数字,<br>
														实时登录,无需记住密码</div>
										</div>
								</div>
						</div>
						<div class="item">
								<div id="new_login_submit">登录</div>
                                <div id="new_login_btn_none" title="正在登录">正在登录</div>
                                <p class="new_login_submit_text"><a class="link" href="<?php echo USER_CENTER.'register';?>" target="_blank">免费注册</a><span>丨</span><a  class="link" target="_blank" href="<?php echo USER_CENTER.'findpassword';?>">找回密码</a></p>
						</div>
				</div>
		</div>
</div>
<?php require APPPATH_MVC.'views/footer.php'; ?>
	<script>
    //发送验证码
    $(function(){
        $('#getcode').getVnum();
    })
	
</script>
<script>
//发送验证码
(function($){
	var defaults={
	};
	$.fn.getVnum = function(){

		var self = $(this);
		var time = 0;
		self.bind("click",function(){

            var kind = $("#kind").val();
			var telno = $("#new_login_name").val();
            var security_key = $("#security_key").val();
			var yztelno = $("#yztelno").val();
			if(time == 0)
			{
				
				//var partten = /^1[0-9]{10}$/;
	            var partten = /^13[0-9]{9}|17[0-9]{9}|15[012356789][0-9]{8}|18[012356789][0-9]{8}|147[0-9]{8}$/;//手机号码
				if(partten.test(telno))
				{
                    $("#new_login_error").parent().hide();
					$.post('http://user.house365.com/register/getyzm',{act:'getyzm',telno:telno,kind:kind,security_key:security_key},
						function(data){
							if(data == '1'){
								time = 60;
								var oTime = null;
								$("#getcode").val('重新获取('+time+')');
								$("#getcode").addClass("get_code_none");
								oTime = setInterval(function(){if(time>0){time--;$("#getcode").val('重新获取('+time+')');}else{clearInterval(oTime);$("#getcode").val('获取验证码');$("#getcode").removeClass("get_code_none");$('#sendingnote').hide();}} ,1000);
							}
						}
					);
				}
				else
				{
						$("#new_login_error").text("请正确填写手机号");
						errorCom("new_login_name");
				}
			}
		})
	}
})(jQuery);

</script>
<script>
function KeyDown(e)
{
  var e = e || event;
  if (e.keyCode == 13)
  {
   $("#new_login_submit").click();
  }
}
function space_none(v){ //去除空格
		var s = v; 
		s = s.replace(/[ ]/g,"");//s.replace(/\s/g, "")
		return s; 	 
};

function space(v) { //判断是否有空格
  var s = v;
  if(s.indexOf(" ") >=0)
	return true; 
};

function errorCom(obj){//错误时显示样式
		$("#new_login_error").parent().show();
		$("#"+obj).addClass("inputTextError");
		return false;
};

function checkedFC(){//切换第一个输入框的提示文字  并且判断手机号码是否正确
			$("#new_login_error").empty().parent().hide();
			var _checked = $("#new_login_code").get(0);
			if(_checked.checked)
			{
					$("#new_login_name_label").text("请输入手机号");
					$("#new_login_code_item").show();
					$("#new_login_password_item").hide();
					var str = $("#new_login_name").val();
					var regBox  = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
					if(space_none(str) == "")
					{
						$("#new_login_name").removeClass("inputTextError");
						$("#new_login_error").empty().parent().hide();
					}
					else if(!regBox.test(str))
					{
							$("#new_login_error").text("请正确填写手机号");
							errorCom("new_login_name");
					}
			}
			else
			{
					$("#new_login_name_label").text("请输入手机号或用户名");
					$("#new_login_code_item").hide();
					$("#new_login_password_item").show();
					$(".new_login_form .inputText").removeClass("inputTextError");
			};
		
};


$(function(){
	$("#new_login_code").each(function(index, element) {
			$(this).attr("checked",false)//重置动态密码选择框
	});
	$(".new_login_form .inputText").focus(function(){//显示影藏输入框提示
			this.className="inputText inputTextOn";
			$(this).siblings(".label").hide();
	}).blur(function(){
			this.className="inputText";
			if( space_none($(this).val()) == "")
			{
				$(this).siblings(".label").show();
				$(this).val("");
			}
	});
	
	$("#checkbox_tip").hover(function(){//显示影藏动态密码解释文字
			$(this).find(".inner").show();
	},function(){
			$(this).find(".inner").hide();
	})
	
	
	
	$("#new_login_code").change(function(){
			checkedFC();//切换第一个输入框的提示文字;
	});
	
	

	$("#new_login_submit").click(function(){//表单前台验证
			var _checked = $("#new_login_code").get(0);
			var _error   = $("#new_login_error");
			var new_login_name = $("#new_login_name").val();
			var new_login_password = $("#new_login_password").val();
			var new_login_code_input = $("#new_login_code_input").val();
			var regBox   = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
			if(_checked.checked)// 动态密码登录选中时
			{
				if( space_none(new_login_name) == "" )// 手机号为空时
				{
					_error.text("请输入手机号");
					errorCom("new_login_name");
                    return;
				}
				else if(space(new_login_name))// 手机号有空格时
				{
						_error.text("手机号不能有空格");
						errorCom("new_login_name");
                        return;
				}
				else if(!regBox.test(new_login_name))// 手机号格式
				{
						_error.text("请正确填写手机号");
						errorCom("new_login_name");
                        return;
				}
				else if( space_none(new_login_code_input) == "" )// 验证码为空时
				{
					_error.text("请输入手机验证码");
					errorCom("new_login_code_input");
                    return;
				}

                        $.ajax({
                        type: 'post',
                        url : 'http://user.house365.com/login_wang',
                        data: "action=loginyz"+"&telno="+new_login_name.replace(/[ ]/g,"")+"&password="+new_login_password+"&loginkind=1&telCode="+new_login_code_input+"&ajaxyz=1",
                        dataType:'html',
                        success: function(msg){


                            if(msg=='N_USER')
                            {
                                _error.text("号码未注册，请立即注册。");
					        	errorCom("new_login_code_input");
                                $("#new_login_name").focus();
                                return;
                            }else if(msg=='N_PASS')
                            {
                                _error.text("动态验证码不正确。");
					        	errorCom("new_login_code_input");
                                $("#new_login_name").focus();
                                return;
                            }else if(msg=='Y')
                            {
                               $("#new_login_name").show();
                               // window.location.href="<?php echo USER_CENTER;?>login/index?telno="+new_login_name+"&telCode="+new_login_code_input+"&loginkind=1";

                                $("#telnotj").val(new_login_name);
                                $("#telcodetj").val(new_login_code_input);
                                $("#loginkindtj").val(1);
                                $("#subform").submit();
                            }
                        }
                    });
				
				
			}
			else// 动态密码登录没选中时
			{
				if(space_none(new_login_name) == "")// 用户名、手机号为空时
				{
					_error.text("请输入手机号或用户名");
					errorCom("new_login_name");
                     return;
				}
				else if(space(new_login_name))// 用户名、手机号有空格时
				{
						_error.text("手机号或用户名不能有空格");
						errorCom("new_login_name");
                         return;
				}
				else if(new_login_password == "")// 密码必填
				{
						_error.text("请填写密码");
						errorCom("new_login_password");
                         return;
				}
				else if(space(new_login_password))// 密码有空格时
				{
						_error.text("密码不能有空格");
						errorCom("new_login_password");
                        return;
				};
                //让ajax和js验证同步  
                $.ajaxSetup({ 
                async : false 
                });   
                var flag = true;
                $.ajax({
                    type: 'post',
                    url : '<?php echo USER_CENTER;?>login_wang/index',
                    data: "ajaxyz=1&telno="+encodeURI(new_login_name)+"&password2="+new_login_password,
                    dataType:'html',
                    success: function(msg){

  
                            if(msg=='N_USER')
                            {
                                _error.text("用户名或密码不正确。");
					        	errorCom("new_login_name");
                                $("#new_login_name").focus()
                            }else if(msg=='Y')
                            {
                               $("#new_login_btn_none").show();
                              var partten = /^1\d{10}$/;
				              if(!partten.test(new_login_name)){
                                $("#telnotj").val(new_login_name);
                                $("#passwordtj").val(new_login_password);
                                $("#subform").submit();
                               }else{
                                  $("#telnotj").val(encodeURI(new_login_name));
                                $("#passwordtj").val(new_login_password);
                                $("#subform").submit();
                               }
                            }

                        
                    }
                });

			}
	
	});
	
	
	
	
})
</script>
<form name="subform" id="subform" action="/login_wang" method="post">
    <input name="telnotj" id="telnotj" type="hidden" value="" >
    <input name="passwordtj" id="passwordtj" type="hidden" value="" >
    <input name="telcodetj" id="telcodetj" type="hidden" value="" >
    <input name="loginkindtj" id="loginkindtj" type="hidden" value="" >

</form>
