﻿function userLoginUI(){
   $.post('../ajaxService/Login.aspx', {
                userName: $("#userNameLogin").val(),
                password: $("#passwordLogin").val(),
                checkCode: $("#checkCode").val()
                }, function(e) {
                    if (e.toString()==""){                                              
                        alert("对不起，无此用户，请注册或重新检查您输入的用户名和密码！");
                        $("#userNameLogin").val("");
                        $("#passwordLogin").val("");
                    }else if((e.toString()+"").indexOf("验证码")!=-1){
                        alert(e.toString());
                        window.location = window.location;
                    }else{
                        $.cookie("jjmUser",e.toString(),{expires:1,path:'/'});
                        var location = window.location+"";
                        var returnUrlIndex = location.indexOf("?returnUrl=");
                        if (returnUrlIndex!=-1){
                            location = location.substr(returnUrlIndex+11,location.length-11-returnUrlIndex);
                            window.location = location;
                        }else
                        {
                            window.location = "/";
                        }
                    }                              
            });
}

function enterLogin(){
    if (window.event.keyCode==13){
        userLoginUI();
    }
}