<%@ Page Language="C#" MasterPageFile="~/home/main.Master" AutoEventWireup="true"
    Codebehind="bunchList.aspx.cs" Inherits="ZYDN.Web.home.bunchList" Title="我的群" %>

<%@ MasterType VirtualPath="~/home/main.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="R_BGDIV">
        <div id="R_Top">
        </div>
        <div>
            <div id="R_Left">
                <div style="width: 100%;">
                    <div style="width: 100%;" class="topOptionList">
                        <div style="width: 5px; float: left;">
                        </div>
                        <div id="mycreateBunch" name="mycreateBunch" class="optionCar">
                            <asp:Label ID="bunchTypeText" runat="server" Text=""></asp:Label></div>
                        <div id="mycreateBunch" name="mycreateBunch" class="optionCar_1">
                            <asp:Label ID="bunchCreateType" runat="server" Text="我创建的群"></asp:Label></div>
                        <div id="mycreateBunch" name="mycreateBunch" class="optionCar_1">
                            <asp:Label ID="Label1" runat="server" Text="热点群"></asp:Label></div>
                        <div id="mycreateBunch" name="mycreateBunch" class="optionCar_1">
                            搜索群
                        </div>
                    </div>
                    <div class="topOptionListBody">
                        <%-- 下面是我参与的群--%>
                        <div id="mycreateBunchBody" name="mycreateBunchBody">
                            <asp:Repeater ID="myBunch" runat="server">
                                <ItemTemplate>
                                    <div id="logoutDiv<%# DataBinder.Eval(Container, "DataItem.id")%>" style="width: 49%;
                                        float: left; overflow: hidden;">
                                        <div class="bunchImg">
                                            <div>
                                                <img src=" <%# DataBinder.Eval(Container, "DataItem.bunchPhoto")%>" onload="setImgWH(this)" />
                                            </div>
                                        </div>
                                        <div class="bunchInfo">
                                            <div>
                                                <a href='index.aspx?useType=<%# DataBinder.Eval(Container, "DataItem.id")%>'>
                                                    <%# DataBinder.Eval(Container, "DataItem.bunchName")%>
                                                </a>
                                            </div>
                                            <div>
                                                群主:
                                                <%# DataBinder.Eval(Container, "DataItem.cuserName")%>
                                                访问数:
                                                <%# DataBinder.Eval(Container, "DataItem.homeClickCount")%>
                                            </div>
                                            <div style="height: 50px; overflow: hidden;">
                                                <%# DataBinder.Eval(Container, "DataItem.note")%>
                                            </div>
                                            <span id="logoutBunch" name="logoutBunch" onclick="logoutBunch(<%# DataBinder.Eval(Container, "DataItem.id")%>)">
                                                退出此群</span>
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                        <%-- 下面是我创建的群--%>
                        <div id="mycreateBunchBody" name="mycreateBunchBody" style="width: 100%; visibility: hidden;">
                            <asp:Repeater ID="myCreateBunch" runat="server">
                                <ItemTemplate>
                                    <div id="delBunch<%# DataBinder.Eval(Container, "DataItem.id")%>" style="width: 49%;
                                        float: left; overflow: hidden;">
                                        <div class="bunchImg">
                                            <div>
                                                <img src=" <%# DataBinder.Eval(Container, "DataItem.bunchPhoto")%>" onload="setImgWH(this)" />
                                            </div>
                                        </div>
                                        <div class="bunchInfo">
                                            <div>
                                                <a href='index.aspx?useType=<%# DataBinder.Eval(Container, "DataItem.id")%>'>
                                                    <%# DataBinder.Eval(Container, "DataItem.bunchName")%>
                                                </a>
                                            </div>
                                            <div>
                                                群主:
                                                <%# DataBinder.Eval(Container, "DataItem.cuserName")%>
                                                访问数:
                                                <%# DataBinder.Eval(Container, "DataItem.homeClickCount")%>
                                            </div>
                                            <div style="height: 50px; overflow: hidden;">
                                                <%# DataBinder.Eval(Container, "DataItem.note")%>
                                            </div>
                                            <span id="delBunch" name="delBunch" onclick="delMyBunch( <%# DataBinder.Eval(Container, "DataItem.id")%>)">
                                                解散此群</span>
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                        <div id="mycreateBunchBody" name="mycreateBunchBody" style="width: 100%; visibility: hidden;">
                            <asp:Repeater ID="hostBunch" runat="server">
                                <ItemTemplate>
                                    <div id="delBunch<%# DataBinder.Eval(Container, "DataItem.id")%>" style="width: 49%;
                                        float: left; overflow: hidden;">
                                        <div class="bunchImg">
                                            <div>
                                                <img src=" <%# DataBinder.Eval(Container, "DataItem.bunchPhoto")%>" onload="setImgWH(this)" />
                                            </div>
                                        </div>
                                        <div class="bunchInfo">
                                            <div>
                                                <a href='index.aspx?useType=<%# DataBinder.Eval(Container, "DataItem.id")%>'>
                                                    <%# DataBinder.Eval(Container, "DataItem.bunchName")%>
                                                </a>
                                            </div>
                                            <div>
                                                群主:
                                                <%# DataBinder.Eval(Container, "DataItem.cuserName")%>
                                                访问数:
                                                <%# DataBinder.Eval(Container, "DataItem.homeClickCount")%>
                                            </div>
                                            <div style="height: 50px; overflow: hidden;">
                                                <%# DataBinder.Eval(Container, "DataItem.note")%>
                                            </div>
                                            
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                         <div id="mycreateBunchBody" name="mycreateBunchBody" style="width: 100%; visibility: hidden; text-align:center;">
                                  群名：<input type="text" value="" id ="bName"/><br>
                                  群主：<input type="text" value="" id ="bMain"/><br>
                                  介绍：<input type="text" value="" id ="bInfo"/><br>
                                  <input type="button" value="确定" onclick="fBunch()" />
                                  <br/>
                                  <br/>
                                  <br/>
                                  <div id="findBunchDiv">
                                  </div>
                         </div>
                    </div>
                </div>
            </div>
            <div id="R_Right">
                <div id="userListDiv">
                    <asp:Label ID="userListType" runat="server" Text=""></asp:Label>
                    <asp:Repeater ID="userList" runat="server">
                        <ItemTemplate>
                            <div style="width: 49%; text-align: center; overflow: hidden; float: left;">
                                <div class="myUserList" style="filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);"  id="myFriendDiv<%# DataBinder.Eval(Container, "DataItem.userID")%>">
                                    <img  id="myFriendList" name="myFriendList" alt="<%# DataBinder.Eval(Container, "DataItem.userName")%>" onload="setImgWH(this)" src="<%# DataBinder.Eval(Container, "DataItem.userPhoto")%>">
                                </div>
                                <a href="index.aspx?user=<%# DataBinder.Eval(Container, "DataItem.userName")%>">
                                    <%# DataBinder.Eval(Container, "DataItem.userName")%>
                                </a>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>
                     <script language="javascript" type="text/javascript">
                          readOnlineFriend();
                        
                    </script>
                </div>
            </div>
        </div>
    </div>
    <div id="R_Bottom">
    </div>

    <script language="javascript" type="text/jscript">
       
                var nCar =new  carClass();
                nCar.optionDiv="mycreateBunch";
                nCar.bodyDiv="mycreateBunchBody";
                nCar.thisClass="optionCar";
                nCar.className="optionCar_1";
                setTimeout("nCar.Create()",1000);
        
        function fBunch(){
            
            var buName=$("bName").value;
            var buMain=$("bMain").value;
            var buInfo=$("bInfo").value;
            
            if (buName=="" & buMain=="" & buInfo==""){
                alert("请你输入一个查询条件");
                return;
            }
            
	         var objResponse=new JHttpResponse();
	         objResponse.write("buName",buName);
	         objResponse.write("buMain",buMain);
	         objResponse.write("buInfo",buInfo);
        	 
             var out=objAjax.getText("post","homeServer.aspx?type=findBunch",objResponse,null);
             if (out.indexOf(c1)==-1){
                alert(erStr(out));
                return;
             }
             displayBunch(out)
            
        }
        
        
        function displayBunch(out){
            out=comminute(out,c1,c2);
             
             if (out.length==1){
                alert("没有找到符合条件的群");
                return;
             }
            var html="";
             //bunchName,id,cuserid,cuserName,cdate,note,bunchPhoto,homeClickCount
             // 0         1  2            3      4   5      6        7 
            for (var i=0;i<out.length-1;i++){
              html+="  <div style=\"width: 49%;";
              html+="  float: left; overflow: hidden;\">";
              html+="  <div class=\"bunchImg\">";
              html+="  <div>";
              html+="  <img src=\""+out[i][6]+"\" onload=\"setImgWH(this)\" />";
              html+="  </div>";
              html+="  </div>";
              html+="  <div class=\"bunchInfo\">";
              html+="  <div>";
              html+="  <a href='index.aspx?useType="+out[i][1]+"'>";
              html+="  "+out[i][0]+"";
              html+="   </a>";
              html+="   </div>";
              html+="   <div>";
              html+="   群主:";
              html+="  "+out[i][3]+"";
              html+="   访问数:";
              html+="   "+out[i][7]+"";
              html+="  </div>";
              html+="  <div style=\"height: 50px; overflow: hidden;\">";
              html+="  "+out[i][5]+"";
              html+="  </div>";
              html+="  </div>";
              html+=" </div>";
                
            }
            
            $("findBunchDiv").innerHTML=html;
            
        }
        
        
        
        function setLogoutOrDel(){
           // alert(isMy);
            if (isMy==0){
                var objs=document.getElementsByName("delBunch");
                var z=objs.length;
                for (var i=0;i<z;i++){
                    objs[0].removeNode(true);
                }
            
              objs=document.getElementsByName("logoutBunch");
               z=objs.length;
                for (var i=0;i<z;i++){
                    objs[0].removeNode(true);
                }
            
            }
        }
        setLogoutOrDel();
    </script>

</asp:Content>
