var il=0;
var xx=0
var ii=3;
var duihua=1

//读取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 ShowPost(id,username,content,posttime,honor,userface,sex,birthday,experience,membercode,uservip,faction,consort,building,money,mypet,petpic,levelpic,postcount,regtime,userlife,jiangz,usermail,userhome,clubname,sign,intro2,myshow,thanksmoney,job,goodtopic,goodguanli,hottopic,hotguanli)
{

document.write("<table class=a2 cellspacing=1 cellpadding=0 width=760 align=center border=0><tr><td valign=top align=left><table style=BORDER-COLLAPSE: cellspacing=0 cellpadding=3 width=100% border=0 height=1%>");
ii++
if(ii==5){ii=3}
document.write("<tr class=a"+ii+"><td valign=top width=160 rowspan=4 height=250>");
document.write("<table cellspacing=0 cellpadding=0 width=90% align=center border=0><tr><td>");
document.write("<table border=0 cellspacing=0 width=95%><tr><td style=filter:glow(color=#ff9933)><font style=font-size:10pt><b>"+username+"</b></font><br>"+honor+"</td><td align=right valign=top width=40>");

if (""+sex+""!=''){
document.write("<img src=images/"+sex+".gif>　")
}

document.write(astro(""+birthday+""));
document.write("</td></tr></table>");




if (getCookie('showface')!='0'){
document.write("<table width=90% border=0><tr><td align=middle width=120><img src='"+userface+"' onload='javascript:if(this.width>120)this.width=120;if(this.height>180)this.height=180;'><br><A href='myshow.asp'><center>我的形象</center></a></td></tr></table>")
}


document.write("<center>")
if (""+mypet+"" !="") {document.write("<font color=red>我的宝宝:<b>"+mypet+"</b></font><br>");}else{
document.write("<font color=red><b><a href='petshop.asp'>快努力赚钱买宝宝吧</a></b></font><br>");
}
document.write("</center>")

document.write("<br>"+level(experience,membercode,username,moderated)+levelimage+"<br>等　　级:"+levelname+"<br>");

if (""+faction+"" !="") {document.write("门　　派:<a style=cursor:hand onclick=\"javascript:open('faction.asp?menu=look&faction="+faction+"','','toolbar=no')\">"+faction+"</a><br>");}
if (""+consort+"" !="") {document.write("配　　偶:"+consort+"<br>");}
if (""+job+"" !="") {document.write("社区职业:"+job+"<br>");}
if (""+building+"" !="") {document.write("社区住宅:"+building+"<br>");}
experienceyouth=parseInt(experience/150);
document.write("经 验 值:"+experience+"<br>");

document.write("Ｌ　　Ｐ:"+money+"<br>");

document.write("总发贴数:"+postcount+"<br>");
document.write("注册时间:"+regtime+"<br>");
document.write("体 力 值:<img border=0 src=images/bar/0.gif width="+userlife/2+" height=9 alt="+userlife+"><br>");
if(onlinelist.indexOf("|"+username+"|") == -1 ){
document.write("在线状态:<img border=0 src=images/offline1.gif alt='离线'><br>");
}else{
document.write("在线状态:<img border=0 src=images/online1.gif alt='在线'><br>");
}
if (""+jiangz+"" !="") {document.write("<img border=0 src=images/banzhujz.gif alt='奖章' ><font color='ff0000'><b>"+ybbcode(jiangz)+"</b></font><br>");}

document.write("<a href='shop.asp?menu=flowers&vs="+username+"' target='_blank'>鲜花</a>&nbsp;"+"<a href='shop.asp?menu=egg&vs="+username+"' target='_blank'>鸡蛋</a>"+"<br>"+"(需5ＬＰ)"+"<br>");

document.write("</td></tr></table></td><td valign=bottom align=middle rowspan=4><table height=100% class=a2 cellspacing=0 cellpadding=0 width=1><tr><td width=1></td></tr></table></td><td valign=top align=left colspan=3><table cellspacing=0 cellpadding=0 width=100% border=0>");
document.write("<tr><td><a href='Profile.asp?username="+username+"'><img alt='查看"+username+"的个人资料' src=images/Profile.gif border=0></a> <a style=cursor:hand onclick=\"javascript:open('friend.asp?menu=post&incept="+username+"','','width=320,height=170')\"><img src=images/pm.gif border=0 alt='发送短讯息给"+username+"'></a> <a href='friend.asp?menu=add&username="+username+"'><img alt='把"+username+"加入好友' src=images/friend.gif border=0></a> <a href='searchok.asp?search=author&searchxm=username&content="+username+"'><img alt='搜索"+username+"发表过的所有主题' src=images/find.gif border=0></a> <a href=mailto:"+usermail+"><img alt='发送电邮给"+username+"' src=images/email.gif border=0></a> ");

if (userhome!="" && userhome!="http://"){
document.write("<a target=_blank href="+userhome+"><img alt=访问"+userhome+"的主页 src=images/homepage.gif border=0></a>");
}

if (il==0){
document.write(" <a href=javascript:copyText(document.all.yu"+id+")><img alt=复制这个帖子 src=images/copy.gif border=0></a> <a href='retopic.asp?id="+topicid+"&retopicid="+id+"&quote=1&topic="+topic+"'><img alt=引用回复这个帖子 src=images/reply.gif border=0></a> <a href='retopic.asp?id="+topicid+"&topic="+topic+"'><img src=images/replynow.gif border=0 alt=回复这个帖子></a></td><td align=right><font color=red><b>楼  主</b></font>&nbsp;</td></tr><tr valign=top><td colspan=2 style=word-break:break-all><hr width=100% color=777777 size=1>");
}else{
document.write("<a href=javascript:copyText(document.all.yu"+id+")><img alt=复制这个帖子 src=images/copy.gif border=0></a> <a href='retopic.asp?id="+topicid+"&retopicid="+id+"&quote=1&topic="+topic+"'><img alt=引用回复这个帖子 src=images/reply.gif border=0></a> <a href='retopic.asp?id="+topicid+"&topic="+topic+"'><img src=images/replynow.gif border=0 alt=回复这个帖子></a></td><td align=right>第<font color=red><b>"+il+"</b></font>楼&nbsp;</td></tr><tr valign=top><td colspan=2 style=word-break:break-all><hr width=100% color=777777 size=1>");
}
il=il+1
if(duihua==0){
if(badlist.indexOf(username) == -1 ){
document.write(ybbcode("<span id=yu"+id+">"+content+"</span>"));
}else{
document.write("<span id=yu"+id+">==============================<br>　　　<font color=RED>该用户帖子已被过滤　　　</font><br>==============================</span>")
}
}else{
if(badlist.indexOf(username) == -1 ){
document.write("<table class=tablebody2 border=0 align=center cellspacing=0 cellpadding=0><tr><td><img src=images/c1.gif></td><td background=images/s1.gif align=center></td><td><img src=images/c2.gif></td></tr><tr><td vAlign=middle background=images/s4.gif></td><td width=100% id=fontsize22 bgColor=#fffff1 style=word-wrap:break-word;width:500>");
document.write("<font color=#bbbbbb>"+username+"<img src=images/yuqi.gif> ：</font><br><br>");	
document.write(ybbcode("<span id=yu"+id+">"+content+"</span>"));
document.write("</td><td vAlign=middle background=images/s2.gif></td></tr><tr><td vAlign=top><img src=images/c4.gif></td><td background=images/s3.gif align=left><img src=images/dd1.gif width=36 height=42></td><td align=right><img src=images/c3.gif></td></tr></table>");	

if (myshow!="")
{
document.write("<DIV style='padding:0;position:relative;top:0;left:0;height:190px;overflow:hidden'><div id='bodyshow"+id+"' style='border:0px solid #000000;padding:0;POSITION: relative; Left: 0; TOP: -35; HEIGHT: 113px;  WIDTH: 70px;'></div></div>");
showit(myshow,id);
}
else
{
if (""+sex+""!=''){
document.write("<img src=images/"+sex+"blank.gif>　");
}
else
{document.write("<img src=images/maleblank.gif>　");
}


}

if (mypet!="")
{document.write("<img src=images/pet/"+petpic+"/"+petpic+levelpic+".gif >")}

document.write("<font color=#ff0066>"+username+"这样说.");
if (thanksmoney!='0') {document.write("并给楼主"+thanksmoney+"ＬＰ")};
document.write("<br><br><br><font color=#bbbbbb>本文版权归<strong>[</strong>"+username+"<strong>]</strong>和<strong>[</strong>"+clubname+"<strong>]</strong>共同所有，未经同意请勿转载</font>");

if (goodtopic=='1') {document.write("<center><font color=#ff0000>本贴被</font><font color=#0000cd>"+goodguanli+"</font><font color=#ff0000>设置成精华贴,奖励10点经验值,60LP</font></center>")};

if (hottopic=='1') {document.write("<p><center><font color=#ff0000>本贴被</font><font color=#0000cd>"+hotguanli+"</font><font color=#ff0000>设置成热门贴,奖励10点经验值,30LP</font></center></p>")};

}else{
document.write("<span id=yu"+id+">==============================<br>　　　<font color=RED>该用户帖子已被过滤　　　</font><br>==============================</span>")
}
}
document.write("</td></tr></table></td></tr><tr class=a"+ii+"><td valign=bottom>")
document.write("<table cellspacing=0 cellpadding=0 width=100% style=TABLE-LAYOUT:fixed><tr><td align=right valign=bottom colspan=3 style=HEIGHT:100px>")
if (getCookie('sign')!='0' && sign!=""){document.write("<img src=images/qianming.gif><br>"+ybbcode(sign)+"");}





document.write("<hr width=100% color=777777 size=1></td></tr><tr class=a"+ii+"><td valign=bottom rowspan=3><a href='EditTopic.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+"'><img src=images/edit.gif border=0></a> <a onclick=checkclick('您确定要删除回贴?')  href=manage.asp?menu=deltopic&id="+topicid+"&retopicid="+id+"><img src=images/del.gif border=0></a><a onclick=checkclick('您确定要不扣分删除回贴?')  href=manage.asp?menu=deltopic1&id="+topicid+"&retopicid="+id+"><img src=images/del1.gif border=0></a></td><td valign=bottom><img src=images/posttime.gif> 发表时间："+posttime+"　</td><td valign=bottom><img src=images/ip.gif> IP：<a href=manage.asp?menu=lookip&id="+topicid+"&retopicid="+id+">已记录</a></td></tr></table>");



document.write("</td></tr></table></td></tr></table>");
}


//帖子列表
function ShowForum(ID,topic,lasttop,newtopic,username,Views,icon,toptopic,locktopic,pollresult,goodtopic,replies,lastname,lasttime)
{
topic = topic.replace(key_word,"<font color=red>"+key_word+"<\/font>");
if (toptopic == 2) {reimage="<img src=images/top.gif>"}
else
if (toptopic == 1) {reimage="<img src=images/f_top.gif>"}
else
if (locktopic== 1) {reimage="<img src=images/f_locked.gif>"}
else
if (pollresult!= '') {reimage="<img src=images/f_poll.gif>"}
else
if ((replies>15) || (Views>150)) {reimage="<img src=images/f_hot.gif>"}
else
if (replies>0) {reimage="<img src=images/f_new.gif>"}
else{reimage="<img src=images/f_norm.gif>"}

if (goodtopic== 1) {reimage2="<img src=images/topicgood.gif>"}
else
if (username == cookieusername) {reimage2="<img src=images/my.gif>"}
else{reimage2=""}

if (replies>0) {reimage3=replies}
else{reimage3="-"}

document.write("<tr height=25><td align=middle width=3% class=a4>"+reimage+"</td>");
document.write("<td width=3% class=a3 align=center>"+reimage2+"</td>");
document.write("<td class=a4 width=45%>&nbsp;<img loaded=no src=images/plus.gif id=followImg"+ID+" style=cursor:hand; onclick=loadThreadFollow("+ID+")> <a target=_blank href=ShowPost.asp?id="+ID+"><img border=0 src=images/brow/"+icon+".gif></a> <a href=ShowPost.asp?id="+ID+" onmouseover=\"showmenu(event,'<div class=menuitems>主题:《"+topic+"》</div><div class=menuitems>内容:"+lasttop+"</div>')\" style=cursor:default>"+topic+"</a>");

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(" "+newtopic+"</td><td align=middle width=9% class=a3><a href=Profile.asp?username="+username+">"+username+"</a></td><td align=middle width=6% class=a4>"+reimage3+"</td><td align=middle width=7% class=a3>"+Views+"</td><td width=27% class=a4>&nbsp;"+lasttime+" by <a href=Profile.asp?username="+lastname+">"+lastname+"</a></td></tr>");
document.write("<tr height=25 style=display:none id=follow"+ID+"><td width=3% class=a4>　</td><td width=3% class=a3>　</td><td id=followTd"+ID+" align=left class=a4 width=94% colspan=5>　Loading...</td></tr>");
}


//论坛列表
function ShowList(pass,id,bbsname,icon,intro,moderated,today,toltopic,tolrestore,lasttime,lastname,lasttopic,password)
{
document.write("<tr><td width=5% align=middle bgcolor=FFFFFF>")

if(password==1){
document.write("<img src=images/skins/"+getCookie('skins')+"/Board4.gif>")
}else{
document.write("<img src=images/skins/"+getCookie('skins')+"/Board"+pass+".gif>")
}

document.write("</td><td bgcolor=FFFFFF>")

document.write("<table border=0 width=100% cellspacing=0 cellpadding=3><tr><td valign=top>『 <a href=ShowForum.asp?forumid="+id+">"+bbsname+"</a> 』&nbsp;<a href=ShowForum.asp?forumid="+id+"&TimeLimit=1><img alt=查看该论坛当天的帖子 src=images/today.gif border=0></a> &nbsp;<a href=ShowForum.asp?forumid="+id+"&search=goodtopic><img alt=查看该论坛的精品文章 src=images/goodtopic.gif border=0></a> &nbsp;<a href=newtopic.asp?forumid="+id+"><img alt=在该论坛发表文章 src=images/postdirect.gif border=0></a></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>100)this.height=100;'>")
}

document.write("</td><td rowspan=2 width=30%>主题:"+lasttopic+"<br>作者:<a href=Profile.asp?username="+lastname+">"+lastname+"</a><br>时间:"+lasttime+"</td></tr><tr><td>"+ybbcode(intro)+"</td></tr><tr class=a3><td>")

var list= moderated.split ('|'); 
for(i=0;i<list.length;i=i+1) {
if (list[i] !=''){
if (i==1) {document.write("版主：")};
if (i==2) {document.write("  副版主：")};
document.write("<a href=profile.asp?username="+list[i]+">"+list[i]+"</a> ")
}
}

document.write("&nbsp;<a style=cursor:hand onclick=\"javascript:open('friend.asp?menu=post&incept=空山新雨','','width=320,height=170')\"><font color=#bbbbbb>[申请版主]</font></a></td><td></td><td><table border=0 width=100% cellspacing=0><tr><td width=33%>今日:<font color=red>"+today+"</font></td><td width=33%>主题:"+toltopic+"</td><td width=33%>帖子:"+tolrestore+"</td></tr></table></td></tr></table></td></tr>")

}



//菜单
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 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 showit(usershow,id)
{
	showlayers=usershow.split('>');
	str="";
	for(xx=0;xx<showlayers.length;xx++)
	{
		if(showlayers[xx]!='0' && showlayers[xx]!='')
		{
			str+="<img src=http://qqshow-item.tencent.com/"+showlayers[xx]+"/"+xx+"/00/' style='padding:0;position:absolute;top:0;left:0;width:140;height:226;z-index:"+(xx+1)+";'>";
		}
	}
	str+="<img src='http://game.qq.com/images/base/blank.gif' style='padding:0;position:absolute;top:0;left:0;width:140;height:226;z-index:100;'>";
	eval("bodyshow"+id).innerHTML=str; 

}
document.write("<iframe height=0 width=0 name=hiddenframe></iframe>");
 

 
 
