<!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/Validform_v5.3.2_ncr_min.js"></script>
<script type="text/javascript">
/*function getCookie(NameOfCookie)
{
   if (document.cookie.length > 0)
   {
       begin = document.cookie.indexOf(NameOfCookie+'=');
       if (begin != -1)
       {
			begin += NameOfCookie.length+1;//cookie值的初始位置
			end = document.cookie.indexOf(';', begin);//结束位置
			if (end == -1) end = document.cookie.length;//没有;则end为字符串结束位置
			document.write(document.cookie.substring(begin, end));
			return unescape(document.cookie.substring(begin, end));
       }
   }
   return null;
}*/

$(function(){
	$(".form").Validform({
		tiptype:2,
		callback:function(form){
			yz();
			return false;
		}
	});
})
</script>
</head>

<body>
<div class="top">
	<div class="w960">
		<div class="topleft"><a href="<?php echo GB_SITE_URL;?>" target="_blank">首页</a>|<a href="<?php echo GB_NEWS_URL;?>" target="_blank">房产资讯</a>|<a href="<?php echo  GB_NEWHOUSE_URL;?>" target="_blank">新房</a>|<a href="<?php echo GB_SELL_URL;?>" target="_blank">二手房</a>|<a href="<?php echo GB_RENT_URL;?>" target="_blank">租房</a>|<a href="<?php echo GB_HOME_URL;?>" target="_blank">家居</a>|<a href="<?php echo GB_BBS_URL?>" target="_blank">华侨路茶坊</a></div>
		<script src="http://www.house365.com/houseshare/login_js.php" language="javascript"></script>|<a href="<?php echo GB_WO_URL;?>" target="_blank">网络经纪人</a></div>
</div>
<div id="js_boxMiddle"> 
	<!--logo开始-->
	<div class="logo">
		<div class="w904">
			<div class="logol"><a href="<?php echo GB_SITE_URL;?>"><img title="" alt="" src="../images/logo.gif"></a></div>
			<div class="geRenZhongXin"><a href="<?php echo GB_CRNTER_URL;?>"><img title="" alt="" src="images/grzx3.png"></a></div>
		</div>
	</div>
	<!--logo结束-->
	
	<div class="w904 innerBg">
	 <form class="form"  action="<?php echo USER_CENTER;?>register_test"  method="post">
        <table  border="0" cellspacing="0" cellpadding="0" class="r-table">
          <tr>
            <th width="120">手机号：</th>
            <td  width="320"><input type="text" errormsg="请正确输入手机号码。" nullmsg="请输入手机号码。" tip="请输入手机号码" value="请输入手机号码" datatype="/^1[0-9]{10}$/" id="telno" name="telNum" class="inputText">
        	<input  id="showcode"  class="yzm " type="button" value="验证码" />
			<input  id="showcode1"  class="yzm " type="button" value="验证码" style="display:none" />
            <div class="addYZMbox" style="display:none" >
			<div class="inner">
				<div class="info">
					<div class="clearfix item">
						<img class="left" width="110" height="31" alt="" src="<?php echo USER_CENTER;?>validcode.php" onclick="reloadimgcode(this);return false;" alt="点击更换图片" id="yzm">
						<input  class="inputText" name="validate" id="validate" type="text">
					</div>		
					<div class="text_b clearfix">
						<a href="javascript:void(0)" onclick="reloadimgcode('#yzm');return false;"  class="get_code">看不清？换一个</a>
						<div class="Validform_checktip Validform_wrong" id="validate_error" style="display:none">请输入验证码</div>
					</div>	
					<div class="btn_b clearfix">
						<a href="javascript:void(0)" class="btn" id="getcode">确认</a>
					</div>
				</div>
				<div class="sjIco">&nbsp;</div>													
			</div>
		</div>
			</td>
            <td width="280"><div class="Validform_checktip" id="js_errorBox1">&nbsp;</div>&nbsp;</td>
          </tr>
          <tr>
            <th>验证码：</th>
            <td><input type="text" class="inputText"  id="validcode" name="validcode" datatype="s4-7" value="请输入验证码"  tip="请输入验证码" nullmsg="请填写验证码。" errormsg="验证码6个字符"></td>
            <td><div class="Validform_checktip" id="js_errorBox">&nbsp;</div>&nbsp;</td>
          </tr>
          <tr>
            <th>密码：</th>
            <td>
			<input type="password" class="inputText" id="password" name="password" datatype="s6-16" nullmsg="请输入密码。" errormsg="密码范围在6~16位之间,或者有非法字符。"></td> 
			<td><div id="js_errorBox2" class="Validform_checktip" >&nbsp;</div>&nbsp;</td>
          </tr>
          <tr>
            <th>&nbsp;</th>
            <td height="25"><input  class="inputChecked" value="1" name="xieyi" type="checkbox" datatype="*" errormsg="请选择。" checked><label for="jsinputChecked">我已经阅读并同意</label><a href="http://www.house365.com/user/365fwxy.html" target="_blank" class="c-3C7DE8">《365地产家居网服务协议》</a></td>
            <td><div id="js_errorBox3" class="Validform_checktip">&nbsp;</div>&nbsp;</td>
          </tr>
          <tr>
            <th>&nbsp;</th>
            <td><button class="reg-btn bg" type="submit">submit</button><span style="position:relative;top:15px;left:10px">已有账号，<a href="<?php echo USER_CENTER.'login';?>" target="_blank" class="ljdl">立即登录</a></span></td>
          </tr>
        </table>
        <input  type="hidden" name="kind" id="kind" value="3">
        <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);?>">
        </form>
	</div>
<style>
.Validform_right{ display:none;}
#js_errorBox,
#js_errorBox2,
#js_errorBox3{margin-left:-105px; _position: relative;_top:10px;}
#js_errorBox1{_position: relative;_top:10px;margin-left:-15px;}
#js_errorBox3{margin-left:-75px;}
</style>


<script>
    //发送验证码
	$('#getcode').click(function(){
	    var self = $("#showcode1");
		    var time = 0;
			var kind = $("#kind").val();
			var telno = $("#telno").val();
			var yztelno = $("#yztelno").val();
			var validate_code = $("#validate").val();
			if(validate_code =='')
			{
			  $("#validate_error").html("请输入验证码。");
			  $("#validate_error").show();
			  return;
			}
			if(time == 0)
			{
				 $.post('http://user.house365.com/register_test/getyzm_register',{act:'getyzm',telno:telno,kind:kind,yztelno:yztelno,validate_code:validate_code},
						function(data){
							if(data == '1'){
							   $(".addYZMbox").hide();
								time = 60;
								var oTime = null;
								self.val('重新获取('+time+')');
								self.css({"color":"#999"});
								oTime = setInterval(function(){if(time>0){time--;$("#showcode1").show();$("#showcode").hide();self.val('重新获取('+time+')');}else{clearInterval(oTime);self.val('获取验证码');self.css({"color":"#000"});$("#showcode").show();$("#showcode1").hide();}} ,1000);
								reloadimgcode('#yzm');
							}else if(data == '2'){
								 $('#orderhouse_validcode').html('验证码获取失败，请刷新页面重新获取。').show();
								 reloadimgcode('#yzm');
						    }else if(data == '3'){
								 $('#orderhouse_validcode').html('发送房源次数超过上限。').show();
							}else if(data == '4'){
                                 $('#orderhouse_validcode').html("今日操作已超过4次，请明日再来。").show();
							}else if(data == '5'){
                                 $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            		     $("#js_errorBox1").html("您的手机号码已经注册过，请直接登录。");
								 $(".addYZMbox").hide();
						         reloadimgcode('#yzm');
							}else if(data == '6'){
                                 $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            		     $("#js_errorBox1").html("您的手机号码未注册过，请直接注册。");
							}else if(data == '7'){
								  $("#validate_error").html("验证码不正确。");
								  $("#validate_error").show();
								  reloadimgcode('#yzm');
							}
						}
					);
		    }
	
	});
    function yz(){
		var flag = true;
        $.ajax({
            type: 'post',
            url : '<?php echo USER_CENTER;?>register_test',
            data: "telno="+$("#telno").val()+"&validcode="+$("#validcode").val()+"&password="+$("#password").val()+"&kind="+$("#kind").val(),
            dataType:'html',
            success: function(msg){

                switch(msg){
                     case '1':
                        openWin('warning');
					    //var jumpto_website = website_jumpto_city+"sell.house365.com";
						//setTimeout("location.href='"+jumpto_website+"'",3000);
						setTimeout("location.href='<?php echo GB_SELL_URL;?>'",3000);
					    break;
                    case '2':
                        $("#js_errorBox").empty();
                        $("#js_errorBox").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox").html("请正确输入验证码。");
			            $("#telno").focus();
						flag = false;
					    break;
				    case '3':
                    	$("#js_errorBox1").empty();
                        $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox1").html("您的手机号码已经注册过，请直接登陆。");
			            $("#telno").focus();
						flag = false;
					    break;
                    case '4':
                    	$("#js_errorBox1").empty();
                        $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox1").html("手机号不存在。");
			            $("#telno").focus();
						flag = false;
					    break;
                }
            }
        });
		if(!flag)
        {
        return false;
        }
    }
</script>

<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();
	});
};

$("#showcode").click(function(){
    partten = /^1[0-9]{10}$/;
	var telno = $("#telno").val();
	
	if(!partten.test(telno))
	 {
       $("#js_errorBox1").empty();
       $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
	   $("#js_errorBox1").html("请输入正确的手机号码。");
         return false;
	 }
	 //验证手机号是否已注册
	 $.post('http://user.house365.com/register_test/yztelno_register',{telno:telno},
	 function(data){
		if(data == '5'){
             $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		     $("#js_errorBox1").html("您的手机号码已经注册过，请直接登录。");
		     return false;
		  }else if(data == '1'){
		  $(".addYZMbox").show();
		  }				
	})
})
</script>
<script type="text/javascript">
function reloadimgcode(obj){//验证码点击刷新
	$(obj).attr("src","<?php echo USER_CENTER;?>validcode.php?"+Math.random());
	//这里必须加入随机数不然地址相同我发重新加载
	return false;
	}
</script>
<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" style="border:1px solid #D1D1D1;">
    	<div class="warning-inner">
        	<div class="war-bg" style="_display:inline;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif)  0 0 no-repeat;" ></div>
        	<p class="war-text" style="_display:inline;">注册成功，3秒后跳转到二手房首页。</p>
        </div>
    	<div class="pop-btn-area"><a href="javascript:location.href='http://nj.sell.house365.com'" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
    </div>
</div>

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

