var timeout = 60;
var timeoutHandler;
var timeoutButtonId;
function preventRush(buttonId, stimeout) {
    if (stimeout)
        timeout = stimeout;
    timeoutButtonId = buttonId;
    $('#' + buttonId).attr('disabled', true);
    timeoutHandler = setTimeout(timeoutShow, 1000);
}
function timeoutShow() {
    timeout--;
    $('#' + timeoutButtonId).val(timeout + "秒后重新尝试");
    if (timeout <= 0) {
        clearTimeout(timeoutHandler);
        $('#' + timeoutButtonId).attr('disabled', false);
        $('#' + timeoutButtonId).val("获取验证码");
    }
    else {
        timeoutHandler = setTimeout(timeoutShow, 1000);
    }
}
//发送手机验证码
function sendMobileCode(obj) {
    $("#" + obj).attr('disabled', true);
    $.post("/User/AjaxSms.aspx", { t: Math.random() }, function (data) {
        if (data == "1") {
            alert("发送验证码成功");
            preventRush(obj, 60);
        }
        else {
            alert(data);
            $("#" + obj).attr('disabled', false);
        }
    });
}