<!--<?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;_bottom:-2px;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>
<!--
EOT;
}
print <<<EOT
}}print <<<EOT
-->
						</ul>
					</div>
				</td>
			</tr>
		</table>
	</div>
</div>

<div class="wrapB cc">
	<div class="contentC 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 p10 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">
<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 pdr" /></a>
		<a href="{$basename}q=user&u=$member[uid]" class="f14 b pdr">$member[username]</a><br />
		<span class="gray1">$member[honor]</span><br />
		<span>
			<a class="s0" style="cursor: pointer;"  onclick="sendmsg('pw_ajax.php?action=addfriend&touid=$member[uid]')">加為好友</a>
		</span><br />
		<span id="sf_$member[uid]">
			<a class="s0" 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>
<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 s2">發送網址邀請</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 s2">給好友發送 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="txa gray1">多個 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" class="txa" >感覺還不錯。這些功能都很有趣，我想你也會喜歡。</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="s1">{$invite_url}</span></p>
							<p>{$db_bbsname} (<span class="s1">$db_bbsurl</span>)</p>
						</div>
					</p>
					<p class="mt8"><input name="" type="button" value=" 邀 請 " class="bt" /></p>
					</form>
				</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';
	}
}
</script>
</div>
<!--
EOT;
}else{
print <<<EOT
-->
			<div class="contentC-main 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>
<!--
EOT;
if($uid==$winduid){
print <<<EOT
-->
			            	<span class="fr" style="display:block;">
								<a style="cursor: pointer;" onclick="sendmsg('pw_ajax.php?action=msg&touid=$value[uid]');" class="pdr">發短信</a>
								<a style="cursor: pointer;" onclick="pwConfirm('是否確認刪除',this,function(){delFriend('$value[uid]')});">刪除</a>
							</span>
<!--
EOT;
}
print <<<EOT
-->
							<img src="$value[face]" class="fl pdr" onload="if(this.width>'80')this.width='80';if(this.height>'80')this.height='80';" /><a href="{$basename}q=user&u=$value[uid]" class="f14 b s1  pdr">$value[username]</a>$value[honor]
						</p>
						<p>
<!--
EOT;
if($uid==$winduid){
if($value[ftid] && $friendtype[$value[ftid]]){
$ftypename = $friendtype[$value[ftid]][name];
}else{
$ftypename = '未分組';
}
print <<<EOT
-->
							<span class="fr">
								分組︰
								<a href="{$thisbase}ftid={$value[ftid]}">
									$ftypename
								</a>
								-
								<a class="gray1" style="cursor: pointer;" onclick="showFriendTypeBox('{$value[uid]}','{$value[username]}','{$value[ftid]}');">修改</a>
							</span>
<!--
EOT;
}
print <<<EOT
-->
							<span class="gray1">$value[joindate]</span>
						</p>
					</dd>
<!--
EOT;
}} else {print <<<EOT
-->
					<dd class="cc">暫沒有好友</dd>
<!--
EOT;
}print <<<EOT
-->
					</dl>$pages
				</div>
			</div>
		</div>
<!--
EOT;
if($u==$winduid || $groupid==3){
print <<<EOT
-->
		<div class="contentC-side cc">
				<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($uid==$winduid || $groupid==3){
print <<<EOT
-->
<!--
EOT;
foreach($friendtype as $value){
print <<<EOT
-->
						<li id="ft_{$value[ftid]}" onmouseover="changSpanDisplay(this);" onmouseout="changSpanDisplay(this);">
							<span class="fr b gray1" style="cursor: pointer;display:none;" onclick="pwConfirm('是否確認刪除',this,function(){delFriendType('$value[ftid]')})">x</span>
							<span class="fr pdr gray1" 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>
</div>
<!--
EOT;
?>-->