// JavaScript Document
/*-------------------------------------------*/  
var InterValObj;
var count = 120;  
var curCount;  
var code = "";  
var codeLength = 6;  
function sendMessage() {  
    curCount = count;  
    var phone=$("#phone").val();
	var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;  
	if(reg.test(phone)){
        $("#btnSendCode").attr("disabled", "true");  
        $("#btnSendCode").val(curCount + "秒后重发");  
        InterValObj = window.setInterval(SetRemainTime, 1000); 
        //向后台发送处理数据  
        $.ajax({  
            type: "POST",  
            dataType: "text",  
            url: 'do.php',  
            data: "act=postmob&phone=" + phone,  
            error: function (XMLHttpRequest, textStatus, errorThrown) { },  
            success: function (msg){}  
        });  
    }else{  
        alert("手机号码不能为空或手机号格式不正确！");  
    }  
}  
function SetRemainTime() {  
    if (curCount == 0) {                  
        window.clearInterval(InterValObj);
        $("#btnSendCode").removeAttr("disabled");
        $("#btnSendCode").val("重新发送验证码");  
        code = "";     
    }  
    else {  
        curCount--;  
        $("#btnSendCode").val(curCount + "秒后重发");  
    } 
} 