function byId(id)
{
	return document.getElementById(id);
}

function supprimer(lien)
{
	if (confirm("Confirmer la suppression."))
		document.location.href = lien;
	else
		document.location.href = '#';	
}

function popup(lien, pLargeur, pHauteur)
{
	var posX = (screen.width / 2) - (pLargeur / 2);
	var posY = (screen.height / 2) - (pHauteur / 2);
	
	window.open(lien,"popup","width = " + pLargeur + ", height = " + pHauteur + ", left = " + posX + ", top = " + posY + ", resizable = yes");
}

function switch_view(element_id)
{
	Effect.toggle(element_id, 'blind');
}

function switch_view_all(id)
{
	var i = 1;
	
    while(byId('chapitre_'+i))
	{
		if('chapitre_'+i != id && byId('chapitre_'+i).style.display != "none")
			switch_view('chapitre_'+i);
			
		if('info_'+i != id && byId('info_'+i).style.display != "none")
			switch_view('info_'+i);
			
		if('avis_'+i != id && byId('avis_'+i).style.display != "none")
			switch_view('avis_'+i);
		
		i++;
	}
	
	switch_view(id);
}

function switch_view_faq(id)
{
	var i = 1;
	
    while(byId('faq_'+i))
	{
		if('faq_'+i != id && byId('faq_'+i).style.display != "none")
			switch_view('faq_'+i);
		
		i++;
	}
	
	switch_view(id);
}

function invertAll(headerfield, checkform, mask)
{
	for (var i = 0; i < checkform.length; i++)
	{
		if (typeof(checkform[i].name) == "undefined" || (typeof(mask) != "undefined" && checkform[i].name.substr(0, mask.length) != mask))
			continue;

		if (!checkform[i].disabled)
			checkform[i].checked = headerfield.checked;
	}
}

function reporter(id, cible) {
	var choix = byId(id).value;
	window.opener.byId(cible).value = choix;
}

function avertissement(lien) {
	if (confirm("Attention le jeune, ces images peuvent te choquer!\n Si tu as peur, clic sur 'annuler' avant de pourrir \n tes yeux innocents")) 
		document.location.href = lien;
	else document.location.href = '#';
}