<?php require ( APPPATH . 'views/findpw_header.php'); ?>
        <section class="findPassword w960">
            <div class="titleText"><span class="tex">没有租售宝账号？</span><a href="<?=GB_BROKER_REG?>" class="link">经纪人注册</a><span class="tex">有租售宝账号？</span><a href="/login/" class="link">登录</a></div>

            <div class="findSpeed findSpeed02">找回密码</div>

            <div class="findForm">
                <form action="" id="jsFindForm02" method="post" onsubmit="return false">
                    <div class="item clearfix">
                        <div class="textTitle">尊敬的房产经纪人，您好！我们已将验证码发送至<? echo $telno;?></div>
                    </div>
                    <div class="item clearfix">
                        <div class="textTitle"><p class="left">验证码有效期30分钟</p><button type="button" class="getCode">重新获取</button></div>
                    </div>
                    <div class="item clearfix">
                        <label class="labelL">输入验证码</label>
                        <div class="info">
                            <div class="divP">
                                <label class="labelT" for="code">请输入输入验证码</label>
                                <input type="text" id="code" class="inputTex jsTextInput" autocomplete="off" name="vaildcode">
                            </div>
                            <div class="textFgErroy"></div>
                        </div>
                    </div>
                    <div class="item item02 clearfix">
                        <div class="info"><span class="tipIco">&nbsp;</span><p class="tipText" id="text_message">由于网络原因，验证码接受可能会有延迟，请等候1-10分钟。</p></div>
                    </div>
                    <div class="item item02 clearfix">
                        <div class="info"><span class="tipIco tipIcoNone">&nbsp;</span><p class="tipText">如长时间未收到短信，可点击按钮重新获取或联系客服400-8859-365</p></div>
                    </div>
                    <div class="item clearfix">
                        <label class="labelL">&nbsp;</label>
                        <input type="hidden" name="submitvalidcode" value="submitvalidcode">
                        <input type="hidden" name="brokerid" id="brokerid" value="<? echo $brokerid;?>">
                        <input type="hidden" name="telno" id="telno" value="<? echo $telno;?>">
                        <div class="info"><button type="submit" class="submitNext" onclick="return false">下一步</button> </div>
                    </div>
                </form>
            </div>
        </section>
        <?php require ( APPPATH . 'views/findpw_footer.php'); ?>
 <script>
            var timeOut;
            var count = 60;
            $(document).ready(function() {
                ds();
                $(".getCode").click(function() {
                    var tel = $("#telno").val();
                    var brokerid = $('#brokerid').val();
                    $.ajax({
                        type: 'get',
                        url: '<?php echo GB_WO_URL; ?>/ajax/revalidcode/',
                        data: {'telno': tel, 'brokerid':brokerid},
                        dataType: 'html',
                        success: function(msg) {
                            if (msg == 1) {
                                $("#text_message").css("color","red").text("每天最多能获得3次验证码！"); 
                              
                            } else if (msg == 2) {
                                $("#text_message").text("重发验证码成功！");  
                                count = 60;
                                ds();
                            } else if (msg == 3) {
                                $("#text_message").css("color","red").text("重发验证码失败！");   
                               
                            }
                        }
                    });
                    
                });
                
                $(".submitNext").click(function(){
                 
                 
                   var code = $("#code").val();
                   var tel = $("#telno").val();
                   var brokerid = $('#brokerid').val();                 
                   if(code==''){
                       $("#text_message").css("color","red").text("请输入验证码！");                     
                       return false;
                   }
                   if(tel=='' || brokerid ==''){
                       location.href = '<?php echo GB_WO_URL; ?>/login/findpw/';
                   }                   
                   $.ajax({
                      type:'get',
                      url:'<?php echo GB_WO_URL; ?>/ajax/vaild_find_pwd/',
                      data: {'telno':tel,'brokerid':brokerid,'code':code},
                      dataType:'html',
                      success: function(msg){
                          if (msg==1) {
                              $("#text_message").css("color","red").text("验证码输入有误！租售宝用户拨打400-8859-365！");
                          } else if (msg == 2){
                              $("#text_message").css("color","red").text("验证码已过期，请重新获取验证码!");
                          } else if(msg == 3){
                              //跳转第三步
                              location.href = '<?php echo GB_WO_URL; ?>/login/confirm_validcode/';
                          }
                          
                      }
                   });
                
                
                });
                
                
            })

            ButtonCount = function() {
                if (count == 0) {
                    $(".getCode").addClass('getCodeNone');
                    $(".getCode").text("重新获取");
                    clearTimeout(timeOut);
                } else {
                    count--;
                    ds();
                }
            }


            function ds() {
                $(".getCode").addClass('getCodeNone');
                $(".getCode").text("重新获取" + count.toString());
                timeOut = setTimeout(ButtonCount, 1000);
            }
        </script>