<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
global $imgurl;
?><!--<?php print <<<EOT
-->
<!--
EOT;
if ($action == 0){
print <<<EOT
-->
<script language="javascript">
var parentfollow=parent.document.getElementById("follow{$rootid}")
var parentfollowTd=parent.document.getElementById("followTd{$rootid}")
var parentfollowImg=parent.document.getElementById("followImg{$rootid}")
if(parentfollow)
{
	parentfollow.style.display="none";	
}
parentfollowTd.style.display="none";
parentfollowImg.innerHTML='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1" target="hiddenframe" title="{$lang['tree.tpl.str1']}" ><img src="{$imgurl}plus.gif" border="0"></a>';
</script>
<!--
EOT;
}else{
print <<<EOT
-->
<script language="JavaScript" type="text/javascript">
var parentfollow=parent.document.getElementById("follow{$rootid}")
var parentfollowTd=parent.document.getElementById("followTd{$rootid}")
var parentfollowImg=parent.document.getElementById("followImg{$rootid}")
if(parentfollow)
{
	parentfollow.style.display="";
}
parentfollowTd.style.display="";
parentfollowImg.innerHTML='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=0" target="hiddenframe"  title="{$lang['tree.tpl.str2']}" ><img src="{$imgurl}nofollow.gif" border="0" ></a>';
parentfollowTd.innerHTML='<div style="width:240px;margin-left:18px;border:1px solid black;background-color:lightyellow;color:black;padding:2px">{$lang['tree.tpl.str3']}</div>'

function showpage(page,RecordCount,PageSize,PageCount)
{
	var Tmpstr='<div style="width:100%;height:20;">{$lang['tree.tpl.str16']}{$lang['tree.tpl.str16']}{$lang['tree.tpl.str16']}&nbsp;&nbsp;{$lang['tree.tpl.str4']}'+page+' / '+PageCount+' {$lang['tree.tpl.str5']}'
	if (page=='1')
	{
		Tmpstr+='<font face=webdings class=redfont>9</font>';
	}else{
		Tmpstr+='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1&star=1" title="{$lang['tree.tpl.str6']}" target="hiddenframe"><font face=webdings>9</font></a>';
	}
	var p;
	if ((page-1)%10==0) 
	{
		p=(page-1) /10
	}
	else
	{
		p=(((page-1)-(page-1)%10)/10)
	}
	if (p*10 > 0)
	{
		Tmpstr+='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1&star='+p*10+'" title="{$lang['tree.tpl.str7']}" target="hiddenframe" ><font face=webdings>7</font></a> ';
	}
	Tmpstr+='<b>';
	for (var i=p*10+1;i<p*10+11;i++)
	{
		if (i==page)
		{
			Tmpstr+=' <font class=redfont>'+i+'</font> ';
		}
		else
		{
			Tmpstr+=' <a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1&star='+i+'" target="hiddenframe">'+i+'</a> ';
		}
		if (i==PageCount) break;
	}
	Tmpstr+='</b>';
	if (i<PageCount)
	{
		Tmpstr+='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1&star='+i+'" title="{$lang['tree.tpl.str8']}" target="hiddenframe"><font face=webdings>8</font></a>   ';
	}
	if (page==PageCount)
	{
		Tmpstr+='<Font face=webdings class=redfont>:</font>';
	}
	else
	{
		Tmpstr+='<a href="loadtree1.php?boardid={$boardid}&rootid={$rootid}&action=1&star='+PageCount+'" title="{$lang['tree.tpl.str9']}" target="hiddenframe"><font face=webdings>:</font></a>  ';
	}
	Tmpstr+='</div>';
	return(Tmpstr)
}
</script>
<Script Language=JavaScript>
var tmpstr='';
<!--
EOT;
while($ts = $db->fetch_array($query)) {
	for($i=0; $i<=$ts['layer']; $i++){
		if ( $i == 0 ){
			$iouttext = $outtext;
		}else{
			$iouttext .= $outtext;
		}
	}
	$star = intval(($allnum-$num)/intval($board_settings[61]))+1;
	if ( $star < 2 ){
		$star = 1;
	}
	if ( $ts['locktopic'] == 2 ){
		$ts['topic'] = $lang['tree.tpl.str10'];
	}elseif( $ts['locktopic'] == 3 ){
		$ts['topic'] = $lang['tree.tpl.str11'];
	}elseif( $ts['lockuser'] == 1 ){
		$ts['topic'] = $lang['tree.tpl.str12'];
	}elseif( $ts['lockuser'] == 2 ){
		$ts['topic'] = $lang['tree.tpl.str13'];
	}else{
		$atitle = i_addslashes($ts['topic']);
		if ( $ts['topic'] == '' ){
			$ts['topic'] = cutStr(reUBBCode($ts['body']),50);
		}else{
			$ts['topic'] = cutStr($ts['topic'],50);
		}
	}
	$ts['topic'] = i_addslashes($ts['topic']);
	if ( $board_settings[58] == 1 && $ts['signflag'] == 2 ){
		if ( $boardmaster === true ){
			$ts['username'] .= "<font color=gray>{$lang['tree.tpl.str14']}</font>";
		}else{
			$ts['postuserid'] = 0;
			$ts['username'] = $lang['tree.tpl.str15'];
		}
	}
	$ts['username'] = i_addslashes($ts['username']);
print <<<EOT
-->tmpstr+='<div style="width:100%;height:20">{$iouttext}<img src="{$imgurl}nofollow.gif"> <a href="dispbbs.php?boardid={$boardid}&id={$ts['rootid']}&replyid={$ts['announceid']}&star={$star}&skin=0#{$ts['announceid']}" title="{$atitle}">{$ts['topic']}</a> -- <a href="dispuser.php?id={$ts['postuserid']}">{$ts['username']}</a></div>';<!--
EOT;
	$iouttext = '';
	$atitle = '';
	$num++;
}
print <<<EOT
-->tmpstr+=showpage({$page},{$allnum},{$board_settings[61]},{$pagecount});
parent.document.getElementById("followTd{$rootid}").innerHTML=tmpstr;
</Script>
<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
?>-->