<Script Language=JScript Runat=Server>
function ybbcode(temp) {
if (request.cookies("ybbcode")!="0"){ //是否打开YBB代码
temp = temp.replace(/&amp;/ig,"&");
temp=temp.replace(/\[(\/|)b\]/ig,"<$1b>");
temp=temp.replace(/\[(\/|)i\]/ig,"<$1i>");
temp=temp.replace(/\[(\/|)u\]/ig,"<$1u>");
temp=temp.replace(/\[(\/|)strike\]/ig,"<$1strike>");
temp=temp.replace(/\[(\/|)center\]/ig,"<$1center>");
temp=temp.replace(/\[(\/|)marquee\]/ig,"<$1marquee>");
temp=temp.replace(/\[QUOTE\]/ig,"<br><table border='0' width='100%' cellspacing='1' cellpadding='10' bgcolor='#31659C' align='center'><tr><td width='90%' bgcolor='#F3F3F3' style='word-break:break-all'>");
temp=temp.replace(/\[\/QUOTE\]/ig,"</td></tr></table>");

temp=temp.replace(/\[TABLE\]/ig,"<br><table borderColor=#ffcc66 border='1' width='100%' bgcolor='#dadacf' align='center'><tr><td width='90%' style='word-break:break-all'>");
temp=temp.replace(/\[\/TABLE\]/ig,"</td></tr></table>");
temp=temp.replace(/(\[font=)([^.:;`'"=\]]*)(\])/ig,"<FONT face='$2'>");
temp=temp.replace(/\[\/font\]/ig,"<\/FONT>");
temp=temp.replace(/(\[COLOR=)([^.:;`'"=\]]*)(\])/ig,"<FONT COLOR='$2'>");
temp=temp.replace(/\[\/COLOR\]/ig,"<\/FONT>");
temp=temp.replace(/(\[size=)([0-9]*)(\])/ig,"<FONT size='$2'>");
temp=temp.replace(/\[\/size\]/ig,"<\/FONT>");
temp=temp.replace(/(\[URL\])([^]]*)(\[\/URL\])/ig,"<A TARGET=_blank HREF='$2'>$2</A>");
temp=temp.replace(/(\[URL=)([^]]*)(\])/ig,"<A TARGET=_blank HREF='$2'>");
temp=temp.replace(/\[\/URL\]/ig,"<\/A>");
temp=temp.replace(/(\[EMAIL\])(\S+\@[^]]*)(\[\/EMAIL\])/ig,"<a href=mailto:$2>$2</a>");
temp=temp.replace(/<A HREF=\"([^"]*)\">/ig,"<A TARGET=_blank HREF=\"$1\">");
temp=temp.replace(/<IMG src=\"([^"]*)\">/ig,"<IMG src=\"$1\" border=0 onmousewheel='return yuzi_img(event,this)' onload='javascript:if(this.width>490)this.width=490'>");
temp = temp.replace(/(\[fly\])(.[^\[]*)(\[\/fly\])/ig,"<MARQUEE scrollAmount=3 behavior=alternate>$2<\/MARQUEE>");
temp = temp.replace(/(\[move\])(.[^\[]*)(\[\/move\])/ig,"<MARQUEE scrollAmount=3>$2<\/MARQUEE>");
temp = temp.replace(/(\[glow\])(.[^\[]*)(\[\/glow\])/ig,"<span style='behavior:url(inc/font.htc)'>$2</span>");
temp = temp.replace(/(\[LIGHT=#([a-z0-9]*)\])([^]]*)(\[\/LIGHT\])/ig,"<table width=100%><tr><td style='FILTER:glow(color=$2)' class=a5>$3</td></tr></table>");
temp = temp.replace(/(\[SHADOW=#([a-z0-9]*)\,([0-9]*)\])([^]]*)(\[\/SHADOW\])/ig,"<table width=100%><tr><td style='FILTER:shadow(color=$2,strength=$3)'>$4</td></tr></table>");
temp = temp.replace(/(\[sound\])(.[^\[]*)(\[\/sound\])/,"<bgsound src='$2' loop='-1'>");

temp = temp.replace(/(\[text1\])(.[^\[]*)(\[\/text1\])/ig,"<span style='width:97%;filter:glow(color=#F8C747,strength=3);color:#000000;font-size:10pt'>$2</span>");
temp = temp.replace(/(\[text2\])(.[^\[]*)(\[\/text2\])/ig,"<span style='width:97%;filter:glow(color=#F73EBF,strength=3);color:#FFFFFF;font-size:10pt'>$2</span>");
temp = temp.replace(/(\[text3\])(.[^\[]*)(\[\/text3\])/ig,"<span style='width:97%;filter:glow(color=#0000FF,strength=3);color:#FFFFFF;font-size:10pt'>$2</span>");
temp = temp.replace(/(\[text4\])(.[^\[]*)(\[\/text4\])/ig,"<span style='width:97%;filter:glow(color=#082B68,strength=3);color:#FFFFFF;font-size:10pt'>$2</span>");
temp = temp.replace(/(\[text5\])(.[^\[]*)(\[\/text5\])/ig,"<span style='width:97%;filter:glow(color=#7D3F00,strength=3);color:#FFFFFF;font-size:10pt'>$2</span>");
}
if (request.cookies("ybbimg")!="0"){  //是否打开[IMG]代码
temp = temp.replace(/(\[IMG\])([^];]*)(\[\/IMG\])/ig,"<img border=0 src=\"$2\" onmousewheel='return yuzi_img(event,this)' onload='javascript:if(this.width>490)this.width=490'>");
}
if (request.cookies("ybbbrow")!="0"){  //是否打开表情代码
temp = temp.replace(/(\[em)([0-9]*)(\])/ig,"<IMG border=0 SRC=images/Emotions/$2.gif>");
}
if (request.cookies('YbbMedia')!='0'){  //是否打开[FLASH][RM][MP]代码
temp=temp.replace(/(\[FLASH=([0-9]*)\,([0-9]*)\])([^]]*)(\[\/FLASH\])/ig,"<embed width=$2 height=$3 src=$4 wmode=transparent>");
temp=temp.replace(/(\[MP=([0-9]*)\,([0-9]*)\,([A-Z]*)\])([^]]*)(\[\/MP\])/ig,"<embed width=$2 height=$3 autostart=$4 src=$5 ShowStatusBar=1>");
temp=temp.replace(/(\[RM=([0-9]*)\,([0-9]*)\,([A-Z]*)\])([^]]*)(\[\/RM\])/ig,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width=$2 height=$3><PARAM NAME=SRC VALUE=$5><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=$4><\/OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=60 width=$2><PARAM NAME=CONTROLS VALUE=ControlPanel,StatusBar><PARAM NAME=CONSOLE VALUE=Clip1><\/OBJECT>");
}
return (temp);
}
</SCRIPT>
