//左侧导航
function showSub(ClassID)
{
    var obj=document.getElementById(ClassID);
    if (!obj) return;
    with(obj){
        style.display=(style.display=="block")?"none":"block";
    }
}
function changeIcon(objid)
{
    var obj=document.getElementById(objid);
    if (!obj) return;
    var tmpsrc=(obj.src.indexOf(picArr[2])==-1)?picArr[2]:picArr[1];
    obj.src=tmpsrc;
}

function getSubCls(topID)
{
    var tmpstr=eval("clsStr.match(/\\${3}"+topID+"\\|{2}[^$]*/g)");
    return tmpstr;
}

function listProCLass(ver)
{
    var tmpArr,tmp,tmp2,tmp3,tmp4,tmp5,icon;
    ver=(ver==1)?1:0;
    tmp=getSubCls(0);
    if (!tmp) return;
    for (var i=0;i<tmp.length;i++)
    {
        tmpArr=tmp[i].replace(/\${3}/,"").split("||");
        tmp2=getSubCls(tmpArr[1]);
        icon=picArr[0];
        document.writeln("<div style=\"background:url(Images/left_bg03.jpg) no-repeat\">");  //修改第一级栏目样式
        document.writeln("<table width=\"100%\" height=\"28\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" onmouseover=\"this.className=\'bg_over1\'\" 																																							onmouseout=\"this.className=\'bg_out1\'\">");//修改第一级栏目背景
        document.writeln("  <tr>");
        document.writeln("    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >");
        document.writeln("      <tr>");
        document.writeln("        <td width=\"15\"><div align=\"center\" class=\"lev0\"><\/div><\/td>");//显示第一级栏目前面的图片
        if (!tmp2){
            document.writeln("        <td height=\"28\" valign=\"middle\"><div  align=\"left\"><a href=\""+linkArr[ver]+"?ClassID="+tmpArr[1]+"\" id=\"prolink"+tmpArr[1]+"\">"+tmpArr[ver+2]+"</a><\/div><\/td>");//第一级栏目链接
        }
        else{
            document.writeln("        <td height=\"28\" valign=\"middle\"><div  align=\"left\"><a href=\"javascript:void(0);\" onclick=\"showSub(\'cls"+tmpArr[1]+"\');\" id=\"prolink"+tmpArr[1]+"\" class=\"clslink1\">"+tmpArr[ver+2]+"</a><\/div><\/td>");
        }
        document.writeln("      <\/tr>");
        document.writeln("    <\/table><\/td>");
        document.writeln("  <\/tr>");
        document.writeln("<\/table>");
        if (!tmp2){document.writeln("</div>");continue;}
        document.writeln("<div id=\"cls"+tmpArr[1]+"\" class='sub1'>");
        for (var j=0;j<tmp2.length;j++)
        {
            var tmpArr2=tmp2[j].replace(/\${3}/,"").split("||");
            tmp3=getSubCls(tmpArr2[1]);
            document.writeln("<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"background:url(Images/left_bg01.jpg) no-repeat\">");
            document.writeln("  <tr>");
            document.writeln("    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" onmouseover=\"this.className=\'bg_over2\'\" onmouseout=\"this.className=\'bg_out2\'\">");//修改第二级栏目背景
            document.writeln("      <tr>");
            icon=(!tmp3)?picArr[3]:picArr[1];
            document.writeln("        <td width=\"28\"><div align=\"center\" class=\"lev1\"><\/div><\/td>");//显示第二级栏目前面的图片
            if (!tmp3){
                document.writeln("        <td height=\"28\"><div align=\"left\"><a href=\""+linkArr[ver]+"?ClassID="+tmpArr2[1]+"\" id=\"prolink"+tmpArr2[1]+"\" class=\"clslink2\">"+tmpArr2[ver+2]+"</a><\/div><\/td>");//第二级栏目链接
            }
            else{
                document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\"javascript:void(0);\" onclick=\"showSub(\'cls"+tmpArr2[1]+"\');changeIcon(\'cls"+tmpArr2[1]+"_icon\');\" id=\"prolink"+tmpArr2[1]+"\">"+tmpArr2[ver+2]+"</a><\/div><\/td>");
            }
            document.writeln("      <\/tr>");
            document.writeln("    <\/table><\/td>");
            document.writeln("  <\/tr>");
            document.writeln("<\/table>");

            if (!tmp3) continue;
            document.writeln("<div id=\"cls"+tmpArr2[1]+"\"class='sub2'>");
            for (var k=0;k<tmp3.length;k++)
            {
                var tmpArr3=tmp3[k].replace(/\${3}/,"").split("||");
                tmp4=getSubCls(tmpArr3[1]);
                icon=(!tmp4)?picArr[3]:picArr[1];
                document.writeln("<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                document.writeln("  <tr>");
                document.writeln("    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" onmouseover=\"this.style.backgroundColor=\'\'\" onmouseout=\"this.style.backgroundColor=\'\'\">");
                document.writeln("      <tr>");
                document.writeln("        <td width=\"23\"><div align=\"center\" class=\"lev2\"><img src=\""+icon+"\" id=\"cls"+tmpArr2[1]+"_icon\" class=\"icon\"  \/><\/div><\/td>");
                if (!tmp4){
                    document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\""+linkArr[ver]+"?ClassID="+tmpArr3[1]+"\" id=\"prolink"+tmpArr3[1]+"\" class=\"clslink2\">"+tmpArr3[ver+2]+"</a><\/div><\/td>");
                }
                else{
                    document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\"javascript:void(0);\" onclick=\"showSub(\'cls"+tmpArr3[1]+"\');changeIcon(\'cls"+tmpArr3[1]+"_icon\');\" id=\"prolink"+tmpArr3[1]+"\">"+tmpArr3[ver+2]+"</a><\/div><\/td>");
                }
                document.writeln("      <\/tr>");
                document.writeln("    <\/table><\/td>");
                document.writeln("  <\/tr>");
                document.writeln("<\/table>");
                if (!tmp4) continue;
                document.writeln("<div id=\"cls"+tmpArr3[1]+"\"class='sub3'>");
                for (var m=0;m<tmp4.length;m++)
                {
                    var tmpArr4=tmp4[m].replace(/\${3}/,"").split("||");
                    tmp5=getSubCls(tmpArr4[1]);
                    icon=(!tmp5)?picArr[3]:picArr[1];
                    document.writeln("<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                    document.writeln("  <tr>");
                    document.writeln("    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" onmouseover=\"this.style.backgroundColor=\'\'\" onmouseout=\"this.style.backgroundColor=\'\'\">");
                    document.writeln("      <tr>");
                    document.writeln("        <td width=\"23\"><div align=\"center\" class=\"lev3\"><img src=\""+icon+"\" id=\"cls"+tmpArr2[1]+"_icon\" class=\"icon\"  \/><\/div><\/td>");
                    if (!tmp5){
                        document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\""+linkArr[ver]+"?ClassID="+tmpArr4[1]+"\" id=\"prolink"+tmpArr4[1]+"\" class=\"clslink2\">"+tmpArr4[ver+2]+"</a><\/div><\/td>");
                    }
                    else{
                        document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\"javascript:void(0);\" onclick=\"showSub(\'cls"+tmpArr4[1]+"\');changeIcon(\'cls"+tmpArr4[1]+"_icon\');\" id=\"prolink"+tmpArr4[1]+"\">"+tmpArr4[ver+2]+"</a><\/div><\/td>");
                    }
                    document.writeln("      <\/tr>");
                    document.writeln("    <\/table><\/td>");
                    document.writeln("  <\/tr>");
                    document.writeln("<\/table>");
                    if (!tmp5) continue;
                    document.writeln("<div id=\"cls"+tmpArr4[1]+"\"class='sub4'>");
                    for (var n=0;n<tmp5.length;n++)
                    {
                        var tmpArr5=tmp5[n].replace(/\${3}/,"").split("||");
                        icon=picArr[3];
                        document.writeln("<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        document.writeln("  <tr>");
                        document.writeln("    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" onmouseover=\"this.style.backgroundColor=\'\'\" onmouseout=\"this.style.backgroundColor=\'\'\">");
                        document.writeln("      <tr>");
                        document.writeln("        <td width=\"23\"><div align=\"center\" class=\"lev4\"><img src=\""+icon+"\" id=\"cls"+tmpArr2[1]+"_icon\" class=\"icon\"  \/><\/div><\/td>");
                        document.writeln("        <td height=\"31\"><div align=\"left\"><a href=\""+linkArr[ver]+"?ClassID="+tmpArr5[1]+"\" id=\"prolink"+tmpArr5[1]+"\" class=\"clslink2\">"+tmpArr5[ver+2]+"</a><\/div><\/td>");
                        document.writeln("      <\/tr>");
                        document.writeln("    <\/table><\/td>");
                        document.writeln("  <\/tr>");
                        document.writeln("<\/table>");
                    }
                    document.writeln("</div>");
                }
                document.writeln("</div>");
            }
            document.writeln("</div>");
       }
       document.writeln("</div>");
       document.writeln("</div>");
    }
}

//保留显示子系列
function keepSubCls()
{
    var tmpstr;
    var id;
    var panel;
    if (!ClassID.match(/^[1-9]\d*$/)) return;
    tmpstr=eval("clsStr.match(/\\${3}(\\d+)\\|{2}"+ClassID+"\\|{2}[^$]*/)");
    if (!tmpstr) return;
    tmpstr=tmpstr.toString();
    id=tmpstr.replace(/^\${3}(\d+)\|{2}.*/,"$1")
    panel=document.getElementById("cls"+id);
    if (!panel) return;
    panel.style.display="block";
    //改变当前系列的字体样式
    //document.getElementById("prolink"+ClassID).style.textDecoration="underline";
    document.getElementById("prolink"+ClassID).style.borderBottom="1px dashed #f60";
    
    while (id>0)
    {
        tmpstr=eval("clsStr.match(/\\${3}(\\d+)\\|{2}"+id+"\\|{2}[^$]*/)");
        if (!tmpstr) return;
        tmpstr=tmpstr.toString();
        id=tmpstr.replace(/^\${3}(\d+)\|{2}.*/,"$1");
        panel=document.getElementById("cls"+id);
        if (!panel) return;
        panel.style.display="block";
    }
}
