
var i=0;
var ii=3;
var kj=1;
var is_max=1;
function yuzi_img(e, o)
{
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom += event.wheelDelta / 12;
if (zoom > 0) o.style.zoom = zoom + '%';
return false;
}

function min_yuzi(){
if(top!=self){
if(kj==1){parent.main_frame.rows='0,*';}
if(getCookie('frame')=='1'){parent.main_frame.rows='50%,*';}
}
}

function img(){if(top!=self){parent.main_frame.rows='*,20';parent.yuzi_frame.kj=1}}



function heartBeat(){
diffY=document.body.scrollTop;
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.all.yuzi.style.pixelTop+=percent;
lastScrollY=lastScrollY+percent;
}
//显示帖子
function ShowPost(lock,id,username,content,posttime,honor,userface,sex,birthday,experience,membercode,faction,consort,money,postcount,regtime,userlife,usermail,userhome,sign,logo)
{
document.write("<table class=a2 cellspacing=1 cellpadding=0 id=mainwidth style=TABLE-LAYOUT:fixed 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=160 align=center border=0 ><tr><td>");

document.write("<table border=0 cellspacing=0 width=95% ><tr><td style=filter:glow(color=#ff9933) align=center><font style=font-size:10pt><b>"+username+"</b></font><br>"+honor+"</td>")
document.write("</tr></table>");

if (getCookie('showface')!='0'){
document.write("<table border=0 width=120 height=120 align=center><tr><td align=middle class=row1><img src='"+userface+"' onload='javascript:if(this.width>100)this.width=100;if(this.height>120)this.height=120;' onerror=\"this.src='images/orr.gif'\" ></td></tr></table>");
}

if (username=="游客") {document.write("<br><table><tr><td width=130>&nbsp;&nbsp;&nbsp;感谢您对本社区的关注，欢迎<a href=register.asp style=color:red title=点此快速成为我们的一员>加入</a>我们。</td></tr></table>")}
else{
document.write("<table><tr><td class=row1 width=145>&nbsp;"+level(experience,membercode,username,moderated)+levelimage+"</td></tr><br><tr><td class=row1>&nbsp;□-等级:"+levelname+"</font><br></td></tr>");
if (""+faction+"" !="") {document.write("<tr><td class=row1>&nbsp;□-门派:<a style=cursor:hand onclick=\"javascript:open('faction.asp?menu=look&faction="+faction+"','','toolbar=no')\">"+faction+"</a><br></td></tr>");}
if (""+consort+"" !="") {document.write("<tr><td class=row1>&nbsp;□-爱人:"+consort+"<br></td></tr>");}
document.write("<tr><td class=row1>&nbsp;□-经值:"+experience+"<br></td></tr>");
document.write("<tr><td class=row1>&nbsp;□-金币:"+money+"<br></td></tr>");
document.write("<tr><td class=row1>&nbsp;□-发贴:"+postcount+"<br></td></tr>");
document.write("<tr><td class=row1>&nbsp;□-注册:"+regtime+"<br></td></tr>");
document.write("<tr><td class=row1>&nbsp;□-体力:"+userlife+"<br></td></tr>");
if(onlinelist.indexOf("|"+username+"|") == -1 ){
document.write("<tr><td class=row1>&nbsp;□-状态:<font color=gray>离线</font><br></td></tr>");
}else{
document.write("<tr><td class=row1>&nbsp;□-状态:<font color=#ff00ff>在线</font><br></td></tr>");
}
document.write("<tr><td class=row1 >&nbsp;□-音乐<a href=index.htm style=color:teal>『开』</a><a href=index.asp target=_top style=color:red>『关』</a><br></td></tr></table>");
}
document.write("</td></tr></table>")

document.write("</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><tr><td>");

if (username!="游客") 
{
document.write("<a  href='Profile.asp?username="+username+"' title='查看"+username+"的个人资料'>资料</a><a href='###' style=cursor:hand onclick=\"javascript:open('friend.asp?menu=post&incept="+username+"','','width=320,height=170')\" title='发送短讯息给"+username+"'>┊短信</a><a href='friend.asp?menu=add&username="+username+"' title='把"+username+"加入好友'>┊好友</a><a  href='searchok.asp?search=author&searchxm=username&content="+username+"' title='搜索"+username+"发表过的所有主题'>┊搜索</a><a href=mailto:"+usermail+" title='发送电邮给"+username+"'>┊邮件</a>┊");

if (userhome!="" && userhome!="http://"){
document.write("<a target=_blank href="+userhome+" title=访问"+userhome+"的主页>主页</a>┊");
}
}
i=i+1
document.write("<a href=javascript:copyText(document.all.yu"+id+") title=复制这个帖子>复制</a><a  href='retopic.asp?id="+topicid+"&retopicid="+id+"&quote=1&topic="+topic+"' title=引用回复这个帖子>┊引用</a><a  href='EditTopic.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+"' title=编辑该帖子>┊编辑</a><a  onclick=checkclick('您确定要删除回贴?')  href=manage.asp?menu=deltopic&id="+topicid+"&retopicid="+id+" title=删除该帖子>┊删除</a>┊<a href=manage_post.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+">奖罚</a></td><td align=right valign=middle>第&nbsp;<font color=red><b>"+i+"</b></font>&nbsp;楼&nbsp;<a href=#di><font size=5 face=Wingdings color=#2983d9 title=直到楼底>H</font></a></td></tr><tr valign=top><td colspan=2 style=word-break:break-all align=center>");
if (lock == 1) {
document.write("<span id=yu"+id+">==============================<br><font color=RED>该用户发言已被管理员屏蔽　　　</font><br>==============================</span>")
}
else
if(badlist.indexOf(username) == -1 ){

document.write("<br><fieldset class=showwidth style='border:1px solid #a4b6d7;'><legend><font color=#ff0000>"+username+"：</font>")
document.write("<SELECT onchange=yu"+id+".style.fontSize=this.value; class=a3 style=color:green;cursor:default><option style=cursor:default selected>字号</option><OPTION value=12pt style=cursor:default>12号</OPTION><OPTION value=14pt style=cursor:default>14号</OPTION><OPTION value=16pt style=cursor:default>16号</OPTION><OPTION value=19pt style=cursor:default>19号</OPTION><OPTION value=24pt style=cursor:default>24号</OPTION></SELECT>");
document.write("<\/legend><table class=tablebody2 border=0 align=center cellspacing=0 cellpadding=0 width=90%><tr><td vAlign=middle><br>");
document.write(ybbcode("<span id=yu"+id+" class=showwidth style=word-wrap:break-word;overflow:hidden;PADDING-RIGHT:5px;PADDING-LEFT:5px;line-height:1.5;font-size:11pt>"+content+"</span>"));
document.write("<br><br><br><br></td></tr>");	
document.write("</table><\/fieldset>");
}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% border=0><tr><td align=right valign=bottom colspan=3>")
if (getCookie('sign')!='0' && sign!=""){document.write("<img src=images/sign.gif><br>"+ybbcode(sign)+"");}
document.write("</td></tr></table></td></tr>")

document.write("</table></td></tr><tr><td><table cellspacing=0 cellpadding=0 width=100% align=center border=0 class=a"+ii+"><tr><td valign=middle width=170><a href=manage.asp?menu=lookip&id="+topicid+"&retopicid="+id+"><img src=images/ip.gif border=0 title=查看IP></a>时间："+posttime+"</td><td valign=bottom align=middle class=a2 border=1 width=1 height=100%></td><td  align=left colspan=3 valign=middle>")
if(logo!=''){
var list=logo.split('|');
chushi=list.length-1
index = Math.floor(Math.random() * chushi+1);
vv=list[index]
gogo=ybbcode(vv)
document.write("<font color=red>广告：</font>"+gogo+"");
}
else{}
document.write("</td><td align=right width=10><a href=#><font size=5 face=Wingdings color=#2983d9 title=返回楼顶>G</font></a></td></tr></table></td></tr></table>");
}
//帖子列表

function ShowForum(ID,topic,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 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="<img src=images/topicgood.gif border=0>"}

else{reimage2=""}

if (replies>0) {reimage3=replies}
else{reimage3="-"}
index = Math.floor(Math.random() * 24+1);
document.write("<tr height=25 ><td align=middle width=5% class=a3><a style=cursor:default href='manage.asp?menu=deltopic&id="+ID+"'\">"+reimage+"<\/a></td>");
document.write("<td class=a4 width=56% onmouseout=\"this.className='a4'\" onmouseover=\"this.className='a3'\"><a target=_blank href=ShowPost.asp?id="+ID+" ><img loaded=no border=0 src=images/brow/" + index + ".gif  border=0 title=开新窗口阅读该主题></a>")
if (icon=="88") {
document.write(" <a   href=ShowPost.asp?id="+ID+"><span id="+ID+">"+ybbcode(topic)+"</a></span>"+reimage2+"");}
else{
document.write(" <a   href=ShowPost.asp?id="+ID+"><span id="+ID+" title='主    题："+topic+"<br>作   者："+username+"<br>更   贴："+lastname+"<br>时   间："+lasttime+"'>"+topic+"</span></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(""+newtopic+"");

document.write("</td><td align=middle width=9% class=a3>")
document.write("<a href=Profile.asp?username="+username+" title=查看["+username+"]的资料>"+username+"</a></td><td align=middle width=6% class=a4>"+reimage3+"</td><td align=middle width=7% class=a3>"+Views+"</td><td width=17% class=a4 align=center><a href=Profile.asp?username="+lastname+" title=查看["+lastname+"]的资料>"+lastname+"</a></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 class=a4>")

if (""+today+""=='0'){
document.write("<img src=images/skins/"+getCookie('skins')+"/off.gif title=今日无新贴！> ")
}
else {
document.write("<img src=images/skins/"+getCookie('skins')+"/on.gif title=今日有新贴！> ")
}

document.write("</td><td>")

document.write("<table border=0 width=100% cellspacing=0 cellpadding=3 class=a4><tr><td valign=top id="+id+">『 <a href=ShowForum.asp?forumid="+id+" id="+id+">"+bbsname+"</a> 』&nbsp;")
if (""+pass+""=='2')document.write("<font color=gray title=需要登陆才可浏览 style=cursor:default>会员论坛</font> ")
if (""+pass+""=='3')document.write("<font color=gray title=需要有VIP资格才可浏览 style=cursor:default>VIP论坛</font> ")
if (""+password+""!="1")document.write("<a href=newtopic.asp?forumid="+id+"><img alt=在该论坛发表文章 src=images/fabiao1.gif border=0></a> <a href=ShowForum.asp?forumid="+id+"&search=goodtopic><img alt=查看该论坛的精品文章 src=images/good1.gif border=0></a> &nbsp;")

document.write("</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=33% align=center><span id=27>秘密基地</span>")
}else{
document.write("<td rowspan=2 width=33%>主题:"+lasttopic+"<br>作者:<a href=Profile.asp?username="+lastname+" title=查看["+lastname+"]的资料>"+lastname+"</a><br>时间:"+lasttime+"")
}
document.write("</td></tr><tr><td style=cursor:default><img src=images/readme.gif>"+ybbcode(intro)+"</td></tr><tr class=a3><td> 版主：")

var list= moderated.split ('|'); 
for(i=0;i<list.length;i=i+1) {
if (list[i] !=''){
document.write("<a href=profile.asp?username="+list[i]+" title=查看斑竹["+list[i]+"]的资料"+">"+list[i]+"</a> ")
}
else{
document.write("<span  style=cursor:hand;color:gray title='<font color=green>点击申请该斑竹职位！</font>' onclick=shenqing()>[虚位以待]</span>")
}
}

document.write("</td><td >&nbsp;</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>")


}

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 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=a4><td colspan=3 >『 <a href=ShowForum.asp?forumid="+id+"  title=\""+ybbcode(intro)+"\" id="+id+">"+bbsname+"</a> 』</td></tr><tr class=a4><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
}
}
//菜单
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.onmousemove=HIDEMENU
document.write("<div class=menuskin id=popmenu onmouseover=highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event)></div>")
function HIDEMENU(){
var menuobj=document.getElementById("popmenu")
var mouxl=parseInt(menuobj.style.left);
var mouxr=parseInt(menuobj.style.left)+100;
var mousex=window.event.x;
if (mousex<mouxl ||  mousex>mouxr) menuobj.thestyle.visibility="hidden";

}


//跳出确认
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
//跳转页面显示
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> ");}
}
}

}
//菜单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";
}
}

document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")


function shenqing(){
var id=prompt("请输入要申请的版块名称！及申请理由！","");if(id){document.location='?menu=shenqing&shenqing='+id+'';}
}
