﻿jQuery(function(){
//    表单提交用户验证
    jQuery("#Login_Submit").click(function(){
        submitForm();
    });
   
    
    function submitForm()
    {
         var username=jQuery("#log_username").val();
         if(username=="")
         {
            hiAlert('用户名不能为空', '系统提示');
            return;
         }
         var pwd=jQuery("#log_password").val();
         if(pwd=="")
         {
            hiAlert('密码不能为空', '系统提示');
            return;
         }
         var checkcodestr=jQuery("#checkcodestr").val();
         if(checkcodestr=="")
         {
            hiAlert('验证码不能为空', '系统提示');
            return;
         }
         hiBox('#objBox', '系统提示',400,'','','.a_close');
         jQuery.post("../Ajax/users/CustomLogin.ashx",{"log_username":username,"log_password":pwd,"checkcodestr":checkcodestr},function(data){
            
            
            if(data=="0")
            {
                hiAlert('用户名或密码错误请重试！', '系统提示');
            }
            else if(data=="-1")
            {
                hiAlert("验证码错误！","系统提示");
                jQuery("#checkcode").click();
            }
            else if(data=="-2")
            {
                hiAlert("请重新获取验证码！","系统提示");
            }
            else
            {
                setTimeout(function(){
                    jQuery("#login_form").submit();
                },1000);
               
            }
         });

    }
    //更换验证码
    jQuery("#user_login_click").click(function(){
        jQuery("#checkcode").click();
    });
    

});
