IE  = window.ActiveXObject ? true : false;
MOZ = window.sidebar       ? true : false;

function iniEditor(){
  if(IE)  edoc = window.frames['editeur'].document;
  if(MOZ) edoc = document.getElementById('editeur').contentDocument;
  if(!IE && !MOZ){
    alert('Votre navigateur n\'est pas compatible avec ce système d\'éditeur WYSIWYG !');
    return;
  }
  if(edoc.designMode != 'On') edoc.designMode = 'On';
  if(!edoc.body){
    setTimeout('iniEditor()',20);
  } else {
    edoc.body.innerHTML = document.getElementById('editeur_content').value;
  }
}

function setContent(action){
  if(IE){
    ewin = window.frames['editeur'];
    edoc = ewin.document;
  }
  if(MOZ){
    ewin = document.getElementById('editeur').contentWindow;
    edoc = document.getElementById('editeur').contentDocument;
  }

  if (action == "createlink") {
   var szURL = prompt("ATTENTION !!! l'adresse doit IMPERATIVEMENT commencer par http:// pour un site et par mailto: pour une adresse e-mail)", "");

  try {

  edoc.execCommand("Unlink", false, null);
  edoc.execCommand("createLink", false, szURL);
    } catch (e) {}}

  edoc.execCommand(action, false, null);
  ewin.focus();
}

function getEditorContent(){
  if(IE)  edoc = window.frames['editeur'].document;
  if(MOZ) edoc = document.getElementById('editeur').contentDocument;
  document.getElementById('editeur_content').value = edoc.body.innerHTML;
  alert(document.getElementById('editeur_content').value)
}


