﻿
function login() {
    var frm = document.form1;
    var user = frm.txtuser.value;
    var pwd = frm.txtpwd.value;
    var role = frm.txtrole.value;

    if (trim(user) == "") {
        alert("请输入用户名！");
        frm.txtuser.focus();
        return false;
    }

    if (trim(pwd) == "" || pwd.length < 3 || pwd.length > 20) {
        alert("密码不合法！");
        frm.txtpwd.focus();
        return false;
    }

    if (trim(role) == "") {
        alert("请选择角色类型！");
        return false;
    }

    frm.submit();
    //self.location.href = "Login/Login.aspx?action=login&u=" + user + "&p=" + pwd + "&r=" + role;
    //window.open("Login/Login.aspx?action=login&u=" + user + "&p=" + pwd + "&r=" + role, "Window");
}

function Search() {
    var frm = document.form1;
    var type = frm.txtstype.value;
    var key = frm.txtsearch.value;

    if (type == "") {
        alert("请选择搜索类型！");
        return false;
    }

    if (trim(key) == "") {
        alert("请输入要查找的关键字！");
        return false;
    }

    if (type == "1") {
        self.location.href = "SNews.aspx?key=" + encodeURI(key);
    } else if(type=="2") {
        self.location.href = "Active.aspx?key=" + encodeURI(key);
    }
}

window.onerror = new Function("return false");

window.onload = function() {
    if (document.getElementById("mm2").clientHeight < document.getElementById("mm1").clientHeight) {
        document.getElementById("mm2").style.height = (document.getElementById("mm1").offsetHeight - 70) + "px";
    }
    else {
        document.getElementById("mm1").style.height = (document.getElementById("mm2").offsetHeight + 80) + "px" ;
    }
}
