//蓝色 00a2ff  红色 e1504a
//获得焦点**************************************************************************************
function ThisOnfocus(ObjID)
{
    $(".tc-msg").hide(); //隐藏顶部提示
    var objText = $("#" + ObjID).val();
    //手机号码
    if (ObjID == "reg_phone")
    {
		var phone_vdata=$("#reg_phone").attr("vdata");
        if(objText == "" || objText == null){
                $("#reg_phone").css("border", "1px solid #e1504a");
                $("#reg_phone_mes").css("color", "#e1504a");
                $("#reg_phone_mes").html("请输入手机号码");
                $("#reg_phone_mes").animate({  lineHeight: "45px"  }, 300);
                return false;
            }else{	
            if (objText == "" || objText == null)
            {
                $("#reg_phone").css("border", "1px solid #00a2ff");
                $("#reg_phone_mes").hide();
                return false;
            }
            $("#reg_phone").attr("vdata", "0");
        }
    }
    //密码
    else if (ObjID == "reg_password")
    {
      
        if (objText == "" || objText == null)
            {
                $("#reg_password").css("border", "1px solid #e1504a");
                $("#reg_password_mes").css("color", "#e1504a");
                $("#reg_password_mes").html("请输入密码");
                $("#reg_password_mes").animate({ lineHeight: "45px" }, 300);
                return false;
            }
        else
        {
            $("#reg_password").attr("vdata", "0");
            if (objText == "" || objText == null)
            {
                $("#reg_password").css("border", "1px solid #00a2ff");
                $("#reg_password_mes").css("color", "#aaa");
                $("#reg_password_mes").html("密码6-20个字符");
                $("#reg_password_mes").animate({  lineHeight: "45px"  }, 300);
                return false;
            }
        }
    }
}
//失去焦点**************************************************************************************
function ThisOnblur(ObjID)
{
    $(".tc-msg").hide(); //隐藏顶部提示
    var objText = $("#" + ObjID).val();
    var isMobile = /^1[3|4|5|7|8]\d{9}$/; //手机号码验证规则
    //手机======================================
    if (ObjID == "reg_phone")
    {
        checkmobile();
    }
    //密码======================================
    else if (ObjID == "reg_password")
    {
        $("#reg_password").attr("vdata", "0");
        if (objText == "" || objText == null)
        {
            $("#reg_password").css("border", "1px solid #ddd");
            $("#reg_password_mes").animate({ height: "0px" }, 100);
            return false;
        }
        else if (objText.length < 6 || objText.length > 20)
        {
            $("#reg_password").css("border", "1px solid #e1504a");
            $("#reg_password_mes").css("color", "#e1504a");
            $("#reg_password_mes").html("密码应该为6-20个字符");
            $("#reg_password_mes").animate({  lineHeight: "45px"  }, 300);
            return false;
        }
        else if (!checkRule())
        {
            $("#reg_password").css("border", "1px solid #e1504a");
            $("#reg_password_mes").css("color", "#e1504a");
            $("#reg_password_mes").html("密码至少包含字母、数字、符号中两种");
            $("#reg_password_mes").animate({  lineHeight: "45px"  }, 300);
            return false;
        }
        else
        {
            $("#reg_password_mes").hide();
            if ($("#reg_pswqueren").val() == "" || $("#reg_pswqueren").val() == null)
            {
                $("#reg_password").css("border", "1px solid #ddd");
                $("#reg_password").attr("vdata", "1");
                $("#reg_password_mes").hide();
            }
            else
            {
                $("#reg_password").css("border", "1px solid #ddd");
                $("#reg_password").attr("vdata", "1");
                $("#reg_password_mes").hide();
                $("#reg_pswqueren").attr("vdata", "1");
                $("#reg_pswqueren").css("border", "1px solid #ddd");
                $("#reg_pswqueren_mes").animate({ height: "0px" }, 100);
            }
        }
    }
}
//内容改变时**************************************************************************************
function ThisOnkeyup(ObjID)
{
    $(".tc-msg").hide(); //隐藏顶部提示
    var objText = $("#" + ObjID).val();
    //手机号码===================
    if (ObjID == "reg_phone")
    {
        $("#reg_phone").css("border", "1px solid #ddd"); //蓝色
        $("#reg_phone_mes").hide();
        return false;
    }
    //确认密码===================
    else if (ObjID == "reg_password")
    {
        $("#reg_password").css("border", "1px solid #00a2ff"); //蓝色
        $("#reg_password_mes").css("color", "#aaa");
        if ($("#reg_password").val() == $("#reg_pswqueren").val() && $("#reg_pswqueren").val() != "")
        {
            $("#reg_pswqueren").css("border", "1px solid #ddd");
            $("#reg_pswqueren").attr("vdata", "1");
            $("#reg_pswqueren_mes").animate({ height: "0px" }, 100);
        }
        return false;
    }
}

//密码规则**************************************************************************************
function checkRule()
{
    var len = 1;
    var Aq = 0;
    var objpsw = $("#reg_password").val();
    len = objpsw.length;
    if (/[a-zA-Z]/.test(objpsw))
    {
        Aq = Aq + 1;
    }
    if (/[0-9]/.test(objpsw))
    {
        Aq = Aq + 1;
    }
    if (/[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/.test(objpsw))
    {
        Aq = Aq + 1;
    }
    if (Aq >= 1)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function checkmobile(){
	  var objText =$("#reg_phone").val();
      var isMobile = /^1[3|4|5|7|8]\d{9}$/; //手机号码验证规则
	   if (objText == "" || objText == null)
        {
            $("#reg_phone").css("border", "1px solid #ddd");
            $("#reg_phone_mes").hide();
            return false;
        }
        else if (!isMobile.test(objText))
        {
            $("#reg_phone").css("border", "1px solid #e1504a");
            $("#reg_phone_mes").show();
            $("#reg_phone_mes").html("手机号码格式有误，请修改");
            $("#reg_phone_mes").animate({ lineHeight: "45px" }, 300);
            return false;
        }else{
            $("#reg_phone").attr("vdata", "1");
            $("#reg_phone_mes").hide();
		}
   }

//计时器**************************************************************************************
function redirection()
{
    seconds--;
    $("#buttonYanzhengma").html(seconds + "秒后重新获取");
    $("#buttonYanzhengma").css("color", "#fff");
    if (seconds == 0)
    {
        window.clearInterval(objTimer);
        $("#buttonYanzhengma").html("重新发送验证码").removeAttr("disabled").css("cursor", "pointer").css("background", "#3598dc").css("color", "#fff");
    }
}
//开始登录**************************************************************************************
