function showTip() {
    $('#divTip').dialog("open");
}

$(function () {

    $('#divTip').dialog({
        width: 680,
        autoOpen: false,
        modal: true,
        title: "提示",
        buttons: {
        }
    });

    $("#Password").keydown(function (e) {      
        if (e.which == 13) {
            $('#btnLogin').click();
            return false;
        }
    });

    $("#btnLogin").click(function () {
        ClearErrorMsg();


        if (!$("#LoginId").val()) {
            $("#LoginId").addClass("redBorder");
            return SetErrorMsg("请输入登录账号");
        }

        if (!$("#Password").val()) {
            $("#Password").addClass("redBorder");
            return SetErrorMsg("请输入登录密码");
        }
 
            $.ajax({
                url: "/Portal/Login",
                type: 'POST',
                cache: false,
                data: { LoginId: $("#LoginId").val(), Password: $("#Password").val() },
                success: function (result) {
                    if (result.code == 0) {
                        location.href = "/Portal/Index"
                    }
                    else {
                        SetErrorMsg('帐号或密码错误');
                         
                    }
                },
                error: function (e) {
                    SetErrorMsg('系统错误');                    
                }
            });
        
    });

});