AjouterGestionCharg(InitBrevesMemeRub);

function InitBrevesMemeRub() {
	
	if (document.getElementById("g2c_liensMemeRub")) {
		var declencheur = document.getElementById("g2c_liensMemeRub");
	
		AjouterGestionEve(declencheur, "mouseover", AfficherBrevesMemeRub, false);
	
		var liens = getElementsByAttribute("class", "g2c_liensMemeRub");
		
		// cacher les liens en Javascript
		for (var i = 0; i < liens.length; i++) {
			liens[i].style.display = "none";			
		}
	
		// correction d'un bug d'affichage dans IE
		document.getElementById("g2c_navBasRub").style.margin = "0";

		return true;
		
	}
}

function AfficherBrevesMemeRub(event) {
			
  if (typeof event == "undefined") {
    event = window.event;
  }

	var liens = getElementsByAttribute("class", "g2c_liensMemeRub");
	
	for (var i = 0; i < liens.length; i++) {
		if (liens[i].style.display == "none") {
			liens[i].style.display = "block";
		}
		else {
			liens[i].style.display = "none";			
		}
	}
	
  return true;
}

function AjouterGestionCharg(fn) {
  if (typeof window.addEventListener != 'undefined') {
    window.addEventListener('load', fn, false);
  } 
	else if (typeof document.addEventListener != 'undefined') {
    document.addEventListener('load', fn, false);
  } 
	else if (typeof window.attachEvent != 'undefined') {
    window.attachEvent('onload', fn);
  } 
	else {
    var precFn = window.onload;
    if (typeof window.onload != 'function') {
      window.onload = fn;
    } 
		else {
      window.onload = function() {
        precFn();
        fn();
      };
    }
  }
}

function AjouterGestionEve(cible, typeEve, refFonction, capture) {
  if (typeof cible.addEventListener != "undefined") {
    cible.addEventListener(typeEve, refFonction, capture);
  } 
	else if (typeof cible.attachEvent != "undefined") {
    cible.attachEvent("on" + typeEve, refFonction);
  } 
	else {
    typeEve = "on" + typeEve;

    if (typeof cible[typeEve] == "function") {
      var precGestion = cible[typeEve];

      cible[typeEve] = function() {
        precGestion();

        return refFonction();
      }
    }
    else {
      cible[typeEve] = refFonction;
    }
  }

  return true;
}

function trouverCibleEvenement(event) {
  var elementCible = null;

  if (typeof event.cible != "undefined") {
    elementCible = event.cible;
  }
  else {
    elementCible = event.srcElement;
  }

  while (elementCible.nodeType == 3 && elementCible.parentNode != null) {
    elementCible = elementCible.parentNode;
  }

  return elementCible;
}

function getElementsByAttribute(attribut, valeurAttribut) {

	var tabElements = new Array();
  var tabCorrespond = new Array();

  if (document.all) {
    tabElements = document.all;
  }
  else {
    tabElements = document.getElementsByTagName("*");
  }

  for (var i = 0; i < tabElements.length; i++) {
    if (attribut == "class") {
      var modele = new RegExp("(^| )" + valeurAttribut + "( |$)");

      if (tabElements[i].className.match(modele)) {
        tabCorrespond[tabCorrespond.length] = tabElements[i];
      }
    }
    else if (attribut == "for") {
      if (tabElements[i].getAttribute("htmlFor") || tabElements[i].getAttribute("for")) {
        if (tabElements[i].htmlFor == valeurAttribut) {
          tabCorrespond[tabCorrespond.length] = tabElements[i];
        }
      }
    }
    else if (tabElements[i].getAttribute(attribut) == valeurAttribut) {
      tabCorrespond[tabCorrespond.length] = tabElements[i];
    }
  }

  return tabCorrespond;
}
 
  
