function pop()
{
    var myAs = document.getElementsByTagName('a');
    for (var a = 0; a < myAs.length; ++a) {
	// Si le lien a une classe de type pop
        if (myAs[a].className == 'pop') {
	// on extrait l'id de la popup à partir du href
            var pop = document.getElementById(myAs[a].href.substring(myAs[a].href.lastIndexOf('#') + 1));
	// si la popup existe on l'affiche (display block)
            if (pop) {       
                pop.style.display = 'none';
                myAs[a].onclick = function() {
                    thisPopup = document.getElementById(this.href.substring(this.href.lastIndexOf('#') + 1))
                    thisPopup.style.display = (thisPopup.style.display == 'none') ? 'block' : 'none';
                    return false;
                };
		// on efface la popup en cliquant dessus

            }
        }
    }
}

function pap()
{
    var myAs = document.getElementsByTagName('a');
    for (var a = 0; a < myAs.length; ++a) {
	// Si le lien a une classe de type pop
        if (myAs[a].className == 'pap') {
	// on extrait l'id de la popup à partir du href
            var pap = document.getElementById(myAs[a].href.substring(myAs[a].href.lastIndexOf('#') + 1));
	// si la popup existe on l'affiche (display block)
            if (pap) {       
                pap.style.display = 'none';
            	myAs[a].onclick = function() {
                    thisPopup = document.getElementById(this.href.substring(this.href.lastIndexOf('#') + 1))
                    thisPopup.style.display = (thisPopup.style.display == 'none') ? 'block' : 'none';
                    return false;
                };
		// on efface la popup en cliquant dessus
			 // pap.onclick = function()
             // {
             //  this.style.display = 'none';
             // };

            }
        }
    }
}



function pip()
{
	var pip = document.getElementById('pip');
	var fermer = document.getElementById('fermer');
	if (pip) {pip.style.display = 'block';};
	if (pip) {fermer.onclick = function() {pip.style.display = 'none';};};
}


function addLoadEvent(func)
{
   var oldonload = window.onload;
   if(typeof window.onload != 'function')
   {
      window.onload = func;
   }
   else
   {
      window.onload = function()
      {
         oldonload();
         func();
      }
   }
}


addLoadEvent(pop);
addLoadEvent(pap);
addLoadEvent(pip);
addLoadEvent(open_ext_link);
