
	/* Version 1.1
	 * Author: Moxiecode Systems 
	* Slightly modified by Thierry Bézecourt, October 2005 (fixed the regexps)
	 */
	
	var tinyMCE_on = false;
	
	document.onload = tinyForumInit();
	
	function tinyForumInit() {
		setTimeout("toggleTinyMCE();",1000);
	}
	
	tinyMCE.init({
		mode : "none",
		theme : "advanced",
		plugins : "emotions,bbcode,inlinepopups,safari",
		theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,forecolor,styleselect,removeformat,cleanup,code",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_toolbar_location : "bottom",
		theme_advanced_toolbar_align : "center",
		theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
		valid_elements : "strong/b[class],em/i[class],u[class],a[href|target|title],img[class|src|border=0|alt|title|width|height|align|name],span[!class],font[color|class],br", 
		entity_encoding: 'raw',
		convert_fonts_to_spans : false,
		remove_linebreaks: false,
		merge_styles_invalid_parents : "^P",
		relative_urls : false,
		add_unload_trigger : false
	});

	function TinyMCESaving() {
		if (tinyMCE_on == true) {
			document.bb_form.req_message.value = convertFromMCEToBBCode(tinyMCE.getContent());
		}
	}

	function toggleTinyMCE() {
		if (tinyMCE_on == true) {
			// if mce is on, we toggle it off and convert to BBCode
			tinyMCE.execCommand("mceRemoveControl", false, "req_message");
			tinyMCE_on = false;
			return;
		} else {
			// if mce is off, we toggle it on and convert to HTML code
			tinyMCE.execCommand("mceAddControl", false, "req_message");
			tinyMCE_on = true;
			return;
		}
	}

	function submitForm(the_form) {
		return true;
	}
