// JavaScript Document

timer1=setTimeout("",0);
list=new Array('chap1','chap2','chap3','chap4');
NS=(document.layers)?1:0;
IE=(document.all)?1:0;
function ctNS()
{
	if(NS==1)
	{
		ct();
	}
}
function ctIE()
{
	if(IE==1)
	{
		ct();
	}
}
function ct()
{
	clearTimeout(timer1)
}
function init()
{
	//alert('ok');
	clearTimeout(timer1);
	for(i in list)
	{
		this.css=est.dom?document.getElementById(list[i]).style:est.ie?document.all[list[i]].style:est.ns?document.layers[list[i]]:0;
		this.css.visibility='hidden';
		//this.css=est.dom?document.getElementById("tri"+list[i]).style:est.ie?document.all["tri"+list[i]].style:est.ns?document.layers["tri"+list[i]]:0;
		//this.css.visibility='hidden'
	}
}
function ia()
{
	timer1=setTimeout('init();',1000);
}
function iaNS()
{
	if(NS==1)
	{
		ia();
	}
}
function iaIE()
{
	if(IE==1)
	{
		ia();
	}
}
function Browser()
{
	b=navigator.appName;
	if(b=="Netscape")this.b="ns"; 
	else if(b=="Microsoft Internet Explorer")this.b="ie"; 
	else this.b=b;
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns"&&this.v>=4);
	this.ie=(this.b=="ie"&&this.v>=4);
	this.dom=((document.createRange&&(document.createRange().createContextualFragment))?true:false);
}
est=new Browser();

function sh(div,state)
{
	clearTimeout(timer1);
	this.css=est.dom?document.getElementById(div).style:est.ie?document.all[div].style:est.ns?document.layers[div]:0;
	this.css.visibility=state;
	//this.css=est.dom?document.getElementById("tri"+div).style:est.ie?document.all["tri"+div].style:est.ns?document.layers["tri"+div]:0;
	//this.css.visibility=state;
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

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
                pop.onclick = function()
                {
                    this.style.display = 'none';
                };
            }
        }
    }
}

window.onload = pop;

function PopupCentrer(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  var w=window.open(page,"popupChant","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
  w.document.close();
  w.focus();
}
