		<div class="userMain">
			<div class="uMain_title"><span class="iconFriend">好友</span></div>
			<div class="uMain_content">
				<div class="stageBox">
					<div class="stageBoxTop"><span></span></div>
					<div class="stageBoxCenter">
						<div class="stageBoxCenterContent">
							<div class="main_nav">
								<ul>
								<li class="nava_4"><a href="?ac=friend">我的好友</a></li>
								<li class="navb_4"><a href="?ac=look">访问脚印</a></li>
								<li class="navb_4"><a href="?ac=online">在线成员</a></li>
								</ul>
							</div>
							<div class="minHeight500">
								<div class="friendGroup">
									<div id="friendGroupList">
										<ul>
<?php
	$fgid=SafeRequest("fgid","get");
	$friendnum= $db -> num_rows($db -> query("select * from s_friend where S_namea='".$chsh_username."' and s_lock=1"));
	if($fgid==""){
$zname="全部好友";
?>
	<li><div class="friendGroupTitle"><a class="fgName on"href="?ac=friend">全部好友<span class="fgCount" id="fgCountAll">[<?php echo $friendnum?>]</span></a></div></li>
<?php
}else{
$zname=$db->getrow("select s_name,s_id from s_friendzu where S_id=$fgid");
$zname=$zname["s_name"];
?>
	<li><div class="friendGroupTitle"><a class="fgName"href="?ac=friend">全部好友<span class="fgCount" id="fgCountAll">[<?php echo $friendnum?>]</span></a></div></li>
<?php
}
	global $db;
	$sql="select s_id,s_name from s_friendzu where S_user='".$chsh_username."' order by s_id desc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	$nums=100;
	if($num<$nums){
		$j=$num;
	}else{
		$j=$nums;
	}
	for($i=0;$i<$j;$i++){
	$row=$db->fetch_array($rs);
	$zid=$row["s_id"];
	$friendnumzu= $db -> num_rows($db -> query("select * from s_friend where S_namea='".$chsh_username."' and s_zu=$zid"));
	if($fgid!=$row["s_id"]){
?>
	<li id="friendGroupLine_78"><a id="group_78" class="fgName" href="?ac=friend&fgid=<?php echo $row["s_id"]?>"><?php echo $row["s_name"]?><span class="fgCount" id="fgCount_78">[<?php echo $friendnumzu?>]</span></a></li>
<?php
}else{
?>
	<li id="friendGroupLine_78"><span class="option"><a class="icon edit" href="javascript:;" onclick="$('#friendGroupModify_78').show();$('#friendGroupLine_78').hide();" title="编辑"></a><a class="icon del" href="javascript:;" onClick="window.open('do.php?ac=zu&op=del&id=<?php echo $zid?>')" title="删除"></a></span><a id="group_78" class="fgName on" href="?ac=friend&fgid=<?php echo $row["s_id"]?>"><?php echo $row["s_name"]?><span class="fgCount" id="fgCount_78">[<?php echo $friendnumzu?>]</span></a></li>
							<li id="friendGroupModify_78" style="display:none;">
					<div class="friendGroupModify"><form  name="form2" action="do.php?ac=zu&op=edit" method="post"><input name="s_id" type="hidden" value="<?php echo $zid?>">
						<div class="inputBox"><input type="text" maxlength="8" style="width:121px;" class="input_normal" name="S_name" value="<?php echo $row["s_name"]?>"></div>
						<div class="buttonBox"><span class="button-main"><span><button type="submit" id="submit">确定</button></span></span><span class="cancel"><a href="javascript:;" onclick="$('#friendGroupModify_78').hide();$('#friendGroupLine_78').show();">取消</a></span></div>
					</div></form>
				</li>

<?php
	}
	}
?>
	</ul>
									</div>
									<div class="friendGroupModifyBox"  id="friendGroupAdd">
										<div class="friendGroupModify"><form  name="form1" action="do.php?ac=zu&op=add" method="post">
											<div class="inputBox"><input type="text" maxlength="8" style="width:121px;" class="input_normal" name="S_name"></div>
											<div class="buttonBox"><span class="button-main"><span><button type="submit" id="submit">添加</button></span></span><span class="cancel"><a href="javascript:;" onclick="$('#friendGroupAdd').hide();">取消</a></span></div>
										</div></font></form>
									</div>
									<div class="friendGroupAddBox">
										<div class="friendGroupAdd" ><a href="javascript:;" onclick="$('#friendGroupAdd').show()">添加分组</a></div>
									</div>
									
								</div>
								<div class="friendList">
									<div class="friendListHead" id="friendGroupName"><?php echo $zname?></div>
									<div id="friendList"><ul>
<?php
$a=0;
	global $db;
	if($fgid==""){
	$sql="select s_id,s_nameb,s_zu from s_friend where S_namea='".$S_Name."' and s_lock=1 order by s_id desc";
	}else{
	$sql="select s_id,s_nameb,s_zu from s_friend where S_namea='".$S_Name."' and s_lock=1 and s_zu=$fgid order by s_id desc";
	}
		$Arr=getuserpage($sql,"20");//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$numdate="a";
		if($result){
		while ($row = $db ->fetch_array($result)){
		$numdate="b";
	$sqlu="select s_logo,S_RealName,s_name from s_users where S_name='".$row["s_nameb"]."' order by s_id desc";
	$rsu=$db->query($sqlu);
	$rowu=$db->fetch_array($rsu);
	$zuid=$row['s_zu'];
?>
			<li>
		<div class="icon"><a href="<?php echo userlink("index",$row["s_nameb"])?>" target="_blank"><img class="avatar-58" src="<?php echo piclink("logo",$rowu["s_logo"],"big")?>" onerror="this.onerror=null;this.src='<?php echo S_SiteDomain?>/user/images/avatar/noface_small.gif'" title="<?php echo $rowu["S_RealName"]?>"/></a></div>
		<div class="info"><form name="form3" action="do.php?ac=friend&op=zu" method="post"><input name="s_name" type="hidden" value="<?php echo $row["s_nameb"]?>">
			<div class="name userLink"><a href="<?php echo userlink("index",$row["s_nameb"])?>" target="_blank"><?php echo $rowu["S_RealName"]?></a></div>
			<div class="group"><SELECT size=1 name="s_zu" title="更换分组"><option value='0'>未分组</option>
                <?php
              	$sqlclass="select * from s_friendzu ";
				$results=$db->query($sqlclass);
				if($results){
					while ($row3=$db->fetch_array($results)){
						if($zuid==$row3['S_ID']){
							echo "<option value='".$row3['S_ID']."' selected='selected'>".$row3['S_Name']."</option>";
							}
						else{
							echo "<option value='".$row3['S_ID']."' >".$row3['S_Name']."</option>";
							}	
					
						}
					}
			  ?>
</SELECT>&nbsp;<input type="submit" value="更换" id="submit"></div></form>
		</div>
		<a href="javascript:;" class="del" title="解除好友" onClick="window.open('do.php?ac=friend&op=del&id=<?php echo $row["s_id"]?>')"></a>
	</li>
<?php
}
}
if($numdate=="a"){
		echo("<div class='nothing'>没有好友。</div>");
}
?>
		</ul>
<div class="page"><div class="pages"><?php echo $Arr[0];?></div></div>

</div>
								</div>
							</div>
						</div>
					</div>
					<div class="stageBoxBottom"><span></span></div>
				</div>
			</div>