﻿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 noname(id)
	{
	var item1 = eval("document.all." + id + "_noname");	
	var item=eval("document.all."+id+"_reviewName");
	if (item1.checked)
	{
	    item.value="匿名";
	}
	else
	{
	    item.value="";
	}
	}
		function can(id)
	{
	var item=eval("document.all."+id+"_reviewName");
	
	item.value="";
	item=eval("document.all."+id+"_reviewContent");
	item.value="";
		
	}

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;
}
