function insertion(editeur, content, nature, repdeb, repfin) {
	var input = document.forms[editeur].elements[content];
	input.focus();

	if(typeof document.selection != 'undefined') {
		var range = document.selection.createRange();
		var insText = range.text;
	}
	else if(typeof input.selectionStart != 'undefined') {
		var start = input.selectionStart;
		var end = input.selectionEnd;
		var insText = input.value.substring(start, end);
	}
	else {
		var insText = prompt("Veuillez entrer le texte à formater:");
	}
	
	if (nature == "lien") {
		var deblien = prompt('URL : ','http://');
		var repdeb = '<a href="' + deblien + '">';
		var repfin = '</a>';
	}
	else if (nature == "img") {
		var pagedesti = 'index.php?upl=img&ser=1';
		window.open(pagedesti,'image','width=720, height=600, statut=0, toolbar=0, location=0, menubar=0, scrollbars=1');
	}
	else if (nature == "pdf") {
		var pagedesti = 'index.php?upl=doc&ser=1';
		window.open(pagedesti,'image','width=720, height=600, statut=0, toolbar=0, location=0, menubar=0, scrollbars=1');
	}
	else if (nature == "son") {
		var pagedesti = 'index.php?upl=son&ser=1';
		window.open(pagedesti,'image','width=720, height=600, statut=0, toolbar=0, location=0, menubar=0, scrollbars=1');
	}
	else if (nature == "list") {
		var debliste = prompt('Première ligne ? O / N','O');
		var finliste = prompt('Dernière ligne ? O / N','N');
		if (debliste == "O") {
			var repdeb = '<ul><li>';
		}
		else {
			var repdeb = '<li>';
		}
		if (finliste == "O") {
			var repfin = '</li></ul>';
		}
		else {
			var repfin = '</li>';
		}
	}
	else {
		var repdeb = repdeb;
		var repfin = repfin;
	}
	

	if(typeof document.selection != 'undefined') {
		range.text = repdeb + insText + repfin;
		range = document.selection.createRange();
		if (insText.length == 0) {
			range.move('character', -repfin.length);
		} 
		else {
			range.moveStart('character', repdeb.length + insText.length + repfin.length);
		}
		range.select();
	}
	else if(typeof input.selectionStart != 'undefined') {
		input.value = input.value.substr(0, start) + repdeb + insText + repfin + input.value.substr(end);
		var pos;
		if (insText.length == 0) {
			pos = start + repdeb.length;
		}
		else {
			pos = start + repdeb.length + insText.length + repfin.length;
		}
		input.selectionStart = pos;
		input.selectionEnd = pos;
	}
	else {
		var pos;
		var re = new RegExp('^[0-9]{0,3}$');
		while(!re.test(pos)) {
			pos = prompt("Insertion à la position (0.." + input.value.length + "):", "0");
		}
		if(pos > input.value.length) {
			pos = input.value.length;
		}
		var insText = prompt("Veuillez entrer le texte à formater:");
		input.value = input.value.substr(0, pos) + repdeb + insText + repfin + input.value.substr(pos);
	}
}