// Init TinyMCE
tinyMCE.init({
	mode : "textareas",
	elements : 'nourlconvert',
	relative_urls : false,
	convert_urls : false,
	theme : "advanced",
	plugins: "table,iespell,safari,fullscreen",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,indent,outdent",
	theme_advanced_buttons2 : "undo,redo,separator,link,unlink,separator,forecolor,fontselect,fontsizeselect",
	theme_advanced_buttons3 : "tablecontrols",
	theme_advanced_toolbar_location : "top",
	theme_advanced_statusbar_location : "none",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path : false,
	theme_advanced_path_location : "bottom",
	theme_advanced_resizing : true,
	editor_selector : "mceEditor"
});


// Toggle button. 'eltId' is the element that the control is on.
var mceModes = new Array();
function toogleEditorMode(eltId) {
	var elt = document.getElementById(eltId);
	var selector = document.getElementById(eltId + '_selector');
	if ( mceModes[eltId] && selector.selectedIndex != 3 ) {
		tinyMCE.execCommand("mceRemoveControl",false,eltId);
		mceModes[eltId] = false;
		elt.setAttribute("rows",elt.rows-3);
	}
	else if ( !mceModes[eltId] && selector.selectedIndex == 3 ) {
		elt.setAttribute("rows",elt.rows+3);
		tinyMCE.execCommand("mceAddControl",false,eltId);
		mceModes[eltId] = true;
	}
}
