function submitsave(loginurl,fromurl,logintype) {
    var pass = false;
    var username = false;
    var msg;
    if (logintype==0)
        msg = $("#msg")[0];
		/*
    //判断用户
	*/
    if ($("input[name='username']").val().length > 3) {
        if (username_test.test($("input[name='username']").val())) {
            username = true;
        }
        else {
            username = false;
            if (logintype == 0)
                msg.innerHTML = "\u7528\u6237\u540d\u683c\u5f0f\u4e0d\u5bf9\uff01";
            else
                alert("\u7528\u6237\u540d\u683c\u5f0f\u4e0d\u5bf9\uff01");
            return false;
        }
    }
    else {
        username = false;
        if (logintype == 0)
            msg.innerHTML = "\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01";
        else
            alert("\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01");
        return false;
    }
	/*
    //判断密码
	*/
    if ($("input[name='userpass']").val().length > 3) {
        pass = true;
    } else {
        pass = false;
        if (logintype == 0)
            msg.innerHTML = "\u8bf7\u8f93\u5165\u5bc6\u7801\uff01";
        else
            alert("\u8bf7\u8f93\u5165\u5bc6\u7801\uff01");
        return false;
    }

    if (pass && username) {
        if (logintype == 0) {
            $("#submit").attr("disabled", true);
        }
        $.post(loginurl,
         { username: $("input[name='username']").val(), userpass: $("input[name='userpass']").val() },
         function (userdata) {
             /*函数开始*/
             switch (userdata) {
                 case "success":
                     /*登录成功，转向到会员中心首页*/
                     if (fromurl == webd + "account/login")
                         fromurl = webd + "account/mypackage";
				    // if (fromurl.indexOf("?")>-1)
					 //     fromurl=fromurl+"&tmp="+ Math.random();
					// else
					 //     fromurl=fromurl+"?tmp="+ Math.random();
                     window.location.href = fromurl;             
                     return;
                     break;
                 case "empty user":
                     if (logintype == 0)
                         msg.innerHTML = "\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\u0021";
                     else
                         alert("\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\u0021");
                     break;
                 case "empty pass":
                     if (logintype == 0)
                         msg.innerHTML = "\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a\u0021";
                     else
                         alert("\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a\u0021");
                     break;
                 case "invalid username":
                     if (logintype == 0)
                         msg.innerHTML = "\u7528\u6237\u540d\u683c\u5f0f\u9519\u8bef\u0021";
                     else
                         alert("\u7528\u6237\u540d\u683c\u5f0f\u9519\u8bef\u0021");
                     break;
                 case "pass error":
                     if (logintype == 0)
                         msg.innerHTML = "\u60a8\u8f93\u5165\u5bc6\u7801\u9519\u8bef\u0021";
                     else
                         alert("\u60a8\u8f93\u5165\u5bc6\u7801\u9519\u8bef\u0021");
                     break;
                 case "no reg":
                     var usern = $("input[name='username']").val();
                     if (logintype == 0)
                         msg.innerHTML = "\u5bf9\u4e0d\u8d77\uff0c\u6ca1\u6709\u0020" + usern + "\u0020\u8fd9\u4e2a\u5e10\u53f7\u3002<br />\u8bf7\u521b\u5efa\u65b0\u5e10\u53f7\u3002";
                     else
                         alert("\u5bf9\u4e0d\u8d77\uff0c\u6ca1\u6709\u0020" + usern + "\u0020\u8fd9\u4e2a\u5e10\u53f7\u3002<br />\u8bf7\u521b\u5efa\u65b0\u5e10\u53f7\u3002");
                     break;
             }
             if (logintype == 0)
                 $("#submit").attr("disabled", false);
         },
        "text");
    }
}