function openCouche(nomCouche)
{
	if (document.getElementById)
	{
		var couche = document.getElementById(nomCouche);
	}
	else if (document.all)
	{
		var couche = document.all[nomCouche];
	}
	else if (document.layers)
	{
		var couche = document.layers[nomCouche];
	}
	if (couche != null)
	{
		var styleDisplay = couche.style.display;
		if (styleDisplay == "none")
			styleDisplay = "block";
		else
			styleDisplay = "none";
		couche.style.display = styleDisplay;
	}
}

function openMultiCouche(chaineMulti)
{
	var tabMulti = chaineMulti.split(";");
	for (i = 0;i<tabMulti.length;i++)
	{
		var couche = tabMulti[i];
		if (couche != "0")
			openCouche(couche);
	}
}
/*
Question qui va afficher la couche du commentaire et cacher la couche de la reponse
ou inversement
*/
function switchPost(montrer,cacher)
{
	if (document.getElementById)
	{
		var couche1 = document.getElementById(montrer);
		var couche2 = document.getElementById(cacher);
	}
	else if (document.all)
	{
		var couche1 = document.all[montrer];
		var couche2 = document.all[cacher];
	}
	else if (document.layers)
	{
		var couche1 = document.layers[montrer];
		var couche2 = document.layers[cacher];
	}
	if (couche1 != null)
	{
		var styleDisplay = couche1.style.display;
		if (styleDisplay == "none")
		{
			styleDisplay = "block";
			couche1.style.display = styleDisplay;
		}
	}
	if (couche2 != null)
	{
		var styleDisplay = couche2.style.display;
		if (styleDisplay == "block")
		{
			styleDisplay = "none";
			couche2.style.display = styleDisplay;
		}
	}
}

function Fenetre(L,H,F,TL,SR,ST)
{
	var vpos=(screen.height-H)/2;
	var hpos=(screen.width-L)/2;
	window.open(F,'','top='+vpos+',left='+hpos+',width='+L+',height='+H+',toolbar='+TL+', scrollbars='+SR+',status='+ST+'');
}
function chat()
{
	Fenetre(640,525,"chat.php",0,0,0);
}
function help()
{
	Fenetre(540,380,"help.php",0,1,0);
}
/*
Fonction qui permet de verifier que la recherche contient quelque chose
à chercher
*/
function chercher()
{
	var root = document.forms['rechercher'];
	if (root.motclef.value == "")
		return false;
	else
		return true;
}

/*
Fonction qui permet de changer la page d'un article.
Appelée lorsqu'on choisis dans la liste la page
*/
function changePageArticle(article)
{
	window.location.replace(article);
}

function changeQuestionStatut(redirectUrl,statut)
{
	iConfirm = confirm("Vous allez changer le statut de la question\nEtes vous sûr ?");
	if (iConfirm)
	{
		url = redirectUrl+statut;
		window.location.replace(url);
	}
}
function changePostStatut(redirectUrl,statut)
{
	iConfirm = confirm("Vous allez changer le statut du post\nEtes vous sûr ?");
	if (iConfirm)
	{
		url = redirectUrl+statut;
		window.location.replace(url);
	}
}
function deletePost(url)
{
	if (confirm("Etes-vous sur de vouloir supprimer ce post ?"))
	{
		window.location.replace(url);
	}
}