// Initialisation
function initialisation() {
	if(typeof pageInitialisation != "undefined") pageInitialisation();
}

// Fermeture
function fermeture() {
	if(typeof pageFermeture != "undefined") pageFermeture();
}

// Ajout de texte dans un champ de formulaire
function addText(formName, fieldName, beforeText, afterText) {
	field = document.forms[formName].elements[fieldName];
	moz = field.selectionStart || field.selectionStart == 0 ? 1 : 0; // Moz 1.6+, Firefox
	ie = document.selection ? 1 : 0; // IEWin, Opéra
	
	field.focus();
	selectedText = moz ? field.value.substring(field.selectionStart, field.selectionEnd) :
	ie ? document.selection.createRange().text : '';
 
	if(selectedText == '') {
	}

	if(ie) {
 		var selection = document.selection.createRange();
 		selection.text = beforeText + selectedText + afterText;
 		selection.select();
	} else if(moz) {
		startText = field.value.substring(0, field.selectionStart);
		endText = field.value.substring(field.selectionEnd, field.value.length);
		fieldScrollTop = field.scrollTop;
		field.value = startText + beforeText + selectedText + afterText + endText;
		field.selectionEnd = field.selectionStart = (startText + beforeText + selectedText + afterText + endText).length;
		field.scrollTop = fieldScrollTop;
	} else {
		field.value = field.value + beforeText + afterText;
	}
}


// Impression d'un texte
function impression() {
	window.print();
}

// Lancer la webradio (popup)
function webradio() {
	window.open('webradio.php', 'Webradio', 'width=400,height=300,toolbar=0,location=0,directories=0,status=0,copyhistory=0,menubar=0,scrollbars=yes');
}

// Affichage des réactions
function afficher_reactions() {
	var divReactions = document.getElementById('reactions');
	divReactions.style.display = 'block';
}

// Réagir à un texte
function afficher_reagir() {
	var divReagirQuestion = document.getElementById('reagir_question');
	var formReagir = document.getElementById('reagir');
	divReagirQuestion.style.display = 'none';
	formReagir.style.display = 'block';
}

