// ******************************************************************************************************************
// Fonction pour demander une confirmation avant d'appeler une autre page.
// Derniére modif : 13/07/2010.
// ******************************************************************************************************************
function change_url_confirmation(texte, url) { 
  var FenetreQuestion = confirm(texte);
  if ( FenetreQuestion ) {
    document.location.href=url;
  }
} 
// ******************************************************************************************************************
// Fonction pour demander une confirmation avant d'envoyer les données d'un formulaire.
// Derniére modif : 13/07/2010.
// ******************************************************************************************************************
function question_confirmation(texte) { 
  var FenetreQuestion = confirm(texte);
  if ( FenetreQuestion ) {
    return true ;
  } else {
    return false ;
  }
} 
// ******************************************************************************************************************
// Permet d'afficher une info bulle personnalisée.
// Derniére modif : 13/07/2010.
// ******************************************************************************************************************
var Offset_Width = 6;
var Offset_Height = 5;
//
var affiche = false;
var w3c = document.getElementById && !document.all;
var IE = document.all;
//
if ( IE || w3c ) var InfoBulle;
//
function PopCorps() {return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body}
//
function PopDeplace(eee) {
  if ( affiche ) {
    var SourisX = (w3c) ? eee.pageX : event.x + PopCorps().scrollLeft;
    var SourisY = (w3c) ? eee.pageY : event.y + PopCorps().scrollTop;
    var FenetreWidth = IE && !window.opera ? PopCorps().clientWidth : window.innerWidth - 20;
    var FenetreHeight = IE && !window.opera ? PopCorps().clientHeight : window.innerHeight - 20;
    var rightedge = IE && !window.opera ? FenetreWidth - event.clientX - Offset_Width : FenetreWidth - eee.clientX - Offset_Width;
    var bottomedge = IE && !window.opera ? FenetreHeight - event.clientY - Offset_Height : FenetreHeight - eee.clientY - Offset_Height;
    var leftedge = ( Offset_Width < 0 ) ? Offset_Width * (-1) : -1000;
// modif largeur si trop grand
    if( InfoBulle.offsetWidth > FenetreWidth / 3 ) {InfoBulle.style.width = FenetreWidth / 3}
// largeur pas assez grande
    if( rightedge < InfoBulle.offsetWidth ) {
// bouge à gauche
      InfoBulle.style.left = SourisX - InfoBulle.offsetWidth + "px";
    } else {
      if ( SourisX < leftedge ) {
        InfoBulle.style.left = "5px";
      } else {
// position h
        InfoBulle.style.left = SourisX + Offset_Width + "px";
      }
    }
// position v
    if ( bottomedge < InfoBulle.offsetHeight ) {
      InfoBulle.style.top = SourisY - InfoBulle.offsetHeight - Offset_Height + "px";
    } else {
      InfoBulle.style.top = SourisY + Offset_Height + "px";
    }
  }
}
function F02_2(text) {
  if ( w3c || IE ) {
    InfoBulle = document.all ? document.all["F02_1"] : document.getElementById ? document.getElementById("F02_1") : "";
    InfoBulle.innerHTML = text;
    InfoBulle.style.visibility = "visible";
    affiche = true;
  }
}
function F02_3() {
  if ( w3c || IE ) {
    affiche = false;
    InfoBulle.style.visibility = "hidden";
    InfoBulle.style.top = '-1000px';
    InfoBulle.style.backgroundColor = '';
    InfoBulle.style.width = '';
  }
}
// souris bouge.
document.onmousemove = PopDeplace;
// ******************************************************************************************************************
// Limite et indique le nombre de caractéres saisies dans un INPUT ou un TEXTAREA.
// Derniére modif : 13/07/2010.
// ******************************************************************************************************************
function ControleCaract(ZoneTexte, NbrCaractMaxi, IdAfficheNbr, ClassNameNormal, ClassNameMaxi) {
  // Controle du nombre de caractéres.
  StrLen = ZoneTexte.value.length;
  if ( StrLen > NbrCaractMaxi ) { // Supprime les caractéres en trop.
    ZoneTexte.value = ZoneTexte.value.substring(0, NbrCaractMaxi);
    CharsLeft = NbrCaractMaxi;
  } else {
    CharsLeft = StrLen;
  }
  // Maj nbr caract.
  if ( document.getElementById ) {
    document.getElementById(IdAfficheNbr).innerHTML = CharsLeft + ' car';
  } else if ( document.all ) {
    document.all[IdAfficheNbr].innerHTML = CharsLeft + ' car';
  }
  // Maj font affichage nbr caract.
  if ( StrLen >= NbrCaractMaxi ) {
    // Maj font (si nbr caract. maxi).
    if ( document.getElementById ) {
      document.getElementById(IdAfficheNbr).className = ClassNameMaxi;
    } else if ( document.all ) {
      document.all[IdAfficheNbr].className = ClassNameMaxi;
    }
  } else {
    // Maj font (si nbr caract ok).
    if ( document.getElementById ) {
      document.getElementById(IdAfficheNbr).className = ClassNameNormal;
    } else if ( document.all ) {
      document.all[IdAfficheNbr].className = ClassNameNormal;
    }
  }
} 

