tinyMCE.init({
	mode : "exact",
	relative_urls : false,
	elements : "compose_comment",
	theme : "advanced",
		languages : 'en',
		remove_script_host : false,
		theme_advanced_blockformats : "h2,h3,blockquote,p",
	theme_advanced_buttons1 : "formatselect,bold,italic,underline,forecolor,separator,bullist,numlist,link,unlink,quote,separator,indent,outdent,separator,image,insertimage,media,youtube,separator,emotions,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	extended_valid_elements : "@[id|class|title|style],a[href|target|title],hr[class|width|size|noshade],span[data-mce-type|class|align|style|id|data-*]",
	plugins : "paste,media,imagemanager,youtube",
	theme_advanced_buttons3_add : "pastetext,pasteword,selectall",



	paste_create_paragraphs : true,
	paste_create_linebreaks : false,
	paste_use_dialog : false,
	paste_auto_cleanup_on_paste : true,
	paste_convert_middot_lists : true,
	paste_remove_spans : true,
	paste_remove_styles : true,
	paste_unindented_list_class : "unindentedList",
	paste_convert_headers_to_strong : true,
	paste_insert_word_content_callback : "convertWord",
		content_css: "/applets/tinymce/themes/advanced/skins/default/skiddle_content.css"
	//theme_advanced_buttons1_add : "emotions"
	
});

function convertWord(type, content) {
	switch (type) {
		case "before":
			//content = content.toLowerCase(); // 
			break;

		case "after":
			//content = content.toLowerCase(); // 
			break;
	}

	return content;
}

var tinyMCEmode = true;
function toogleEditorMode(sEditorID) {
    try {
        if(tinyMCEmode) {
            tinyMCE.removeMCEControl(tinyMCE.getEditorId(sEditorID));
            tinyMCEmode = false;
        } else {
            tinyMCE.addMCEControl(document.getElementById(sEditorID), sEditorID);
            tinyMCEmode = true;
        }
    } catch(e) {
        //error handling
    }
}

function switchTinyMCE(link_id) {
  toogleEditorMode('compose_comment');
  var link = document.getElementById(link_id);
  link.innerHTML = (link.innerHTML == 'Hide editor') ? 'Show editor' : 'Hide editor';
  link.title = link.innerHTML;
  var instruct = document.getElementById('compose_instruct');
  instruct.style.display=(instruct.style.display=='none'?'block':'none');
}

function showAllowedHTML(){
	alert("The following html tags are allowed: <b> <strong> <i> <em> <u> <a> <div> <span> <p> <blockquote> <ol> <ul> <li> <font> <img> <br> <h1> <h2> <h3> <h4> <h5> <h6> <object> <embed>\n\nAny other tags will be removed from your code");
}

