sumlyBBCode = {
	BBCode2THML : function(text) {
		var search_array = [/\[quote\]/gm,/\[\/quote\]/gm,/\[u\]/gm,/\[\/u\]/gm,/\[b\]/gm,/\[\/b\]/gm,/\[i\]/gm,/\[\/i\]/gm,/\[list\]/gm,/\[\/list\]/gm,/\[li\]/gm,/\[\/li\]/gm,/\[sub\]/gm,/\[\/sub\]/gm,/\[sup\]/gm,/\[\/sup\]/gm,/\[strike\]/gm,/\[\/strike\]/gm,/\[blockquote\]/gm,/\[\/blockquote\]/gm,/\[hr\]/gm];
		var replace_array = ['<div class="BBCodeQuote">','</div>','<u>','</u>','<b>','</b>','<i>','</i>','<ul style="margin:0 0 0 15px">','</ul>','<li>','</li>','<sub>','</sub>','<sup>','</sup>','<strike>','</strike>','<blockquote>','</blockquote>','<hr />'];
		var n = search_array.length;
		for(var i = 0; i < n; i ++)
			text = text.replace(search_array[i],replace_array[i]);
		for(var i in sumlyEmoticons) {
			var pattern = new RegExp(this.EscapeReg(sumlyEmoticons[i]), "gm");
			text = text.replace(pattern,'<img src="' + sumlyEmoticonDir + i + '.gif" border="0" />');
		}
		return text;
	},

	HTMLEncode : function(text) {
		text = text.replace(/&/g,"&amp;");
		text = text.replace(/"/g,"&quot;");
		text = text.replace(/'/g,"&#039;");
		text = text.replace(/</g,"&lt;");
		text = text.replace(/>/g,"&gt;");
		return text;
	},

	EscapeReg : function(str) {
		str = str.replace(/\//g,"\\/");
		str = str.replace(/\\/g,"\\\\");
		str = str.replace(/\./g,"\\.");
		str = str.replace(/\*/g,"\\*");
		str = str.replace(/\+/g,"\\+");
		str = str.replace(/\?/g,"\\?");
		str = str.replace(/\|/g,"\\|");
		str = str.replace(/\(/g,"\\(");
		str = str.replace(/\)/g,"\\)");
		str = str.replace(/\[/g,"\\[");
		str = str.replace(/\]/g,"\\]");
		str = str.replace(/\{/g,"\\{");
		str = str.replace(/\}/g,"\\}");
		return str;
	}
}