// JavaScript Document
function montre(id,id2) {
var d = document.getElementById(id);

if (d)
{
	document.getElementById('new_besoins').className='besoins';
	document.getElementById('new_domaine').className='domaine';
	document.getElementById('new_reference').className='reference';
	document.getElementById('new_approche').className='approche';
	document.getElementById('new_entreNous').className='entreNous';
	document.getElementById('new_qui').className='qui';
}

	for (var i = 1; i<=10; i++) {
		if (document.getElementById('sresult'+i)) {
			document.getElementById('sresult'+i).style.display='none';
		}
	}
	if (d) {
		d.style.display='block';
		document.getElementById('new_'+id2).className='new_'+id2;
	}
}


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 &agrave; 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
                /*pop.onclick = function()
                {
                    this.style.display = 'none';
                };*/
            }
        }
		if (myAs[a].className == 'closepop') {
			var closepop = document.getElementById(myAs[a].href.substring(myAs[a].href.lastIndexOf('#') + 1));
			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;
                };
            }
		}
    }
}


window.onload = function(){
    montre(); 
	pop();
}
