// JavaScript Document

function OpenLoad() {
    $('#Dialog-Load').dialog({
        width: 90,
        height: 37,
        border: false,
        noheader: true,
        modal: true,
        content: '<div class="easyui-panel" style="width:90px; height:37px; padding:5px;">\n' +
        '<img src="Image/loading.gif" width="16" height="16" style="position: absolute; top: 10px;" />\n' +
        '<span style="position: absolute; top: 11px; left: 32px;">请稍等...</span>\n' +
        '</div>',
    })
}
function CloseLoad() {
    $('#Dialog-Load').dialog('close');
}
function Login() {
    var n = $("#name").val();
    var p = $("#pass").val();
    if (n.length < 3) {
        $.messager.alert('警告', '非法的用户名称...', 'error');
        return;
    }
    if (p.length < 3) {
        $.messager.alert('警告', '非法的用户密码...', 'error');
        return;
    }
    var json = {
        "username": n,
        "password": p,
    }
    var aj = $.ajax({
        beforeSend: function () {
            OpenLoad();
        },

        success: function () {
            CloseLoad();
            if (json.username != "admin" && json.password != "admin") {
                $.messager.alert('警告', 'error');
            } else {
                window.location.href = "/web/main/";
            }
        },
        error: function () {
            CloseLoad();
            $.messager.alert('警告', '与服务器通讯失败...', 'error');
        }
    })
}