﻿
        var isAction = 0;

        var isAdding = 0;

        var GoodsSortCodeArray;

        function SubItemShow(Item_ID) {

            eval("isHas = SubItem_" + Item_ID + "Has");

            if (isHas == 1) {


            }
            else {
                
                OutSubItemObj = document.getElementById("OutSubItem_" + Item_ID);

                OutSubItemObj.style.height = "0";

                SubItemObj = document.getElementById("SubItem_" + Item_ID);

                SubItemObj.style.height = "0";
            }

        }

        function SubItemHide(Item_ID) {
            //alert("SubItemHide");

            eval("isHas = SubItem_" + Item_ID + "Has");

            if (isHas == 1) {
                SubItemObj = document.getElementById("SubItem_" + Item_ID);

                if (SubItemObj != null) {

                    OutSubItemObj = document.getElementById("OutSubItem_" + Item_ID);

                    DivHeightSubtract(Item_ID);

                }
                else {

                }

            }

        }

        function DivHeightAdd(P_MaxHeight, P_Item_ID) {

            if (isAction == 0 || isAction == P_Item_ID) {

                //alert("DivHeightAdd");

                P_OutSubItemObj = document.getElementById("OutSubItem_" + P_Item_ID);

                //alert("offsetHeight" + P_OutSubItemObj.offsetHeight);

                //alert("P_MaxHeight" + P_MaxHeight);

                if (P_OutSubItemObj.offsetHeight < P_MaxHeight) {

                    //alert("DivHeightAdd2");

                    P_OutSubItemObj.style.height = P_OutSubItemObj.offsetHeight + 8;

                    isAction = P_Item_ID;

                    isAdding = 1;

                    //alert("Adding");

                    setTimeout("DivHeightAdd(" + P_MaxHeight + "," + P_Item_ID + ")", 15);


                }
                else {
                    isAction = 0;

                    isAdding = 0;

                }
            }

        }

        function DivHeightSubtract(P_Item_ID) {


            if (isAdding == 1 && isAction == P_Item_ID)
            { }
            else {


                P_OutSubItemObj = document.getElementById("OutSubItem_" + P_Item_ID);

                if (P_OutSubItemObj.offsetHeight > 0) {

                    P_OutSubItemObj.style.height = P_OutSubItemObj.offsetHeight - 8;

                    setTimeout("DivHeightSubtract(" + P_Item_ID + ")", 15);

                }
                else {
                    //isAction = 0;
                }
            }

        }


        function GetParentSortID(P_SortID) {

            if (P_SortID == 0) {
                return 0;
            }

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {

                pp_4 = GoodsSortCodeArray[i].split(",");

                if (pp_4[1] == null || pp_4[1] == "undefined" || pp_4[1] == "") {
                }
                else {

                    if (pp_4[1] == P_SortID) {
                        return pp_4[2];
                    }

                }

            }

            return 0;

        }


        function ShowMainSortList(thisunionid, thissortid) {

            GoodsSortCodeArray = CommSortCode.split(";");

            parentid = GetParentSortID(thissortid);

            thisItemID = 0;

            j = 0;

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {

                pp = GoodsSortCodeArray[i].split(",");

                if (pp[1] == null || pp[1] == "undefined" || pp[1] == "") {
                }
                else {

                    if (pp[2] == parentid) {

                        thisItemID = pp[1];

                        document.write("<li><a href=\"/Catalog/" + thisItemID + ".htm\">");
                        document.write(pp[0]);
                        document.write("</a></li>");

                        eval("SubItem_" + thisItemID + "Has = 0");

                        document.write("<div class=\"OutSubCategoriesDiv\" id=\"OutSubItem_" + thisItemID + "\">");

                        document.write("<div class=\"SubCategoriesDiv\" id=\"SubItem_" + thisItemID + "\">");

                        document.write("<ul class=\"SubCategoriesList\">");

                        ShowSubSortList(thisunionid, thisItemID);

                        document.write("</ul>");

                        document.write("</div>");

                        document.write("</div>");

                        SubItemShow(thisItemID);

                        j++;
                    }

                }
            }


        }


        function ShowSubSortList(P_UnionID, P_SortID) {

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {
                pp_2 = GoodsSortCodeArray[i].split(",");

                if (P_SortID == pp_2[2]) {

                    

                    document.write("<li><a href=\"/Catalog/" + pp_2[1] + ".htm\">");
                    document.write(pp_2[0]);
                    document.write("</a></li>");

                    //alert(pp_2[0]);

                    eval("SubItem_" + P_SortID + "Has = 1");

                }

            }
        }

        function ShowSubDiv(P_SortID) {
            thisSubDivObj = document.getElementById("SubSortDiv_" + P_SortID);
            //alert(thisSubDivObj);
            if (thisSubDivObj != null) {
                if (thisSubDivObj.style.display != "none") {
                    thisSubDivObj.style.display = "none";
                }
                else
                { thisSubDivObj.style.display = "block"; }
            }
        }


        function UnionDivReset() {

            MenuHome.className = "";

            MenuIntro.className = "";

            MenuNews.className = "";

            MenuLeague.className = "";

            MenuGoods.className = "";

        }


        function ShowCatalogList(thisshopid) {

            GoodsSortCodeArray = CommSortCode.split(";");

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {

                var pp_3 = GoodsSortCodeArray[i].split(",");

                if (pp_3[0] == null || pp_3[0] == "undefined" || pp_3[0] == "") {
                }
                else {

                    if (pp_3[4] == 0) {

                        document.write("<option value=\"" + pp_3[0] + "\">" + pp_3[3] + "</option>");

                        ShowCatalogSubList(thisshopid, pp_3[0]);

                    }



                }

            }
        }

        function ShowCatalogSubList(thisshopid, parentid) {

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {

                var pp_5 = GoodsSortCodeArray[i].split(",");

                if (pp_5[0] == null || pp_5[0] == "undefined" || pp_5[0] == "") {
                }
                else {

                    if (pp_5[4] == parentid) {

                        document.write("<option value=\"" + pp_5[0] + "\">--" + pp_5[3] + "</option>");

                        ShowCatalogSubList_3(thisshopid, pp_5[0]);

                    }

                }

            }
        }

        function ShowCatalogSubList_3(thisshopid, parentid) {

            for (var i = 0; i < GoodsSortCodeArray.length; i++) {

                var pp_6 = GoodsSortCodeArray[i].split(",");

                if (pp_6[0] == null || pp_6[0] == "undefined" || pp_6[0] == "") {
                }
                else {

                    if (pp_6[4] == parentid) {

                        document.write("<option value=\"" + pp_6[0] + "\">----" + pp_6[3] + "</option>");

                    }

                }

            }
        }