/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 mardi 28 octobre 2008 09:26:23
 - - - - - - - - - - - - - - - - - - - - - - - */
divScripts_tracesJS = 2;

/*
var NomNavigateur = navigator.appName;
var navigateurIE6;
navigateurIE6 = 0;
var VersionNavigateur = parseFloat(navigator.appVersion);
if ( (NomNavigateur == "Microsoft Internet Explorer") && (VersionNavigateur <= 6)) {
   navigateurIE6 = 1;
}
*/

// Correctif de l'affichage des images PNG dans IE5.5 et IE6 (transparent pour les autres navigateurs).
function setpng(img) {
/*
  if (navigateurIE6)  {

  imgName=img.src.toUpperCase();

  chaineSortie = "<span ";
  if (img.id) chaineSortie+= "id='" + img.id + "' ";
  if (img.className) chaineSortie+= "class='" + img.className + "' ";
  if (img.title) chaineSortie+= "title=\"" + img.title + "\" ";
  chaineSortie+= "style=\"width:" + img.width + "px;height:" + img.height + "px;";
  if (img.align == "left") chaineSortie+= "float:left;";
  if (img.align == "right") chaineSortie+= "float:right;";
  if (img.parentElement.href) chaineSortie+= "cursor:hand;";
  chaineSortie+= "display:inline-block;",
  // if (img.style.cssText != "") chaineSortie+= img.style.cssText + ";";
  chaineSortie+= "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src + "', sizingMethod='scale');\"></span>";

  img.outerHTML = chaineSortie;

  }
*/
}


    var ecranLargeur;
    var ecranHauteur;
    ecranLargeur = 630;
    ecranHauteur = 460;
        
     function detecteTailleFenetre() {

                          if (document.body) {
                              ecranLargeur = document.body.clientWidth;
                              ecranHauteur = document.body.clientHeight;
                          } else {
                              ecranLargeur = window.innerWidth;
                              ecranHauteur = window.innerHeight;
                          }
    }



function jetDe ( nombreLimite ) {
         resultat = parseInt(Math.random() * 10, 10) + 1;
         return resultat;
}

function cacheDiv( id ) {
//     alert("on cache la div : " + id);
     document.getElementById(id).style.visibility = "hidden";
}

function montreDiv( id ) {
//     alert("changement de la div : " + id);
     document.getElementById(id).style.visibility = "visible";
}



function alternerImageBoutonId( idBouton, urlImage) {

//    if (divScripts_tracesJS >= 1) alert("--- Entrée dans alternerImageBouton, nomBouton : "+nomBouton);
      document.getElementById(idBouton).src = urlImage;
}


function changeDiv(div, chaine)
{
        document.getElementById(div).innerHTML = chaine;
        document.getElementById(div).style.visibility = 'visible';
        document.getElementById(div).style.display = 'block';
}

function changePositionXDiv(div, position_x)
{
        document.getElementById(div).style.left = position_x;
}

function changePositionDiv(div, position_x, position_y)
{
        document.getElementById(div).style.left = position_x;
        document.getElementById(div).style.top = position_y;
}

function changeDimDiv(div, width, height)
{
    if (navigator_ie4) {
        document.all['' + div].width = width;
        document.all['' + div].height = height;
    } else {
        document.getElementById(div).width = width;
        document.getElementById(div).height = height;
    }
}


function alternerImageBouton( nomBouton, urlImage) {

//    if (divScripts_tracesJS >= 1) alert("--- Entrée dans alternerImageBouton, nomBouton : "+nomBouton);
    for (i = 0; i < document.images.length; i++) {

        if (document.images[i].name == nomBouton) {
//            if (divScripts_tracesJS >= 1) alert("image trouvée par alternerImageBouton...");
            document.images[i].src = urlImage;
            // if (navigateurIE6) setpng(document.images[i]);
        }

    }

}



             tableOpacites = new Array();
             nombreCadresOpacites = 100;
             for (compteurTableOpacites = 0; compteurTableOpacites < nombreCadresOpacites; compteurTableOpacites++) {
                 tableOpacites[compteurTableOpacites] = 0.00;
             }


             // Le "delai" est le nombre de secondes avant d'atteindre opacité 100
             function apparitionCadre( cadreDestination, delai, indexCadre ) {
                 tableOpacites[indexCadre] = tableOpacites[indexCadre] + 0.01;
                 opacite = tableOpacites[indexCadre];
                 document.getElementById(cadreDestination).style.opacity = "" + opacite;
                 document.getElementById(cadreDestination).style.filter = "alpha(opacity=" + parseInt((opacite * 100), 10) + ")";
                 if (opacite < 1) {
                     setTimeout("apparitionCadre('" + cadreDestination+ "', " + delai + ", " + indexCadre + ")", parseInt((delai / 100), 10));
                 } else {
//                     alert("fin du traitement, opaciteDepart : " + opaciteDepart);
//                     clearTimeout();
                 }

             }

             function apparitionCadreRapide( cadreDestination, delai, indexCadre ) {
                 tableOpacites[indexCadre] = tableOpacites[indexCadre] + 0.03;
                 opacite = tableOpacites[indexCadre];
                 document.getElementById(cadreDestination).style.opacity = "" + opacite;
                 document.getElementById(cadreDestination).style.filter = "alpha(opacity=" + parseInt((opacite * 100), 5) + ")";
                 if (opacite < 1) {
                     setTimeout("apparitionCadre('" + cadreDestination+ "', " + delai + ", " + indexCadre + ")", parseInt((delai / 100), 5));
                 } else {
//                     alert("fin du traitement, opaciteDepart : " + opaciteDepart);
//                     clearTimeout();
                 }

             }

             function apparitionCadreVitesse( cadreDestination, delai, vitesse, indexCadre ) {
                 tableOpacites[indexCadre] = tableOpacites[indexCadre] + (0.01 * vitesse);
                 opacite = tableOpacites[indexCadre];
                 document.getElementById(cadreDestination).style.opacity = "" + opacite;
                 document.getElementById(cadreDestination).style.filter = "alpha(opacity=" + parseInt((opacite * 100), 5) + ")";
                 if (opacite < 1) {
                     setTimeout("apparitionCadre('" + cadreDestination+ "', " + delai + ", " + vitesse + ", " + indexCadre + ")", parseInt((delai / 100), 5));
                 } else {
//                     alert("fin du traitement, opaciteDepart : " + opaciteDepart);
//                     clearTimeout();
                 }

             }

             function disparitionCadre( cadreDestination, delai, indexCadre ) {
                 tableOpacites[indexCadre] = tableOpacites[indexCadre] - 0.01;
                 opacite = tableOpacites[indexCadre];
                 document.getElementById(cadreDestination).style.opacity = "" + opacite;
                 document.getElementById(cadreDestination).style.filter = "alpha(opacity=" + parseInt((opacite * 100), 10) + ")";
                 if (opacite > 0) {
                     setTimeout("disparitionCadre('" + cadreDestination+ "', " + delai + ", " + indexCadre + ")", parseInt((delai / 100), 10));
                 } else {
//                     alert("fin du traitement, opaciteDepart : " + opaciteDepart);
//                     clearTimeout();
                 }

             }

             function disparitionCadreVitesse( cadreDestination, delai, vitesse, indexCadre ) {
                 tableOpacites[indexCadre] = tableOpacites[indexCadre] - (0.01 * vitesse);
                 opacite = tableOpacites[indexCadre];
                 document.getElementById(cadreDestination).style.opacity = "" + opacite;
                 document.getElementById(cadreDestination).style.filter = "alpha(opacity=" + parseInt((opacite * 100), 10) + ")";
                 if (opacite > 0) {
                     setTimeout("disparitionCadreVitesse('" + cadreDestination+ "', " + delai + ", " + vitesse + ", " + indexCadre + ")", parseInt((delai / 100), 10));
                 } else {
//                     alert("fin du traitement, opaciteDepart : " + opaciteDepart);
//                     clearTimeout();
                 }

             }

function montreDivProgressive( idCadre, indexCadre ) {

    tableOpacites[indexCadre] = 0.00;
    document.getElementById(idCadre).style.opacity = 0.00;
    document.getElementById(idCadre).style.filter = "alpha(opacity=0)";
    montreDiv(idCadre);

    setTimeout("apparitionCadre('" + idCadre + "', 2, " + indexCadre + ")", 10);

}

function cacheDivProgressive( idCadre, indexCadre ) {

//    alert("entrée dans cacheDivProgressive, cadre : " + idCadre  + ", index : " + indexCadre);

/*
    if (document.getElementById(idCadre).style.visibility == 'hidden') {

    } else {
*/
      tableOpacites[indexCadre] = 0.00;
      document.getElementById(idCadre).style.opacity = 0.00;
      document.getElementById(idCadre).style.filter = "alpha(opacity=" + 0 + ")";;

      setTimeout("disparitionCadre('" + idCadre + "', 2, " + indexCadre + ")", 10);
      setTimeout("cacheDiv('" + idCadre + "')", 3000);
      setTimeout("clearTimeout()", 3000);
//    }

}


function videSouris() 
{
    changeDiv("aidesouris", "");
}


