<!--<?php
if (empty($winduid)) {print <<<EOT
-->
<!--
EOT;
if($groupid=='guest'){
$arr_logintypename = array('用戶名','UID','電子郵箱');
$loginJumpUrl = "http://{$pwServer['HTTP_HOST']}{$REQUEST_URI}";
if (basename($REQUEST_URI,".php") == 'login') {
	$loginJumpUrl = "{$db_bbsurl}/index.php";
}
print <<<EOT
-->
<form action="login.php" name="login_FORM" method="post" onsubmit="return headerAjaxLogin.login(document.login_FORM);">
<input type="hidden" name="jumpurl" value="$loginJumpUrl" />
<input type="hidden" name="step" value="2" />
<input type="hidden" name="ajax" value="1" />
<div class="header_login fr">
<table style="table-layout:fixed;">
	<tr>
		<td width="145">
<!--
EOT;
if (count($_LoginInfo['logintype']) >1) {print <<<EOT
-->
		<span class="fl"><a href="javascript:;" hidefocus="true" title="切換登錄方式" class="select_arrow" onclick="showLoginType();">下拉</a></span>
		<div class="fl">
			<div class="pw_menu" id="login_type_list" style="position:absolute;display:none;margin:20px 0 0 0;">
				<ul class="menuList tal" style="width:134px;">
<!--
EOT;
foreach($_LoginInfo['logintype'] as $v){print <<<EOT
-->
					<li><a href="javascript:;" onclick="selectLoginType('$v','$arr_logintypename[$v]')" hidefocus="true">$arr_logintypename[$v]</a></li>
<!--
EOT;
}print <<<EOT
-->
				</ul>
			</div>
			</div>
<!--
EOT;
}print <<<EOT
-->
			<div class="login_row mb5"><label for="nav_pwuser" class="login_label">用戶名</label><input type="text" class="input fl" name="pwuser" id="nav_pwuser" placeholder="輸入用戶名"></div>
			<div class="login_row"><label for="showpwd" class="login_label">密　碼</label><input type="password" name="pwpwd" id="showpwd" class="input fl"></div>
		</td>
		<td width="75">
			<div class="login_checkbox" title="下次自動登錄"><input type="checkbox" id="head_checkbox" name="cktime" value="31536000"><label for="head_checkbox">記住登錄</label></div>
			<span class="bt2 fl"><span><button type="submit" name="head_login" style="width:70px;">登錄</button></span></span>
		</td>
		<td width="70">
			<a href="sendpwd.php" class="login_forget" rel="nofollow">找回密碼</a>
			<span class="btn2 fl"><span><button type="button" style="width:70px;" onClick="location.href='$regurl#breadCrumb';">注冊</button></span></span>
		</td>
	</tr>
</table>
</div>
<!--
EOT;
if (count($_LoginInfo['logintype'])>=1) {
$value = $_LoginInfo['logintype'][0];
empty($value) && $value = 0;
print<<<EOT
-->
		<input type="hidden" name="lgt" id="nav_lgt" value="$value">
<!--
EOT;
} else {print <<<EOT
-->
		<input type="hidden" name="lgt" id="nav_lgt" value="0">
<!--
EOT;
}print <<<EOT
-->
</form>
<!--
EOT;
/* platform weibo app --start */
L::loadClass('WeiboLoginViewHelper', 'sns/weibotoplatform/viewhelper', false);
$weiboLoginService = L::loadClass('WeiboLoginService', 'sns/weibotoplatform/service');
$loginWays = $weiboLoginService->getLoginWays();
if ($loginWays) {
	$firstWay = array_shift($loginWays);
	$windowOpenScript = WeiboLoginViewHelper_WindowOpenScript($firstWay['type']);
print <<<EOT
-->
<link rel="stylesheet" href="u/images/expand/weibologin.css" />
<div class="loginWays fr">
	<span id="weibo_login" class="firstWay cp">
		<a href="javascript:;" onclick="$windowOpenScript"><img src="{$firstWay['loginLogo']}" alt="使用{$firstWay['accountTitle']}登錄">{$firstWay['accountTitle']}登錄</a>
		<span class="icon-down"></span>
	</span>
	<span class="text">內容互通，快速登錄</span>
<!--
EOT;
	if ($loginWays) {
print <<<EOT
-->
<div id="menu_weibo_login" class="pw_menu" style="display: none;">
    <ul class="menuList" style="width:118px;">
<!--
EOT;
		foreach ($loginWays as $restWay) {
			$windowOpenScript = WeiboLoginViewHelper_WindowOpenScript($restWay['type']);
print <<<EOT
-->
		<li><a title="使用{$restWay['accountTitle']}登錄" href="javascript:;" onclick="$windowOpenScript"><img src="{$restWay['loginLogo']}" />{$restWay['accountTitle']}登錄</a></li>
<!--
EOT;
		}
print <<<EOT
-->
    </ul>
</div>
<!--
EOT;
		$GLOBALS['db_menuinit'] .= ",'weibo_login' : 'menu_weibo_login'";
	}
print <<<EOT
-->
</div>
<!--
EOT;
}
/* platform weibo app --end */

print <<<EOT
-->
<script type="text/javascript">
var default_login_type = '$value';
var default_input_value = '輸入' + '$arr_logintypename[$value]';

function showLoginType(){
	var login_type = getObj('login_type_list');
	login_type.style.display = login_type.style.display === 'none' ? '' : 'none';
	if (IsElement('nav_logintab')){
		getObj('nav_logintab').style.display = 'none';
	}
}
function placeHolder(elem){
		   var placeholder;
		   if(elem.getAttribute("placeholder")){
				placeholder=elem.getAttribute("placeholder");
		   }
		   elem.value=placeholder;
		   var style=elem.style;
		   style.color="#888";
		   elem.onfocus=function(){
				if(this.value==placeholder){
					 this.value="";
					 style.color="#000";
				}
		   }
		   elem.onblur=function(){
				if(this.value.replace(/\s*/g,"")==""){
					 this.value=placeholder;
					 style.color="#888";
				}
		   }
 }
function changeDefaultInputValue(text){
	var nav_pwuser=getObj('nav_pwuser');
	nav_pwuser.setAttribute("placeholder",text);
	placeHolder(nav_pwuser);
	getObj('nav_lgt').value = default_login_type;
}

function selectLoginType(type,text){
	var nav_pwuser = getObj('nav_pwuser');
	nav_pwuser.setAttribute("placeholder","輸入"+text);
	placeHolder(nav_pwuser);
	getObj('nav_lgt').value = type;
	getObj('login_type_list').style.display = 'none';
}
changeDefaultInputValue(default_input_value);

var headerAjaxLogin = {
	'username' : '',
	'pwd' : '',
	'login' : function(obj) {
		var _this = this;
		var username = obj.pwuser.value;
		if ((!username || username.indexOf('輸入')===0) && !obj.pwpwd.value) {
			document.location.href="login.php";
			return false;
		}
		obj.head_login.disabled = true;
		_this.username = obj.pwuser.value;
		_this.pwd = obj.pwpwd.value;
		_this.submitBasicInfo(obj);
		return false;
	},
	
	'submitBasicInfo' : function(obj) {
		var url = 'login.php';
		ajax.send(url, obj, function() {
			var rText = ajax.request.responseText.split('\t');
			if (rText[0] == 'error') {
				showDlg('error', rText[1], 2);
				obj.head_login.disabled = false;
			} else if (rText[0] == 'success') {
				document.location.href = rText[1];
			} else {
				ajax.get('', '1','',1);
				//臨時遮罩
				var dd=document.documentElement;
				var cw=dd.clientWidth;
				var sh=Math.max(dd.scrollHeight,dd.clientHeight);
				var div=document.createElement("div");
				div.setAttribute("id","headerTmpMask");
				div.style.position="absolute";
				div.style.width=cw+"px";
				div.style.height=sh+"px";
				div.style.left=0;
				div.style.top=0;
				div.style.backgroundColor="#333";
				div.style.opacity="0.5";
				div.style.filter="alpha(opacity=50)";
				div.style.zIndex=1000;
				document.body.appendChild(div);
				//end
			}
		});
		return false;
	},
	
	'submitCheckInfo' : function(obj) {
		var _this = this;
		var url = 'login.php';
		var ifChangeGdcode = true;
		obj.pwuser.value = _this.username;
		obj.pwpwd.value = _this.pwd;
		ajax.send(url, obj, function() {
			var rText = ajax.request.responseText.split('\t');
			if (rText[0] == 'error') {
				if (rText[1] == 'gdcodeerror') {
					getObj('headrajaxlogintip').innerHTML = '驗證碼不正確或已過期';
				} else if (rText[1] == 'ckquestionerror') {
					getObj('headrajaxlogintip').innerHTML = '請輸入正確的驗證問題答案';
				} else if (rText[1] == 'safequestionerror') {
					getObj('headrajaxlogintip').innerHTML = '安全問題錯誤,您還可以嘗試 ' + rText[2] + ' 次';
				}
				getObj('headrajaxlogintip').style.display = '';
			} else if (rText[0] == 'success') {
				location.href = rText[1];
				ifChangeGdcode = false;
			} else {
				getObj('headrajaxlogintip').innerHTML = rText[0];
				getObj('headrajaxlogintip').style.display = '';
			}
			if (ifChangeGdcode && getObj('changeGdCode')) getObj('changeGdCode').onclick();
		});
		return false;
	},
	
	'close' : function(obj) {
		document.login_FORM.head_login.disabled = false;
		closep();
		//清除遮罩
		if(getObj("headerTmpMask")){
			var mask=getObj("headerTmpMask");
			mask.parentNode.removeChild(mask);
		}
		//end
	}
};
</script>
<!--
EOT;
$bubble=GetCookie('bubble')?GetCookie('bubble'):array();
if ($bubble){
$bubble=stripslashes($bubble);
$bubble=pwJsonEncode(unserialize($bubble));
print <<<EOT
-->
<script>
var userBubbleInfo =$bubble
</script>
<!--
EOT;
}
}} else {
$db_menuinit .= ",'td_userinfomore' : 'menu_userinfomore','td_profile' : 'menu_profile'";
if ($winddb['bubble']) {
$userBubbleInfo = pwJsonEncode(unserialize($winddb['bubble']));
print <<<EOT
-->
<script>
var userBubbleInfo = $userBubbleInfo;
</script>
<!--
EOT;
}
if (getstatus($winddb['userstatus'],12)) {print <<<EOT
--><script src="js/userbinding.js"></script>
<!--
EOT;
}
print <<<EOT
-->
<dl class="login">
	<dt class="fr"><a href="u.php" hidefocus="true" class="img_50"><img src="$_LoginInfo[faceurl]" alt="$windid" /></a></dt>
	<dd class="fr">
		<p class="l_info mb5"><span id="td_userinfomore" style="padding:0 5px;"><a href="u.php" class="b link_down"><span>$windid</span></a></span><span class="mr5"></span><a href="$loginouturl" class="mr5">退出</a><span class="gray mr5">|</span><script>
var td_userinfomore = {
	pz : 21,
	open : function() {
		getObj('td_userinfomore').className = 'current';
		if (typeof userBinding == 'object') {
			userBinding.append();
		}
	},
	close : function () {
		getObj('td_userinfomore').className = '';
	}
};
</script><a href="message.php" class="mr5">消息{$tmpMsgNums}</a><span id="td_profile" class="pd5"><a href="profile.php?action=modify" target="_blank" class="link_down"><span>設置</span></a></span><!--
EOT;
if(CkInArray($windid,$manager) || $SYSTEM['allowadmincp']){print <<<EOT
--><span class="gray mr5">|</span><a href="$db_adminfile" target="_blank">系統設置</a><!--
EOT;
}
print <<<EOT
--></p><p>{$db_moneyname}︰<a href="userpay.php" class="mr10">$winddb[money] $db_moneyunit</a>{$db_rvrcname}︰<a href="userpay.php" class="mr10">$userrvrc $db_rvrcunit</a>身份︰<a href="profile.php?action=permission">{$gp_grouptitle}</a></p>
</dd>
</dl>
<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
if ($winduid){print<<<EOT
-->
<div id="menu_userinfomore" class="cc pw_menu" style="display:none;">
	<h6 style="left:-1px;right:auto;"><a href="u.php" class="b link_down"><span>$windid</span></a></h6>
	<div>
		<ul class="menu-half cc" style="width:26em;">
<!--
EOT;
if ($gp_gptype == 'member') {print <<<EOT
-->
		<li>等級: $gp_grouptitle</li>
<!--
EOT;
} else {print <<<EOT
-->
		<li>身份: $gp_grouptitle</li>
<!--
EOT;
}if ($_G['allowhide']) {print <<<EOT
-->
		<li>狀態:
<span style="cursor:pointer;" onClick="ajax.send('pw_ajax.php?action=changestate','',changeState)" id="online_state"><!--
EOT;
if (GetCookie('hideid') == 1) {print <<<EOT
--><img src="$imgpath/stealth.png" align="absmiddle" alt="隱身" />隱身<!--
EOT;
} else {print <<<EOT
--><img src="$imgpath/online.png" align="absmiddle" alt="在線" />在線<!--
EOT;
}print <<<EOT
--></span>
<script>
function changeState() {
	var msg = ajax.request.responseText;
	if (msg == 1){
		getObj('online_state').innerHTML = '<img src="$imgpath/stealth.png" align="absmiddle" alt="隱身" />隱身';
	}else{
		getObj('online_state').innerHTML = '<img src="$imgpath/online.png" align="absmiddle" alt="在線" />在線';
	}
}
</script>
			</li>
<!--
EOT;
}print <<<EOT
-->
			<li>帖子: $winddb[postnum]</li>
			<li>今日: $winddb[todaypost]</li>
			<li>$db_rvrcname: $userrvrc $db_rvrcunit</li>
			<li>$db_moneyname: $winddb[money] $db_moneyunit</li>
			<li>$db_creditname: $winddb[credit] $db_creditunit</li>
			<li>最後登錄: <span class="f10">{$_LoginInfo['lastlodate']}</span></li>
            <li style="width:90%">登錄IP: <span class="f10">{$onlineip}</span></li>
        </ul>
		<div class="userbindingMenu"></div>
	</div>
</div>
<div id="menu_profile" class="pw_menu" style="display:none;">
	<h6><a href="profile.php?action=modify" class="link_down"><span>設置</span></a></h6>
    <ul style="width:50px;" class="menuList">
        <li><a href="profile.php?action=modify" target="_blank">帳號</a></li>
<!--
EOT;
if ($db_authstate) {print <<<EOT
-->
		<li><a href="profile.php?action=auth" target="_blank">認證</a></li>
<!--
EOT;
}print <<<EOT
-->
        <li><a href="profile.php?action=privacy" target="_blank">隱私</a></li>
        <li><a href="userpay.php" target="_blank">積分</a></li>
        <li><a href="profile.php?action=permission" target="_blank">權限</a></li>
    </ul>
</div>
<!--
EOT;
}?>