<ad:set name="classid" value="$word(request("id"),"id")$" />
<ad:set name="ispassed" value="0" />
<ad:if test="$isnotempty(request("showid"))$">
	
	<ad:set name="faqid" value="$request("showid","")$" />
	<ad:set name="faq" value="$dataview("c_faq","ispassed=0 and id=$faqid$","inputdate desc")$" />
	<ad:set name="title" value="$htmlencode(faq[0]["title"])$" />
	<ad:set name="nav" value="&gt; $title$" />
	<ad:set name="pagetitle" value="$title$_" />
	<ad:set name="title" value="$htmlencode(faq[0]["title"])$" />
	<h1 class="subtitle">$htmlencode(faq[0]["title"])$</h1>
	<div class="faqcontent">$ubbdecode(faq[0]["content"])$<div class="faqtime">$faq[0]["inputdate"]$</div></div>

	<ad:if test="$comparenocase(dataviewrow("c_faq","parentid","id=$faqid$"),"0")$">
	<form name="form1" method="post" action="$sitepath$postsubmit.aspx">
	<input type="hidden" name="table" value="c_faq">
	<input type="hidden" name="isinputip" value="true">
	<input type="hidden" name="returnurl" value="$url("default.aspx?diy=message")$">
	<input type="hidden" name="codeerror" value="$url("default.aspx?diy=message&type=codeerror")$">
	<input type="hidden" name="C_ClassID" value="$classid$">
	<input type="hidden" name="C_Parentid" value="$faqid$">
	<input type="hidden" name="C_Ispassed" value="$ispassed$">
	<input type="hidden" name="C_Title" value="Re:$faq[0]["title"]$">
	<br />
	<table class="faqtable" width="100%">
	<tr>
		<td style="text-align:center; width:70px;">回复问题</td>
		<td colspan="2"><textarea name="C_Content" rows="2" cols="20" id="c_content" style="height:80px;width:99%;"></textarea></td>
	</tr>
	<tr>
		<td style="text-align:center;">验证码</td>
		<td><input name="c_validate" type="text" id="c_validate" style="width:80px" />&nbsp<img src="$sitepath$validate.aspx" alt="看不清？点击更换" onclick="this.src='$sitepath$validate.aspx?random=' + Math.random()" style="cursor:pointer;border:1px solid #391107; position:absolute" /></td>
		<td style="width:150px; text-align:right;"><input type="submit" name="ButtonInsert" value=" 提 交 " id="ButtonInsert" />&nbsp;&nbsp;<input type="reset" value=" 重 置 " /></td>
	</tr>
	</table>
	</form>
	<div class="tip">
		<div></div>
	</div>
	<ad:foreach collection="$dataview("c_faq","ispassed=0 and parentid=$faqid$","inputdate,id desc")$" var="it" index="i">
	<div class="faqcontent">$ubbdecode(it["content"])$<div>$it["inputdate"]$</div></div>
	</ad:foreach>
	<div class="back"><a href="$url("default.aspx?classid=$request("classid")$&id=$request("id")$")$">[返回上页]</a>浏览次数：<script type="text/javascript" src="$sitepath$files/common/common.aspx?action=faqcount&id=$faq[0]["id"]$"></script></div>
	<ad:else />
	</ad:if>
<ad:else />
	<ad:if test="$isnotempty(request("keywords"))$">
		<ad:set name="faqlist" value="$dataview("c_faq", "classid=$classid$ and parentid=0 and ispassed=0 and title like '%$request("keywords")$%'","inputdate desc")$" />
		<ad:if test="$comparenocase(faqlist.count,"0")$">
		<div class="list">没有数据！</div>
		<ad:else />
		<div class="list">
			<ul>
				<ad:foreach collection="$faqlist$" var="it" index="i">
				<li><span>$cdate(it["inputdate"]).ToString("yyyy-MM-dd")$</span><em></em><a href="$url("default.aspx?classid=$request("classid")$&id=$request("id")$&showid=$it["id"]$")$" title="$htmlencode(it["title"])$">$htmlencode(it["title"])$</a></li>
				</ad:foreach>
			</ul>
		</div>
		</ad:if>
	<ad:else />
		<ad:set name="faqlist" value="$page("c_faq","15","classid=$classid$ and parentid=0 and ispassed=0","inputdate desc")$" />
		<div class="list">
			<ul>
				<ad:foreach collection="$faqlist$" var="it" index="i">
				<li><span>$cdate(it["inputdate"]).ToString("yyyy-MM-dd")$</span><em></em><a href="$url("default.aspx?classid=$request("classid")$&id=$request("id")$&showid=$it["id"]$")$" title="$htmlencode(it["title"])$">$htmlencode(it["title"])$</a></li>
				</ad:foreach>
			</ul>
		</div>
		<div class="page"><span>$page["PageNumAll"]$</span>总记录：$Page["RecordCount"]$&nbsp;&nbsp;总分页：$Page["PageCount"]$&nbsp;&nbsp;当前页：$Page["PageNum"]$</div>
	</ad:if>
	<br />
	<form name="form1" method="post" action="$sitepath$postsubmit.aspx">
	<input type="hidden" name="table" value="c_faq">
	<input type="hidden" name="isinputip" value="true">
	<input type="hidden" name="returnurl" value="$url("default.aspx?diy=message")$">
	<input type="hidden" name="codeerror" value="$url("default.aspx?diy=message&type=codeerror")$">
	<input type="hidden" name="C_ClassID" value="$classid$">
	<input type="hidden" name="C_Parentid" value="0">
	<input type="hidden" name="C_IsPassed" value="$ispassed$">
	<table class="faqtable" width="100%">
	<tr>
		<td style="width:70px; text-align:center;">标题</td>
		<td colspan="2"><input name="C_Title" type="text" id="c_title" style="width:50%" /></td>
	</tr>
	<tr>
		<td style="text-align:center;">问题补充</td>
		<td colspan="2"><textarea name="C_Content" rows="2" cols="20" id="c_content" style="height:80px;width:99%;"></textarea></td>
	</tr>
	<tr>
		<td style="text-align:center;">验证码</td>
		<td><input name="c_validate" type="text" id="c_validate" style="width:80px" />&nbsp;<img src="$sitepath$validate.aspx" alt="看不清？点击更换" onclick="this.src='$sitepath$validate.aspx?random=' + Math.random()" style="cursor:pointer;border:1px solid #391107; position:absolute" /></td>
		<td style="width:150px; text-align:right;"><input type="submit" name="ButtonInsert" value=" 提 交 " id="ButtonInsert" />&nbsp;&nbsp;<input type="reset" value=" 重 置 " /></td>
	</tr>
	</table>
	</form>
	<div class="tip">
		<div></div>
	</div>
</ad:if>

<script type="text/javascript">
$$(".tip").hide();
$$("#ButtonInsert").click(function()
{
	$$(".tip").hide();

	if($$("#c_title").val() == "")
	{
		$$(".tip").show();
		$$(".tip div").text('请输入标题！');
		$$("#c_title").focus();
		return false;
	}

	if($$("#c_content").val() == "")
	{
		$$(".tip").show();
		$$(".tip div").text('请输入内容！');
		$$("#c_content").focus();
		return false;
	}

	if($$("#c_validate").val() == "")
	{
		$$(".tip").show();
		$$(".tip div").text('请输入验证码！');
		$$("#c_validate").focus();
		return false;
	}
})

if($$(".buttonkeywords").length != 0)
{
	$$(".buttonkeywords").click(function()
	{
		if($$(".keywords").val().replace(/\ /g,"") == "")
		{
			alert("请输入关键词！");
			$$(".keywords").focus();
			return false;
		}
		else
		{
			var url = $$(this).attr("name");
			location.href = url.replace("{keywords}", encodeURIComponent($$(".keywords").val().replace(/\ /g,"")));
		}
	})
}
</script>