var enter = "";

function keyDown() {
    if (event.srcElement.type == "textarea") return;
    if (event.keyCode == 13) {
        if (enter != "") {

            var key = eval("document.all." + enter);
            key.click();

        }

        event.returnValue = false;
    }
}
function setKeyDown(id, name, focus) {


    enter = id.replace(name, "");
    enter = enter + focus;


}
function resear(bigClass, count) {

    var aaa = "resear.aspx?aaa=" + bigClass;
    var height = 230 + 30 * count;
    window.open(aaa, "", "toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,width=350,height=" + height);
}


function ballot(bigClass, id, count) {
    var i;
    var pkId;
    for (i = 0; i < count; i++) {
        var item = eval("document.all." + id + "_sati_" + i);
        if (item.checked == true) {
            pkId = item.value;
            break;
        }
    }
    if (i == count) {
        alert("请选择其中一项再投票！");
        return;
    }
    var height = 230 + 30 * count;
    var aaa = "resear.aspx?aaa=" + bigClass + "&pkId=" + pkId;
    window.open(aaa, "", "toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,width=400,height=" + height);

}
function openreg() {
    window.open("regLicense.aspx", "", "toolbar=no,menubar=no,scrollbars=NO,resizable=no,location=no,status=no,width=550,height=530");
}
function forget() {
    window.open("retake.aspx", "", "toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,width=330,height=250");
}

function validReview(id, filter) {
    var item1 = eval("document.all." + id + "_reviewName");
    if (item1.value.LTrim().RTrim().length == 0) {
        alert("请输入用户名！");
        return false;
    }
    var item = eval("document.all." + id + "_reviewContent");
    if (item.value.LTrim().RTrim().length == 0) {
        alert("请输入评论内容！");
        return false
    }
    var keys = filter.split('|');
    for (i = 0; i < keys.length; i++) {
        var j = item.value.indexOf(keys[i], 0);
        if (j != -1) {
            alert("警告：不能在评论中发布不良信息！");
            return false
        }
    }
    return true;
}
function isValidLogin(id) {
    var item = eval("document.all." + id + "_name");
    if (item.value.LTrim().RTrim().length == 0) {
        alert("请输入用户名！");
        return false
    }
    var item1 = eval("document.all." + id + "_password");
    if (item1.value.LTrim().RTrim().length == 0) {
        alert("请输入密码！");
        return false
    }
    return true;
}
String.prototype.Trim = function () {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.LTrim = function () {
    return this.replace(/(^\s*)/g, "");
}

String.prototype.RTrim = function () {
    return this.replace(/(\s*$)/g, "");
}
function validSearch(id) {
    var item = eval("document.all." + id + "_content");
    if (item.value.LTrim().RTrim().length == 0) {
        alert("搜索内容不能为空！");
        item.focus();
        return false;
    }
    return true;
}
function setWinuponIframe(id, content) {
    document.getElementById(id).innerHTML = content;
}



// 若是新疆数字校园，请将以下注释段复制到index.aspx页面的最后
//var table9 = document.getElementById("FlashGameRank9");

//if (table9 != null) {
//    Web.Service.FlashGameGetRankService.GetRank(0, 9, GetRankSuccess);
//}
//var table100 = document.getElementById("FlashGameRank100");
//if (table100 != null) {
//    Web.Service.FlashGameGetRankService.GetRank(0, 100, GetAllRankSuccess);
//}

////新疆数字校园游戏页面定制  沈建昌20091127
//function GetAllRankSuccess(result) {
//    var rankList = result.split(' ');
//    for (var i = 1; i < rankList.length; i++) {
//        var x = table100.rows[i].cells;
//        var user = rankList[i - 1].split('@');
//        x[1].innerHTML = user[1];
//        x[2].innerHTML = user[2] + "分";
//    }
//    for (var i = rankList.length; i < table100.rows.length; i++) {
//        table100.rows[i].style.display = "none";
//    }

//}

////新疆数字校园游戏页面定制  沈建昌20091127
//function GetRankSuccess(result) {
//    var rankList = result.split(' ');
//    for (var i = 1; i < table9.rows.length; i++) {
//        if (i > (rankList.length - 1))
//            break;
//        var x = table9.rows[i].cells;
//        var user = rankList[i - 1].split('@');
//        x[2].innerHTML = user[1];
//        x[4].innerHTML = user[2] + "分";
//    }
//}	