<!--<?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="accord" id="accord" 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('accord').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;
?>-->
