<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/jquery-1.4.1.min.js"
        type="text/javascript"></script>
    <link href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Content/Site.css" rel="stylesheet"
        type="text/css" />
    <link href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/messagetipthem1/css/style.css"
        rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            var selectID = $("#SelectTypeID").val();
            var IDList = selectID.split(",");
            for (var i = 0; i < IDList.length; i++) {
                var id = IDList[i];
                if (id != "") {
                    $("#TypID" + id).attr("checked", true);
                }
            }
            selectMenu("展品索引", "")
        });
        var result;
        function SetValue() {
            var result = new Array();
            $("[name=TypID]:checkbox:checked").each(function () {
                result.push($(this).val());
            });

            var resultname = "";
            var ArrName = document.getElementsByName("TypID");
            for (var i = 0; i < ArrName.length; i++) {
                if (ArrName[i].checked) {
                    resultname = resultname + ArrName[i].title + ",";
                }
            }
            if (resultname.length > 0) {
                resultname = resultname.substring(0, resultname.length - 1);
            }

            parent.window.document.getElementById("pint").value = resultname;
            parent.window.document.getElementById("pintvalue").value = result;
            parent.dynaform.close();
        }
    </script>
    <style type="text/css">
        .button
        {
            background-image: url(../Content/images/botton.jpg);
            width: 106px;
            height: 32px;
            line-height: 32px;
            font-size: 12px;
            color: #333333;
            cursor: pointer;
            border: none;
            text-align: center;
            display: inline-block;
            float: left;
            margin-right: 5px;
        }
        .checktypefirst
        {
            width: 280PX;
            height: 23px;
            padding: 5px;
            line-height: 13px;
            display: block;
        }
        .checktype
        {
            width: 200px;
            height: 23px;
            padding: 5px;
            line-height: 13px;
            display: inline;
            float: left;
        }
        .checktypeword
        {
            width: 140px;
            height: 22px;
            line-height: 13px;
            display: inline;
            padding-top: 5px;
            padding-bottom: 5px;
        }
        .childcontainer
        {
            margin-left: 30px;
            
        }
    </style>
</head>
<body>
    <div>
        <table border="0" style="text-align: left" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="left" style="font-size:12px">
                    <span><strong>请选择观众感兴趣的产品：</strong></span>
                </td>
            </tr>
            <tr>
                <td align="left" style="border: 0px solid #000000;font-size:12px">
                <br />
                    <%
                        List<FamousFurnitureExpo.Models.TypeInfo> liAll = Model;
                        if (liAll.Count > 0)
                        {
                            int i = 0;
                            List<FamousFurnitureExpo.Models.TypeInfo> liType1 = liAll.FindAll(main => main.TypParentID.Trim() == "");
                            foreach (FamousFurnitureExpo.Models.TypeInfo ti1 in liType1)
                            {
                                List<FamousFurnitureExpo.Models.TypeInfo> liType2 = liAll.FindAll(child => child.TypParentID.Trim() == ti1.TypID.ToString());
                                bool type1HaveChild = false;
                                if (liType2.Count > 0)
                                {
                                    type1HaveChild = true;
                                }
                    %>
                    <%if (type1HaveChild && i != 0)
                      { %><%} %>
                    <div id="Type1-<%=ti1.TypID %>" class="checktypefirst" style="font-weight: bolder;">
                        <%if (!type1HaveChild)
                          { %>
                        <input type="checkbox" id="TypID<%=ti1.TypID %>" name="TypID" title="<%=ti1.TypName%>" value="<%=ti1.TypID %>"
                            style="vertical-align: top;" />
                        <%}%>
                        <div class="checktypeword">
                            <label for="TypID<%=ti1.TypID %>">
                                <%=ti1.TypName%></label>
                        </div>
                    </div>
                    <%if (type1HaveChild)
                      { %>
                    <table id="Child-Type1-<%=ti1.TypID %>" class="childcontainer">
                        <tr>
                            <td>
                                <%} %>
                                <%
                                    foreach (FamousFurnitureExpo.Models.TypeInfo ti2 in liType2)
                                    {
                                        List<FamousFurnitureExpo.Models.TypeInfo> liType3 = liAll.FindAll(child => child.TypParentID.Trim() == ti2.TypID.ToString());
                                        bool type2HaveChild = false;
                                        if (liType3.Count > 0)
                                        {
                                            type2HaveChild = true;
                                        }  
                                %>
                                <%if (type2HaveChild)
                                  { %><%} %>
                                <div id="Type2-<%=ti2.TypID %>" class="checktype" style="font-weight: normal;">
                                    <%if (!type2HaveChild)
                                      { %>
                                    <input type="checkbox" id="TypID<%=ti2.TypID %>" name="TypID" value="<%=ti2.TypID %>"
                                        style="vertical-align: top;" />
                                    <%}%>
                                    <div class="checktypeword">
                                        <label for="TypID<%=ti2.TypID %>">
                                            <%=ti2.TypName%></label>
                                    </div>
                                </div>
                                <%if (type2HaveChild)
                                  { %>
                                <table id="Child-Type2-<%=ti2.TypID %>" class="childcontainer">
                                    <tr>
                                        <td>
                                            <%} %>
                                            <% 
                                                foreach (FamousFurnitureExpo.Models.TypeInfo ti3 in liType3)
                                                {
                                            %>
                                            <div id="Type3-<%=ti3.TypID %>" class="checktype" style="font-weight: lighter;">
                                                <input type="checkbox" id="TypID<%=ti3.TypID %>" name="TypID" value="<%=ti3.TypID %>"
                                                    style="vertical-align: top;" />
                                                <div class="checktypeword">
                                                    <label for="TypID<%=ti3.TypID %>">
                                                        <%=ti3.TypName%></label>
                                                </div>
                                            </div>
                                            <%                    
                                                }    
                                            %>
                                            <%if (type2HaveChild)
                                              { %>
                                        </td>
                                    </tr>
                                </table>
                                <%} %>
                                <%                
                                    }  
                                %>
                                <%if (type1HaveChild)
                                  { %>
                            </td>
                        </tr>
                    </table>
                    <%} %>
                    <%
i++;
                            }
                    %>
                    <br />
                    <br />
                    <%
}
                        else
                        { %>
                    未设置展品分类！
                    <%}
                    %>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    <div class="button" onclick="SetValue()">
                        提交</div>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" id="SelectTypeID" name="SelectTypeID" value="<%=ViewData["Type"] %>" />
                    
                </td>
            </tr>
        </table>
    </div>
</body>
</html>
