﻿ var secs = 100;
                                function btnSend(obj) {
                                    var _phone = $("#yourmovetel").val();
                                    var data = "phone=" + _phone + "&method=code";
                                    if (_phone != '' && _phone != null) {
                                        $.ajax({

                                            type: "post",

                                            url: "/Consult.aspx",

                                            data: data,

                                            async: false,

                                            contentType: "application/x-www-form-urlencoded; charset=gb2312",

                                            success: function (data) {
                                                result = data;
                                                if (result == "1") {
                                                    for (var i = 0; i <= secs; i++) {
                                                        window.setTimeout("update(" + i + ")", i * 1000);

                                                    }

                                                } else {
                                                    alert("验证码发送失败，请检查手机是否输入有误！");
                                                    document.getElementById("btncode").value = " 获取验证码 ";
                                                    document.getElementById("btncode").disabled = false;
                                                }

                                            }

                                        });
                                    } else {
                                        alert("请输入手机号");
                                        $("#yourmovetel").focus();
                                    }
                                }

                                // })
                                function update(num) {
                                    if (num == secs) {
                                        document.getElementById("btncode").disabled = false;
                                        document.getElementById("btncode").value = " 获取验证码 ";
                                    }
                                    else {
                                        printnr = secs - num;
                                        document.getElementById("btncode").value = " " + printnr + "秒后重发 ";
                                        document.getElementById("btncode").disabled = true;

                                    }
                                }


                                function consult() {

                                    if ($("#novip_name").val() == "") { $("#novip_name").focus(); alert("提示：请输入您的称呼！"); return; }
                                    if ($("#yourmovetel").val() == "") { $("#yourmovetel").focus(); alert("提示：请输入您的电话！"); return; }
                                    if ($("#vcode").val() == "") { $("#vcode").focus(); alert("提示：请输入验证码！"); return; }


                                    var data = "novip_name=" + $("#novip_name").val() + "&novip_tel=" + $("#yourmovetel").val() + "&mobileCode=" + $("#vcode").val() + "&mobile=" + $("#mobile").val()+"&method=consult";

                                    $.ajax({

                                        type: "post",

                                        url: "/Consult.aspx",

                                        data: data,

                                        async: false,

                                        contentType: "application/x-www-form-urlencoded; charset=gb2312",

                                        success: function (data) {

                                            alert(data);
                                            result = data;
                                            $("#novip_name").val("");
                                            $("#yourmovetel").val("");
                                            $("#vcode").val("");

                                        }

                                    });
                                };