var as = 1;
var fontt;
var expo;

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

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

		addChil(fontt,"windows-install.php","Dans Windows");
		addChil(fontt,"linux-install.php","Dans Linux");
		addChil(fontt,"mac-install.php","Dans Mac OS");
	}
	else if(das == "database")
	{
		var tdr = document.getElementById("database");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"apercu.php","Aperçu de base de donnée");
		addChil(fontt,"demarrage-mysql.php","Démarrage de MySQL");
		addChil(fontt,"connect-mysql.php","Connection on MySQL");
		addChil(fontt,"creation-base-donnees.php","Création");
		addChil(fontt,"utilisation-base-donnees.php","Utilisation");
		addChil(fontt,"suppression-base-donnees.php","Suppression");
	}
	else if(das == "types")
	{
		var tdr = document.getElementById("types");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"datatypes.php","Introduction");
		addChil(fontt,"numerique-datatype.php","Types numériques");
		addChil(fontt,"date-datatype.php","Date et heure");
		addChil(fontt,"chaine-datatype.php","Chaîne");
	}
	else if(das == "tables")
	{
		var tdr = document.getElementById("tables");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"creation-tables.php","Création");
		addChil(fontt,"liste-tables.php","Liste");
		addChil(fontt,"suppression-tables.php","Suppression");
		addChil(fontt,"renommer-tables.php","Renommer");
		addChil(fontt,"alterer-tables.php","Alterer");
	}
	else if(das == "insert")
	{
		var tdr = document.getElementById("insert");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"insert.php","Ajouter une ligne");
		addChil(fontt,"insert-plusieurs-lignes.php","Plusieurs lignes");
		addChil(fontt,"insert-auto-increment.php","Auto Increment");
	}
	else if(das == "select")
	{
		var tdr = document.getElementById("select");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"select-decompte.php","Décompte des lignes");
		addChil(fontt,"select.php","Sélection de  toutes les données");
		addChil(fontt,"select-limit.php","Utilisation de Limit");
		addChil(fontt,"select-colonnes.php","Sélection des colonnes");
		addChil(fontt,"select-triage.php","Triage des lignes");
		addChil(fontt,"select-where.php","Clause Where");
		addChil(fontt,"select-pattern.php","Pattern Matching");
		addChil(fontt,"select-groupby.php","Utilise Group By");
	}
	else if(das == "operators")
	{
		var tdr = document.getElementById("operators");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"operateur-ordre.php","Ordre des opérateurs");
		addChil(fontt,"typeconversion.php","Conversion de type");
		addChil(fontt,"logique-operateur.php","Opérateur logique");
		addChil(fontt,"comparaison-operateur.php","Opérateur de comparaison");
	}
	else if(das == "functions")
	{
		var tdr = document.getElementById("functions");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"numerique-fonction.php","Fonctions numériques");
		addChil(fontt,"chaine-fonction.php","Fonctions chaînes");
		addChil(fontt,"date-heure-fonction.php","Fonctions date et heure");
	}
}

function removeChilds(fontt)
{
	if(fontt != null)
	{		
		//alert(font.ChildNodes.length);
		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);
}
