tinyMCE.init({
	mode : "exact",
	elements : "text",
	theme : "advanced",
	plugins : "inlinepopups,table,contextmenu,paste,spellchecker",
	inline_styles : false,
	convert_urls : false,
	theme_advanced_buttons1 : "bold,italic,underline,separator,formatselect,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,image,link,unlink,separator,paste,pasteword,cleanup,spellchecker,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	extended_valid_elements : "a[href|target|title],img[src|border|alt|title|hspace|vspace|width|height|align|name],strong/b,em/i,u",
	theme_advanced_blockformats : "h2,h3",
	entity_encoding : "none",
//	force_p_newlines : false,
//	auto_cleanup_word : true,
//	paste_use_dialog : true,
//	paste_auto_cleanup_on_paste : true,
//	paste_create_paragraphs : false,
//	paste_force_cleanup_wordpaste : true,
//	paste_unindented_list_class : "unindentedList",
//	paste_convert_headers_to_strong : true,
//  autolink_linkchecker_url : '/js/tiny_mce/plugins/autolink/linkcheck.php?url=<URL>',
//  autolink_linkchecker_interval : 10000,
//	cleanup_callback : "CustomCleanup",
	textarea_trigger : 'text'
	
});

function toggleEditor(id) {
	if (!tinyMCE.getInstanceById(id))
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
}
/*
function CustomCleanup(type, content) {
	switch (type) {
   // gets passed when user submits the form
   case "get_from_editor":
    content = content.replace(/<p>\s*<\/p>/gi, ""); // remove empty paragraphs <-- does not work
	 	content = content.replace(/<p> <\/p>/gi, '');
	 	content = content.replace(/<p>&nbsp;<\/p>/gi, '');
	 	content = content.replace(/<p>[space]<\/p>/gi, '');
    break;
   // gets passed when new content is inserted into the editor
   case "insert_to_editor":
  	content = content.replace(/“|„|”|«|»/gi, '"'); //replace Word quotes with standard ASCII quotes
  	content = content.replace(/<p>\s*<\/p>/gi, ""); // remove empty paragraphs <-- does not work
	 	content = content.replace(/<p> <\/p>/gi, '');
	 	content = content.replace(/<p>&nbsp;<\/p>/gi, '');
	 	content = content.replace(/<p>[space]<\/p>/gi, '');
   break;
  }
return content;
}
*/