function highlight(which,color){

if (document.all||document.getElementById)

which.style.backgroundColor=color

}
function ShowIcon(replies,good,top,lock){
	if((top==1)||(top==2)){
		img="<img src=images/status_top.gif alt=置顶>";
	}else{
		if(good==1){
			//img="<img src=images/status_good.gif alt=精华>";
			img="<img src=images/post_good.gif alt=精华>";
		}else{
			if(replies==0){
				img="<img src=images/status_new.gif alt=新帖>";
			}else{
				img="<img src=images/status_normal.gif alt=帖>";
			}
		}
	}
	document.write(img);
}
function Level(membercode){
	var lvlstr;
	if (membercode=='0'){lvlstr="尚未激活";}
	else if (membercode=='1'){lvlstr="普通会员";}
	else if (membercode=='2'){lvlstr="VIP会员";}
	else if (membercode=='3'){lvlstr="<b>版主</b>";}
	else if (membercode=='4'){lvlstr="<font color=red><b>系统管理员</b></font>";}
	else if (membercode=='5'){lvlstr="<font color=red><b>社区区长</b></font>";}
	return(lvlstr);
}
function Levelimg(membercode){
	var lvlstr;
	if (membercode=='0'){lvlstr="尚未激活";}
	else if (membercode=='1'){lvlstr="<img border=0 src=/pic/gl2.gif>";}
	else if (membercode=='2'){lvlstr="<img border=0 src=/pic/vip0.gif>";}
	else if (membercode=='3'){lvlstr="<img border=0 src=/pic/gl1.gif>";}
	else if (membercode=='4'){lvlstr="<img border=0 src=/pic/gl0.gif>";}
	else if (membercode=='5'){lvlstr="<img border=0 src=/pic/AO1.gif>";}
	return(lvlstr);
}
function CreditImg(cdt){
	if (cdt<= 5){imgnum=1;}
	else if(cdt<=14){imgnum=2;}
	else if(cdt<=30){imgnum=3;}
	else if(cdt<=62){imgnum=4;}
	else if(cdt<=126){imgnum=5;}
	else if(cdt<=254){imgnum=6;}
	else if(cdt<=510){imgnum=7;}
	else if(cdt<=1022){imgnum=8;}
	else if(cdt<=2046){imgnum=9;}
	else if(cdt<=4094){imgnum=10;}
	var cdtimg="";
	if (imgnum<=5){
		for(i=1;i<=imgnum;i++){
			cdtimg=cdtimg+"<img src='/images/xin1.gif' width='17' height='14' border='0'>";
		}
	}else if(imgnum<=10){
		for(i=6;i<=imgnum;i++){
			cdtimg=cdtimg+"<img src='/images/xinxin1.gif' width='16' height='16' border='0'>";
		}
	}
	return(cdtimg);
}
function ShowUser(UserName,UserFace,Address,MemberCode,Experience,Credit,URL){
	if(moderated.indexOf("|"+UserName+"|") != -1 && moderated!=""){levelname="<b>版主</b>";}else{levelname=Level(MemberCode);}
	document.write("<table width='90%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#FFFFFF'>");
	document.write("<tr><td height='25' align='center' valign='bottom'><b>"+UserName+"</b></td></tr>");
	document.write("<tr><td height='45' align='center' valign='middle'><img src="+UserFace+" onload='javascript:if(this.width>120)this.width=120;if(this.height>120)this.height=120;'></td></tr>");
	document.write("<tr><td height='20'>来自："+Address+"</td></tr>");
	document.write("<tr><td height='20'>级别："+levelname+"</td></tr>");
	document.write("<tr><td height='20'>积分："+Experience+"</td></tr>");
	document.write("<tr><td height='20'>信用：<a href='/Auction/credit.asp?user="+UserName+"' target='_blank' title='我的信用积分为："+Credit+"分'>"+CreditImg(Credit)+"</a></td></tr>");
	document.write("<tr><td height='25' valign='middle'><a href='Message.asp?incept="+UserName+URL+"'><img src='images/wangwang_offline.gif' alt='点击给我留言' border='0'></a></td></tr>");
	document.write("</table>");
}
function ShowSign(sign){
	if(sign!="")
		document.write("<p><table style=TABLE-LAYOUT:fixed><tr><td style=HEIGHT:80px align=left valign=bottom>签名档："+sign+"</td></tr></table></p>");
}
function ShowPage(ID,TotalPage,CurrentPage){
			document.write("<b>( </B>");
	for (var i=1; i <= TotalPage; i++) {
			if (CurrentPage==i){
			document.write("<font color=#FF0000><b> "+ i +" </b></font>");
		}else{
			document.write("<a href=Body.asp?id="+ID+"&page="+i+"> "+ i +" </a>");
		}
	}
			document.write(" <b>) </B>");
}
function checkclick(msg){
	if(confirm(msg)){
		event.returnValue=true;
	}else{
		event.returnValue=false;
	}
}
function ybbcode(temp) 
{
temp = temp.replace(/&amp;/ig,"&");
temp = temp.replace(/  /ig,"　");
temp = temp.replace(/(| |<br>)((http|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9/\.\-_?=&:@%]+)( |<br>)/ig,"$1<A TARGET=_blank HREF=\"$2\">$2</A>$5");
temp = temp.replace(/( |<br>)((http|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9/\.\-_?=&:@%]+)(| |<br>)/ig,"$1<A TARGET=_blank HREF=\"$2\">$2</A>$5");
temp = temp.replace(/(\[b\])(.[^\[]*)(\[\/b\])/ig,"<b>$2<\/b>");
temp = temp.replace(/(\[i\])(.[^\[]*)(\[\/i\])/ig,"<I>$2<\/I>");
temp = temp.replace(/(\[u\])(.[^\[]*)(\[\/u\])/ig,"<u>$2<\/u>");
temp = temp.replace(/(\[strike\])(.[^\[]*)(\[\/strike\])/ig,"<strike>$2<\/strike>");
temp = temp.replace(/(\[div\])(.[^\[]*)(\[\/div\])/ig,"<div>$2<\/div>");
temp = temp.replace(/(\[center\])(.[^\[]*)(\[\/center\])/ig,"<center>$2<\/center>");
temp = temp.replace(/(\[marquee\])(.[^\[]*)(\[\/marquee\])/ig,"<marquee>$2<\/marquee>");
temp = temp.replace(/(\[URL\])((http|ftp|rtsp|mms):\/\/(.[^\[]*))(\[\/URL\])/ig,"<A TARGET=_blank HREF=\"$2\">$2</A>");
temp = temp.replace(/(\[URL=)((http|ftp|rtsp|mms):\/\/(.[^\[]*))(\])((.[^\[]*))(\[\/URL\])/ig,"<A TARGET=_blank HREF=\"$2\">$6</A>");
temp = temp.replace(/(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])/ig,"<a href=mailto:$2>$2</a>");
temp = temp.replace(/(\[font=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/font\])/ig,"<FONT face=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[size=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/size\])/ig,"<FONT size=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[COLOR=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/COLOR\])/ig,"<FONT COLOR=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[code\])(.[^\[]*)(\[\/code\])/ig,"<BLOCKQUOTE><strong>代码</strong>：<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
temp = temp.replace(/(\[QUOTE\])(.*)(\[\/QUOTE\])/ig,"<BLOCKQUOTE><strong>引用</strong>：<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
temp = temp.replace(/\[RM\](.[^\[]*)\[\/RM\]/ig,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width=350 height=200><PARAM NAME=SRC VALUE=$1><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=true><\/OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=50 width=350><PARAM NAME=SRC VALUE=$1><PARAM NAME=CONTROLS VALUE=ControlPanel,StatusBar><PARAM NAME=CONSOLE VALUE=Clip1><\/OBJECT>");
temp = temp.replace(/(\[MP\])(.[^\[]*)(\[\/MP\])/ig,"<object classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 width=400 height=320><param name=ShowStatusBar value=-1><param name=Filename value=$2><\/object>");
temp = temp.replace(/(\[IMG\])(.[^\[ ]*)(\[\/IMG\])/ig,"<img src='images/jpg.gif' width='16' height='16'>此主题相关图片如下：<br><A TARGET=_blank HREF=$2><img alt=$2 border=0 src=$2 onload='javascript:if(this.width>screen.width-440)this.width=screen.width-440'></a>");
temp = temp.replace(/(\[FLASH\])(.[^\[]*)(\[\/FLASH\])/ig,"<embed src=$2 width=500 height=375>");
temp = temp.replace(/\/:\)/ig,"<IMG border=0 SRC=images/regular_smile.gif>");
temp = temp.replace(/\/:d/ig,"<IMG border=0 SRC=images/teeth_smile.gif>");
temp = temp.replace(/\/:o/ig,"<IMG border=0 SRC=images/omg_smile.gif>");
temp = temp.replace(/\/:p/ig,"<IMG border=0 SRC=images/tounge_smile.gif>");
temp = temp.replace(/\/;\)/ig,"<IMG border=0 SRC=images/wink_smile.gif>");
temp = temp.replace(/\/:\(/ig,"<IMG border=0 SRC=images/sad_smile.gif>");
temp = temp.replace(/\/:s/ig,"<IMG border=0 SRC=images/confused_smile.gif>");
temp = temp.replace(/\/:\|/ig,"<IMG border=0 SRC=images/whatchutalkingabout_smile.gif>");
temp = temp.replace(/\/:\$/ig,"<IMG border=0 SRC=images/embaressed_smile.gif>");
temp = temp.replace(/(\[em)([0-9]*)(\])/ig,"<IMG border=0 SRC=images/Emotions/$2.gif>");
return (temp);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

window.onload = initImageResizer;
function initImageResizer(){
	var cons	= getElementsByClassName("PostContent");
	if(!cons) return;
	var img,imgs;
	for(var i=0;i<cons.length;i++){
		imgs	= cons[i].getElementsByTagName('img');
		if(!imgs) continue;
		for (var j=0;j<imgs.length;j++){		
			img	= imgs[j];
			if(img.width>screen.width-330){
				img.width = screen.width-400;
			}
		}
	}
}
function getElementsByClassName(class_name){
	var all_obj,ret_obj=new Array(),j=0,teststr;
	
	if(document.all){
		all_obj=document.all;
	}else if(document.getElementsByTagName && !document.all){
		all_obj=document.getElementsByTagName("*");
	}
	
	for(i=0;i<all_obj.length;i++){
		if(all_obj[i].className.indexOf(class_name)!=-1){
			teststr=","+all_obj[i].className.split(" ").join(",")+",";
			if(teststr.indexOf(","+class_name+",")!=-1)	{
				ret_obj[j]=all_obj[i];
				j++;
			}
		}
	}
	return ret_obj;
}




