// CG38RNtpl javascript

// [général]

function _ ( id ) { return window.document.getElementById(id); }
function setTransp ( e , v ) {
  _ ( e ).style.opacity = v/100;
  _ ( e ).style.MozOpacity = v/100;
  _ ( e ).style.KHTMLopacity = v/100;
  if ( _ ( e ).style.filter != null ) _ ( e ).style.filter = "alpha(opacity="+v+")";
}

// [bandeau images]

 // mettre un minimum de 4 images !!!

 var coef = 1/100 ; // avancement de l'opacité
 var temps = 20 ; // temps entre chaque changement d'opacité
 var temps_pause = 4000 ; // temps d'attente entre 2 changements d'images
 var deca = 3500;
 var nombre_image = 15 ; // nombre d'images a faire bouger
 var prefix_image = 'fileadmin/template/images/bandeau/'; // chemin + prefix du nom des images
 var suffix_image = '.jpg' ; // suffix + '.extension' du nom des images

 // pas touche
 var isIE = navigator.userAgent.toLowerCase().indexOf('msie')!=-1 ;
 //alert(isIE);
 var img1 = null;
 var img2 = null ;
 var img1b = null;
 var img2b = null ;
 var img1c = null;
 var img2c = null ;
 var img1d = null;
 var img2d = null ;
 var sens1 = 1;
 var sens2 = 1;
 var sens3 = 1;
 var sens4 = 1;
 var indice1 = 2; // les 2 premiere image sont deja charger dans le HTML, on commence a la 3eme
 var indice2 = 4;
 var indice3 = 6;
 var indice4 = 0;

 var tabImg; // tab contenant les images

 function prechargerImg(){
 tabImg = new Array(nombre_image/*+1*/);
 for (i=0; i<=nombre_image -1; i++){
 tabImg[i]=new Image();
 tabImg[i].src = prefix_image+(i+1)+suffix_image;
 //alert(tabImg[i].src);
 }
 //tabImg[nombre_image]=new Image();
 //tabImg[nombre_image].src = tabImg[0].src;
 }

 function init()
 {
 //window.defaultStatus="ok?";
 img1 = document.getElementById("defilement1") ;
 img2 = document.getElementById("defilement2") ;
 img1b = document.getElementById("defilement1b") ;
 img2b = document.getElementById("defilement2b") ;
 img1c = document.getElementById("defilement1c") ;
 img2c = document.getElementById("defilement2c") ;
 img1d = document.getElementById("defilement1d") ;
 img2d = document.getElementById("defilement2d") ;

 prechargerImg();
 change_opacity1();
 setTimeout("change_opacity2();",deca);
 setTimeout("change_opacity3();",deca*2);
 setTimeout("change_opacity4();",deca*3);
 }

 function change_opacity1()
 {
 var opacity1 = 0 ;
 var opacity2 = 0 ;
 if (isIE) // for IE
 { opacity1 = parseFloat(img1.filters.alpha.opacity);
 opacity2 = parseFloat(img2.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1.style.MozOpacity);
 opacity2 = parseFloat(img2.style.MozOpacity);
 }

 if (sens1)
 { if (isIE) // for IE
 { img1.filters.alpha.opacity = opacity1 + coef * 100;
 img2.filters.alpha.opacity = opacity2 - coef * 100;
 }
 else // for Mozilla
 { img1.style.MozOpacity = opacity1 + coef;
 img2.style.MozOpacity = opacity2 - coef;
 }
 }
 else
 {
 if (isIE) // for IE
 { img1.filters.alpha.opacity = opacity1 - coef * 100;
 img2.filters.alpha.opacity = opacity2 + coef * 100;
 }
 else // for Mozilla
 { img1.style.MozOpacity = opacity1 - coef;
 img2.style.MozOpacity = opacity2 + coef;
 }
 }

 if (isIE) // for IE
 { opacity1 = parseFloat(img1.filters.alpha.opacity);
 opacity2 = parseFloat(img2.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1.style.MozOpacity);
 opacity2 = parseFloat(img2.style.MozOpacity);
 }

 if (opacity2 <= 0)
 { img2.src=tabImg[indice1++].src;
 sens1 = 0;
 if (indice1 == (tabImg.length)) indice1=0;
 window.setTimeout("change_opacity1()",temps_pause) ; // attente
 return 0;
 }
 else if (opacity1 <= 0)
 { img1.src=tabImg[indice1++].src;
 sens1 = 1;
 if (indice1 == (tabImg.length)) indice1=0;
 window.setTimeout("change_opacity1()",temps_pause) ; // attente
 return 0;
 }
 window.setTimeout("change_opacity1();",temps) ; 
 }

function change_opacity2()
 {
 var opacity1 = 0 ;
 var opacity2 = 0 ;
 if (isIE) // for IE
 { opacity1 = parseFloat(img1b.filters.alpha.opacity);
 opacity2 = parseFloat(img2b.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1b.style.MozOpacity);
 opacity2 = parseFloat(img2b.style.MozOpacity);
 }

 if (sens2)
 { if (isIE) // for IE
 { img1b.filters.alpha.opacity = opacity1 + coef * 100;
 img2b.filters.alpha.opacity = opacity2 - coef * 100;
 }
 else // for Mozilla
 { img1b.style.MozOpacity = opacity1 + coef;
 img2b.style.MozOpacity = opacity2 - coef;
 }
 }
 else
 {
 if (isIE) // for IE
 { img1b.filters.alpha.opacity = opacity1 - coef * 100;
 img2b.filters.alpha.opacity = opacity2 + coef * 100;
 }
 else // for Mozilla
 { img1b.style.MozOpacity = opacity1 - coef;
 img2b.style.MozOpacity = opacity2 + coef;
 }
 }

 if (isIE) // for IE
 { opacity1 = parseFloat(img1b.filters.alpha.opacity);
 opacity2 = parseFloat(img2b.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1b.style.MozOpacity);
 opacity2 = parseFloat(img2b.style.MozOpacity);
 }

 if (opacity2 <= 0)
 { img2b.src=tabImg[indice2++].src;
 sens2 = 0;
 if (indice2 == (tabImg.length)) indice2=0;
 window.setTimeout("change_opacity2()",temps_pause) ; // attente
 return 0;
 }
 else if (opacity1 <= 0)
 { img1b.src=tabImg[indice2++].src;
 sens2 = 1;
 if (indice2 == (tabImg.length)) indice2=0;
 window.setTimeout("change_opacity2()",temps_pause) ; // attente
 return 0;
 }
 window.setTimeout("change_opacity2();",temps) ; 
 }
 
function change_opacity3()
 {
 var opacity1 = 0 ;
 var opacity2 = 0 ;
 if (isIE) // for IE
 { opacity1 = parseFloat(img1c.filters.alpha.opacity);
 opacity2 = parseFloat(img2c.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1c.style.MozOpacity);
 opacity2 = parseFloat(img2c.style.MozOpacity);
 }

 if (sens3)
 { if (isIE) // for IE
 { img1c.filters.alpha.opacity = opacity1 + coef * 100;
 img2c.filters.alpha.opacity = opacity2 - coef * 100;
 }
 else // for Mozilla
 { img1c.style.MozOpacity = opacity1 + coef;
 img2c.style.MozOpacity = opacity2 - coef;
 }
 }
 else
 {
 if (isIE) // for IE
 { img1c.filters.alpha.opacity = opacity1 - coef * 100;
 img2c.filters.alpha.opacity = opacity2 + coef * 100;
 }
 else // for Mozilla
 { img1c.style.MozOpacity = opacity1 - coef;
 img2c.style.MozOpacity = opacity2 + coef;
 }
 }

 if (isIE) // for IE
 { opacity1 = parseFloat(img1c.filters.alpha.opacity);
 opacity2 = parseFloat(img2c.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1c.style.MozOpacity);
 opacity2 = parseFloat(img2c.style.MozOpacity);
 }

 if (opacity2 <= 0)
 { img2c.src=tabImg[indice3++].src;
 sens3 = 0;
 if (indice3 == (tabImg.length)) indice3=0;
 window.setTimeout("change_opacity3()",temps_pause) ; // attente
 return 0;
 }
 else if (opacity1 <= 0)
 { img1c.src=tabImg[indice3++].src;
 sens3 = 1;
 if (indice3 == (tabImg.length)) indice3=0;
 window.setTimeout("change_opacity3()",temps_pause) ; // attente
 return 0;
 }
 window.setTimeout("change_opacity3();",temps) ; 
 }
 
 
 function change_opacity4()
 {
 var opacity1 = 0 ;
 var opacity2 = 0 ;
 if (isIE) // for IE
 { opacity1 = parseFloat(img1d.filters.alpha.opacity);
 opacity2 = parseFloat(img2d.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1d.style.MozOpacity);
 opacity2 = parseFloat(img2d.style.MozOpacity);
 }

 if (sens4)
 { if (isIE) // for IE
 { img1d.filters.alpha.opacity = opacity1 + coef * 100;
 img2d.filters.alpha.opacity = opacity2 - coef * 100;
 }
 else // for Mozilla
 { img1d.style.MozOpacity = opacity1 + coef;
 img2d.style.MozOpacity = opacity2 - coef;
 }
 }
 else
 {
 if (isIE) // for IE
 { img1d.filters.alpha.opacity = opacity1 - coef * 100;
 img2d.filters.alpha.opacity = opacity2 + coef * 100;
 }
 else // for Mozilla
 { img1d.style.MozOpacity = opacity1 - coef;
 img2d.style.MozOpacity = opacity2 + coef;
 }
 }

 if (isIE) // for IE
 { opacity1 = parseFloat(img1d.filters.alpha.opacity);
 opacity2 = parseFloat(img2d.filters.alpha.opacity);
 }
 else // for mozilla
 { opacity1 = parseFloat(img1d.style.MozOpacity);
 opacity2 = parseFloat(img2d.style.MozOpacity);
 }

 if (opacity2 <= 0)
 { img2d.src=tabImg[indice4++].src;
 sens4 = 0;
 if (indice4 == (tabImg.length)) indice4=0;
 window.setTimeout("change_opacity4()",temps_pause) ; // attente
 return 0;
 }
 else if (opacity1 <= 0)
 { img1d.src=tabImg[indice4++].src;
 sens4 = 1;
 if (indice4 == (tabImg.length)) indice4=0;
 window.setTimeout("change_opacity4()",temps_pause) ; // attente
 return 0;
 }
 window.setTimeout("change_opacity4();",temps) ; 
 }
 
 
// [root colonne droite]

var chgcol = false;
var chgsou = true;

function faq_click ( ) {
  //alert("faq_click");
  window.location.replace("index.php?id=103");
  return false;
}
function faq_hover ( o ) {
  if (chgcol) {
  _("module_faq_titre").style.color="white";
  _("module_faq_texte").style.color="white";
  }
  if (chgsou) {
  _("module_faq_titre").style.textDecoration="underline";
  _("module_faq_texte").style.textDecoration="underline";
  }
}
function faq_hout ( o ) {
  if (chgcol) {
  _("module_faq_titre").style.color="black";
  _("module_faq_texte").style.color="black";
  }
  if (chgsou) {
  _("module_faq_titre").style.textDecoration="none";
  _("module_faq_texte").style.textDecoration="none";
  }
}

function news_click ( ) {
  //alert("news_click");
  return false;
}
function news_hover ( ) {
  if (chgcol) {
  _("module_news_titre").style.color="white";
  _("module_news_texte").style.color="white";
  }
  if (chgsou) {
    _("module_news_titre").style.textDecoration="underline";
    _("module_news_texte").style.textDecoration="underline";
  }
  
}
function news_hout ( ) {
  if (chgcol) {  
  _("module_news_titre").style.color="black";
  _("module_news_texte").style.color="black";
  }
  if (chgsou) {
    _("module_news_titre").style.textDecoration="none";
    _("module_news_texte").style.textDecoration="none";
  }
}

function liens_click ( ) {
  //alert("liens_click");
  window.location.replace("index.php?id=102");
  return false;
}
function liens_hover ( ) {
  if (chgcol) {
  _("module_liens_titre").style.color="white";
  _("module_liens_texte").style.color="white";
  }
  if (chgsou) {
    _("module_liens_titre").style.textDecoration="underline";
    _("module_liens_texte").style.textDecoration="underline";
  }  
}
function liens_hout ( ) {
  if (chgcol) {
  _("module_liens_titre").style.color="black";
  _("module_liens_texte").style.color="black";
  }
  if (chgsou) {
    _("module_liens_titre").style.textDecoration="none";
    _("module_liens_texte").style.textDecoration="none";
  }  
}

function frss_click() {
  window.location.replace("index.php?id=102");
  return false;
}
function frss_hover ( ) {
  if (chgcol) {
  _("module_frss_titre").style.color="white";
  _("module_frss_texte").style.color="white";
  }
  if (chgsou) {
    _("module_frss_titre").style.textDecoration="underline";
    _("module_frss_texte").style.textDecoration="underline";
  }  
}
function frss_hout ( ) {
  if (chgcol) {
  _("module_frss_titre").style.color="black";
  _("module_frss_texte").style.color="black";
  }
  if (chgsou) {
    _("module_frss_titre").style.textDecoration="none";
    _("module_frss_texte").style.textDecoration="none";
  }  
}




// [ général ]


