var i=0;
var c=0;
var ii=3;


var a=4;
function create() { 
this.under = '' 
}
b = new Array() 
for(var jq=1; jq<=a; jq++) { b[jq] = new create() } 
b[1].under = ''
b[2].under = ''
b[3].under = ''
b[4].under = ''

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;}}


//显示Article
function ShowPost(id,UserName,content,posttime,honor,face,sex,birthday,experience,membercode,faction,consort,magicpower,power,money,mypet,postcount,posttopic,deltopic,addDate,logins,userlife,building,UserEmail,homepage,sign,myshow,lastlogin,lock,userxz,timesum,timesum1,timesum2,ww)
{
document.write("<table  style=TABLE-LAYOUT:fixed cellPadding=0 width=97% align=center border=0 cellSpacing=0>");
 
document.write("<tr><td width=170 align=center valign=top class=a9>");

idnum=id

//--------形象判断是否在线------------------
var linkname="匿名用户"
if (ww!="匿名用户") {linkname=UserName}

else{linkname=ww}

document.write("<br><img src='"+face+"'  onload='javascript:if(this.width>120)this.width=120;' align=center><br><br>");



document.write("<table width='80%' border=0 align=center cellpadding=0 cellspacing=0 height=100 ><tr><td><img src=images/showleft/q1.gif>Name：<font color=#cc9b74 ><b>"+linkname+"</b></font><br><img src=images/showleft/q1.gif>Grade："+level(experience,membercode,UserName,moderated)+levelname+"<br>");

if(onlinelist.indexOf("|"+UserName+"|") == -1 ){
document.write("<img src=images/showleft/q.gif>State：off-line<br>");
}else{
document.write("<img src=images/showleft/q.gif>State：on-line<a style=cursor:hand onclick=\"javascript:open('friend.asp?menu=post&incept="+UserName+"','','width=520,height=450')\">[Message]</a><br>");
}

document.write("<img src=images/showleft/q1.gif>life：<img border=0 src=images/bar/0.gif width="+userlife/2+" height=9 alt="+userlife+"><br>");





//-----left end-----

document.write("</td></tr></table></td><td height='100%'>");
if (ww!="匿名用户") {
document.write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 height='100%'><tr style='background-color:#f4f4f4'><td colspan=3 width=80% style='padding:3; border-bottom:#dcdcdc solid 1px;'>&nbsp;<a href='Profile.asp?UserName="+UserName+"' title='View "+linkname+" Personal data'> Information </a> &nbsp;<a style=cursor:hand onclick=\"javascript:open('friend.asp?menu=post&incept="+UserName+"','','width=520,height=350')\" title='Send out the message interest give"+linkname+"'> Message </a> &nbsp;<a href='friend.asp?menu=add&UserName="+UserName+"' title='Join"+linkname+"into the good friend'> Good friend </a> &nbsp;<a href='search.asp?menu=ok&search=author&searchxm=UserName&content="+UserName+"' title='View "+linkname+" article'> Article </a>");}
else{document.write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 height='100%'><tr style='background-color:#f4f4f4'><td colspan=3 width=80% style='padding:3; border-bottom:#dcdcdc solid 1px;'>&nbsp;<a href='Profile.asp?UserName="+UserName+"' title='View "+linkname+" personal data'> Information </a> &nbsp; Message  &nbsp; Friend  &nbsp; Article");}


i=i+1
if (i<2){
document.write(" &nbsp; <a href=javascript:copyText(document.all.yu"+id+") title=Make duplicate this article>Copy </a>&nbsp;  <a href='retopic.asp?id="+topicid+"&retopicid="+id+"&quote=1&topic="+topic+"' title=The adduction replies this article>Quote</a> &nbsp; <a href='retopic.asp?id="+topicid+"&topic="+topic+"' title=Reply this article>Reply</a></td><td style='padding:3;color:#7B7B7B'class='a10' align=right><b>1 Floor</b>&nbsp;</td></tr>");}
else{
document.write(" &nbsp;  <a href=javascript:copyText(document.all.yu"+id+") title=Make duplicate this article>Copy</a>&nbsp;&nbsp;&nbsp;<a href='retopic.asp?id="+topicid+"&retopicid="+id+"&quote=1&topic="+topic+"' title=The adduction replies this article>Quote</a>&nbsp;&nbsp;&nbsp;<a href='retopic.asp?id="+topicid+"&topic="+topic+"' title=Reply this article>Reply</a></td><td align=right style='padding:3; border-bottom:#cecbce solid 1px;border-right:#dcdcdc  solid 1px;'><font color='7B7B7B'><b>"+i+"</b></font> Floor&nbsp;&nbsp;</td></tr>");}

document.write("<tr vAlign=top><td colSpan=4 height=100% style='word-break:break-all;padding:8 8 8 20;line-height:22px;letter-spacing:3px;color:#988c74;border-right:#dcdcdc  solid 1px;'>");



if(badlist.indexOf(UserName) == -1 ){

if (lock==1){
document.write("<span id=yu"+id+">================================<br><font color=red>The user has been spoken administrator shielding　　</font><br>================================</span>")
}
else{


document.write(ybbcode("<span id=yu"+id+">"+content+"</span>"));

}


}else{
document.write("<span id=yu"+id+">==============================<br>　　　<font color=RED>A son has already is filter　　</font><br>==============================</span>")
}
document.write("</td></tr>")


document.write("<tr vAlign=top style='padding:3px;'><td width=30% class='a11'>&nbsp;&nbsp;<a href='EditTopic.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+"' title='Edit' class='post'>Edit</a>&nbsp;&nbsp;<a href=manage.asp?menu=deltopic&id="+topicid+"&retopicid="+idnum+" title='Delete'class='post'>Delete</a>&nbsp;");
document.write("<a onMouseOver=\"showmenu(event,'<div class=menuitems><a class=post href=manage_post.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+">management</a></div><div class=menuitems>");
if (lock == 0) 
document.write("<a class=post href=manage.asp?menu=lockpage&id="+topicid+"&retopicid="+id+">Target</a>");
if (lock == 1) 
document.write("<a  class=post href=manage.asp?menu=unlockpage&id="+topicid+"&retopicid="+id+">relief target</a>");
document.write("</div>')\" style=cursor:hand class=post> Manage</a>");
document.write("</td><td align=right valign=bottom class='a11'colspan=3 style='border-right:#dcdcdc solid 1px;color:#8B8B8B'> date："+posttime+"　<a class=post href=manage.asp?menu=lookip&id="+topicid+"&retopicid="+idnum+">IP</a>&nbsp;&nbsp;<a class=post  href=# title='TOP'>TOP</a>&nbsp;</td></tr></table></td></tr></table>");
}

//帖间个人信息美化
function ShowSpeakInfo(id){
if(!id){id = 0;}
return aSpeak[id]+'：';
}

function show1(num,sss) {
	for (ii=1;ii<=4;ii++) 
	{
	eval("d1"+sss+ii).style.display="none";
	eval("bt1"+sss+ii).style.background = "url('images/showleft/t_bt_off.gif')";
	}
	eval("d1"+sss+num).style.display="";
	eval("bt1"+sss+num).style.background = "url('images/showleft/t_bt_on.gif')";
}

//Article列表
function ShowForum(ID,topic,newtopic,UserName,Views,icon,toptopic,locktopic,pollresult,goodtopic,replies,lastname,lasttime,w,lastname2)
{
topic = topic.replace(key_word,"<font color=red>"+key_word+"<\/font>");

if (toptopic == 2) {reimage="<img src=images/top.gif border=0>"}
else
if (toptopic == 1) {reimage="<img src=images/f_top.gif border=0>"}
else
if (locktopic== 1) {reimage="<img src=images/f_locked.gif border=0>"}
else
if (pollresult!= '') {reimage="<img src=images/f_poll.gif border=0>"}
else
if ((replies>15) || (Views>150)) {reimage="<img src=images/f_hot.gif border=0>"}
else
if (replies>0) {reimage="<img src=images/f_new.gif border=0>"}
else{reimage="<img src=images/f_norm.gif border=0>"}

if (goodtopic== 1) {reimage2="&nbsp;&nbsp;<img src=images/topicgood.gif style='margin:-3;'>"}
else
if (UserName == cookieUserName) {reimage2="<img src=images/my.gif>"}
else{reimage2=""}

if (replies>0) {reimage3=replies}
else{reimage3="-"}

document.write("<tr height=45><td align=middle width=3% class=a4>"+reimage+"</td>")
var linkname=""
if (w== "匿名用户") {linkname=w}
else{linkname=UserName}

var lastname_1=""
if (lastname2== "匿名用户") {lastname_1=lastname2}
else{lastname_1=lastname}

if (toptopic == 2){

document.write("<td class=a4 width=48% align=left colspan=2 >&nbsp;&nbsp;<img src=images/plus.gif> <a href=ShowPost.asp?id="+ID+" title='Topic author:"+linkname+"&#13;&#10;Reply author:"+lastname+"'class=forum>"+topic+"</a>"+reimage2+"")
}else if (toptopic == 1){
document.write("<td class=a4 width=48% align=left colspan=2 >&nbsp;&nbsp;<img src=images/plus.gif> <a href=ShowPost.asp?id="+ID+" title='Topic author:"+linkname+"&#13;&#10;Reply author:"+linkname+"'class=forum>"+topic+"</a>"+reimage2+"")
}else{
document.write("<td class=a4 width=48% align=left colspan=2 >&nbsp;&nbsp;<img loaded=no src=images/plus.gif id=followImg"+ID+" style=cursor:hand onclick=loadThreadFollow("+ID+")> <a href=ShowPost.asp?id="+ID+" title='Topic author:"+linkname+"&#13;&#10;Reply author:"+lastname_1+"' class=forum>"+topic+"</a>"+reimage2+"")
}

if (replies > 15) {
var topicpage=""
var tol=replies/15+1;

for (var i=1; i < tol; i++) {
if(i<4 || i>=tol-2){
topicpage=topicpage+"<b><a href=ShowPost.asp?id="+ID+"&topage="+ i +">"+ i +"</a></b> ";
}
if (i >= tol-3  && i<tol-2 && i>3){topicpage=topicpage+" ... ";}
}
document.write(" ( <img src=images/multipage.gif> "+topicpage+")");
}


document.write(" </td><td align=middle width=9% class=a4><a href=Profile.asp?UserName="+UserName+">"+linkname+"</a></td><td align=middle width=6% class=a4>"+reimage3+"</td><td align=middle width=7% class=a4>"+Views+"</td><td width=27% class=a4 align=middle valign=middle>&nbsp;"+lasttime+"<a href=Profile.asp?UserName="+lastname+">"+lastname_1+"</a></td></tr>");
document.write("<tr height=25 style=display:none id=follow"+ID+"><td width=3% class=a4>　</td><td id=followTd"+ID+" align=left class=a4 width=97% colspan=6>　Loading...</td></tr>");
}


//论坛列表
function ShowList(pass,id,bbsname,icon,intro,moderated,today,toltopic,tolrestore,lasttime,lastname,lasttopic,password)
{
if(pass >2){password=1}

document.write("<tr><td width=5% align=middle class=a3>")

if(password==1){
document.write("<img src=images/skins/"+getCookie('skins')+"/Board3.gif>")
}else{
document.write("<img src=images/skins/"+getCookie('skins')+"/Board"+pass+".gif>")
}

document.write("</td><td class=a4>")

document.write("<table border=0 width=100% cellspacing=0 cellpadding=3><tr><td valign=top>『 <a href=ShowForum.asp?forumid="+id+">"+bbsname+"</a> 』<a href=newtopic.asp?forumid="+id+"><img alt=Published an article  src=images/bic/postdirect.gif border=0></a> <a href=ShowForum.asp?forumid="+id+"&search=goodtopic><img alt=View best article src=images/bic/goodtopic.gif border=0></a> <a href=ShowForum.asp?forumid="+id+"&TimeLimit=1><img alt=View today's article src=images/bic/today.gif border=0></a>&nbsp;")
if (""+pass+""=='2')document.write("<font color=gray title='Needing to be land just can browse' style=cursor:default></font> ")
if (""+pass+""=='5')document.write("<font color=gray title='Needing the VIP just can browse' style=cursor:default>VIP论坛</font> ")
if (""+pass+""=='6')document.write("<font color=gray title='The webmaster just can browse' style=cursor:default></font> ")
if (""+pass+""=='7')document.write("<font color=gray title='Super just can browse' style=cursor:default></font> ")
document.write("</td></td><td rowspan=2 align=right>")


if (icon!=''){
document.write("<img src="+icon+" onload='javascript:if(this.width>100)this.width=100;if(this.height>60)this.height=60;'>")
}

document.write("</td>")

if(password==1){
document.write("<td rowspan=2 width=30%>Topic:"+lasttopic+"<br>Author:<a href=Profile.asp?UserName="+lastname+">"+lastname+"</a><br>Time:"+lasttime+"")
}else{
document.write("<td rowspan=2 width=30%>Topic:"+lasttopic+"<br>Author:<a href=Profile.asp?UserName="+lastname+">"+lastname+"</a><br>Time:"+lasttime+"")
}
document.write("</td></tr><tr><td>"+ybbcode(intro)+"</td></tr><tr class=a3><td> Webmaster：")

var list= moderated.split ('|'); 
for(i=0;i<list.length;i++) {
if (list[i] !=''){
document.write("<a href=profile.asp?UserName="+list[i]+">"+list[i]+"</a> ")
}

}

document.write("</td><td></td><td><table border=0 width=100% cellspacing=0><tr><td width=33%>Today:<b>"+today+"</b></td><td width=33%>Topic:<b>"+toltopic+"</b></td><td width=33%>Article:<b>"+tolrestore+"</b></td></tr></table></td></tr></table></td></tr>")
i=0;
}


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 class=a3><td colspan=3 title='"+intro+"'>『 <a href=ShowForum.asp?forumid="+id+"&forskins=1>"+bbsname+"</a> 』</td></tr><tr class=a3><td>Today:<b>"+today+"</b></td><td>Topic:<b>"+toltopic+"</b></td><td>Article:<b>"+tolrestore+"</b></td></tr><tr class=a3><td colspan=3>Webmaster：")

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<5){PageLong=10-topage;}
else
if (TotalPage-topage<5){PageLong=9-(TotalPage-topage)}
else{PageLong=4;}

for (var i=1; i <= TotalPage; i++) {
if (i < topage+PageLong && i > topage-PageLong ){   //加条件||i=1||i=TotalPage就总有首页和尾页
if (topage==i){document.write("<span style='color:#990000'> "+ i +"</span> ");}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

// add area script
function focusEdit(editBox)
{
 if ( editBox.value == editBox.helptext )
 {
 editBox.value = '';
 editBox.className = 'editbox';
 }
 return true;
}
function blurEdit(editBox)
{
 if ( editBox.value.length == 0 )
 {
 editBox.className = 'editbox Graytitle';
 editBox.value = editBox.helptext;
 }
}
function ValidateTextboxAdd(box, button)
{
 var buttonCtrl = document.getElementById( button );
 if ( buttonCtrl != null )
 {
 if (box.value == "" || box.value == box.helptext)
 {
 buttonCtrl.disabled = true;
 }
 else
 {
 buttonCtrl.disabled = false;
 }
 }
}
// add area script end

function loadtree(ino,bbsname){
document.frames["hiddenframe"].location.replace("ForumTree.asp?id="+ino+"")
}


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("loading.asp?id="+ino+"&forumid="+online+"");}
}else{
targetDiv.style.display="none";
targetImg.src="images/plus.gif";
}
}

function loadThreadFollow2(){
if (hidden0.style.display!='block'){
hidden0.style.display="block";
hidden1.style.display="none";
followImgJ.src="images/minus.gif";
 }else{
hidden0.style.display="none";
hidden1.style.display="block";
followImgJ.src="images/plus.gif";
}
}


document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")

