var as = 1;
var fontt;
var expo;

function addChilds(das,exps)
{
	var nam =das;
	expo = exps;

	if(das == "main")
	{
		var tdr = document.getElementById("main");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"index.php","Intro");
		addChil(fontt,"comment.php","Comment");
		addChil(fontt,"write.php",".write");
		addChil(fontt,"marqueurs-html.php","Marqueurs Html");
		addChil(fontt,"alerte.php","Alerte");
	}
	else if(das == "vari")
	{
		var tdr = document.getElementById("vari");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"types.php","Types");
		addChil(fontt,"chaine.php","Chaîne");
		addChil(fontt,"nombres.php","Nombres");
		addChil(fontt,"booleen.php","Booléen");
		addChil(fontt,"type-conversions.php","Type Conversion");
	}
	else if(das == "oper")
	{
		var tdr = document.getElementById("oper");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"operateurs.php","Basics");
		addChil(fontt,"arithmetique-operateur.php","Arithmétiques");
		addChil(fontt,"logique-operateur.php","Logique");
		addChil(fontt,"comparaison.php","Comparaison");
		addChil(fontt,"attribution-operateur.php","Attribution");
		addChil(fontt,"ternaire.php","Térnaire");
		addChil(fontt,"priorite.php","Priorité");
	}
	else if(das == "state")
	{
		var tdr = document.getElementById("state");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"declaration-if.php","Déclaration If");
		addChil(fontt,"if-else.php","If Else");
		addChil(fontt,"cas.php","Cas");
		addChil(fontt,"declaration-with.php","Déclaration with");
	}
	else if(das == "loops")
	{
		var tdr = document.getElementById("loops");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"for-boucle.php","for");
		addChil(fontt,"while-boucle.php","while");
		addChil(fontt,"do-while-boucle.php","do while");
		addChil(fontt,"declaration-break.php","break");
		addChil(fontt,"declaration-continue.php","continue");
	}
	else if(das == "funct")
	{
		var tdr = document.getElementById("funct");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"javascript-fonction.php","Basics");
		addChil(fontt,"parametres.php","Paramètres");
		addChil(fontt,"valeur-renvoyee.php","Valeur renvoyée");
	}
	else if(das == "object")
	{
		var tdr = document.getElementById("object");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"chaine-objet.php","Chaîne Objet");
		addChil(fontt,"date-methodes.php","Date Objet");
		addChil(fontt,"math-methodes.php","Math Objet");
		addChil(fontt,"nombre-objets.php","Nombre Objet");
		addChil(fontt,"globale-fonctions.php","Globale");
	}
	else if(das == "arrays")
	{
		var tdr = document.getElementById("arrays");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"matrice.php","Matrice Basic");
		addChil(fontt,"dynamique-matrice.php","Dynamique Matrice");
		addChil(fontt,"matrice-methodes.php","Matrice Méthodes");
	}
	else if(das == "bobject")
	{
		var tdr = document.getElementById("bobject");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"hierarchie.php","Hiérarchie");
		addChil(fontt,"fenetre-objet.php","Fenêtre Objet");
		addChil(fontt,"document-objet.php","Document Objet");
		addChil(fontt,"historique-objet.php","Historique Objet");
		addChil(fontt,"navigateur-objet.php","Navigateur Objet");
	}
	else if(das == "form")
	{
		var tdr = document.getElementById("form");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"index.php","DOM & Events");
		addChil(fontt,"touche-evenements.php","Touche Objet");
		addChil(fontt,"checkbox-evenements.php","Checkbox Objet");
		addChil(fontt,"radio-evenements.php","Radio Objet");
		addChil(fontt,"textfield-evenements.php","Text Field");
		addChil(fontt,"textarea-evenements.php","Textarea Objet");
		addChil(fontt,"select-evenements.php","Select Objet");
		addChil(fontt,"forme-objet.php","Forme Objet");
	}
}

function removeChilds(fontt)
{
	if(fontt != null)
	{
		while(fontt.hasChildNodes() && fontt.childNodes.length> 1)
		{	
		if(as > 1)
		{
		fontt.removeChild(fontt.lastChild);
		}
		as = as+1;
		}
	}
}

var love = "yes";
function addChil(parent,linkname,textname)
{
var breaka = document.createElement("br");
var divs= document.createElement("div");
var link = document.createElement("a");
link.setAttribute("href",ajss+expo+linkname);
link.style.color="#aa300a";
divs.style.marginLeft="8px";
divs.style.marginRight="4px";
divs.style.paddingLeft="3px";
divs.style.fontSize="12px";
divs.style.lineHeight="20px";
divs.style.border="0px green solid";

if(love == "yes")
{
divs.style.backgroundColor="#beefec";
love = "no";
}
else
{
divs.style.backgroundColor="#dfffdf";
love = "yes";
}
link.style.textDecoration="none";
//link.setAttribute("style","background-color: white;");

var name = document.createTextNode(textname);
//parent.appendChild(breaka);
parent.appendChild(divs);
divs.appendChild(link);
link.appendChild(name);
}

