function doCommand (idCommand)
{
// Cas où insertion d'un lien
if (idCommand == 'createLink')
	{
	doCreateLink();
	return;
	}

// Cas où insertion d'une image
if (idCommand == "insertImage")
	{
	document.execCommand(idCommand, true);
	return;
	}

// Exécute les autres commandes telles quelles
document.execCommand(idCommand);
}

function doCreateLink ()
{
// Configure la boite de dialogue
var sFeatures;
sFeatures = "dialogHeight:160px;dialogWidth:450px;help:no;scroll:no;status:no";
// Affiche la boite de dialogue de création d'un lien
var sNewLink;
sNewLink = window.showModalDialog('createLink3.htm', '', sFeatures);
// Insère le lien saisi
if (sNewLink != "")
	{
	var oSelection = document.selection.createRange();
	sNewLink = sNewLink + oSelection.htmlText + "</a>";
	sNewLink = sNewLink.replace(" </a>", "</a> ");
	oSelection.pasteHTML(sNewLink);
	}
}

function CopyContent (sHtmlSource, sTextTarget)
{
// Récupère le code html de la zone de texte wysiwyg
var sHtml = document.getElementById(sHtmlSource).innerHTML;
// Transforme le code html en xhtml
var sXhtml = HtmlToXhtml(sHtml);
// Copie ce code xhtml dans un textarea pour récupération via un formulaire
document.getElementById(sTextTarget).innerText = sXhtml;
}

function HtmlToXhtml (sHtmlCode)
{
// Transformation de code html en xhtml (enfin c'est ce que ça fera plus tard)
return(sHtmlCode);
}