// JScript 文件
function killErrors() {
    return true;
}
window.onerror = killErrors;

function selectrow(obj) {
    obj = "check" + obj;
    if (document.getElementById(obj).name == "") {
        if (document.getElementById(obj).checked) {
            document.getElementById(obj).checked = false;
        } else {
            document.getElementById(obj).checked = true;
        }
    }
    document.getElementById(obj).name = "";
}
function eidt(id, page) {
    selectrow1(id);
    window.location.href = "CommonityType_up.aspx?page=" + page + "&id=" + id;
}
function del(id) {
    selectrow(id);
    idcheck = "check" + id;
    var obj = document.getElementById(idcheck);
    var node = childs(obj.parentNode.parentNode.childNodes);
    var count = node[3].getElementsByTagName("span")[0].innerHTML;
    if (count != "0") {
        alert("你选择的了类别下面还有商品，不能删除该类别！");
    } else {
        if (confirm("您确定要删除这些类别吗？请确定在类别下面没有商品！")) {
            var ids = checkids(id);
            document.getElementById("CheckedIDS").value = ids;
            document.getElementById("inputbtndel").click();
        }
    }
}
function quickQueryCust(evt) {
    evt = (evt) ? evt : ((window.event) ? window.event : "") //兼容IE和Firefox获得keyBoardEvent对象
    var key = evt.keyCode ? evt.keyCode : evt.which; //兼容IE和Firefox获得keyBoardEvent对象的键值
    if (key == 13) { //判断是否是回车事件。
        event.keyCode = 9;
        document.getElementById("btnSou").click();
    }
}

function huifu() {
    if (confirm("您确定要进行分类数据的恢复吗？请谨慎此操作！！！")) {
        if (confirm("再次确认，您是要执行此操作吗？")) {
            document.getElementById("btnhuifu").click();
        }
        return false;
    }
    return false;
}

function openDi(ObjID) {
    tipsWindown("选择类别", "iframe:commodity_Manage_Dialog.aspx?d=" + Date() + "&objid=" + ObjID, "350", "460", "true", "", "true", "text");
}

function digCheck(id, value, objID) {
    parent.document.getElementById(objID).value = value;
    parent.document.getElementById("hf" + objID).value = id;
    parent.$("#windownbg").remove();
    parent.$("#windown-box").fadeOut("slow", function () { parent.$(this).remove(); });
}

var s = '';
var lis = forums$('fs_group').getElementsByTagName('LI');
var lastswitchobj = "";
var selectfid = 0;
var switch1 = switchforum = switchsubforum = '';
function forums$(id) {
    return document.getElementById(id);
}
function switchforums(obj, block, fid, num) {
    if (lastswitchobj != obj) {
        if (lastswitchobj) {
            lastswitchobj.parentNode.className = '';
        }
        obj.parentNode.className = 'pbl_selected';
    }
    var s = '';
    //是否禁用添加按钮
    if (num == 0) {
        if (forums$("serverResponse").innerHTML == "") {
            forums$('enterbtn').removeAttribute("disabled");
            forums$('btnSub').removeAttribute("disabled");
            currentblock = num;
            forums$('typeId').value = fid;
            currentfid = fid;
        }
    } else {
        forums$('enterbtn').setAttribute("disabled", "disabled");
        forums$('btnSub').setAttribute("disabled", "disabled");
    }
    if (block == 1) {

        var lis = forums$('fs_forum_' + fid).getElementsByTagName('LI');
        for (i = 0; i < lis.length; i++) {
            fid = lis[i].getAttribute('fid');
            num = lis[i].getAttribute('num');
            if (fid != '') {
                s += '<p><a href="javascript:;" ondblclick="locationforums(' + num + ', ' + fid + '\)" onclick="switchforums(this, 2, ' + fid + ',' + num + ')"' + ((num != 0) ? 'class="hassubboard"' : '') + '>' + lis[i].innerHTML + '</a></p>';
            }
        }
        forums$('block_forum').innerHTML = s;
        forums$('block_subforum').innerHTML = '';
        switch1 = obj.innerHTML;
        switchforum = switchsubforum = '';
        selectfid = 0;

    } else if (block == 2) {

        selectfid = fid;
        if (forums$('fs_subforum_' + fid)) {
            var lis = forums$('fs_subforum_' + fid).getElementsByTagName('LI');
            for (i = 0; i < lis.length; i++) {
                fid = lis[i].getAttribute('fid');
                num = lis[i].getAttribute('num');
                s += '<p><a href="javascript:;" ondblclick="locationforums(' + num + ', ' + fid + ')" onclick="switchforums(this, 3, ' + fid + ',' + num + ')">' + lis[i].innerHTML + '</a></p>';
            }
            forums$('block_subforum').innerHTML = s;
        } else {
            forums$('block_subforum').innerHTML = '';
        }

        switchforum = obj.innerHTML;
        switchsubforum = '';

    } else {
        selectfid = fid;
        switchsubforum = obj.innerHTML;

    }
    lastswitchobj = obj;
    forums$('switchnav').innerHTML = switch1 ? '&nbsp;&gt;&nbsp;' + switch1 + (switchforum ? '&nbsp;&gt;&nbsp;' + switchforum + (switchsubforum ? '&nbsp;&gt;&nbsp;' + switchsubforum : '') : '') : '';
}

function locationforums(num, fid) {
    //        if(num==0){}
    ////            top.location.href = 'add_c2.aspx?typeid='+fid;
}

//页面加载
for (i = 0; i < lis.length; i++) {
    var gid = lis[i].getAttribute('fid');
    var nn = lis[i].getAttribute('num');
    if (forums$('fs_forum_' + gid)) {
        s += '<p><a href="javascript:;" onclick="switchforums(this,1,' + gid + ',' + nn + ')" class="hassubboard">' + lis[i].innerHTML + '</a></p>';
    }
}
function goto_page() {
    forums$('block_group').innerHTML = '' + s + '';
}