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,honors)
{
document.write("<table class=a2 style=TABLE-LAYOUT:fixed cellPadding=5 width=97% align=center border=0 cellSpacing=1>");
if(ii==3)
	ii = 4;
else
	ii = 3;
document.write("<tr class=a"+ii+"><td width=160 align=center valign=top>");
document.write("<table border=0 width=90%><tr><td><font style='width:96px;filter:glow(color=red, strength=2)'><b>"+username+"</b></font></td><td align=right valign=top>");

if (""+sex+""!=''){
document.write("<img src=images/"+sex+".gif>　")
}

document.write(astro(""+birthday+""));
document.write("</td></tr></table>");

if (getCookie('showface')!='0'){
document.write("<img src='"+userface+"' onload='javascript:if(this.width>120)this.width=120;if(this.height>120)this.height=120;'>")
}
//分析时间格式
//var ti=regtime
//var qt=ti.split(" ");
//var d=qt[0].split("-");
regtime=regtime.split(" ")[0].split("-")[0]+"年"+regtime.split(" ")[0].split("-")[1]+"月"+regtime.split(" ")[0].split("-")[2]+"日"
posttime=posttime.split(" ")[0].split("-")[0]+"年"+posttime.split(" ")[0].split("-")[1]+"月"+posttime.split(" ")[0].split("-")[2]+"日 "+posttime.split(" ")[1]

document.write("<br><br><table border=0 width=95%><tr><td>"+level(experience,membercode,username,moderated)+levelimage+"<br>");
if (""+honor+"" !="") {document.write("头 衔:<span style=\"font-family:'Comic Sans MS'\">"+honor+"</span><br>");}
document.write("等 级:"+levelname+"<br>");
if (""+lvname+"" !="") {document.write("<font color='#5eab50'>职 务:"+lvname+"</font><br>");}
if (""+honors+"" !="") {document.write("<font color='red'>荣 誉:"+honors+"</font><br>");}
if (""+faction+"" !="") {document.write("门 派:"+faction+"<br>");}
if (""+consort+"" !="") {document.write("配 偶:"+consort+"<br>");}
//document.write("经 验:"+experience+"<br>");
document.write("羽 币:"+money+"<br>");
document.write("发 贴:"+postcount+"<br>");
document.write("注 册:"+regtime.split(" ")[0]+"<br>");
//计算经验显示部分
if(exp==0)
userexp=75;
else
userexp=Math.round((experience-lowexp)/(exp-lowexp)*75);
if(userexp>75)userexp=75;
prexp=Math.round((experience-lowexp)/(exp-lowexp)*100);
if(prexp>100)prexp=100;
//
//document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>经 验:</td><td><table width=\"79\" height=\"13\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"images/afimage/bg.gif\"><tr> <td width=\"2\"></td><td><img src=\"images/afimage/exp.gif\" onmouseover=\"showmenu(event,'<div class=menuitems><a href=javascript:void(0)>Exp:"+prexp+"% ("+experience+" / "+exp+")</a></div>')\" width=\""+userexp+"\" height=\"9\" border=\"0\"></td><td width=\"1\"></td></tr></table></td></td></table>")
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>经 验:</td><td><table width=\"79\" height=\"13\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"images/afimage/bg.gif\"><tr> <td width=\"2\"></td><td><img src=\"images/afimage/exp.gif\" alt='Exp:"+prexp+"% ("+experience+" / "+exp+")' width=\""+userexp+"\" height=\"9\" border=\"0\"></td><td width=\"1\"></td></tr></table></td></td></table>")
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>体 力:</td><td><table width=\"79\" height=\"13\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"images/afimage/bg.gif\"><tr> <td width=\"2\"></td><td><img src=\"images/afimage/hp.gif\" alt='HP:"+userlife+"' width=\""+userlife/4*3+"\" height=\"9\" border=\"0\"></td><td width=\"1\"></td></tr></table></td></td></table>")
//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/offline.gif alt='离线'><br>");
}else{
document.write("状 态:<img border=0 src=images/online.gif alt='在线'><br>");
}

document.write("</td></tr></table></td><td height=100%>");
document.write("<table cellSpacing=0 cellPadding=0 width=100% border=0 height=100%><tr><td colspan=3 width=85%><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='ShowBBS.asp?menu=5&username="+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>No.<font color=red><b>"+i+"</b></font>&nbsp;</td></tr><tr vAlign=top><td colSpan=4><hr width=100% color=#777777 SIZE=1></td></tr>");


document.write("<tr vAlign=top><td colSpan=4 height=100% style=word-break:break-all>");



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>")
}
document.write("</td></tr><tr vAlign=top><td colSpan=4 align=right>")
if(getCookie('sign')!='0' && sign!=""){document.write("——————————<br><div id=div"+id+">"+ybbcode(sign)+"</div>");}
document.write("</td></tr><tr vAlign=top><td colSpan=4><hr width=100% color=#777777 SIZE=1></td></tr><tr vAlign=top><td width=30%><a href='EditTopic.asp?id="+topicid+"&retopicid="+id+"'><img src=images/edit.gif border=0></a> <a 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 colSpan=2 width=40% valign=bottom><img src=images/ip.gif> IP：<a href=manage.asp?menu=lookip&id="+topicid+"&retopicid="+id+">已记录</a></td></tr></table></td></tr>");
document.write("</table>")
//if(getCookie('sign')!='0' && sign!=""){if(eval("div"+id+".scrollHeight")>150){eval("div"+id+".style.height=150")}}
}


//帖子列表
function ShowForum(ID,topic,newtopic,username,Views,icon,toptopic,locktopic,pollresult,goodtopic,replies,lastname,lasttime,Topic_Color)
{
if(lasttime.indexOf(newDate) == 0){lasttime = lasttime.replace(newDate,"今日");}
if (key_word!="") 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>"}
else
if (username == cookieusername) {reimage2="<img src=images/my.gif>"}
else{reimage2=""}

if (replies>0) {reimage3=replies}
else{reimage3="-"}

if (icon>0) {icon="<img src=images/brow/"+icon+".gif>"}

document.write("<tr height=25><td align=middle width=3% class=a4><a target=_blank href=ShowPost.asp?id="+ID+">"+reimage+"</a></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+")> "+icon+" <a href=ShowPost.asp?id="+ID+"><font face='Comic Sans MS' color='"+Topic_Color+"' title='ID:"+ID+"<br>Topic："+topic+"<br>Lastname："+lastname+"<br>Lasttime："+lasttime+"'>"+isLeft(topic,52)+"</font></a>");

var pagesetup = 10
replies = parseInt(replies)
if (replies+1 > pagesetup) {
var topicpage=""
var tol=(replies + 1) / pagesetup;//+1;
//if(((replies + 1) % pagesetup)>0)tol=tol+1;

for (var i=1; i < tol+1; 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,topicid)
{
//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><img src=\'images/fea_l_1.gif\' name=lf id=lf> <a href=ShowForum.asp?forumid="+id+">"+bbsname+"</a> <img name=rf id=rf src=\'images/fea_r_1.gif\'></td><td rowspan=2 align=right>")

if (icon!=''){
document.write("<img src="+icon+">")
}

document.write("</td>")

lasttime=lasttime.split(" ")[0].split("-")[0]+"年"+lasttime.split(" ")[0].split("-")[1]+"月"+lasttime.split(" ")[0].split("-")[2]+"日 "+lasttime.split(" ")[1]


//判定论坛
if(pass==0){
document.write("<td rowspan=2 width=30% align=left><br><font color='#ff0000'>本分论坛已关闭，禁止浏览</font>")}
else if(password==1){
document.write("<td rowspan=2 width=30% align=left><br><font color='#ff0000'>加密论坛,请有密码的用户进入浏览</font>")}
else if(pass==3){
document.write("<td rowspan=2 width=30% align=left><br><font color='#ff0000'>认证论坛,请认证用户进入浏览</font>")}
else if(pass==4){
document.write("<td rowspan=2 width=30% align=left>主题:<a href=ShowPost.asp?id="+topicid+"&tolast=1>"+isLeft(lasttopic,40)+"</a><br>作者:<a href=Profile.asp?username="+lastname+">"+lastname+"</a><br><font color='#ff0000'>认证论坛,非认证用户禁止发表新主题</font>")}
else{
document.write("<td rowspan=2 width=30% align=left>主题:<a href=ShowPost.asp?id="+topicid+"&tolast=1>"+isLeft(lasttopic,40)+"</a><br>作者:<a href=Profile.asp?username="+lastname+">"+lastname+"</a><br>时间:"+lasttime+"")
}


document.write("</td></tr><tr><td>"+ybbcode(intro)+"</td></tr><tr class=a3><td> 版主：")

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%>今日:<font color=red>"+today+"</font></td><td width=33%>主题:"+toltopic+"</td><td width=33%>帖子:"+tolrestore+"</td></tr></table></td></tr></table></td></tr>")

}

var ii = 0
function SmallShowList(id,bbsname,intro,moderated,today,toltopic,tolrestore)
{
//intro = intro.replace(/<br>/ig,"\n");

ii++;
if (ii==1){document.write("<tr><td width=\"33%\" height=\"100%\">")}
if (ii==2){document.write("<td width=\"34%\">")}
if (ii==3){document.write("<td width=\"33%\">")}
document.write("<table border=0 width=100% height=100% cellspacing=0 cellpadding=4><tr bgcolor=FFFFFF><td colspan=3 valign='top'><img src=\'images/fea_l_1.gif\' name=lf id=lf> <a href=ShowForum.asp?forumid="+id+">"+bbsname+"</a> <img name=rf id=rf src=\'images/fea_r_1.gif\'></td></tr><tr bgcolor=FFFFFF><td colspan=3>"+ybbcode(intro)+"</td></tr><tr bgcolor=FFFFFF><td width=33%><img src=images/Forum_nav.gif alt=今日> <font color=red>"+today+"</font></td><td width=34%><img src=images/Forum_nav.gif alt=主题> "+toltopic+"</td><td width=33%><img src=images/Forum_nav.gif alt=帖子> "+tolrestore+"</td></tr><tr class=a3><td height='20' 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("<a href=profile.asp?username="+list[1]+">"+list[1]+"</a> ");}
if (list.length>2){document.write("<a href=profile.asp?username="+list[2]+">"+list[2]+"</a> ");}
if (list.length>3){document.write("<font color=gray>...</font>")}

document.write("</td></tr></table></td>")

if (ii==3){ii=0;document.write("</tr>")}

}


function makeupShowList()
{
if (ii!=0){
for(jj=ii;jj<3;jj++){document.write("<td bgcolor=FFFFFF><table border=0 width=100% height=100% cellspacing=0 cellpadding=4><tr bgcolor=FFFFFF><td colspan=3 valign='top'><img src=\'images/fea_l_1.gif\' name=lf id=lf> 　　　 <img name=rf id=rf src=\'images/fea_r_1.gif\'></td></tr><tr bgcolor=FFFFFF><td colspan=3></td></tr><tr bgcolor=FFFFFF><td><img src=images/Forum_nav.gif alt=今日> <font color=red></font></td><td><img src=images/Forum_nav.gif alt=主题></td><td><img src=images/Forum_nav.gif alt=帖子></td></tr><tr class=a3><td height='20' colspan=3>版主：</td></tr></table>")}
ii=0
}
}

//跳转页面显示
function ShowPage(TotalPage,topage,url){
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(" "+ i +" ");}else{
	if(i==topage+PageLong-1)
		document.write(" <a href=?topage="+i+"&"+url+">"+ i +"</a> ... ");
	else if(i==topage-PageLong+1)
		document.write(" ... <a href=?topage="+i+"&"+url+">"+ i +"</a> ");
	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'){
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";
}
}
function defaultLoadTree(){
	if(document.follow0.style.display == "none")
		document.frames["hiddenframe"].location.replace("loading.asp?id=0&forumid=0&Default=1");
	else
		document.follow0.style.display = "none";
}
document.write("<iframe height=0 width=0 name=hiddenframe></iframe>")
//鼠标提示
var sPop = null;
var postSubmited = false;
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Comic Sans MS; background-color: #DDEEFF; border: 1px #8899AA dashed; font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000;filter:blendtrans(duration=.2) revealTrans(duration=.1,transition=12) alpha(opacity=90,enabled=1)' class='cPopText'></div>");
function showPopupText() {
	var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
        if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" } 
		if(o.pop) { 
			o.pop=o.pop.replace("\n","<br>"); 
		    o.pop=o.pop.replace("\n","<br>");	
					}
	if(o.pop!=sPop) {
		sPop=o.pop;
		if(sPop==null || sPop=="") {
			popLayer.filters[0].apply();
			popLayer.style.visibility="hidden";	
			popLayer.filters[0].play();
			popLayer.style.width=""
		} else {
			if(o.dyclass!=null) popStyle=o.dyclass 
			else popStyle="cPopText";
             
			popLayer.filters[1].apply();
			popLayer.style.visibility="visible";
			popLayer.filters[1].play();
			showIt();
			if (popLayer.offsetWidth>500)
			{
				popLayer.style.width=500
			}
		}
	}
}

function showIt() {
	popLayer.className=popStyle;
	popLayer.innerHTML=sPop;
	popWidth=popLayer.clientWidth;
	popHeight=popLayer.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;
	popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
	popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
}

function ctlent(obj) {
	if(postSubmited == false && (event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
			if (!docheck()) return
			if(this.document.input.topicsubmit) this.document.input.topicsubmit.disabled = true;
			if(this.document.input.replysubmit) this.document.input.replysubmit.disabled = true;
			if(this.document.input.editsubmit) this.document.input.editsubmit.disabled = true;
			this.document.input.submit();
	}
}

function runEx(cod1)  {
	 cod=document.all(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}

var flag=false; 
function DrawImage(ImgD){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width>=518){ 
			ImgD.width=518; 
			ImgD.height=(image.height*518)/image.width; 
		}else{ 
			ImgD.width=image.width; 
			ImgD.height=image.height; 
		}  
	} 
} 


function showIntro(objID)
{
	if (document.getElementById(objID).style.display == "none") {
		document.getElementById(objID).style.display = "";
	}else{
		document.getElementById(objID).style.display = "none";
	}
}

document.onmouseover=showPopupText;

function setleft(str,n)
{
	var mx=String.fromCharCode(127);
	if(str.length<=n/2)
	{
		return(str);
	}
	else
	{
		var TStr="";
		var l,t=0;
		var i;
		l=str.length;
		for(i=0;i<l;i++)
		{
			if(str.charAt(i)>mx)
			{
				t=t+2;
			}
			else
			{
				t=t+1;
			}
			if(t>n)break;
			TStr=TStr+str.charAt(i);
		}
		return(TStr);
	}
}

function getleft(str)
{
	var mx=String.fromCharCode(255);
	if(str.length==0)
	{
		return(0);
	}
	else
	{
		var TStr="";
		var l,t,c;
		var i;
		l=str.length;
		t=l;
		for(i=0;i<l;i++)
		{
			if(str.charAt(i)>mx)
			{
				t+=1;
			}
		}
		return(t);
	}
}

function isLeft($1,$2){ //isLeft(字符串,长度)
	var tmpstr
	if(getleft($1)>$2)
		tmpstr=setleft($1,($2-3))+"...";
	else
		tmpstr=$1;
	return tmpstr;
}