/**
\file fonctions.js
\brief fonctions générales Java
*/
//------------------------------------------------------------------------



//------------------------------------------------------------------------
/**
\brief  rajout de l'option de langue dans la chaine de requete

Rechargement de la page
\param [in] valeur : choix de la langue (code)
*/
//------------------------------------------------------------------------
function forcer(valeur)
{
var chaine;
var chaineBis;
var reg1=new RegExp("[?&]Langue=[A-Z]{1,3}");
var reg2=new RegExp("Langue=[A-Z]{1,3}");
document.choixLangue.Langue.value = valeur;
chaine=window.location.search;
if (chaine.match(reg1)) {
    chaine=chaine.replace(reg2,"Langue="+valeur);
}
else {
    if (window.location.search != "")
        chaine = window.location.search+"&Langue="+valeur;
    else
        chaine = "?Langue="+valeur;
}
window.location.search=chaine;
}

//------------------------------------------------------------------------
/**
\brief  rajout de l'option de zone de niveau 1

Rechargement de la page
*/
//------------------------------------------------------------------------
function forcerN1(evt)
{
var chaine;
var reg1=new RegExp("[?&]N1=[a-zA-Z]*");
//var reg2=new RegExp("N1=[a-zA-Z]*");
var reg2=new RegExp("N1=[^&]*");
//document.choixLangue.Langue.value = valeur;
chaine=window.location.search;
if (chaine.match(reg1)) {
    chaine=chaine.replace(reg2,"N1="+evt.value);
}
else {
    if (window.location.search != "")
        chaine = window.location.search+"&N1="+evt.value;
    else
        chaine = "?N1="+evt.value;
}
window.location.search=chaine;
}




//------------------------------------------------------------------------
/**
\brief fonction de substitution d'une sous-chaine
\param [in] inputString : chaine à modifier
\param [in] fromString : chaine à remplacer
\param [in] toString : chaine de remplacement
\return chaine modifiée
*/
//------------------------------------------------------------------------
function replaceSubstring(inputString, fromString, toString) 
{
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function


//------------------------------------------------------------------------
/**
\brief affichage du détail dans le DIV infoPlus 
*/
//------------------------------------------------------------------------
function detail(texte)
{
var monDiv;


monDiv = document.getElementById("infoPlus");
if (isIE || isIE5mac)
   monDiv.style.position="absolute";
else
    monDiv.style.position = "fixed";
monDiv.innerHTML = texte;
monDiv.style.visibility="visible";
monDiv.style.backgroundColor="yellow";
}
//------------------------------------------------------------------------
/**
\brief efface le DIV infoPlus 
*/
//------------------------------------------------------------------------
function effaceDetail()
{
var monDiv;
monDiv = document.getElementById("infoPlus");
monDiv.innerHTML = "";
monDiv.style.visibility="hidden";
}




<!--
-->