

Wysiwyg = {};

// Save wysiwyg content
Wysiwyg.save = function () {
    tinyMCE.triggerSave ();
}
    
// Load wysiwyg components
Wysiwyg.load = function () {
    $$('textarea.wysiwyg').each (function (el) {
	    tinyMCE.execCommand('mceAddControl', false, el.id);
	});
}
    
// Unload wysiwyg components
Wysiwyg.unload = function () {
    $$('textarea.wysiwyg').each (function (el) {
	    tinyMCE.execCommand('mceRemoveControl', false, el.id);
	});
}

// Init all wysiwyg stuff
Wysiwyg.init = function () {
    tinyMCE.init (
{
    /* Interface configuration */
    document_base_url: U_ROOT + '/',
    mode : "textareas",
    editor_selector : "simple",
    theme : "simple",
    language : "fr",
    content_css : U_ROOT + "/theme/css/wysiwyg.css",
    
    /* Display  */
    width: "775",
    height: "400"
});
    
    tinyMCE.init(
{
    /* Interface configuration */
    dialog_type: 'modal',
    document_base_url: U_ROOT + '/',
	mode : "textareas",
	editor_selector : "advanced",
	theme : "advanced",
	language : "fr",
	content_css : U_ROOT + "/theme/css/wysiwyg.css",
	
	/* Display */
	width: "775",
	height: "400",
	
	/* Cleanup */
	cleanup_on_startup : true,
	cleanup: true,

	/* Plugins */
	plugins : "inlinepopups,contextmenu,save,advlink,advimage,style,layer,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras,template",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect,|,image,link,unlink,template",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,unlink,anchor,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor,|,visualchars",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_blockformats : "p,div,h1,h2,h3,h4",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",		
	theme_advanced_resizing : true,
	extended_valid_elements : "iframe[src|width|height|name|align],a[name|class|href|target|title|onclick],img[id|class|src|border|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],input[type|name|value|class|size|maxlength|onclick],object[width,height],param[name,value],embed[src,type,allowfullscreen,width,height]",
	theme_advanced_styles : "Alignement gauche=float-left;Alignement droite=float-right;Liste=list;Ligne paire=even;Ligne impaire=odd;Fond coach=bgcoachs;Coaching=encart-coaching;Conseil=encart-conseil;Formation=encart-Formation;Lien Accueil=link-home",

	/* Advanced plugins */
	external_link_list_url : U_ROOT + "/?module=webpage&action=wysiwyglist",
	external_image_list_url : U_ROOT + "/?module=file&action=wysiwyglist",
	/*	template_external_list_url : U_ROOT + "/?module=webpage&action=templateslist?dyn=1",*/

	// URLs behavior
	relative_urls: false,
	convert_urls: false,
	document_base_url : U_ROOT + "/",
	remove_script_host: true
	});
}
	   


