 var s = '';
    var lis = $('fs_group').getElementsByTagName('LI');
    var lastswitchobj = null;
    var selectfid = 0;
    var switch1=switchforum = switchsubforum = '';
    function $(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) {
            var sax =$('hidsax').value;
            var count =$('hidcount').value;
            if(count<sax)
            {
                $('enterbtn').removeAttribute("disabled");
            }
            currentblock = num;
            currentfid = fid;
        } else {
           
                $('enterbtn').setAttribute("disabled", "disabled");  
           
        }
        if(block == 1) {

            var lis = $('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>';
                }
            } 
            $('block_forum').innerHTML = s;
            $('block_subforum').innerHTML = '';
            switch1=obj.innerHTML;
            switchforum = switchsubforum = '';
            selectfid = 0;
        
        }else if(block == 2) {
              
            selectfid = fid;
            if($('fs_subforum_' + fid)) {
                var lis = $('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>';
                }
                $('block_subforum').innerHTML = s;
            } else {
                $('block_subforum').innerHTML = '';
            }  

            switchforum = obj.innerHTML;
            switchsubforum = '';

        } else {
            selectfid = fid;
            switchsubforum = obj.innerHTML;
            
        }
        lastswitchobj = obj;
        $('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($('fs_forum_' + gid)) {
            s += '<p><a href="javascript:;" onclick="switchforums(this,1,' + gid + ','+nn+')" class="hassubboard">' + lis[i].innerHTML + '</a></p>';
        }
    }
    function goto_page() {
        $('block_group').innerHTML = ''+s+'';
    }
//    if(typeof(document.body.onload)=="undefined") {
//        window.onload=goto_page();
//    }
//    else {
//        document.body.onload=new Function('goto_page();');
//    }

