function toggleEditor(id) {
	var elm = document.getElementById(id);
	if (tinyMCE.getInstanceById(id) == null) {
		init_tiny_mce(id, true, false);
	} else {
		tinyMCE.execCommand('mceRemoveControl', false, id);
	}
}

var tiny_mce_editors = {};
function init_tiny_mce(id, load_from_cookie, load_text_mode) {	
	if(load_text_mode == true) {
		return true;
	}
	var content = 'Tiny Mce Error. Can\'t load content.'
	if(tinyMCE.get(id)) {
		var content = tinyMCE.get(id).getContent();
	}
	if(!tiny_mce_editors['tiny_mce_editor_'+id]) 
		tiny_mce_editors['tiny_mce_editor_'+id] = {};
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : id,
		theme : "advanced",
		plugins : "inlinepopups",
		theme_advanced_buttons3 : '',
		theme_advanced_buttons2 : '',
		theme_advanced_buttons1 : 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,forecolor,link,|,bullist,numlist',
		relative_urls : false,
		theme_advanced_toolbar_location : "top",
		theme_advanced_resize_horizontal : false,
		theme_advanced_resizing : true,
		cleanup : true
	});
}

