<!--<?php
include_once PrintEot('m_header');
print <<<EOT
-->

<div class="infobox pr cc">
	<div class="p10">
		<table border="0" cellpadding="0" cellspacing="0" class="vt">
			<tr>
				<td width="65"><a href="{$basename}q=user&u=$uid"><img src="$faceimg" class="portrait-m"/></a> </td>
				<td><p class="pd8"> <span class="b f14 pdr">{$username}</span> <a href="{$basename}q=user&u=$u">返回首页</a> </p>
					<div class="tabA" style="position:absolute;bottom:-1px;padding-left:0;width:600px;">
						<ul><!--
EOT;
if($u == $winduid){
print <<<EOT
-->
							<li id="type_my"><a href="{$thisbase}">好友列表</a></li>
							<li id="type_find"><a href="{$thisbase}type=find">查找好友</a></li><!--
EOT;
if ($o_invite == '1'){print <<<EOT
-->
							<li id="type_invite"><a href="{$thisbase}type=invite">邀请好友</a></li><!--
EOT;
}}else{
print <<<EOT
-->
							<li><a href="{$basename}q=write&u=$u">记录</a></li>
							<li><a href="{$basename}q=photos&u=$u">相册</a></li>
							<li><a href="{$basename}q=share&u=$u">分享</a></li>
							<li><a href="{$basename}q=article&u=$u">帖子</a></li>
							<li class="current"><a href="{$basename}q=friend&u=$u">好友</a></li>
							<li><a href="{$basename}q=groups&u=$u">群组</a></li><!--
EOT;
}
print <<<EOT
}}print <<<EOT
-->
						</ul>
					</div></td>
			</tr>
		</table>
	</div>
</div>
<div class="wrapB cc">
	<div class="contentB cc fl" style="padding-bottom:4em">
		<div class="p10">
			<div class="c"></div>
			<script language="JavaScript">
setCurrent('type_$type','type_my','current');
</script><!--
EOT;
if($type=='find'){
print <<<EOT
-->
			<div class="boxB bgB mt8">
				<div class="p10">
					<h3 style="cursor: pointer;" onclick="hidden('find_name')"> 根据用户名查找 </h3>
					<div class="sect-content" id="find_name">
						<form action="{$thisbase}type=find&accord=username" method="post" id="inviteForm">
							<input type="hidden" name="step" value="2">
							<input class="input" type="text" name="username" value="$input_username" maxlength="10" size="20"/>
							<input class="bt3" value="查找" type="submit">
						</form>
					</div>
				</div>
				<div class="p10">
					<h3 style="cursor: pointer;" onclick="hidden('find_uid')"> 根据用户UID查找 </h3>
					<div class="sect-content" id="find_uid">
						<form action="{$thisbase}type=find&accord=uid" method="post" id="inviteForm">
							<input type="hidden" name="step" value="2">
							<input class="input" type="text" name="uid" maxlength="10" size="20"/>
							<input class="bt3" value="查找" type="submit">
						</form>
					</div>
				</div>
				<div class="p10">
					<h3 style="cursor: pointer;" onclick="hidden('find_email')"> 根据用户email查找 </h3>
					<div class="sect-content" id="find_email">
						<form action="{$thisbase}type=find&accord=email" method="post" id="inviteForm">
							<input type="hidden" name="step" value="2">
							<input class="input" type="text" name="email" maxlength="25" size="20"/>
							<input class="bt3" value="查找" type="submit">
						</form>
					</div>
				</div>
				<div class="list-dlA-E cc img fircha">
					<dl><!--
EOT;
if($members){
foreach ($members as $key => $member){print <<<EOT
-->
						<dd class="cc"><a href="{$basename}q=user&u=$member[uid]"><img alt="$member[username]" src="{$member[face][0]}" class="w80 fl" /></a> <a href="{$basename}q=user&u=$member[uid]" class="f14 b pdr">$member[username]</a><br />
							<span class="gray">$member[honor]</span><br />
							<span> <a class="black" style="cursor: pointer;"  onclick="sendmsg('pw_ajax.php?action=addfriend&touid=$member[uid]')">加为好友</a> </span><br />
							<span id="sf_$member[uid]"> <a class="black" style="cursor: pointer;" onclick="sendmsg('pw_ajax.php?action=msg&touid=$member[uid]','','sf_$member[uid]')">发送短消息</a> </span> </dd><!--
EOT;
}}elseif($accord){print <<<EOT
-->
						<dd class="cc"> 很遗憾，没有您所要查找的好友^_^ </dd><!--
EOT;
}print <<<EOT
-->
					</dl>
				</div>
				$pages </div>
		</div>
		<script language="javascript">
function hidden(obj){
	if (typeof(obj) == 'string') {
		obj = document.getElementById(obj);
	}
	if (obj.style.display == 'none') {
		obj.style.display = '';
	} else {
		obj.style.display = 'none';
	}
}
</script>
	</div><!--
EOT;
}elseif($type=='invite'){print <<<EOT
-->
	<div class="mt8 mb8 cc">
		<div class="fr invite" style="width:45%">
			<h4 class="mt8 b f14 blue">发送网址邀请</h4>
			<br />
			<p class="pdtb3" id="web_invite">把下面的网址通过MSN、QQ发给好友，邀请他们加入{$db_bbsname}的圈子。</p>
			<p>
			<h4 class="b mb8 mt8">默认邀请：</h4>
			<a style="cursor: pointer;" onclick="copyUrl('$invite_url')">$invite_url</a>
			</p>
		</div>
		<div class="fl invite" style="width:50%">
			<h4 class="mt8 b f14 blue">给好友发送 Email 邀请</h4>
			<form action="{$thisbase}type=invite" method="post" id="inviteForm">
				<input type="hidden" name="step" value="2">
				<p class="mb8">
				<h4 class="b mb8 mt8">好友的 Email</h4>
				<textarea name="emails" cols="45" rows="2" class="gray">多个 Email 用逗号 (,) 或者换行分隔</textarea>
				<p class="maxlength-hint warning" id="emails_warning" style="display: none;"></p>
				</p>
				<p class="mb8 mt8">
				<h4 class="b mb8 mt8">邀请附言</h4>
				<textarea name="extranote" cols="45" rows="3">感觉还不错。这些功能都很有趣，我想你也会喜欢。</textarea>
				<p class="maxlength-hint warning" id="extra_warning" style="display: none;"></p>
				</p>
				<p class="mt8">
				<h4 class="b mb8 mt8">预览</h4>
				<div class="boxB pdD">
					<h4 class="b">我是{$windid}，我在{$db_bbsname}上建立了个人主页，请你也加入并成为我的好友。</h4>
					<p>[ 邀请附言 ]</p>
					<p>请点击以下链接，接受好友邀请：</p>
					<p><span class="blue">{$invite_url}</span></p>
					<p>{$db_bbsname} (<span class="blue">$db_bbsurl</span>)</p>
				</div>
				</p>
				<p class="mt8">
					<input name="" type="button" value=" 邀 请 " class="bt" />
				</p>
			</form>
		</div>
	</div>
	<script language="javascript">
function hidden(obj){
	if (typeof(obj) == 'string') {
		obj = document.getElementById(obj);
	}
	if (obj.style.display == 'none') {
		obj.style.display = '';
	} else {
		obj.style.display = 'none';
	}
}

function copyUrl(url) {
	if (is_ie) {
		window.clipboardData.setData("Text",url);
		showDialog('success','已成功复制',1);
	} else {
		prompt('Press Ctrl+C Copy to Clipboard', url);
	}
}
function objChange(obj, func){
	if (typeof(obj) == 'string') {
		obj = document.getElementById(obj);
	}
	if (is_ie) {
		obj.onpropertychange = func;
		return;
	}
	if (document.addEventListener) {
		obj.addEventListener("input", func, false);
		return;
	} else if (document.attachEvent) {
		obj.attachEvent("onpropertychange",func);
		return;
	}
}
objChange('extranote',extraChange);
objChange('emails',emailChange);

function extraChange() {
	var text = document.getElementById('extranote');
	var strleng = text.value.length;
	var warning = document.getElementById('extra_warning');
	if (strleng>200) {
		warning.innerHTML = '内容超出 '+(strleng-200)+' 字，请酌情删减后提交。';
		warning.style.display = '';
	} else {
		warning.style.display = 'none';
	}
}
function emailChange() {
	var text = document.getElementById('emails');
	var strleng = text.value.length;
	var warning = document.getElementById('emails_warning');
	if (strleng>200) {
		warning.innerHTML = '内容超出 '+(strleng-200)+' 字，请酌情删减后提交。';
		warning.style.display = '';
	} else {
		warning.style.display = 'none';
	}
}
</script><!--
EOT;
}else{
print <<<EOT
-->
	<div class="cc">
		<div class="list-dlA list-dlA-B">
			<dl><!--
EOT;
if (!empty($friends)) {
foreach ($friends as $key => $value) {print <<<EOT
-->
				<dd class="cc" id="friend_{$value[uid]}">
					<p> <a href="{$basename}q=user&u=$value[uid]"><img src="$value[face]" class="fl pdr" onload="if(this.width>'80')this.width='80';if(this.height>'80')this.height='80';" /></a> <a href="{$basename}q=user&u=$value[uid]" class="f14 b blue"> $value[username] </a><!--
EOT;
if(checkOnline($value['thisvisit'])){
print <<<EOT
-->
						<span><img src="$imgpath/$stylepath/head-ol.gif" title="在线" /></span>
<!--
EOT;
}print <<<EOT
--><!--
EOT;
if($u==$winduid){
print <<<EOT
-->
						<a style="cursor: pointer;line-height:2;" onclick="sendmsg('pw_ajax.php?action=msg&touid=$value[uid]');"><img src="$imgpath/wind/write-meg.png" align="absmiddle" title="发送短消息" /></a>
<!--
EOT;
}print <<<EOT
-->
						<br />
						$value[honor]<br />
						<span class="gray">$value[joindate]</span><!--
EOT;
if($u==$winduid){
if($value[ftid] && $friendtype[$value[ftid]]){
$ftypename = $friendtype[$value[ftid]][name];
}else{
$ftypename = '未分组';
}
print <<<EOT
-->
						<span class="fr tar" style="display:block;margin-left:2em;"> <a href="{$thisbase}ftid={$value[ftid]}"> $ftypename </a> - <a class="gray" style="cursor: pointer;" onclick="showFriendTypeBox('{$value[uid]}','{$value[username]}','{$value[ftid]}');">修改</a> <a style="cursor: pointer;" onclick="pwConfirm('是否确认删除',this,function(){delFriend('$value[uid]')});" title="删除" class="o-del gray">删除</a> </span><!--
EOT;
}print <<<EOT
-->
					</p>
				</dd><!--
EOT;
}} else {print <<<EOT
-->
				<dd class="cc">暂没有好友</dd><!--
EOT;
}print <<<EOT
-->
			</dl>
			$pages </div>
	</div>
</div>
</div><!--
EOT;
if($u==$winduid || $groupid==3){
print <<<EOT
-->
<div class="sidebarB1 cc mt8">
	<h2 class="h5A" style="display:block;"> <span>好友分组</span> <small> <a style="cursor: pointer;" onclick="addType('ft_ul')">添加分组</a> </small> </h2>
	<div class="list-liA bdtA">
		<h2> <span class="b"><a href="{$thisbase}">全部好友</a></span> ({$count}) </h2>
		<ul id="ft_ul"><!--
EOT;
if($u==$winduid || $groupid==3){
print <<<EOT
--><!--
EOT;
foreach($friendtype as $value){
print <<<EOT
-->
			<li id="ft_{$value[ftid]}" onmouseover="changSpanDisplay(this);" onmouseout="changSpanDisplay(this);"> <span style="cursor: pointer;display:none;" onclick="pwConfirm('是否确认删除',this,function(){delFriendType('$value[ftid]')}')" title="删除" class="o-del b gray fr">x</span> <span class="fr pdr gray" style="cursor: pointer;display:none;" onclick="showEidt('$value[ftid]');">编辑</span> <a href="{$thisbase}ftid={$value[ftid]}">$value[name]</a> </li><!--
EOT;
}}else{
print <<<EOT
-->
			<li id="ft_{$value[ftid]}"> <a href="{$thisbase}ftid={$value[ftid]}">$value[name]</a> </li><!--
EOT;
}
print <<<EOT
-->
			<li id="ft_null"> <a href="{$thisbase}ftid=0">未分组</a> </li>
		</ul>
	</div>
</div><!--
EOT;
}
print <<<EOT
-->
<script language="JavaScript" src="mode/o/js/friendtype.js"></script>
<script language="javascript">
function delFriend(u){
	ajax.send('mode.php?m=o&q=ajax&action=delfriend&u='+u,'',function(){
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'success') {
			var element = document.getElementById('friend_'+u);
			if (element) {
				showDialog('success','操作成功!',1);
				element.parentNode.removeChild(element);
			} else {
				//alert(ajax.request.responseText);
			}
		} else {
			ajax.guide();
		}
	});
}
</script><!--
EOT;
}print <<<EOT
-->
</div>
</div><!--
EOT;
?>-->
