﻿function logininfer() {
    var html = "<br/><table width='275' cellspacing='2' cellpadding='0' border='0'> <tbody><tr><td style='font-size: 14px; width: 60px; text-align: right;'>账号：</td> <td> <input type='text' style='border: 1px solid rgb(204, 204, 204); padding: 4px 3px 0pt; height: 16px; color: rgb(136, 136, 136); width: 185px;' autocomplete='off' class='w' id='txtusername' name='txtusername' onkeydown=onKeypress4(event,$('.dialog-ok')) > </td> </tr> <tr><td style='font-size: 14px; height: 40px; text-align: right;'>密码：</td><td> <input type='password' style='border: 1px solid rgb(204, 204, 204); padding: 4px 3px 0pt; height: 16px; color: rgb(51, 51, 51); width: 185px;' class='w' id='txtpwd' name='txtpwd' onkeydown=onKeypress4(event,$('.dialog-ok'))> </td></tr><tr><td></td><td><span style='float: right; margin: 0px 25px 0px 0px;'><a href='\/getPasswd.aspx' target='_black'>取回密码</a></span> <span style='width: 150px;display:none'><input type='checkbox' name='cbIs' id='cbIs'><label for='cbIs'>下次自动登录</label></span> </td></tr></tbody></table>";
    $.weeboxs.open(html, { width: 420, title: "登录", okBtnName: '确定',
        cancelBtnName: '取消',
        onok: function(box) {
            submitlogin("txtusername", "txtpwd");
        }
    });
    return false;
}
function submitlogin(txtusername, txtpwd) {
var jq_username= $("#"+txtusername);
var jq_txtpwd= $("#"+txtpwd);

    var uname = $.trim(jq_username.val())
    var upwd = $.trim(jq_txtpwd.val());
    if (uname == "") { alert("请输入账号"); jq_username.focus(); return false; }
    if (upwd == "") { alert("请输入密码"); jq_txtpwd.focus(); return false; }
    var ajax = new AjaxSubmit("AjaxByLogin", Ajax_Defind.PHA, {
    uname: uname, upwd: upwd
    }, function(html) {
        var msg = eval("(" + html + ")");
        if (msg.suc == 0) {
            window.location.href = window.location.href.toString().split('#')[0];
        }
        else if (msg.suc == 1) {
            alert(msg.ex);
            jq_txtpwd.val("");
        } else {
            window.location.href = "www.equan.com/" + msg.ex;
        }

    });
    ajax.Request();
    ajax = null;
}
//回车事件
function onKeypress4(e, obj) {
    var isie = (document.all) ? true : false;
    var key;
    if (isie)
        key = window.event.keyCode;
    else
        key = e.which;
    if (key == 13) {
        var btnok = $(obj);
        btnok.focus();

    }
}
try {
    if ($ == undefined || $ == null) {
        document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/jquery.js\" type=\"text\/javascript\"><\/script>");
    }
}
catch (e) {
    document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/jquery.js\" type=\"text\/javascript\"><\/script>");
}

try {
    if ($.weeboxs == undefined || $.weeboxs == null) {
        document.writeln("<link media=\"all\" type=\"text\/css\" rel=\"stylesheet\" href=\"http:\/\/img1.equan.com\/css\/weebox.css\">");
        document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/bgiframe.js\" type=\"text\/javascript\"><\/script>");
        document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/weebox.js\" type=\"text\/javascript\"><\/script>");
    }
}
catch (e) {

    document.writeln("<link media=\"all\" type=\"text\/css\" rel=\"stylesheet\" href=\"http:\/\/img1.equan.com\/css\/weebox.css\">");
    document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/bgiframe.js\" type=\"text\/javascript\"><\/script>");
    document.writeln("<script src=\"http:\/\/img1.equan.com\/js\/jquery\/weebox.js\" type=\"text\/javascript\"><\/script>");
} 
