// And the language we need to use in the editor.
var _editor_lang = "fr";

var xinha_plugins =
	[	'ExtendedFileManager',
		'ImageManager',
		'ContextMenu',
		'SuperClean',
		'CSS',
		'InsertAnchor',
		'TableOperations',
		'UnFormat'
	];

function getTextAreas() {
	var tes = document.getElementsByTagName("textarea");
	var noms = new Array(tes.length);
	for (var i=0;i<tes.length;i++) {
		noms[i] = tes[i].name;
	}
	return noms;
}

var xinha_editors = null;

function xinha_init()
{
	
	xinha_editors = getTextAreas();
	
	if (xinha_editors.length > 0) {
	
  if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
  var xinha_config = new Xinha.Config();
  
 
  xinha_config.width = '600px';
  xinha_config.height = '450px';
  xinha_config.statusBar = false;
  
  xinha_config.toolbar = [
  	[	'bold', 'italic', 'superscript', 'separator',
		'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'separator',
		'outdent', 'indent','insertunorderedlist', 'insertorderedlist', 'linebreak',
		'createlink', 'insertimage',
		"copy", "cut", "paste", "separator",
		'htmlmode','linebreak'
	]
  ];
  xinha_config.statusBar = false;
  xinha_config.expandRelativeUrl = false;
  xinha_config.stripBaseHref = false;
  xinha_config.pageStyle = "@import url(" + _base_url + "/css/common.css);@import url(" + _base_url + "/css/" + _site + ".css);@import url(" + _base_url + "/css/editor_" + _site + ".css);";
  xinha_config.flowToolbars = false;
  
  xinha_config.cssPluginConfig =
  {
    combos : [
      { label: "Style",
        options: { "Normal"           : "",
					"Sous-titre"	  : "soustitre"
                 }
      }
    ]
  };
  
 
  xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
  
  Xinha.startEditors(xinha_editors);
	}
}

addLoadEvent(xinha_init);