<!--<?php
$posturl = "post.php?fid=$fid".($psot_sta ? "&action=$psot_sta" : '').($tid ? "&tid=$tid" : '');
$quoteurl = "post.php?fid=$fid&action=quote&article=1".($tid ? "&tid=$tid" : '');
$fastDo = $psot_sta ? '回復' : '發帖';
$tmpVerify = GetVerify($onlineip.$GLOBALS['winddb']['regdate'].$fid.$tid);

$imageConfigTabs = array();
($db_allowupload && $_G['allowupload'] && (!$_G['allownum'] || $winddb['uploadnum'] < $_G['allownum'])) && $imageConfigTabs[] = 'local';
($db_phopen && $winduid) && $imageConfigTabs[] = 'album';
$imageConfigTabs[] = 'network';
$imageConfigTabs = "'" . implode("','", $imageConfigTabs) . "'";
//max attachnum
$uploadedNum = $winddb['uploadtime'] < $tdtime ? 0 : $winddb['uploadnum'];
if ($_G['allownum'] > 0 && $_G['allownum'] - $uploadedNum<$db_attachnum){
	$maxAttachnum = $_G['allownum'] - $uploadedNum;
} else {
	$maxAttachnum = $db_attachnum;
}
print <<<EOT
-->
<script type="text/javascript" src="js/message.js"></script>
<script type="text/javascript" src="js/pw_search.js"></script>
<link rel="stylesheet" href="$imgpath/post/fast_editor.css?{$GLOBALS['wind_repair']}" />
<link rel="stylesheet" href="js/breeze/editor/style/style.css?{$GLOBALS['wind_repair']}" />
<div class="t $tmpStyle" style="padding-top:0;">
	<form name="FORM" method="post" action="post.php?fid=$fid" enctype="multipart/form-data" onsubmit="return checkpost(document.FORM);" id="anchor">
	<div id="formHiddens" style="display:none">
	<input type="hidden" name="atc_usesign" value="1" />
	<input type="hidden" name="atc_convert" value="1" />
	<input type="hidden" name="atc_autourl" value="1" />
	<input type="hidden" value="2" name="step" />
	<input type="hidden" value="" name="type" />
	<input type="hidden" value="$psot_sta" name="action" />
	<input type="hidden" value="$fid" name="fid" />
	<input type="hidden" value="$cyid" name="cyid" />
	<input type="hidden" value="$tid" name="tid" />
	<input type="hidden" name="stylepath" value="$stylepath" />
	<input type="hidden" name="ajax" value="1" />
	<input type="hidden" name="verify" value="$verifyhash" />
	<input type="hidden" value="cn0zz" name="_hexie" />
	<input type="hidden" value="0" name="iscontinue" />
	</div>
	<input type="hidden" value="1" name="isformchecked" />
	<div class="b h s5" style="border-top:0;">快速$fastDo</div>
	<table width="100%">
		<tr class="vt t_one">
			<td class="floot_left" id="header_floot_left">
				<div class="readName" style="font:bold 12px/18px Arial;padding:10px 0 0 15px;margin-bottom:-5px;">
<!--
EOT;
if ($action != 'modify' && getstatus($winddb['userstatus'],12)) {print <<<EOT
-->
						<span id="div_userinfomore"><a href="javascript:;" hidefocus="true" class="link_down" onmouseover="userBinding.get('div_userinfomore');"><span>{$windid}</span></a></span>
<script>
var userinfomorediv = {}
</script>
<!--
EOT;
}
list($fp_face,,$httpWidth,$httpHeight,,,,$fp_size) = showfacedesign($winddb['icon'], true, 'm');
print <<<EOT
-->
				</div>
				<div class="floot_leftdiv">
					<div class="face_img"><img class="pic" src="{$fp_face}" width="120" height="120" {$fp_size} border="0" /></div>
				</div>
			</td>
			<td class="p10">
				<div class="cc mb5">
<!--
EOT;
if (!$psot_sta && ($t_per>0 || $admincheck) && $t_exits == 1) {
	$tmpHtml = ($t_sub_exits == 1) ? ' onchange="getSubType(this.value);"' : '';
print <<<EOT
-->
					<select name="p_type" class="mr5"{$tmpHtml}>
						<option value="0">不分類</option>
<!--
EOT;
	foreach ($t_typedb as $key => $value) {
		if ($value) {print <<<EOT
-->
						<option value="$key">$value[name]</option>
<!--
EOT;
		}
	}
print <<<EOT
-->
					</select>
<!--
EOT;
	if ($t_sub_exits == 1) {print <<<EOT
-->
					<select name="p_sub_type" id="p_sub_type" class="mr5" style="display:none"><option value="">不分類</option></select>
<!--
EOT;
	}
print <<<EOT
-->
<script>
function getSubType(id){
	var selobj = getObj('p_sub_type');
	if (typeof(selobj) == 'undefined' || !selobj) return;
	selobj.options.length=0;
	selobj.options.add(new Option("不分類","0"));
	var t_subtypedb = JSONParse('$t_subtypedb');
	for (var temp in t_subtypedb) {
		if (temp == id) {
			for (var temp2 in t_subtypedb[temp]) {
				if (typeof sel_subid != "undefined" && sel_subid == temp2) {
					selobj.options.add(new Option(t_subtypedb[temp][temp2],temp2));
				} else {
					selobj.options.add(new Option(t_subtypedb[temp][temp2],temp2));
				}
			}
			selobj.style.display = '';
		} else {
			selobj.style.display = 'none';
		}
	}
}
</script>
<!--
EOT;
} elseif ($special === 'read_debate') {print <<<EOT
-->
					<select name="standpoint" id="standpoint" class="mr5">
						<option value="0" $debate_0>閑聊一下</option>
<!--
EOT;
	if ($debatestand != 2) {print <<<EOT
-->
						<option value="1" $debate_1>正方觀點</option>
<!--
EOT;
	}
	if ($debatestand != 1) {
print <<<EOT
-->
						<option value="2" $debate_2>反方觀點</option>
<!--
EOT;
	}
print <<<EOT
-->
					</select>
<!--
EOT;
}print <<<EOT
-->
					<input type="text" maxlength="50" class="input mr10" id="atc_title" name="atc_title" value="$titletop1" size="40" /><span id="atc_title_warn">限{$db_titlemax} 字節</span>
				</div>
<!--
EOT;
if (isset($db_sitemsg['reply']['0']) && $db_sitemsg['reply']['0'] && $psot_sta) {
print<<<EOT
-->
				<div style="background:#fffeed;padding:5px 10px;margin:0 0 5px;">{$db_sitemsg[reply][array_rand($db_sitemsg[reply])]}</div>
<!--
EOT;
} elseif (isset($db_sitemsg['post']['0']) && $db_sitemsg['post']['0']) {print<<<EOT
-->
				<div style="background:#fffeed;padding:5px 10px;margin:0 0 5px;">{$db_sitemsg[post][array_rand($db_sitemsg[post])]}</div>
<!--
EOT;
}print<<<EOT
-->


<!--
EOT;
if ($psot_sta == 'reply' && $anonymity) {print <<<EOT
-->
					<div class="fl pr" style="width:100%;">
						<div class="login_tips">您目前還是游客，請 <a id="fast_login" href="javascript:void(0)" _href="pw_ajax.php?action=poplogin&anchor=anchor&tid={$tid}&fpage={$fpage}&toread=$toread{$urladd}&page={$page}" class="s4" hidefocus="true">登錄</a> 或 <a href="$db_registerfile" target="_blank" class="s4" hidefocus="true">注冊</a></div>
					</div>
					<script type="text/javascript">
					window.onReady(function(){
						var fast_login=getObj('fast_login');
						var url=fast_login.getAttribute("_href");
						addEvent(fast_login,"click",function(){
								sendmsg(url,'');
								return false;
							})
						document.FORM.onsubmit = function(){
								sendmsg(url,'');return false;
						}
						});
					</script>
<!--
EOT;
}print<<<EOT
-->
				<div class="B_editor B_editor_fp cc" id="fp_editor" onclick="loadEditor(event);">
<!--
EOT;
$_G['uploadtype'] && $db_uploadfiletype = $_G['uploadtype'];
$db_uploadfiletype = (is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype));
$attachAllow = pwJsonEncode($db_uploadfiletype);
$imageAllow = pwJsonEncode(getAllowKeysFromArray($db_uploadfiletype, array('jpg','jpeg','gif','png','bmp')));
print <<<EOT
-->
					<div class="B_editor_toolbar B_editor_minitoolbar">
						<div class="B_tar">
						<a href="javascript:gotoEditor();" class="fr gotoedit" hidefocus="true">進入高級模式</a>
						</div>
						<ul><li class="edit_toolbar">
							<a href="javascript:;" class="B_ico" title="加粗" data-type="wy_boldIcon" hidefocus="true" style="display:block"><div class="B_boldIcon B_do"></div></a>
							<div class="B_icoDown" style="display: block;" data-type="wy_foreColor"><a href="javascript://" class="B_ico"><div class="B_foreColor B_do1" title="文字顏色"><span style="background-color: rgb(255, 0, 0);"></span>文字顏色</div></a><em unselectable="on" class="B_do1"></em></div>
							<a href="javascript:;" class="B_ico" title="插入鏈接" data-type="wy_linkIcon" hidefocus="true" style="display:block"><div class="B_linkIcon B_do"></div></a>
							<a href="javascript:;" class="B_icoBig" title="插入圖片" data-type="wy_photoBtn" hidefocus="true" style="display:block"><div class="B_photoIcon B_do"></div></a>
<!--
EOT;
if ($db_allowupload && $_G['allowupload']) {print <<<EOT
-->
							<a href="javascript:;" class="B_icoBig" title="插入附件" data-type="wy_fileBtn" hidefocus="true" style="display:block"><div class="B_fileIcon B_do"></div></a>
<!--
EOT;
}print <<<EOT
-->
						</li></ul>
					</div>
					<textarea id="textarea" class="editorTextarea" name="atc_content" style="width:535px;*width:100%;max-width:100%;min-width:100%;height:140px;padding:0;margin:0;border:0 none;overflow:auto;" onkeydown="quickpost(event)"></textarea>
					<span id="autosave"></span><div id="menu_editor" class="wy_menu_B" style="display: none;"></div>
				</div>
				<div class="c mb10">&nbsp;</div>
<!--
EOT;
if($_G['allowat']){
$atNum = $_G['atnum'] ? "可@您關注的人，最多可@{$_G['atnum']}人" : '';
print <<<EOT
-->	
					<div class="mb15 cc">
						<span id="alreadyAtNum" class="fl at_icon" style="margin-top:2px;font-family:Simsun;">提到某人︰</span>
						<div class="input_img fl">
							<span class="at_input_tip" id="at_input_tip">$atNum</span>
							<em class="input_down" onclick="pwSearch.selectInit(event,'popout','message.php?type=ajax','action=friend',0,changeFriendNum)">選擇好友</em>
							<div id="get_friend"><input style="float:none;" type="text" max="{$_G['atnum']}" name="usernames" value="" id="usernames" onblur="pwSearch.blur()" onfocus="pwSearch.init('message.php?type=ajax','action=friend','resultd',changeFriendNum)" onkeydown="pwSearch.move(event)" onkeyup="pwSearch.searchResult(event,200);" autocomplete="off" disableautocomplete=""></div>
					   </div>
					</div>
					
<!--
EOT;
}
print <<<EOT
-->	
				<div class="cc mb10">
					<span class="btn" style="margin:0 20px 0 0;"><span><button title="Ctrl+Enter快速發布" type="submit" name="Submit"> 發 布 </button></span></span>			
<!--
EOT;
if (0 != $tid) {print <<<EOT
-->				
				  <label for="go_lastpage" class="s6"><input id="go_lastpage" type="checkbox" title="選定" name="go_lastpage" value="1" />&nbsp;回復後跳轉到最後一頁</label>
<!--
EOT;
}
print <<<EOT
-->							
				</div>
			</td>
			<td style="width:250px;">
				<div id="fp_face" class="fp_show">
					<div class="fp_show_tab">
						<b id="doleft" style="/*display:none*/" class="tab_left fl" onclick="PwFace.showTab(-1)" title="上一個">上一個</b>
						<b id="doright" style="/*display:none*/" class="tab_right fr" onclick="PwFace.showTab(1)" title="下一個">下一個</b>
						<ul id="face_tab"></ul>
					</div>
					<div class="fp_show_cont">
						<div class="fp_show_height">
							<ul class="cc" id="face_main"></ul>
							<div id="face_page" class="fp_show_pages cc"></div>
						</div>
					</div>
				</div>
			</td>
		</tr>
	</table>
<!--
EOT;
list($postq,$showq)=explode("\t",$db_qcheck);
empty($winddb[postnum]) && $winddb[postnum]=0;
if (($db_gdcheck & 4) && (!$db_postgd || $winddb['postnum'] < $db_postgd) || (($db_ckquestion & 4) && (!$postq || $winddb[postnum] < $postq) && $db_question)) {
print <<<EOT
-->
<div id="fpt_check" style="display:none;">
<div class="popout">
	<table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="bgcorner1"></td><td class="pobg1"></td><td class="bgcorner2"></td></tr><tr><td class="pobg4"></td><td><div class="popoutContent">
	<div style="width:330px;">
	<div class="popTop" style="cursor:move" onmousedown="read.move(event);"><a href="javascript:;" onclick="closePopGd();" class="adel">關閉</a>補充發布信息</div>
	<div class="p10">
		<div id="fpt_checktip" class="wrongTip" style="display:none;"></div>
		<table width="100%">
<!--
EOT;
if (($db_gdcheck & 4) && (!$db_postgd || $winddb['postnum'] < $db_postgd)) {
$checkCode = L::loadClass('checkcode', 'site');
$checkCodeString = $checkCode->getCheckCodeTemplate();
print <<<EOT
-->		
			<tr>
				<td class="tar vt" width="75">驗證碼︰</td>
				<td>
					<input name="gdcode" id="input_gdcode" type="text" style="width:50px;" onKeyUp="checkGDkey(event);" class="input mr5" onfocus="showgd();">
					<span id="ckcode" style="display:none"></span>
$checkCodeString
				</td>
			</tr>
<!--
EOT;
}if (($db_ckquestion & 4) && (!$postq || $winddb[postnum] < $postq) && $db_question) {
	$qkey = array_rand($db_question);
	if ($db_imagequestion) {
		$question = '<img id="ckquestion" class="sitegdcheck" src="ckquestion.php?q='.$qkey.'&t='.$timestamp.'" align="top">';
	} else {
		$question = $qkey<0 ? getMachineQuestion_1() :  $db_question[$qkey];
	}
	$q_a = $question.($showq && $qkey>0?" （答案︰".$db_answer[$qkey] . '）' : '');
print <<<EOT
-->
			<tr>
				<td class="tar" width="75">驗證問題︰</td>
				<td>
					<input name="qanswer" id="input_qanswer" type="text" style="width:50px;" onKeyUp="checkGDkey(event);" class="input mr5">{$q_a}
					<input type="hidden" name="qkey" value="$qkey" />
				</td>
			</tr>
<!--
EOT;
}print <<<EOT
-->
		</table>
	</div>
	<div class="popBottom"><span class="btn2"><span><button type="button" onclick="setFormChecked();">發 布</button></span></span></div>
	</div>
</div></td><td class="pobg2"></td></tr><tr><td class="bgcorner4"></td><td class="pobg3"></td><td class="bgcorner3"></td></tr></tbody></table></div></div>
<!--
EOT;
}print <<<EOT
-->
	</form>
</div>
<script type="text/javascript">
<!--
EOT;
if($_G['allowat']){print <<<EOT
-->	
onReady(function(){
	//快速回復@功能
	if(typeof pwSearch!="undefined"){
		pwSearch.type="post";
	}
		getObj("get_friend").onclick=(getObj("at_input_tip").onclick)=function(){
			getObj("at_input_tip").style.display="none";
			setTimeout(function(){
				getObj("usernames").focus();
			},100)
			return false;
		}
	
})

function changeFriendNum(n){
		if(n>=1){
			getObj("alreadyAtNum").innerHTML="已提到"+n+"人︰";
		}else{
			getObj("alreadyAtNum").innerHTML="提到某人︰"	
		}
		if(getObj("at_input_tip")){
			getObj("at_input_tip").style.display="none";
		}
}
<!--
EOT;
}
print <<<EOT
-->
document.FORM._hexie.value = '$tmpVerify';

var titlemax = '$db_titlemax';
var postmax = '$db_postmax';
initCheckTextNum('atc_title','atc_title_warn',titlemax);
//initCheckTextNum('atc_content','atc_content_warn',postmax);

var charset='$db_charset';
var bbsurl ="{$B_url}";
var BREEZE_BASE_PATH = getBaseUrl() + 'js/breeze/';
var editor = null;
var attachConfig = {
		'attachnum' : parseInt('$maxAttachnum'),
		'list' : {},
		'postData' : {fid : '$fid'},
		'filetype' : $attachAllow
	},
	imageConfig = {
		tabs : [$imageConfigTabs],
		url : 'pweditor.php?action=image',
		filetype : $imageAllow
	};
function loadEditor(e) {
	var e = e || event;
	var o = e.srcElement || e.target;
	if (hasClass(o,'gotoedit')) {return;}
	getObj('fp_editor').onclick = null;
	loadjs('js/breeze/core/base.js', '', '', function() {
		B.require('editor.editor', 'editor.ubb', function(B){
			editor=B.editor(B.$('#textarea'), 'edit_toolbar', 'boldIcon foreColor linkIcon photoBtn fileBtn',{'currentMode' : 'UBB'});
			var s = B.hasClass(o, 'B_do') ? o.parentNode : (B.hasClass(o, 'B_do1') ? o : null);
			if(s){
				B.trigger(s,'mousedown');
			}
		});
	});
}
var dataStorage = {
	save : function(quick) {
		SetCookie('ds', 1);
		var title=quick?document.quickpostForm.atc_title.value:document.FORM.atc_title.value;
		var cont=quick?document.quickpostForm.atc_content.value:document.FORM.atc_content.value;
			localStorage.setItem('msg',cont);
			localStorage.setItem('title',title);
			//如果有@權限
			if(getObj("get_friend")!=null){
				var span=getObj("get_friend").getElementsByTagName("span");
				//如果已@用戶
				if(span.length>0){
					var atUserList=[];
					//遍歷並保存用戶
					for(var i=0,len=span.length;i<len;i++){
						var input=span[i].getElementsByTagName("input")[0];
						var uname=input.value;
						atUserList.push(uname);
					}
					//存儲數據
					localStorage.setItem('atUserList',atUserList);
				}
			}
	},
	load : function() {
		document.FORM.atc_title.value = localStorage.getItem('title') || '';
		var msg = localStorage.getItem('msg');
		if (msg) {
			document.FORM.atc_content.value = msg;
			document.FORM.atc_content.focus();
		}
		SetCookie('ds', 0);
	}
}
function gotoEditor(quick,pid) {
	dataStorage.save(quick);
	if (pid) {
		location.href = '$quoteurl'+'&pid='+pid;
	} else {
		location.href = '$posturl';
	}
}
</script>
<!--
EOT;
$postMinLength = empty($forumset['contentminlen']) ? $db_postmin : $forumset['contentminlen'];
print <<<EOT
-->
<script src="$db_htmdir/js/face.js"></script>
<script type="text/javascript" src="js/post.js"></script>
<script>
document.FORM.Submit.disabled = false;
var charset = '$db_charset';
var stylepath = '$stylepath';
var cate = '$db_forcetype';
var cnt = 0;

{$facedb}
window.onReady(function(){PwFace.init('face_tab', 'face_main', 3, 16)});
function checkpost(obj){
	try{clearEditorDialog();}catch(e){}//關閉編輯器相關彈窗 pw_lwd.js
	//過濾描述
	if(getObj("B_qlist")){
		var B_file_desc=getElementsByClassName("B_file_desc",getObj("B_qlist"));
		for(var i=0,len=B_file_desc.length;i<len;i++){
			var qlist_li=B_file_desc[i];
			var qlist_inp=qlist_li.getElementsByTagName("input")[0];
			if(qlist_inp!=undefined&&qlist_inp.value=="請輸入描述"){
				qlist_inp.value="";
			}
		}	
	}
	if(getObj("B_image_tile")){
		var B_file_ip=getElementsByClassName("B_file_ip",getObj("B_image_tile"));
		for(var i=0,len=B_file_ip.length;i<len;i++){
			var B_image=B_file_ip[i];
			var B_image_inp=B_image.getElementsByTagName("input")[0];
			if(B_image_inp!=undefined&&B_image_inp.value=="請輸入描述"){
				B_image_inp.value="";
			}
		}
			
	}
	//end
	var action =  "{$psot_sta}";
	if(cate==1 && obj.p_type!=null && obj.p_type.value==0){
		showDlg({type:"error",message:"沒有選擇主題分類",onClose:function(){
			obj.p_type.focus();	
		}});
		return false;
	}
	if(obj.atc_title.value==""){
		if (action != 'reply'){
			showDlg({type:"error",message:"<font color='red'>標題</font> 不能為空。",onClose:function(){
				obj.atc_title.focus();				
			}});
			return false;
		}
	} else if(strlen(obj.atc_title.value)>$db_titlemax){
		showDlg({type:"error",message:"標題超過最大長度 <font color='red'>$db_titlemax</font> 個字節。",onClose:function(){
			obj.atc_title.focus();	
		}});
		return false;
	}
	if(strlen(obj.atc_content.value)<$postMinLength){
		showDlg({type:"error",message:"文章內容少于  <font color='red'>$postMinLength</font> 個字節。",onClose:function(){
			obj.atc_content.focus();
		}});
		return false;
	} else if(strlen(obj.atc_content.value)>$db_postmax){
		showDlg({type:"error",message:"文章內容大于   <font color='red'>$db_postmax</font> 個字節。",onClose:function(){
			obj.atc_content.focus();
		}});
		return false;
	}
	obj.Submit.disabled = true;
	//顯示驗證碼
	if (obj.name == "FORM" && getObj('fpt_check') && obj.isformchecked.value == 1) {
		read.open('fpt_check', '', 2);
		setTimeout(function(){
			getObj('input_qanswer')&&getObj('input_qanswer').focus();
			getObj('input_gdcode')&&getObj('input_gdcode').focus();
		}, 100);
		if(!is_ie6){
			 var st = getPWBox().style;
			 st.position = 'fixed';
			 st.top = '200px';
		}
		return false;
	}
	if (obj.name == 'quickpostForm' || (obj['go_lastpage'] && false == obj['go_lastpage'].checked && 0 != obj['tid'].value)) {
		obj['type'].value = "ajax_addfloor";
		postfloor(obj);
		var topicRepliesNum = getObj('topicRepliesNum');
		if (topicRepliesNum != 'undefined') {
			topicRepliesNum.innerHTML = parseInt(topicRepliesNum.innerHTML) + 1;
		}
		return false;
	};
	try{
		if (is_ie && newAtt.aid < 2) {
			obj.encoding = "application/x-www-form-urlencoded";
		}
	}catch(e){}
	if (obj['go_lastpage'] && true == obj['go_lastpage'].checked){
		obj.target = obj['ajax'].value = obj['type'].value = '';
		obj.submit();
		return false;
	}
	ajaxSubmit(obj);
	return false;
}
function ajaxSubmit(obj){
	obj.Submit.disabled = true;
	ajax.send("post.php?fid=$fid", obj, function(){
		var changeCheck = true;
		if(undefined == ajax.request.responseText){
			showDlg({
				type: 'error',
				message: "<font color=\'red\'>附件</font> 太大或網絡原因，請求超時，請稍後再試!"
			});
			obj.Submit.disabled = false;
			return false;
		}
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'success') {
			if (obj.name == 'quoteFORM') {
				top.window.location =  top.window.location.pathname;
			}
			window.onbeforeunload = function(){};
			top.window.location =  rText[1];
			obj.atc_content.value = '';
			if (typeof (obj.qanswer) != 'undefined') obj.qanswer.value = '';
			if (typeof (obj.gdcode) != 'undefined') obj.gdcode.value = '';
			obj.iscontinue.value = 0;
			if (obj.name == 'quickpostForm') closep();
			if (obj.name == 'FORM') obj.isformchecked.value = 1;
		}else if(rText[0] == 'continue'){
			changeCheck = false;
			showDlg({type:'confirm',message:rText[1],okText:'繼續',onOk:function(){
				obj.iscontinue.value = 1;
				ajaxSubmit(obj);
			}});
		}else{
			if (obj.name == 'FORM') obj.isformchecked.value = 1;
			showDlg('error', rText[0]);
		}
		if (changeCheck) changeHiddenGd(obj);
		obj.Submit.disabled = false;
		return false;
	});	
}
function postfloor(obj){
	var url = 'post.php?fid=$fid';
	if (obj.name == 'quickpostForm' && obj.pid.value > 0) {
		obj.action.value = 'quote';
	}
	ajax.send(url, obj, function() {
		var changeCheck = true;
		var rText = ajax.runscript(ajax.request.responseText);
		if (rText.indexOf('read_t') !== -1) {
			//快速回復彈窗位置移到底部
			if(obj.name=="quickpostForm"){
				var dd=document.documentElement;
				var db=document.body;
				var h=dd.scrollHeight-dd.clientHeight;
				var b=dd.scrollTop+db.scrollTop;//初始值
				var c=h-b;//變化量
				var d = 10,t = 0;//持續時間和增量
				var easeInOut=function(t,b,c,d){
					if ((t/=d/2) < 1) return c/2*t*t + b;
					return -c/2 * ((--t)*(t-2) - 1) + b;
				}
				var run=function(){
					if(dd.scrollTop){
						dd.scrollTop=Math.ceil(easeInOut(t,b,c,d));
					}else{
						db.scrollTop = Math.ceil(easeInOut(t,b,c,d));
					}
					if(t<d){ t++; setTimeout(function(){
						run();
					}, 40); }else{t=0;}
				}
				run();
			}
			//end
			var div=document.createElement("div");
			div.innerHTML=rText;
			document.forms['delatc'].appendChild(div);
			obj.reset();
			if(editor) editor.reset();
			if(pwSearch) pwSearch.clear();//清除@的人
			//重置圖片數據
			if(typeof attachConfig!="undefined"){
				attachConfig.list={};
			}
			if(typeof uploader!="undefined"){
				uploader.data={};
			}
			//end
			loadFloor.showHidden(tid);
			obj.iscontinue.value = 0;
			read.InitMenu();
			if (obj.name == 'quickpostForm') closep();
			if (obj.name == 'FORM') obj.isformchecked.value = 1;
			if (rText.indexOf('isreplyrewardsuccess') !== -1) changeReplyRewardNum();
			//重新初始化@功能
			if(typeof uCard!="undefined"){
				uCard.init();
			}
		} else {
			var rText = ajax.request.responseText.split('\t');
			if (rText[0] == 'success') {
				window.onbeforeunload = function(){};
				top.window.location =  rText[1];
				obj.atc_content.value = '';
				if (typeof (obj.qanswer) != 'undefined') obj.qanswer.value = '';
				if (typeof (obj.gdcode) != 'undefined') obj.gdcode.value = '';
				obj.iscontinue.value = 0;
			}else if(rText[0] == 'continue'){
				changeCheck = false;
				showDlg({type:'confirm',message:rText[1],okText:'繼續',onOk:function(){
					obj.iscontinue.value = 1;
					ajaxSubmit(obj);
				}});
			}else{
				if(obj.name=="FORM"){
					//處理驗證碼輸入錯誤的情況
					if(rText[0].indexOf("驗證")!=-1&&getObj("fpt_checktip")){
						read.open('fpt_check', '', 2);
						setTimeout(function(){
							getObj("fpt_checktip").innerHTML=rText[0];
							getObj("fpt_checktip").style.display="";
							if(getObj('input_qanswer')){
								var input_qanswer=getObj('input_qanswer');
								input_qanswer.value="";
								input_qanswer.focus();
							}
							if(getObj('input_gdcode')){
								var input_gdcode=getObj('input_gdcode');
								input_gdcode.value="";
								input_gdcode.focus();
							}
						}, 100);
						if(!is_ie6){
							 var st = getPWBox().style;
							 st.position = 'fixed';
							 st.top = '200px';
						}
						return false;
					}else{
						showDlg('error', rText[0],'');
					}
					//end
				}else{
					showDlg('error', rText[0],'',function(){
						 if(obj['gdcode']){
							obj['gdcode'].value="";
							obj['gdcode'].focus();
							if(getObj("changeGdCode")){
								changeCkImage(getObj("changeGdCode"));
							}
						}
						if(obj['qanswer']){
							obj['qanswer'].value="";
							obj['qanswer'].focus();
						}
					});
				}
				if (obj.name == 'quickpostForm') {
					var pwbox = getPWBox();
					pwbox.style.display = '';
					try{
						getObj('qk_ckquestion').src = getObj('qk_ckquestion').src.replace(/t=\d+|nowtime=\d+/,'t='+new Date().getTime());
						var qk_qdcodes = getElementsByClassName('sitegdcheck', getObj('qk_ckcode'));
						for (var i = 0; i < qk_qdcodes.length; i++) {
							if (qk_qdcodes[i].src) qk_qdcodes[i].src = qk_qdcodes[i].src.replace(/t=\d+|nowtime=\d+/,'t='+new Date().getTime());
							if (typeof qk_qdcodes[i].onclick == 'function') qk_qdcodes[i].onclick();
						}
					}catch(e){}
				} else if (obj.name == 'FORM') {
					obj.isformchecked.value = 1;
				}
			}
		}
		if (changeCheck) changeHiddenGd(obj);
		cnt = 0;
		obj.Submit.disabled = false;
		obj.target = '';
		
		if (getObj('creditlocation')) {
			setTimeout(function() {
				getObj('creditlocation').parentNode.removeChild(getObj('creditlocation'));;
			},3000);
		};
	});
}
//End Add by liaohu for addfloor
function checklength(theform,postmaxchars){
	if(postmaxchars != 0){
		message = '<br />系統限制最大字節數:'+postmaxchars+' 字節';
	} else{
		message = '';
	}
	showDlg({type:"warning",message:'您的信息已有字節數: <font color="red">'+strlen(theform.atc_content.value)+'</font> 字節'+message});
}
function addsmile(NewCode){
    getObj('textarea').value += ' [s:'+NewCode+'] ';
}
window.onbeforeunload = function() {
	saveData('msg', document.FORM.atc_content.value);
}
if (FetchCookie('ds') == 1) {
	try{dataStorage.load();}catch(e){}
}

function showFace() {
	var menus = getObj("face_tab").getElementsByTagName('li');
	if(menus){
		showTabBtn(menus.length);
	}
}
function checkGDkey(e){
		var e=e||window.event;
		var keyCode=e.keyCode||e.which;
		if(keyCode==13){
				setFormChecked();
		}
}
function setFormChecked() {
	document.FORM.isformchecked.value = 2;
	if (document.FORM.gdcode) document.FORM.gdcode.value = getObj('input_gdcode').value;
	if (document.FORM.qanswer) document.FORM.qanswer.value = getObj('input_qanswer').value;
	closep();
	checkpost(document.FORM);
	return true;
}

function changeHiddenGd(obj) {
	if (obj.name != 'FORM') return false;
	try {
		var checks = getElementsByClassName('sitegdcheck', getObj('fpt_check'));
		for (var i=0; i < checks.length; i++) {
			if (checks[i].src) checks[i].src = checks[i].src.replace(/t=\d+|nowtime=\d+/,'t='+new Date().getTime());
			if (typeof checks[i].onclick == 'function') checks[i].onclick();
		}
	} catch(e){}
	return true;
}

function closePopGd() {
	document.FORM.Submit.disabled = false;
	closep();
}

function changeReplyRewardNum() {
	var replyrewardnum = getObj('replyrewardnum'),
		leftreplyrewardnum = getObj('leftreplyrewardnum');
	if (!replyrewardnum || !leftreplyrewardnum) return false;
	var newnum = parseInt(leftreplyrewardnum.innerHTML) - parseInt(replyrewardnum.innerHTML);
	if (newnum >= 0) {
		leftreplyrewardnum.innerHTML = newnum;
	}
	return true;
}

window.onReady(showFace);
</script>
<!--
EOT;
?>