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,"wiezu.php","Begin");
		addChil(fontt,"write.php",".write");
		addChil(fontt,"html-tags.php","html tags");
		addChil(fontt,"alarm.php","alarm");
	}
	else if(das == "vari")
	{
		var tdr = document.getElementById("vari");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"arten.php","Arten");
		addChil(fontt,"zeichenfolge.php","Zeichenfolge");
		addChil(fontt,"nummers.php","Nummer");
		addChil(fontt,"boolesch.php","Boolesch");
		addChil(fontt,"konversionstyp.php","Konversionstyp");
	}
	else if(das == "oper")
	{
		var tdr = document.getElementById("oper");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"operatoren.php","Grundlagen");
		addChil(fontt,"arithmetisch-operatoren.php","Arithmetisch");
		addChil(fontt,"logisch-operatoren.php","Logisch");
		addChil(fontt,"vergleich.php","Vergleich");
		addChil(fontt,"zuweisungs-operatoren.php","Zuweisungs");
		addChil(fontt,"ternar.php","Ternar");
		addChil(fontt,"vorrang.php","Vorrang");
	}
	else if(das == "state")
	{
		var tdr = document.getElementById("state");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"if-aussage.php","if aussage");
		addChil(fontt,"if-else.php","if else");
		addChil(fontt,"switch-case.php","switch case");
		addChil(fontt,"with-aussage.php","with");
	}
	else if(das == "loops")
	{
		var tdr = document.getElementById("loops");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

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

		addChil(fontt,"javascript-funktionen.php","Grundlagen");
		addChil(fontt,"parameter.php","Parameters");
		addChil(fontt,"ruckgabewert.php","Rückgabewert");
	}
	else if(das == "object")
	{
		var tdr = document.getElementById("object");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"zeichenfolge-funktionen.php","Zeichenfolge Funktionen");
		addChil(fontt,"datum-methoden.php","Datum");
		addChil(fontt,"mathe-methoden.php","Mathe");
		addChil(fontt,"nummer-objekte.php","Nummer Objekte");
		addChil(fontt,"global-funktionen.php","Global");
	}
	else if(das == "arrays")
	{
		var tdr = document.getElementById("arrays");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"grundmatrix.php","Grundmatrix");
		addChil(fontt,"dynamische-matrix.php","Dynamische Matrix");
		addChil(fontt,"matrix-methoden.php","Matrix Methoden");
	}
	else if(das == "bobject")
	{
		var tdr = document.getElementById("bobject");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"hierarchie.php","Hierarchie");
		addChil(fontt,"fenster-objekt.php","Fenster Objekt");
		addChil(fontt,"dokument-objekt.php","Dokument Objekt");
		addChil(fontt,"history-objekt.php","History Objekt");
		addChil(fontt,"navigator-objekt.php","Navigator Objekt");
	}
	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,"knopf-objekt.php","Knopf Objekt");
		addChil(fontt,"checkbox-objekt.php","Checkbox Objekt");
		addChil(fontt,"radio-objekt.php","Radio Objekt");
		addChil(fontt,"textfeld-objekt.php","Text Feld Objekt");
		addChil(fontt,"textarea-objekt.php","Textarea Objekt");
		addChil(fontt,"select-objekt.php","Select Objekt");
		addChil(fontt,"form-objekt.php","Form Objekt");
	}
}

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);
}

