var i=0;
var ii=3;

newDate=new Date()
newDate=""+newDate.getYear()+"-"+[newDate.getMonth()+1]+"-"+newDate.getDate()+""

//读取COOKIE
function getCookie (CookieName) { 
var CookieString = document.cookie; 
var CookieSet = CookieString.split (';'); 
var SetSize = CookieSet.length; 
var CookiePieces 
var ReturnValue = ""; 
var x = 0; 
for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) { 
CookiePieces = CookieSet[x].split ('='); 

if (CookiePieces[0].substring (0,1) == ' ') { 
CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length); 
}

if (CookiePieces[0] == CookieName) {
ReturnValue = CookiePieces[1];
var value =ReturnValue
}


}
return value;
}


//跳出确认
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}


function Topiclist(id,username,content,posttime,membercode,regtime,email,replyid,langid,topic,ipaddress)
{
if (langid!='') 
{
findimg="find"+langid+".gif";
emailimg="email"+langid+".gif";
replyimg="reply"+langid+".gif";
replynowimg="replynow"+langid+".gif";
editimg="edit"+langid+".gif";
delimg="del"+langid+".gif";
}
topic=topic.replace(/#!/ig," ");
content=content.replace(/#!/ig," ");

if (langid!='') 
  {
  if (langid==0) {zcyh="注册用户";zxstatus="状态:【在线】";lxstatus="状态:【离线】";tzgl="该用户帖子已被过滤" }
  if (langid==1) {zcyh="Member";zxstatus="Status:【Online】";lxstatus="Status:【Offline】";tzgl="The user's topics have been filtered!"}
  if (langid==2) {zcyh="註冊用戶";zxstatus="狀態:【在線】";lxstatus="狀態:【離線】";tzgl="该用户帖子已被过滤" }
  }

if (membercode>4)
	{
	ipimg="<img src=images/ip.gif > IP："+ipaddress+" ";
	}
else
	{ipimg="&nbsp;";}

document.write("<table class=a2 style=TABLE-LAYOUT:fixed cellPadding=5 width=97% align=center border=0 cellSpacing=1>");
ii++
if(ii==5){ii=3}
document.write("<tr class=a"+ii+">");
document.write("<td width=156 align=center valign=top>");
document.write("<table border=0 width=90%>");
document.write("<tr><td><b><font class=Topic_font_color style=font-size:10pt>"+username+"</font></b></td></tr>");
//document.write("<tr><td>Member</td></tr>");
document.write("<tr><td>"+zcyh+"</td></tr>");
document.write("</table><br>");
document.write("<table border=0 width=90%><tr><td>");
//document.write("Registered:"+regtime+"<br>");  
if(onlinelist.indexOf("|"+username+"|") == -1 ){
//document.write("Status:【Offline】<br>");
document.write(""+lxstatus+"<br>");
}else{

//document.write("Status:【Online】<br>");
document.write(""+zxstatus+"<br>");
}
document.write("</td></tr></table>");
document.write("</td>");

// 下边为内容显示td部分开始
document.write("<td height=100%>");

document.write("<table cellSpacing=0 cellPadding=0 width=100% border=0 height=100%>");
document.write("<tr vAlign=top><td colSpan=4 height=100% >");
//2005-8-18 修改将强制换行去掉
//document.write("<tr vAlign=top><td colSpan=4 height=100% style=word-break:break-all>");

if(badlist.indexOf(username) == -1 )
{
	if (topic!='')
  {
   	document.write("&nbsp;<b><font color=#6D8D3E >"+topic+"</font></b>&nbsp;&nbsp;<br><br>");
  }
//document.write(ybbcode("&nbsp;<span id=yu"+id+"><font color=#444444 >"+content+"</font></span>"));
document.write("&nbsp;<span id=yu"+id+"><font color=#444444 >"+content+"</font></span>");
}
else{

//document.write("<span id=yu"+id+">==============================<br>　　<font color=RED>该用户帖子已被过滤　　　</font><br>==============================</span>")
document.write("<span id=yu"+id+">==============================<br>　　<font color=RED>"+tzgl+"　　　</font><br>==============================</span>")
}
document.write("</td></tr><tr vAlign=top><td colSpan=4 align=right>")
document.write("</td></tr>")
document.write("</table>");

document.write("</td></tr>");
// 内容显示td部分结束

//class=a"+ii+"
document.write("<tr class=a"+ii+" ><td align=center valign=top><img src=images/posttime.gif> "+posttime+"</td>");
document.write("<td height=100% align=right >");
document.write("&nbsp;"+ipimg+"&nbsp;&nbsp;&nbsp;&nbsp;");
document.write("<a href='search.asp?menu=ok&search=author&searchxm=username&keyword="+username+"'><img alt='Find more posts by "+username+"' src=images/"+findimg+" border=0></a>&nbsp;");
//document.write("<a href=mailto:"+email+"><img alt='Send mail to "+username+"' src=images/"+emailimg+" border=0></a> ");
document.write("<a href='retopic.asp?id="+topicid+"&quote=1&replyid="+replyid+"&topic="+topic+"'><img alt='Quote This topic' src=images/"+replyimg+" border=0></a>&nbsp;");
document.write("<a href='retopic.asp?id="+topicid+"&replyid="+replyid+ "&topic="+topic+"'><img src=images/"+replynowimg+" border=0 alt='Reply this topic' ></a>&nbsp;");
document.write("<a href='EditTopic.asp?id="+topicid+"&replyid="+replyid+"&topic="+topic+"'><img src=images/"+editimg+" border=0 alt='Edit this topic'></a>&nbsp;");
if (membercode>4)
{
document.write("<a href=manage.asp?menu=deltopic&id="+topicid+"&replyid="+replyid+"><img src=images/"+delimg+" border=0 alt='Delete this topic'></a>");
}
document.write("</td>");
document.write("</tr>");

document.write("</table>");
}

function SmallShowList(id,bbsname,intro,moderated,today,toltopic,tolrestore)
{
intro = intro.replace(/<br>/ig,"\n");

i++;
if (i==1){document.write("<tr>")}

document.write("<td><table border=0 width=100% cellspacing=0 cellpadding=4><tr bgcolor=FFFFFF><td colspan=3 title='"+intro+"'>『 <a href=ShowForum.asp?forumid="+id+">"+bbsname+"</a> 』</td></tr><tr bgcolor=FFFFFF><td>今日:<font color=red>"+today+"</font></td><td>主题:"+toltopic+"</td><td>帖子:"+tolrestore+"</td></tr><tr class=a3><td colspan=3>版主：")

var list= moderated.split ('|'); 
if (list.length!=0){document.write("<a href=profile.asp?username="+list[0]+">"+list[0]+"</a>")}
if (list.length>1){document.write(" <font color=gray>...</font>")}

document.write("</td></tr></table></td>")

if (i==3){i=0;document.write("</tr>")}

}

function makeupShowList()
{
if (i!=0){
for(jj=i;jj<3;jj++){document.write("<td bgcolor=FFFFFF></td>")}
i=0
}
}

//跳转页面显示
function ShowPage(TotalPage,topage,url){

if (topage<6){long=11-topage;}
else
if (TotalPage-topage<6){long=10-(TotalPage-topage)}
else{long=5;}

for (var i=1; i <= TotalPage; i++) {
if (i < topage+long && i > topage-long || i==1 || i==TotalPage){
if (topage==i){document.write(" "+ i +" ");}else{document.write(" <a href=?topage="+i+"&"+url+">"+ i +"</a> ");}
}
}

}

//菜单
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=20	//菜单距连接文字顶端距离

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
function showmenu(e,vmenu,mod){
	which=vmenu
	menuobj=document.getElementById("popmenu")
	menuobj.thestyle=menuobj.style
	menuobj.innerHTML=which
	menuobj.contentwidth=menuobj.offsetWidth
	eventX=e.clientX
	eventY=e.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY

		if (rightedge<menuobj.contentwidth)
			menuobj.thestyle.left=document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX
		else
			menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
		
		if (bottomedge<menuobj.contentheight&&mod!=0)
			menuobj.thestyle.top=document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23
		else
			menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY

	menuobj.thestyle.visibility="visible"
}


function ie_y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}

function highlightmenu(e,state){
	if (document.all)
		source_el=event.srcElement
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
		}
	}
}


function hidemenu(){if (window.menuobj)menuobj.thestyle.visibility="hidden"}
function dynamichide(e){if ((ie4||ns6)&&!menuobj.contains(e.toElement))hidemenu()}
document.onclick=hidemenu
document.write("<div class=menuskin id=popmenu onmouseover=highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event)></div>")
//菜单END

function loadThreadFollow(ino,online){
var targetImg =eval("followImg" + ino);
var targetDiv =eval("follow" + ino);
if (targetDiv.style.display!='block'){
targetDiv.style.display="block";
//targetImg.src="images/minus.gif";
if(targetImg.loaded=="no"){document.frames["hiddenframe"].location.replace("loadtree.asp?id="+ino+"&forumid="+online+"");}
}else{
targetDiv.style.display="none";
//targetImg.src="images/plus.gif";
}
}

function loadThreadonline(ino,online){
var targetImg =eval("followImg" + ino);
var targetDiv =eval("follow" + ino);
if (targetDiv.style.display!='block'){
targetDiv.style.display="block";
targetImg.src="images/minus.gif";
if(targetImg.loaded=="no"){document.frames["hiddenframe"].location.replace("loading.asp?id="+ino+"&forumid="+online+"");}
}else{
targetDiv.style.display="none";
targetImg.src="images/plus.gif";
}
}
document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")

