/*
 * Inicialization of TinyMCE editor
 */

/* Advanced mode */
tinyMCE.init({
    mode : 'specific_textareas',
    editor_selector : "tinyMceAdvanced",
    theme : 'advanced',
	elements : "ajaxfilemanager",

    force_br_newlines : true,
    forced_root_block : '',


    plugins : 'safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template',
    theme_advanced_buttons1 : 'save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect',
    theme_advanced_buttons2 : 'cut,copy,paste,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
    theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
    theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage',
    theme_advanced_toolbar_location : 'top',
    theme_advanced_toolbar_align : 'left',
    theme_advanced_statusbar_location : 'bottom',
    theme_advanced_resizing : true,
	
	file_browser_callback : "ajaxfilemanager",


    entity_encoding : 'raw',
    /* content_css : '".iqtsupport::get_blank_url()."styles/general.css',*/

    theme_advanced_toolbar_location : 'top',
	
});

function ajaxfilemanager(field_name, url, type, win) {
			//root variable taken from {$basePath} var
			var ajaxfilemanagerurl = root + "/js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php"; //!!!
			switch (type) {
				case "image":
					break;
				case "media":
					break;
				case "flash": 
					break;
				case "file":
					break;
				default:
					return false;
			}
            tinyMCE.activeEditor.windowManager.open({
                url: ajaxfilemanagerurl,
                width: 782,
                height: 440,
                inline : "yes",
                close_previous : "no"
            },{
                window : win,
                input : field_name
            });
}

/* Simple mode */
tinyMCE.init({
    theme : "advanced",
    mode : "specific_textareas",
    editor_selector : "tinyMce",

    force_br_newlines : true,
    forced_root_block : '',

    plugins : 'advlink',

    theme_advanced_buttons1 : 'bold,link,forecolor,fontsizeselect',
    theme_advanced_buttons2 : '',
    theme_advanced_buttons3 : '',
    theme_advanced_toolbar_location : 'top',
    theme_advanced_toolbar_align : 'left',

    /* content_css : '".iqtsupport::get_blank_url()."styles/general.css', */
    theme_advanced_toolbar_location : 'top'
});

