<!--<?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_viewer"><a href="{$thisbase}type=viewer">我的访客</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{
$friendHeaderGuide = creatFriendsHeader($u);
print <<<EOT
-->
	$friendHeaderGuide
<!--
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="mt8">
				<div id="search_type_list" class="pdD">
					<div id="person-nav" class="cc">
						<ul>
							<li id="username" onclick="changeSearchType('search_type_list','username','li','current');"><a href="javascript:;">用户名</a></li>
							<li id="uid" onclick="changeSearchType('search_type_list','uid','li','current')"><a href="javascript:;">用户ID</a></li>
							<li id="email" onclick="changeSearchType('search_type_list','email','li','current')"><a href="javascript:;">Email</a></li>
						</ul>
					</div>
				</div>
				<div class="c"></div>
				<div class="p10">
					<form action="{$thisbase}type=find" method="post" id="inviteForm">
						<input type="hidden" name="step" value="2">
						<input type="hidden" name="according" id="according" value="$accord">
						<input class="input" type="text" name="keyword" value="$keyword" maxlength="25" size="25" style="height:18px;font-size:14px;" />
						<input class="bt3" value="查找" type="submit" style="width:80px;" />
					</form>
				</div>
			</div>
			<div class="mt8">
<!--
EOT;
if($mosort){print <<<EOT
-->
<div class="p10">
<div class="h6A">可能认识：</div>
				<div class="list-dlA-E cc">
					<dl>
<!--
EOT;
foreach ($mosort as $key => $member){
if (empty($ifmosortcache) || $ifmosortcache == 1 && $member['uid'] != $winduid && !CkInArray($member['uid'],$friendkeys)){print <<<EOT
-->
						<dd class="cc"><a href="{$basename}q=user&u=$member[uid]" class="fl" style="margin-right:10px;width:60px;height:60px;"><img alt="$member[username]" src="{$member[face]}" class="portrait-m" /></a> <a href="{$basename}q=user&u=$member[uid]" class="f14 b pdr">$member[username]</a><br />
						<a class="black" style="cursor: pointer;"  onclick="sendmsg('pw_ajax.php?action=addfriend&touid=$member[uid]')">加为好友</a>
						</dd>
<!--
EOT;
}
}print <<<EOT
-->
					</dl>
				</div>
<!--
EOT;
}print <<<EOT
-->
				<div class="list-dlA-E cc">
					<dl>
<!--
EOT;
if($members){
foreach ($members as $key => $member){print <<<EOT
-->
						<dd class="cc"><a href="{$basename}q=user&u=$member[uid]" class="fl" style="margin-right:10px;width:60px;height:60px;"><img alt="$member[username]" src="{$member[face]}" class="portrait-m" /></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 && $step == '2'){print <<<EOT
-->
						<dd class="cc"> 很遗憾，没有您所要查找的好友^_^ </dd>
<!--
EOT;
}print <<<EOT
-->
					</dl>
				</div>
				<div style="padding:0 0 5px 10px;">$pages</div>
				</div>
				</div>
		</div>
<script language="javaScript">
var select = '$accord';
function changeSearchType(id,select,element,css){
	var oSearchType = getObj(id);
	var elements = oSearchType.getElementsByTagName('li');
	for (var i=0;i<elements.length;i++) {
		if (elements[i].id == select) {
			elements[i].className = css;
			getObj('according').value = select;
		} else {
			elements[i].className = '';
		}
	}
}
changeSearchType('search_type_list',select,'li','current');

</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" id="emails" cols="45" rows="2" class="gray" onclick="grayChange(this)">多个 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" id="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 bgB">
					<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 type="submit" value=" 邀 请 " class="bt" />
				</p>
			</form>
		</div>
	</div>
</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';
	}
}
function grayChange(obj) {
	if (typeof(obj) == 'string') {
		obj = document.getElementById(obj);
	}
	if (obj.className == 'gray') {
		obj.className = '';
	}
	if (obj.value =='多个 Email 用逗号 (,) 或者换行分隔') {
		obj.value = '';
	}
}
</script>
<!--
EOT;
}elseif($type=='viewer'){
print <<<EOT
-->
	<div class="cc">
		<div class="list-dlA list-dlA-B">
			<dl>
<!--
EOT;
if (!empty($whovisit)) {
foreach ($whovisit as $key => $value) {
$value[honor] = substrs($value[honor],50);
print <<<EOT
-->
				<dd class="cc">
					<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
-->
						<br />
						<div style="overflow:hidden">$value[honor]</div>
						<span class="gray">来访时间：$value[visittime]</span>
					</p>
				</dd>
<!--
EOT;
}} else {print <<<EOT
-->
				<dd class="cc">暂没有用户访问过你的空间</dd>
<!--
EOT;
}print <<<EOT
-->
			</dl>
		</div>
	</div>
</div>
<!--
EOT;
}else{
print <<<EOT
-->
	<div class="cc">
		<div class="list-dlA list-dlA-B">
			<dl>
<!--
EOT;
if (!empty($friends)) {
foreach ($friends as $key => $value) {
$value[honor] = substrs($value[honor],50);
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;
}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 />
<!--
EOT;
if($u==$winduid){
print <<<EOT
-->
						<span class="fr tar" style="display:block;margin-left:2em;"> <a style="cursor: pointer;" onclick="pwConfirm('是否确认解除',this,function(){delFriend('$value[uid]')});" title="解除好友" class="o-del gray">解除好友</a> </span>
<!--
EOT;
}print <<<EOT
-->
						<div style="overflow:hidden">$value[honor]</div>
						<span class="gray">最近登录：$value[lastvisit]</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> </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','$u')">添加分组</a> </small> </h2>
	<div class="list-liA bdtA">
<!--
EOT;
if($u==$winduid){
print <<<EOT
-->
		<h2> <span class="b"><a href="{$thisbase}">全部好友</a></span> ({$count}) </h2>
		<ul id="ft_ul">
<!--
EOT;
foreach($friendtype as $value){
print <<<EOT
-->
			<li id="ft_{$value[ftid]}" onmouseover="changSpanDisplay(this);" onmouseout="changSpanDisplay(this);"> <span class="fr b pdr gray" style="cursor: pointer;display:none" onclick="pwConfirm('是否确认删除',this,function(){delFriendType('$value[ftid]','$u')})">x</span> <span class="fr pdr gray" style="cursor: pointer;display:none;" onclick="showEidt('$value[ftid]','$u');">编辑</span> <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>
<!--
EOT;
}else{print <<<EOT
-->
		<h2> <span class="b"><a>全部好友</a></span></h2>
		<ul id="ft_ul">
<!--
EOT;
foreach($friendtype as $value){
print <<<EOT
-->
			<li id="ft_{$value[ftid]}" onmouseover="changSpanDisplay(this);" onmouseout="changSpanDisplay(this);"> <span class="fr b pdr gray" style="cursor: pointer;display:none" onclick="pwConfirm('是否确认删除',this,function(){delFriendType('$value[ftid]','$u')})">x</span> <span class="fr pdr gray" style="cursor: pointer;display:none;" onclick="showEidt('$value[ftid]','$u');">编辑</span> <a>$value[name]</a> </li>
<!--
EOT;
}print <<<EOT
-->
			<li id="ft_null"> <a>未分组</a> </li>
		</ul>
<!--
EOT;
}print <<<EOT
-->
	</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 {
			}
		} else {
			ajax.guide();
		}
	});
}
</script>
<!--
EOT;
}print <<<EOT
-->
</div>
</div>
<!--
EOT;
?>-->
