function ybbcode(temp) {

if (badwords!=''){    //过滤敏感字
var badword= badwords.split ('|'); 
for(i=0;i<badword.length;i=i+1) {
if (badword[i] !=""){temp = temp.replace(badword[i],"****");}
}
}



if (getCookie('ybbcode')!='0'){ //是否打开YBB代码
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(/(\[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=500 height=375><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=60 width=500><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=500 height=420><param name=ShowStatusBar value=-1><param name=Filename value=$2><\/object>");
}

if (getCookie('ybbimg')!='0'){  //是否打开[IMG]代码
temp = temp.replace(/(\[IMG\])(http:\/\/.[^\[ ]*)(\[\/IMG\])/ig,"<img border=0 src=$2 onmousewheel='return yuzi_img(event,this)' onload='javascript:if(this.width>screen.width-450)this.width=screen.width-450'>");
}

if (getCookie('ybbflash')!='0'){  //是否打开[FLASH]代码
temp = temp.replace(/(\[FLASH\])(http:\/\/.[^\[]*)(\[\/FLASH\])/ig,"<embed src=$2 width=500 height=375>");
}

if (getCookie('ybbbrow')!='0'){  //是否打开表情代码
temp = temp.replace(/\/:\)/ig,"<IMG border=0 SRC=images/brow/regular_smile.gif>");
temp = temp.replace(/\/:d/ig,"<IMG border=0 SRC=images/brow/teeth_smile.gif>");
temp = temp.replace(/\/:o/ig,"<IMG border=0 SRC=images/brow/omg_smile.gif>");
temp = temp.replace(/\/:p/ig,"<IMG border=0 SRC=images/brow/tounge_smile.gif>");
temp = temp.replace(/\/;\)/ig,"<IMG border=0 SRC=images/brow/wink_smile.gif>");
temp = temp.replace(/\/:\(/ig,"<IMG border=0 SRC=images/brow/sad_smile.gif>");
temp = temp.replace(/\/:s/ig,"<IMG border=0 SRC=images/brow/confused_smile.gif>");
temp = temp.replace(/\/:\|/ig,"<IMG border=0 SRC=images/brow/whatchutalkingabout_smile.gif>");
temp = temp.replace(/\/:\$/ig,"<IMG border=0 SRC=images/brow/embaressed_smile.gif>");
}

return (temp);
}




function level(experience,membercode)
{
if (membercode=='0'){levelname="禁止发言";levelimage="<img src=images/level1.gif>";return('');}
if (membercode=='2'){levelname="特邀嘉宾";levelimage="<img src=images/level11.gif>";return('');}
if (membercode=='3'){levelname="论坛版主";levelimage="<img src=images/level12.gif>";return('');}
if (membercode=='4'){levelname="管 理 员";levelimage="<img src=images/level13.gif>";return('');}
if (membercode=='5'){levelname="社区区长";levelimage="<img src=images/level14.gif>";return('');}
if (experience<'100'&& membercode=='1'){levelname="新手上路";levelimage="<img src=images/level1.gif>";return('');}
if (experience<'501'&& membercode=='1'){levelname="初出江湖";levelimage="<img src=images/level1.gif>";return('');}
if (experience<'1301'&& membercode=='1'){levelname="一般站友";levelimage="<img src=images/level2.gif>";return('');}
if (experience<'2601'&& membercode=='1'){levelname="中级站友";levelimage="<img src=images/level2.gif>";return('');}
if (experience<'4501'&& membercode=='1'){levelname="高级站友";levelimage="<img src=images/level3.gif>";return('');}
if (experience<'7001'&& membercode=='1'){levelname="老 站 友";levelimage="<img src=images/level3.gif>";return('');}
if (experience<'11001'&& membercode=='1'){levelname="青铜长老";levelimage="<img src=images/level4.gif>";return('');}
if (experience<'19001'&& membercode=='1'){levelname="白银长老";levelimage="<img src=images/level5.gif>";return('');}
if (experience<'30001'&& membercode=='1'){levelname="黄金长老";levelimage="<img src=images/level6.gif>";return('');}
if (experience<'45001'&& membercode=='1'){levelname="白金长老";levelimage="<img src=images/level7.gif>";return('');}
if (experience<'65001'&& membercode=='1'){levelname="钻石长老";levelimage="<img src=images/level8.gif>";return('');}
if (experience<'90001'&& membercode=='1'){levelname="本站元老";levelimage="<img src=images/level9.gif>";return('');}
if (experience>'90000'&& membercode=='1'){levelname="开国大老";levelimage="<img src=images/level10.gif>";return('');}
}

//读取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;
}
