<?php
require_once(dirname(__FILE__)."/header.htm");
?>
    <!--中间开始-->
    <div id="group_main">
        <div class="r_title" style="margin-top:40px;height:150px;">
        	<p style="background-repeat: repeat-x; background-image: url(images/group_index_rbg.gif);">最新主题</p>
            <ul style="margin-top:8px;">
            <?php
            $db->SetQuery("SELECT subject,digest,replies,gid,tid FROM #@__group_threads WHERE closed=0 ORDER BY dateline DESC LIMIT 0,10");
            $db->Execute();
            if(!isset($title)) $title = '';
            if(!isset($titleleft)) $titleleft = '';
            while($rs = $db->GetArray()){
            $title = $rs['subject'];                     
            if($rs['digest']) $titleleft .= " [<font color=\"red\">精华</font>]";
            if($rs['replies']>10) $titleleft .= "<img src=\"images/icon_hotp.gif\" />";
            $title = $titleleft.$title;
            $titleleft = "";
            ?>
            <li class="newtopic"><a href="viewthread.php?id=<?php echo $rs['gid'];?>&tid=<?php echo $rs['tid'];?>" title="<?php echo $rs['subject'];?>" target="_blank"><?php echo $title;?></a></li>
            <?php
            }?>
            </ul>
        </div>
    	<div id="group_main_middle" style="margin-top:8px;">

        <div class="clear"></div>
        	<div class="group_main_title">热门分类
            </div>
            <div class="group_main_class">
            <?php
            $i=0;$j=0;
            foreach($topgroups as $v){
            $i++;$j++;
            if($j>1) $j=0;
            ?>             
           	  <div class="group_main_list">
               	  <div class="group_main_list_img"><img src="<?php echo Showindeximage($v['storeid'],"img");?>" />                  </div>
              		<div class="group_main_list_text">
                    	<div class="group_main_list_text01"><a href="store.php?id=<?php echo $v['storeid'];?>"><?php echo $v['storename'];?></a>
                        </div>
                        <div class="group_main_list_text02">
                        	<ul>
                            <?php
                            $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops='".$v['storeid']."' ORDER BY orders ASC LIMIT 0,4");
                            $db->Execute();
                            while($rs = $db->GetObject()){
                            ?>
                            <li><a href="store.php?id=<?php echo $rs->storeid;?>"><?php echo $rs->storename;?></a></li>
                            <?php
                            }?>
                            </ul>
                        </div> 
                        <div class="clear">
                        </div>              	                     
                  	</div>
                    <div class="clear">
                    </div>
              </div>
            <?php
            	if(in_array($i,$sprit)) {
             		if($j) echo  "</div>\n<div class=\"group_main_class1\">";
            	 	else echo  "</div>\n<div class=\"group_main_class\">";
            	}
            }?>
            </div>                       
        </div>
    </div>
        <div class="clear"></div>
        <!--圈子排行-->
        <div class="r_title">
            <p style="background-repeat: repeat-x; background-image: url(images/group_index_rbg.gif);">圈子排行</p>
            <?php
            $db->SetQuery("SELECT groupimg,groupid,groupname FROM #@__groups WHERE ishidden=0 ORDER BY threads DESC LIMIT 0,7");
            $db->Execute();
            $i=0;
            while($rs = $db->GetArray()){
            $i++;
            $icon  = $rs['groupimg'];
            if(!$icon) $icon = "images/group_mainlist00.gif";
            ?>         
            <div class="r_ico">
            <a href="group.php?id=<?php echo $rs['groupid'];?>" title="<?php echo $rs['groupname'];?>" target="_blank">
            <img style="width: 100px; height: 70px; visibility: inherit;" alt="" title="<?php echo $rs['groupname'];?>" src="<?php echo $icon;?>" />
            <span><?php echo $rs['groupname'];?></span>
            </a>

            </div>
            <div class="hot_<?php echo $i;?>"></div>
            <?php $icon = ""; }
            $rs = "";
            ?>
            <div class="clear"></div>
        </div>
        <!--圈子排行-->
    <div class="clear">
    </div>
    <!--中间结束-->
<?php
require_once(dirname(__FILE__)."/footer.htm");
?>