
var UBB={};UBB.extend=function(d,c)
{if(c)
{var o=c;for(var n in d)
{if(typeof(c[n])=='endefined')
o[n]=d[n];}
return o;}
return d;};UBB.summaryHTML=function(html,l)
{if(html.length<=l)
return html;var part_html=html.substr(0,l);part_html=part_html.replace(/(&[a-zA-Z]*?$)|(<\/?[^>]*?$)/ig,'');var suffix='';var lefth=part_html.replace(/<.*?\/>/g,'');lefth=lefth.replace(/<[^<]*?>[^<]*<\/.*?>/g,'');lefth.replace(/<([a-zA-Z]+).*?>/g,function($0,$1){suffix+='</'+$1+'>';return'';});return part_html+suffix;};UBB.photoQuoteHTML=function(photo_id,floor)
{var identity="楼主";if(floor>0)
{identity=floor+'楼';}
var html='<blockquote name="editor_photo_quote" contentEditable="false" class="blockquote01"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="left" valign="middle" class="blockquote01Td01" name="floor">引用了'+identity+'的图片：</td></tr><tr><td align="center" valign="middle" class="blockquote01Td02">';html+='<img src="/bbs/picture/show/type/1/picture_id/'+photo_id+'" /></td></tr></table></blockquote>';return html;};UBB.replyQuoteHTML=function(rcontent,runame,rcreated,floor)
{floor=floor||1;var floor_str='<span name="floor">'+floor+'</span>楼';rcontent=rcontent.replace(/<blockquote[\w\W]*?>[\w\W]*?<\/blockquote>(<br[\/]?>)*/ig,'');var ubb=UBB.html2ubb(rcontent);ubb=ubb.replace(/\[IMG.*?\].*?\[\/IMG\]/ig,'「图片」');ubb=ubb.replace(/\[FACE\|(.*?)\](\d{1,3})\[\/FACE\]/ig,'「表情」');ubb=ubb.replace(/\[PHOTO\]([\da-z]{32})\[\/PHOTO\]/ig,function($0,$1){return'[IMG]/bbs/picture/show/type/2/picture_id/'+$1+'[/IMG]';});rcontent=UBB.ubb2html(ubb);if(rcontent.width()>G_CONF.bbs.reply_quote_max_l)
rcontent=UBB.summaryHTML(rcontent,G_CONF.bbs.reply_quote_max_l)+'...';var html='<blockquote name="editor_reply_quote" contentEditable="false" class="blockquote02"><div class="blockquote02T01">'+floor_str+'「<b name="quname">'+runame+'</b>」 <span name="qcreated">'+rcreated+'</span>发表</div><div class="blockquote02T02" name="qcontent">'+rcontent+'</div></blockquote>';return html;};UBB.quoteHTML=function(rcontent,floor)
{var floor_str='<div class="blockquote02T01">引用</div>';if(floor>0)
floor_str='<div class="blockquote02T01" floor="'+floor+'">引用'+floor+'楼</div>';else if(floor==0)
floor_str='<div class="blockquote02T01" floor="0">引用楼主</div>';rcontent=rcontent.replace(/<blockquote[\w\W]*?>[\w\W]*?<\/blockquote>(<br[\/]?>)*/ig,'');var ubb=UBB.html2ubb(rcontent);ubb=ubb.replace(/\[IMG.*?\].*?\[\/IMG\]/ig,'「图片」');ubb=ubb.replace(/\[PHOTO\]([\da-z]{32})\[\/PHOTO\]/ig,function($0,$1){return'[IMG]/bbs/picture/show/type/2/picture_id/'+$1+'[/IMG]';});rcontent=UBB.ubb2html(ubb);if(rcontent.width()>G_CONF.bbs.reply_quote_max_l)
rcontent=UBB.summaryHTML(rcontent,G_CONF.bbs.reply_quote_max_l)+'...';var html='<blockquote name="editor_quote" contentEditable="false" class="blockquote02">'+floor_str+'<div class="blockquote02T02" name="qcontent">'+rcontent+'</div></blockquote>';return html;};UBB.swfBlockHTML=function(w,h,src)
{return'<img class="swfBlock" src="/images/editor/swf_sp.gif" style="width:'+w+'px;height:'+h+'px;" swf="'+src+'"/>';};UBB.ubb2html=function(str,opt)
{opt=UBB.extend({flash:true},opt);if(str==''){return'';}
str=preg_replace(['&','>','<',' '],['&amp;','&gt;','&lt;','&nbsp;'],str);if(true){str=str.replace(/\n/g,'<br/>');str=str.replace(/\[url[^\]]*\]\[\/url\]/ig,'');str=str.replace(/\[url\]\s*(www.|https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|bctp:\/\/|ed2k:\/\/){1}([^\[\"']+?)\s*\[\/url\]/ig,function($1,$2,$3){return UBB.cuturl($2+$3);});str=str.replace(/\[url=www.([^\[\"']+?)\](.+?)\[\/url\]/ig,'<a href="http://www.$1" target="_blank">$2</a>');str=str.replace(/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k){1}:\/\/([^\[\"']+?)\]([\s\S]+?)\[\/url\]/ig,'<a href="$1://$2" target="_blank">$3</a>');str=str.replace(/\[email\](.*?)\[\/email\]/ig,'<a href="mailto:$1">$1</a>');str=str.replace(/\[email=(.[^\[]*)\](.*?)\[\/email\]/ig,'<a href="mailto:$1" target="_blank">$2</a>');str=str.replace(/\[color=([^\[\<]+?)\]/ig,'<font color="$1">');str=str.replace(/\[size=(\d+?)\]/ig,'<font size="$1">');str=str.replace(/\[size=(\d+(\.\d+)?(px|pt|in|cm|mm|pc|em|ex|%)+?)\]/ig,'<font style="font-size: $1">');str=str.replace(/\[font=([^\[\<]+?)\]/ig,'<font face="$1">');str=str.replace(/\[align=([^\[\<]+?)\]/ig,'<p align="$1">');str=str.replace(/\[float=([^\[\<]+?)\]/ig,'<br style="clear: both"><span style="float: $1;">');re=/\[table(?:=(\d{1,4}%?)(?:,([\(\)%,#\w ]+))?)?\]\s*([\s\S]+?)\s*\[\/table\]/ig;for(i=0;i<4;i++){str=str.replace(re,function($1,$2,$3,$4){return UBB.parsetable($2,$3,$4);});}
str=preg_replace(['\\\[\\\/color\\\]','\\\[\\\/size\\\]','\\\[\\\/font\\\]','\\\[\\\/align\\\]','\\\[b\\\]','\\\[\\\/b\\\]','\\\[i\\\]','\\\[\\\/i\\\]','\\\[u\\\]','\\\[\\\/u\\\]','\\\[list\\\]','\\\[list=1\\\]','\\\[list=a\\\]','\\\[list=A\\\]','\\\[\\\*\\\]','\\\[\\\/list\\\]','\\\[indent\\\]','\\\[\\\/indent\\\]','\\\[\\\/float\\\]'],['</font>','</font>','</font>','</p>','<b>','</b>','<i>','</i>','<u>','</u>','<ul>','<ul type=1>','<ul type=a>','<ul type=A>','<li>','</ul>','<blockquote>','</blockquote>','</span>'],str);}
str=str.replace(/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ig,'<img src="$1" border="0" onerror="imgLoadErr(this)"/>');str=str.replace(/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ig,'<img width="$1" height="$2" src="$3" border="0" onerror="imgLoadErr(this)"/>');str=str.replace(/\[SWF\|(\d+)\|(\d+)\](.*?)\[\/SWF\]/ig,function($0,$1,$2,$3){return $.swf({w:$1,h:$2,src:$3});});str=str.replace(/\[PHOTO\](\d{10}_\d{8}_\w{32})\[\/PHOTO\]/ig,function($0,$1){return'<img src="/file/load/photo_id/'+$1+'/norm/1" />'});str=str.replace(/\[FACE\](\d{1,3})\[\/FACE\]/ig,function($0,$1){return'<img src="/images/editor/face/'+$1+'.gif" />'});str=str.replace(/\[REPLY_QUOTE\|(\d+)\|([\d(&nbsp;):-]+)\]\[NICK\]([\w\W]+?)\[\/NICK\]\[CON\](.*?)\[\/CON\]\[\/REPLY_QUOTE\]/ig,function($0,$1,$2,$3,$4){return replyQuoteHTML($4,$3,$2,$1);});str=str.replace(/\[PHOTO_QUOTE\|(\d+)\]([\da-z]{32})\[\/PHOTO_QUOTE\]/ig,function($0,$1,$2){return photoQuoteHTML($2,$1);});str=str.replace(/\[PHOTO_QUOTE\]([\da-z]{32})\[\/PHOTO_QUOTE\]/ig,function($0,$1){return photoQuoteHTML($1);});str=str.replace(/\[QUOTE\](.*?)\[\/QUOTE\]/ig,function($0,$1){return quoteHTML($1);});str=str.replace(/\[QUOTE\|(\d+)\](.*?)\[\/QUOTE\]/ig,function($0,$1,$2){return quoteHTML($2,$1);});str=str.replace(/\[LBRACK\]/g,'[');return str;}
UBB.html2ubb=function(str,opt)
{opt=UBB.extend({flash:true},opt);str=str.replace(/\[/g,'[LBRACK]');str=preg_replace(['<style.*?>[\\\s\\\S]*?<\/style>','<script.*?>[\\\s\\\S]*?<\/script>','<noscript.*?>[\\\s\\\S]*?<\/noscript>','<select.*?>[\s\S]*?<\/select>','<!--[\\\s\\\S]*?-->',' on[a-zA-Z]{3,16}\\\s?=\\\s?"[\\\s\\\S]*?"'],'',str);if(!opt.flash)
str=preg_replace(['<object.*?>[\s\S]*?<\/object>','<embed*?>[\s\S]*?<\/embed>'],'',str);str=str.replace(/(\r\n|\n|\r)/ig,'');str=str.replace(/&((#(32|127|160|173))|shy|nbsp);/ig,' ');str=str.replace(/<br\s+?style=(["']?)clear: both;?(\1)[^\>]*>/ig,'');str=str.replace(/<br[^\>]*>/ig,"\n");if(true){str=str.replace(/<blockquote.*?name=\"editor_quote\".*?><div[^>]*?floor=\"(\d+)\">[\w\W]*?<\/div><div.*?name=\"qcontent\">([\w\W]*?)<\/div><\/blockquote>/ig,function($0,$1,$2){return'[QUOTE|'+$1+']'+$2+'[/QUOTE]';});str=str.replace(/<blockquote.*?name=\"editor_quote\".*?><div[^>]*?>[\w\W]*?<\/div><div.*?name=\"qcontent\".*?>([\w\W]*?)<\/div><\/blockquote>/ig,function($0,$1){return'[QUOTE]'+$1+'[/QUOTE]';});str=str.replace(/<blockquote.*?name=\"editor_photo_quote\"[^>]*?>[\w\W]*?name=\"floor\"[^>]*?>[^<]*?(\d+)[\w\W]*?<img[^>]*?src=\".*?picture_id\/([\da-z]{32}).*?\"[^>]*?><\/td>.*?<\/blockquote>/ig,function($0,$1,$2){return'[PHOTO_QUOTE|'+$1+']'+$2+'[/PHOTO_QUOTE]';});str=str.replace(/<blockquote.*?name=\"editor_photo_quote\"[^>]*?>[\w\W]*?<img[^>]*?src=\".*?picture_id\/([\da-z]{32}).*?\"[^>]*?>[\w\W]*?<\/blockquote>/ig,function($0,$1){return'[PHOTO_QUOTE|0]'+$1+'[/PHOTO_QUOTE]';});str=str.replace(/<blockquote.*?name=\"editor_reply_quote\"[^>]*?>.*?<span name=\"floor\">(\d+)<\/span>.*?<b name=\"quname\">([\w\W]+?)<\/b>.*?<span name=\"qcreated\">([\d\s\:-]*?)<\/span>.*?<div.*?name=\"qcontent\">([\w\W]*?)<\/div><\/blockquote>/ig,function($0,$1,$2,$3,$4){return'[REPLY_QUOTE|'+$1+'|'+$3+'][NICK]'+$2+'[/NICK][CON]'+$4+'[/CON][/REPLY_QUOTE]';});str=preg_replace(swfHTMLRegExp,[function($0,$1,$2,$3){return'[SWF|'+$1+'|'+$2+']'+$3+'[/SWF]';},function($0,$1,$2,$3){return'[SWF|'+$2+'|'+$1+']'+$3+'[/SWF]';},function($0,$1,$2,$3){return'[SWF|'+$1+'|'+$2+']'+$3+'[/SWF]';},function($0,$1,$2,$3){return'[SWF|'+$2+'|'+$1+']'+$3+'[/SWF]';},function($0,$1,$2,$3){return'[SWF|'+$2+'|'+$1+']'+$3+'[/SWF]';},function($0,$1,$2,$3){return'[SWF|'+$1+'|'+$2+']'+$3+'[/SWF]';}],str);str=str.replace(/<img.*?class=\"?swfBlock\"?.*?style=\".*?width:\s?(\d+)px;\s?height:\s?(\d+)px;?[^\"]*?\".*?swf=\"(.*?)\".*?>/ig,function($0,$1,$2,$3){return'[SWF|'+$1+'|'+$2+']'+$3+'[/SWF]';});str=preg_replace(['<table([^>]*(width|background|background-color|bgcolor)[^>]*)>','<table[^>]*>','<tr[^>]*(?:background|background-color|bgcolor)[:=]\\\s*(["\']?)([\(\)%,#\\\w]+)(\\1)[^>]*>','<tr[^>]*>','<t[dh]([^>]*(width|colspan|rowspan)[^>]*)>','<t[dh][^>]*>','<\/t[dh]>','<\/tr>','<\/table>'],[function($1,$2){return UBB.tabletag($2);},'[table]',function($1,$2,$3){return'[tr='+$3+']';},'[tr]',function($1,$2){return UBB.tdtag($2);},'[td]','[/td]','[/tr]','[/table]'],str);str=str.replace(/<h([0-9]+)[^>]*>(.*)<\/h\\1>/ig,"[size=$1]$2[/size]\n\n");str=str.replace(/<img\s[^>]*?src=\"[^>]*?\/images\/editor\/face\/(\d{1,3})\.[a-z]{3}\".*?\/?>/ig,function($0,$1){return'[FACE]'+$1+'[/FACE]';});str=str.replace(/<img\s[^>]*?src=\"[^>]*?\/images\/editor\/face\/([^\/]+)\/(\d{1,3})\.[a-z]{3}\".*?\/?>/ig,function($0,$1,$2){return'[FACE|'+$1+']'+$2+'[/FACE]';});str=str.replace(/<img\s[^>]*?src=\"[^>]*?\/bbs\/picture\/show\/type\/2\/picture_id\/([\da-z]{32}).*?\".*?\/?>/ig,function($0,$1){return'[PHOTO]'+$1+'[/PHOTO]';});str=str.replace(/<img([^>]*src[^>]*)>/ig,function($0,$1){return UBB.imgtag($1);});str=str.replace(/<a\s+?name=(["']?)(.+?)(\1)[\s\S]*?>([\s\S]*?)<\/a>/ig,'$4');str=UBB.recursion('b',str,'UBB.simpletag','b');str=UBB.recursion('strong',str,'UBB.simpletag','b');str=UBB.recursion('i',str,'UBB.simpletag','i');str=UBB.recursion('em',str,'UBB.simpletag','i');str=UBB.recursion('u',str,'UBB.simpletag','u');str=UBB.recursion('a',str,'UBB.atag');str=UBB.recursion('font',str,'UBB.fonttag');str=UBB.recursion('blockquote',str,'UBB.simpletag','indent');str=UBB.recursion('ol',str,'UBB.listtag');str=UBB.recursion('ul',str,'UBB.listtag');str=UBB.recursion('div',str,'UBB.dpstag');str=UBB.recursion('p',str,'UBB.dpstag');str=UBB.recursion('span',str,'UBB.dpstag');}
str=str.replace(/<[\/\!]*?[^<>]*?>/ig,'');str=str.replace(/\[table\]\[\/table\]/ig,'');str=str.replace(/\[size[^\]]*?\](.*?)\[\/size\]/ig,function($0,$1){return $1;});str=str.replace(/\[font[^\]]*?\](.*?)\[\/font\]/ig,function($0,$1){return $1;});return preg_replace(['&nbsp;','&lt;','&gt;','&amp;'],[' ','<','>','&'],str);};UBB.cuturl=function(url){var length=65;var urllink='<a href="'+(url.toLowerCase().substr(0,4)=='www.'?'http://'+url:url)+'" target="_blank">';if(url.length>length){url=url.substr(0,parseInt(length*0.5))+' ... '+url.substr(url.length-parseInt(length*0.3));}
urllink+=url+'</a>';return urllink;};UBB.recursion=function(tagname,text,dofunction,extraargs){if(extraargs==null){extraargs='';}
tagname=tagname.toLowerCase();var open_tag='<'+tagname;var open_tag_len=open_tag.length;var close_tag='</'+tagname+'>';var close_tag_len=close_tag.length;var beginsearchpos=0;do{var textlower=text.toLowerCase();var tagbegin=textlower.indexOf(open_tag,beginsearchpos);if(tagbegin==-1){break;}
var strlen=text.length;var inquote='';var found=false;var tagnameend=false;var optionend=0;var t_char='';for(optionend=tagbegin;optionend<=strlen;optionend++){t_char=text.charAt(optionend);if((t_char=='"'||t_char=="'")&&inquote==''){inquote=t_char;}else if((t_char=='"'||t_char=="'")&&inquote==t_char){inquote='';}else if(t_char=='>'&&!inquote){found=true;break;}else if((t_char=='='||t_char==' ')&&!tagnameend){tagnameend=optionend;}}
if(!found){break;}
if(!tagnameend){tagnameend=optionend;}
var offset=optionend-(tagbegin+open_tag_len);var tagoptions=text.substr(tagbegin+open_tag_len,offset)
var acttagname=textlower.substr(tagbegin*1+1,tagnameend-tagbegin-1);if(acttagname!=tagname){beginsearchpos=optionend;continue;}
var tagend=textlower.indexOf(close_tag,optionend);if(tagend==-1){break;}
var nestedopenpos=textlower.indexOf(open_tag,optionend);while(nestedopenpos!=-1&&tagend!=-1){if(nestedopenpos>tagend){break;}
tagend=textlower.indexOf(close_tag,tagend+close_tag_len);nestedopenpos=textlower.indexOf(open_tag,nestedopenpos+open_tag_len);}
if(tagend==-1){beginsearchpos=optionend;continue;}
var localbegin=optionend+1;var localtext=eval(dofunction)(tagoptions,text.substr(localbegin,tagend-localbegin),tagname,extraargs);text=text.substring(0,tagbegin)+localtext+text.substring(tagend+close_tag_len);beginsearchpos=tagbegin+localtext.length;}while(tagbegin!=-1);return text;};UBB.imgtag=function(attributes)
{var width='';var height='';re=/src=(["']?)([\s\S]*?)(\1)/i;var matches=re.exec(attributes);if(matches!=null){var src=matches[2];}else{return'';}
re=/width\s?:\s?(\d{1,4})(px)?/ig;var matches=re.exec(attributes);if(matches!=null){width=matches[1];}
re=/height\s?:\s?(\d{1,4})(px)?/ig;var matches=re.exec(attributes);if(matches!=null){height=matches[1];}
if(!width||!height){re=/width=(["']?)(\d+)(\1)/i;var matches=re.exec(attributes);if(matches!=null){width=matches[2];}
re=/height=(["']?)(\d+)(\1)/i;var matches=re.exec(attributes);if(matches!=null){height=matches[2];}}
return width>0&&height>0?'[img='+width+','+height+']'+src+'[/img]':'[img]'+src+'[/img]';};UBB.simpletag=function(options,text,tagname,parseto)
{if(UBB.trim(text)==''){return'';}
text=UBB.recursion(tagname,text,'UBB.simpletag',parseto);return'['+parseto+']'+text+'[/'+parseto+']';};UBB.atag=function(aoptions,text)
{if(UBB.trim(text)=='')
{return'';}
href=UBB.getoptionvalue('href',aoptions);if(href.substr(0,11)=='javascript:'){return UBB.trim(UBB.recursion('a',text,'UBB.atag'));}else if(href.substr(0,7)=='mailto:'){tag='email';href=href.substr(7);}else{tag='url';}
return'['+tag+'='+href+']'+UBB.trim(UBB.recursion('a',text,'UBB.atag'))+'[/'+tag+']';};UBB.fonttag=function(fontoptions,text)
{var prepend='';var append='';var tags=new Array();tags={'font':'face=','size':'size=','color':'color='};for(bbcode in tags){optionvalue=UBB.fetchoptionvalue(tags[bbcode],fontoptions);if(optionvalue){prepend+='['+bbcode+'='+optionvalue+']';append='[/'+bbcode+']'+append;}}
var pend=UBB.parsestyle(fontoptions,prepend,append);return pend['prepend']+UBB.recursion('font',text,'UBB.fonttag')+pend['append'];};UBB.listtag=function(listoptions,text,tagname)
{text=text.replace(/<li>(([\s\S](?!<\/li))*?)(?=<\/?ol|<\/?ul|<li|\[list|\[\/list)/ig,'<li>$1</li>')+(UBB.is_opera?'</li>':'');text=UBB.recursion('li',text,'litag');var opentag='[list]';var listtype=UBB.fetchoptionvalue('type=',listoptions);listtype=listtype!=''?listtype:(tagname=='ol'?'1':'');if(UBB.in_array(listtype,['1','a','A'])){opentag='[list='+listtype+']';}
return text?opentag+UBB.recursion(tagname,text,'UBB.listtag')+'[/list]':'';};UBB.dpstag=function(options,text,tagname)
{if(UBB.trim(text)==''){return'\n';}
var pend=UBB.parsestyle(options,'','');var prepend=pend['prepend'];var append=pend['append'];if(UBB.in_array(tagname,['div','p'])){align=UBB.getoptionvalue('align',options);if(UBB.in_array(align,['left','center','right'])){prepend='[align='+align+']'+prepend;append+='[/align]';}else{append+='\n';}}
return prepend+UBB.recursion(tagname,text,'UBB.dpstag')+append;};UBB.listtag=function(listoptions,text,tagname){text=text.replace(/<li>(([\s\S](?!<\/li))*?)(?=<\/?ol|<\/?ul|<li|\[list|\[\/list)/ig,'<li>$1</li>')+(UBB.is_opera?'</li>':'');text=UBB.recursion('li',text,'UBB.litag');var opentag='[list]';var listtype=UBB.fetchoptionvalue('type=',listoptions);listtype=listtype!=''?listtype:(tagname=='ol'?'1':'');if(UBB.in_array(listtype,['1','a','A'])){opentag='[list='+listtype+']';}
return text?opentag+UBB.recursion(tagname,text,'UBB.listtag')+'[/list]':'';};UBB.litag=function(listoptions,text){return'[*]'+text.replace(/(\s+)$/g,'');};UBB.getoptionvalue=function(option,text)
{re=new RegExp(option+"(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|$|>)","ig");var matches=re.exec(text);if(matches!=null){return UBB.trim(matches[3]);}
return'';};UBB.fetchoptionvalue=function(option,text)
{if((position=UBB.strpos(text,option))!==false){delimiter=position+option.length;if(text.charAt(delimiter)=='"'){delimchar='"';}else if(text.charAt(delimiter)=='\''){delimchar='\'';}else{delimchar=' ';}
delimloc=UBB.strpos(text,delimchar,delimiter+1);if(delimloc===false){delimloc=text.length;}else if(delimchar=='"'||delimchar=='\''){delimiter++;}
return UBB.trim(text.substr(delimiter,delimloc-delimiter));}else{return'';}};UBB.parsestyle=function(tagoptions,prepend,append){var searchlist=[['align',true,'text-align:\\s*(left|center|right);?',1],['float',true,'float:\\s*(left|right);?',1],['color',true,'color:\\s*([^;]+);?',1],['font',true,'font-family:\\s*([^;]+);?',1],['size',true,'font-size:\\s*(\\d+(\\.\\d+)?(px|pt|in|cm|mm|pc|em|ex|%|));?',1],['b',false,'font-weight:\\s*(bold);?'],['i',false,'font-style:\\s*(italic);?'],['u',false,'text-decoration:\\s*(underline);?']];var style=UBB.getoptionvalue('style',tagoptions);re=/color:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)(;?)/ig;style=style.replace(re,function($1,$2,$3,$4,$5){return("color:#"+(parseInt($2)>0xf?'':'0')+parseInt($2).toString(16)+(parseInt($3)>0xf?'':'0')+parseInt($3).toString(16)+(parseInt($4)>0xf?'':'0')+parseInt($4).toString(16)+$5);});var len=searchlist.length;for(var i=0;i<len;i++){re=new RegExp(searchlist[i][2],"ig");match=re.exec(style);if(match!=null){opnvalue=match[searchlist[i][3]];prepend+='['+searchlist[i][0]+(searchlist[i][1]==true?'='+opnvalue+']':']');append='[/'+searchlist[i][0]+']'+append;}}
return{'prepend':prepend,'append':append};};UBB.trim=function(str){return(str+'').replace(/(\s+)$/g,'').replace(/^\s+/g,'');};UBB.strpos=function(haystack,needle,offset){if(offset==undefined||offset==null){offset=0;}
index=haystack.toLowerCase().indexOf(needle.toLowerCase(),offset);return index==-1?false:index;};UBB.in_array=function(needle,haystack)
{if(typeof needle=='string'||typeof needle=='number')
{for(var i in haystack)
{if(haystack[i]==needle)
{return true;}}}
return false;};UBB.parsetable=function(width,bgcolor,str)
{bgcolor=undefined;if(typeof(width)=='undefined'){var width='';}else{width=width.substr(width.length-1,width.length)=='%'?(width.substr(0,width.length-1)<=98?width:'98%'):(width<=560?width:'98%');}
str=str.replace(/\[tr(?:=([\(\)%,#\w]+))?\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ig,function($1,$2,$3,$4,$5){return'<tr'+($2?'':'')+'><td'+($3?' colspan="'+$3+'"':'')+($4?' rowspan="'+$4+'"':'')+($5?' width="'+$5+'"':'')+'>';});str=str.replace(/\[\/td\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ig,function($1,$2,$3,$4){return'</td><td'+($2?' colspan="'+$2+'"':'')+($3?' rowspan="'+$3+'"':'')+($4?' width="'+$4+'"':'')+'>';});str=str.replace(/\[\/td\]\s*\[\/tr\]/ig,'</td></tr>');return'<table '+(width==''?'':'width="'+width+'" ')+'class="t_table"'+(typeof(bgcolor)=='undefined'?'':' style="background: '+bgcolor+'"')+'>'+str+'</table>';};UBB.tabletag=function(attributes){var width='';re=/width=(["']?)(\d{1,4}%?)(\1)/i;var matches=re.exec(attributes);if(matches!=null){width=matches[2].substr(matches[2].length-1,matches[2].length)=='%'?(matches[2].substr(0,matches[2].length-1)<=98?matches[2]:'98%'):(matches[2]<=560?matches[2]:'98%');}else{re=/width\s?:\s?(\d{1,4})([px|%])/ig;var matches=re.exec(attributes);if(matches!=null){width=matches[2]=='%'?(matches[1]<=98?matches[1]:'98%'):(matches[1]<=560?matches[1]:'98%');}}
var bgcolor='';return bgcolor?'[table='+width+','+bgcolor+']':(width?'[table='+width+']':'[table]');};UBB.tdtag=function(attributes){var colspan=1;var rowspan=1;var width='';re=/colspan=(["']?)(\d{1,2})(\1)/ig;var matches=re.exec(attributes);if(matches!=null){colspan=matches[2];}
re=/rowspan=(["']?)(\d{1,2})(\1)/ig;var matches=re.exec(attributes);if(matches!=null){rowspan=matches[2];}
re=/width=(["']?)(\d{1,4}%?)(\1)/ig;var matches=re.exec(attributes);if(matches!=null){width=matches[2];}
return UBB.in_array(width,['','0','100%'])?(colspan==1&&rowspan==1?'[td]':'[td='+colspan+','+rowspan+']'):'[td='+colspan+','+rowspan+','+width+']';};UBB.userAgent=navigator.userAgent.toLowerCase();UBB.is_opera=UBB.userAgent.indexOf('opera')!=-1&&opera.version();var re;
