tPopWait=50;
tPopShow=5000;
showPopStep=20;
popOpacity=99;

sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText {  background-color: #444444;color:#969696; border: 1px #222222 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");

function showPopupText(){
var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
	if(o.dypop!=sPop) {
			sPop=o.dypop;
			clearTimeout(curShow);
			clearTimeout(tFadeOut);
			clearTimeout(tFadeIn);
			clearTimeout(tFadeWaiting);	
			if(sPop==null || sPop=="") {
				dypopLayer.innerHTML="";
				dypopLayer.style.filter="Alpha()";
				dypopLayer.filters.Alpha.opacity=0;	
				}
			else {
				if(o.dyclass!=null) popStyle=o.dyclass 
					else popStyle="cPopText";
				curShow=setTimeout("showIt()",tPopWait);
			}
	}
}

function showIt(){
		dypopLayer.className=popStyle;
		dypopLayer.innerHTML=sPop;
		popWidth=dypopLayer.clientWidth;
		popHeight=dypopLayer.clientHeight;
		if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
			else popTopAdjust=0;
		dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
		dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
		dypopLayer.style.filter="Alpha(Opacity=0)";
		fadeOut();
}

function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
		}
		else {
			dypopLayer.filters.Alpha.opacity=popOpacity;
			tFadeWaiting=setTimeout("fadeIn()",tPopShow);
			}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0) {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
		}
}
document.onmouseover=showPopupText;

function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=no,menubar=no,status=no' );
}

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 ShowPost(id,UserName,content,posttime,honor,userface,sex,birthday,experience,membercode,faction,consort,money,postcount,regtime,userlife,usermail,userhome,sign)
{
document.write("<table class=a2 cellspacing=1 cellpadding=0 width=740 align=center border=0 style=TABLE-LAYOUT:fixed><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><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><img src='"+userface+"' onload='javascript:if(this.width>120)this.width=120;if(this.height>120)this.height=120;'></td></tr></table>")
}

document.write("<table width=90% border=0><tr><td height=18>"+level(experience,membercode,UserName,moderated)+levelimage+"</td></tr><tr><td height=18>等　　级:"+levelname+"</td></tr><tr><td height=18>");
if (""+faction+"" !="") {document.write("门　　派:"+faction+"</td></tr><tr><td height=18>");}
if (""+consort+"" !="") {document.write("配　　偶:"+consort+"</td></tr><tr><td height=18>");}
document.write("经 验 值:"+experience+"</td></tr><tr><td height=18>");
document.write("论坛金币:"+money+"</td></tr><tr><td height=18>");
document.write("总发贴数:"+postcount+"</td></tr><tr><td height=18>");
document.write("注册时间:"+regtime+"</td></tr><tr><td height=18>");
document.write("体 力 值:<img border=0 src=images/bar/0.gif width="+userlife/2+" height=9 alt="+userlife+"></td></tr><tr><td height=20>");
if(onlinelist.indexOf("|"+UserName+"|") == -1 ){
document.write("在线状态:<img border=0 src=images/offline.gif alt='离线'></td></tr><tr><td height=18>");
}else{
document.write("在线状态:<img border=0 src=images/online.gif alt='在线'></td></tr><tr><td height=18>");
}

document.write("</td></tr></table></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 style='padding-top:5px'>&nbsp;<a href='Profile.asp?UserName="+UserName+"' title='查看"+UserName+"的个人资料'>[资料]</a> <a 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='search.asp?menu=ok&search=author&searchxm=UserName&content="+UserName+"' title='搜索"+UserName+"发表过的所有主题'>[搜索]</a> <a href=mailto:"+usermail+" title='发送电邮给"+UserName+"'>[E-mail]</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='retopic.asp?id="+topicid+"&topic="+topic+"' title=回复这个帖子>[回复]</a></td><td align=right>No.<font color=red><b>"+i+"</b></font>&nbsp;</td></tr><tr valign=top><td colspan=2 style=word-break:break-all><hr width=100% color=777777 size=1>");

if(badlist.indexOf(UserName) == -1 ){
document.write(ubbcode("<span id=yu"+id+">"+content+"</span>"));
}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%><tr><td align=right valign=bottom colspan=3>")
if (getCookie('sign')!='0' && sign!=""){document.write("←——————————<br>"+ubbcode(sign)+"");}
document.write("<hr width=100% color=#777777 size=1></td></tr><tr class=a"+ii+"><td valign=bottom rowspan=3>&nbsp;<a href='EditTopic.asp?id="+topicid+"&retopicid="+id+"&topic="+topic+"'>[编辑]</a> <a onclick=checkclick('您确定要删除回贴?')  href=manage.asp?menu=deltopic&id="+topicid+"&retopicid="+id+">[删除]</a></td><td valign=bottom>发表时间："+posttime+"　</td><td valign=bottom>IP：<a href=manage.asp?menu=lookip&id="+topicid+"&retopicid="+id+">已经记录</a></td></tr></table></td></tr></table></td></tr></table>");
}


//帖子列表
function ShowForum(ID,topic,newtopic,UserName,Views,icon,toptopic,locktopic,pollresult,goodtopic,replies,lastname,lasttime)
{
if(lasttime.indexOf(newDate) == 0){lasttime = lasttime.replace(newDate,"今日");}
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+">"+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 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>『 <a href=ShowForum.asp?forumid="+id+" title='"+intro+"'>"+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 class=a4></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.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";
}
}
document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")
