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 OpenFriendWindow (target) { 
  window.open(target, "Friend", "resizable=yes,width=320,height=175"); 
}

//跳出确认
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}

function shownews(content)
{
document.write(ybbcode("<span style='font-size:10pt'>"+content+"</span>"));
}

//显示帖子
function ShowPost(id,username,replies,userqq,realname,content,posttime,honor,userface,sex,birthday,experience,membercode,faction,consort,money,mypet,petname,building,car,postcount,regtime,userlife,usermail,userhome,sign,word,phonetic,remark,sound)
{
document.write("<table class=a2 cellspacing=1 cellpadding=0 width=97% 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=162 rowspan=4 height=250>");
document.write("<table cellspacing=0 cellpadding=0 width=90% align=center border=0 style=TABLE-LAYOUT:fixed><tr><td>");
document.write("<table border=0 cellspacing=0 width=95%><tr><td style=filter:glow(color=#000000)>&nbsp;&nbsp;<font style=font-size:10pt color=#ffffff ><b>"+username+"</b></font></td><td align=right valign=top width=40>");

if (""+sex+""!=''){
document.write("<img src=images/"+sex+".gif>")
}
document.write("&nbsp;");
document.write(astro(""+birthday+""));
document.write("</td></tr></table>");

if (getCookie('showface')!='0'){
document.write("<table border=0 align=center cellspacing=0 cellpadding=0><tr><td><img src=images/bg_0ltop.gif></td><td background=images/bg_01.gif align=center></td><td><img src=images/bg_0rtop.gif></td></tr><tr><td vAlign=middle background=images/bg_03.gif></td><td background=images/a_bg.jpg>");
document.write("<table width=100% border=0><tr><td align=middle><a href='Profile.asp?username="+username+"'><img src='"+userface+"' alt='查看"+username+"的个人资料' border=0 onload='javascript:if(this.width>120)this.width=120;if(this.height>167)this.height=167;'></a></td></tr></table>")
document.write("</td><td vAlign=middle background=images/bg_04.gif></td></tr><tr><td vAlign=top><img src=images/bg_0lbottom.gif></td><td background=images/bg_02.gif align=left></td><td align=right><img src=images/bg_0rbottom.gif></td></tr></table>");
}

document.write("<br>"+level(experience,membercode,username,moderated)+levelimage+"<br>")
if (""+realname+"" !="") {document.write("<IMG src=images/icon_1.gif border=0>真实姓名:<FONT color=#9b21e8>"+realname+"</FONT><br>");}
document.write("<IMG src=images/icon_2.gif border=0>等　　级:<FONT color=#fd289b>"+levelname+"</FONT><br>");
if (""+honor+"" !="") {document.write("<IMG src=images/icon_1.gif border=0>头　　衔:<FONT color=#5d8d12>"+honor+"</FONT><br>");}
if (""+userqq+"" !="") {document.write("<IMG src=images/icon_2.gif border=0>ＱＱ号码:<FONT color=#ff20ff>"+userqq+"</FONT><br>");}
if (""+faction+"" !="") {document.write("<IMG src=images/icon_1.gif border=0>门　　派:<FONT color=#cc3333>"+faction+"</FONT><br>");}
if (""+consort+"" !="") {document.write("<IMG src=images/icon_2.gif border=0>异性伴侣:<a href='Profile.asp?username="+consort+"' target=_blank><FONT color=#33cc33>"+consort+"</FONT></a><br>");}
document.write("<IMG src=images/icon_1.gif border=0>经 验 值:<FONT color=#6699cc>"+experience+"</FONT><br>");
document.write("<IMG src=images/icon_2.gif border=0>湘大金币:<FONT color=#990033>"+money+"</FONT><br>");
document.write("<IMG src=images/icon_1.gif border=0>总发贴数:<FONT color=#9b21e8>"+postcount+"</FONT><br>");
document.write("<IMG src=images/icon_2.gif border=0>注册时间:<font color=#CC3399>"+regtime+"</FONT><br>");
document.write("<IMG src=images/icon_1.gif border=0>体 力 值:<FONT color=#6699cc>"+userlife+"</FONT><br>");
if(onlinelist.indexOf("|"+username+"|") == -1 ){
document.write("<IMG src=images/icon_2.gif border=0>在线状态:<img border=0 src=images/offline.gif alt='离线'><br>");
}else{
document.write("<IMG src=images/icon_2.gif border=0>在线状态:<img border=0 src=images/online.gif alt='在线'><br>");
}
document.write("<hr><a href=car.asp target=_blank><IMG src=images/bbscar.jpg border=0 alt=去买车子 valign=bottom align=middle></a>");
if (""+car+"" !="") {document.write("&nbsp;&nbsp;<FONT color=#fd289b>"+car+"</FONT><br>");}
else
{document.write("&nbsp;&nbsp;<a href=car.asp target=_blank><font color=#fd289b>去买车子</font></a><br>");
}
document.write("<a href=building.asp target=_blank><IMG src=images/bbsmyhome.gif border=0 alt=去买房子 valign=bottom align=middle></a>");
if (""+building+"" !="") {document.write("&nbsp;&nbsp;<FONT color=#fd289b>"+building+"</font><br>");}
else
{document.write("&nbsp;&nbsp;<a href=building.asp target=_blank><font color=#fd289b>去买房子</font></a><br>");
}
document.write("<a href=petshop.asp target=_blank><IMG src=images/bbspet.gif border=0 width=47 height=29 alt=去买宝宝 valign=bottom align=middle></a>");
if (""+mypet+"" !="") {document.write("&nbsp;&nbsp;<font color=#fd289b>"+mypet+"</font>");}else{document.write("&nbsp;&nbsp;<a href=petshop.asp target=_blank><font color=#fd289b>去买宝宝</font></a>");
}

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 style=TABLE-LAYOUT:fixed>");
document.write("<tr><td width=90%><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='search.asp?menu=ok&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>");
}
i=i+1
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>")
if (i==1) {document.write("<font color=red><b>楼主</b></font>&nbsp;");}
else {document.write("<font color=red><b>"+i+"</b></font>楼&nbsp;");}
document.write("</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 ){
if(moderated.indexOf("|"+username+"|")!=-1 || membercode>1){
document.write("<br><table cellSpacing=0 cellPadding=0 border=0 style='table-layput:fixed;word-wrap:break-word;word-break:break-all'><tbody><tr><td width=14><img src=images/admin_01.gif width=18 height=25></td><td background=images/admin_02.gif></td><td width=15><img src=images/admin_03.jpg width=15 height=25></td></tr><tr><td vAlign=top width=18 background=images/admin_04.gif></td><td  bgColor=#ffffff>");
document.write(ybbcode("<span id=yu"+id+" style='font-size:12pt;'>"+content+"</span>"));
document.write("<td vAlign=top width=15 background=images/admin_06.jpg></td></tr><tr><td vAlign=top width=14><img src=images/admin_07.gif width=18 height=39></td><td background=images/admin_08.gif></td><td align=right width=15><img src=images/admin_09.jpg width=15 height=39></td></tr></tbody></table>");}
else{
document.write("<br><table cellSpacing=0 cellPadding=0 border=0 style='table-layput:fixed;word-wrap:break-word;word-break:break-all'><tbody><tr><td width=14><img src=images/top_l.gif width=14 height=8></td><td background=images/top_c.gif></td><td width=16><img src=images/top_r.gif width=16 height=8></td></tr><tr><td vAlign=top width=14 background=images/center_l.gif></td><td style=LINE-HEIGHT: 14pt bgcolor=#F1F1FF>");

document.write(ybbcode("<span id=yu"+id+" style='font-size:12pt'>"+content+"</span>"));

document.write("<td vAlign=top width=16 background=images/center_r.gif><img src=images/top_r2.gif width=16 height=8></td></tr><tr><td vAlign=top width=14><img src=images/foot_l1.gif width=14 height=42></td><td background=images/foot_c.gif><img src=images/foot_l3.gif width=36 height=42></td><td align=right width=16><img src=images/foot_r.gif width=16 height=42></td></tr></tbody></table>");}}
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("<img src=images/qianming1.gif><img src=images/qianming.gif><br><br>");
document.write("<table width=100% border=0 cellspacing=0 cellpadding=0 style=TABLE-LAYOUT:fixed ><tr><td align=right>");
document.write(ybbcode(sign));
document.write("</td></tr></table>");
}
document.write("<br><hr width=100% color=777777 size=1></td></tr><tr class=a"+ii+"><td valign=bottom><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></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><tr><td colspan=4 align=right><br><b><font color='#9b21e8' size=4 face='华文新魏'>myxtu.com四六级词汇→</font><font color='#cc3333' size=4>"+word+"</font><font color=#EE9611 size=3>[</font><font face='HMPhone BDC'  color=blue size=3>"+phonetic+"</font><font color=#EE9611 size=3>]</font><font color='#FF6712' size=3>"+remark+"</font></b><br>");
if (i==1) {document.write("<a href=http://gao6.com target=_blank><marquee><b><font color='#fd289b' size=4 face='华文新魏'>欢迎访问高牛博客：www.gao6.com</font></b></marquee></a>");}
document.write("</td></tr></table></td></tr></table></td></tr></table>");
if (""+id+""=="yuzi" && replies>0){
document.write("<table width='97%' align=center><tr><td height=1></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>"}
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=a3>"+reimage+"</td>");
document.write("<td width=3% class=a4 align=center>"+reimage2+"</td>");
document.write("<td class=a3  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 > 10) {
var topicpage=""
var tol=replies/10+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=a4><a href=Profile.asp?username="+username+">"+username+"</a></td><td align=middle width=6% class=a3>"+reimage3+"</td><td align=middle width=7% class=a4>"+Views+"</td><td width=27% class=a3>&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=a3>　</td><td width=3% class=a4>　</td><td id=followTd"+ID+" align=left class=a3 width=94% colspan=5>　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 bgcolor=FFFFFF>")

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 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> 』</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% align=center>私密论坛")
}else{
document.write("<td rowspan=2 width=30%>主题:"+lasttopic+"<br>作者:<a href=Profile.asp?username="+lastname+">"+lastname+"</a><br>时间:"+lasttime+"")
}

document.write("</td></tr><tr><td>"+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]+">"+list[i]+"</a> ")
}
}

document.write("</td><td></td><td><table border=0 width=100% cellspacing=0><tr><td width=33%>")
if (today>0) {
document.write("今日:<font color=red>"+2*today+"</font></td>")
}
else {
today = Math.floor(Math.random() * 20+1);
document.write("今日:<font color=red>"+today+"</font></td>") 
}
document.write("<td width=33%>主题:"+5*toltopic+"</td><td width=33%>帖子:"+5*tolrestore+"</td></tr></table></td></tr></table></td></tr>")

}


function SmallShowList(id,bbsname,intro,moderated,today,toltopic,tolrestore)
{
intro = intro.replace(/<br>/ig,"\n");

i=i+1;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>")
if (today>0) {
document.write("<td>今日:<font color=red>"+2*today+"</font></td>") 
}
else {
today = Math.floor(Math.random() * 20+1);
document.write("<td>今日:<font color=red>"+today+"</font></td>")
}
document.write("<td>主题:"+5*toltopic+"</td><td>帖子:"+5*tolrestore+"</td></tr><tr class=a3><td colspan=3>版主：")

var list= moderated.split ('|'); 
for(m=0;m<list.length;m=m+1) {
if (m <1){document.write("<a href=profile.asp?username="+list[m]+">"+list[m]+"</a> ")}
else
if (m ==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=jj+1){document.write("<td bgcolor=FFFFFF></td>")}
i=0
}
}

//跳转页面显示


function ShowPage(TotalPage,topage){

document.write("<table cellspacing=1 cellpadding=2 class=a2><tr class=a3><td class=a1><b><font color=red>"+topage+"</font>/"+TotalPage+"</b></td>");
if (topage<6){PageLong=11-topage;}
else
if (TotalPage-topage<6){PageLong=10-(TotalPage-topage)}
else{PageLong=5;}
for (var i=1; i <= TotalPage; i++) {
if (i< topage+PageLong && i > topage-PageLong || i==1 || i==TotalPage){
if (topage==i){document.write("<td>&nbsp;<b>"+ i +"</b>&nbsp;</td>");}else{document.write("<td>&nbsp;<b><a href=?topage="+i+">"+ i +"</a></b>&nbsp;</td>");}
}
}
document.write("<td class=a4><input onkeydown=if((event.keyCode==13)&&(this.value!=''))window.location='?topage='+this.value+''; onkeyup=if(isNaN(this.value))this.value='' style='border:1px solid #698cc3;' size=2></td></tr></table>");

}

//菜单
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'){
if(targetImg.loaded=="no"){document.frames["hiddenframe"].location.replace("loading.asp?id="+ino+"&forumid="+online+"");}
targetDiv.style.display="block";
targetImg.src="images/minus.gif";
}else{
targetDiv.style.display="none";
targetImg.src="images/plus.gif";
}
}
document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")
