// ÷ 2010-01-18 12:22:25
/*
buttons1: save, ibrowser
buttons3: styleprops, insertlayer, moveforward, movebackward, absolute, preview, tablecontrols


*/

tinyMCE.init({
    theme : "advanced",
    mode : "none",
    //mode : "textareas",
    editor_selector : "mceEditor",
    language : "hu",
    //theme_advanced_toolbar_location : "top",
    // PUT ALL YOU tinyMCE options there
//    plugins : "preview, layer, style, table,save, ibrowser,emotions,advcolor,advimage",
    plugins : "preview, layer, style, table,save, ibrowser,emotions,advimage,paste",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,zoom,bullist,numlist,separator,outdent,indent,separator,separator,link,unlink,anchor,ibrowser,separator,preview,help,code",
	theme_advanced_buttons2 : "fontselect,fontsizeselect,advcolor,backcolor,separator,emotions,hr,visualaid,separator,sub,sup,separator,charmap",
	theme_advanced_buttons3 : "insertlayer,moveforward,movebackward,absolute,separator,tablecontrols,separator,undo,redo,pasteword",
    plugin_preview_width : "500",
    plugin_preview_height : "300",
    convert_urls : false,
    extended_valid_elements : "img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|onclick]",
    //relative_urls : true,
    urlconverter_callback : "doNotModifyLocalAnchors",
    //convert_fonts_to_spans : true,
    save_callback : "",
	
//    content_css : "http://www.woodpecker.hu/WPGenerator/css/default.css"


        // Don't forget to define the height

});
/*
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	language : "hu",
	editor_selector : "mceDivListEditor",
	convert_urls : false,
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,link,separator,forecolor",
	//MIKE ezt írd át:
	content_css : "http://www.aquis.hu/Aquis/graphic_pages/allashirdetesek_admin/ManualCodes/mce.css",
	extended_valid_elements : "b/strong",
	theme_advanced_text_colors : "FF00FF,FFFF00,000000"
});
*/



var tinyMCEmode = false;
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, textarea_id) {
  toogleEditorMode(textarea_id);
  var link = document.getElementById(link_id);
  link.innerHTML = (link.innerHTML == 'Hide TinyMCE') ? 'Show TinyMCE' : 'Hide TinyMCE';
  link.title = link.innerHTML;
}



function doNotModifyLocalAnchors(url, node, on_save) {
      //index = url.indexOf('/portal/layout#');
      index = url.indexOf('#');
      if (index != -1) {
         url = url.substring(index);
      }
      return url;
}

