/**
 * Permet l'ajout d'un compteur pour les champs de type textarea
 * Utiliser cette méthode sur onkeyup & onkeydown du textarea cible
 * exemple voir question medical ou formulaire de contact (int/ext)
 * 
 */
function limiteTxtQM(textarea, max) {	
	max = parseInt (max);
	var affichage_reste = '';  
    if(textarea.value.length >  max) {
        textarea.value = textarea.value.substring(0, max + 1);
        affichage_reste = '<br />Votre message doit comporter ' + max + ' signes maximum, veuillez modifier votre message.';
    }
    affichage_reste = textarea.value.length + '/' + max + ' caract&egrave;res restant' + affichage_reste;
    document.getElementById('cptQMId').innerHTML = affichage_reste;
}

/**
 * Permet de mettre a vide les input email et email de confirmation 
 * quand  on clique sur non a confirmer (GERONIMO 004184)
 * 
 */
function razChampEmail (emailId, emailConfirmeId) {
	document.getElementById(emailId).value = "";
	document.getElementById(emailConfirmeId).value = "";
}

/**
 * Permet d'afficher un element avec un identifiant donnee.
 * 
 * @param baliseId
 *            L'identifiant de l'Ã©lÃ©ment Ã  afficher.
 */
function afficheId(baliseId) {
	if (document.getElementById(baliseId) != null) {
		document.getElementById(baliseId).style.visibility = 'visible';
		document.getElementById(baliseId).style.display = 'block';
	}
}

/**
 * Permet de masquer un Ã©lÃ©ment avec un identifiant donnÃ©.
 * @param baliseId L'identifiant de l'Ã©lÃ©ment Ã  masquer.
 */
function cacheId(baliseId) {
	if (document.getElementById(baliseId) != null) {
		document.getElementById(baliseId).style.visibility = 'hidden';
		document.getElementById(baliseId).style.display = 'none';
	}
}

/**
 * Permet d'afficher ou de masquer une div en fonction de l'Ã©tat d'une checkbox.
 * 
 * @param checkBoxId L'Ã©tat de la checkbox.
 * @param divId La div Ã  afficher / masquer.
 */
function afficheBloc(checkBoxId, divId) {
	if (document.getElementById(checkBoxId) != null) {
		if (document.getElementById(checkBoxId).checked) {
			afficheId(divId);
		} else {
			cacheId(divId);
		}
	}
}
 
 function openWindow(votrePage,hPopup,lPopup)
 {
   var H = (screen.height - hPopup) / 2;
   var L = (screen.width - lPopup) / 2;
   var popup = null;
   var parm = "status=no,scrollbars=no,resizable=no,height=" + hPopup + ",width=" + lPopup + ",top=" + H + ",left=" + L;
   
   popup = window.open(votrePage,"",parm);
 } 
 
