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-instalar.php","En Windows");
		addChil(fontt,"linux-instalar.php","En Linux");
		addChil(fontt,"mac-instalar.php","En Mac OS");
	}
	else if(das == "database")
	{
		var tdr = document.getElementById("database");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"descripcion-general.php","Descripción");
		addChil(fontt,"arrancar-mysql.php","Arrancar MySQL");
		addChil(fontt,"conexion-mysql.php","Conexión MySQL");
		addChil(fontt,"creacion-basedatos.php","Creación");
		addChil(fontt,"uso-basedatos.php","Uso" );
		addChil(fontt,"extraccion-basedatos.php","Extracción");
	}
	else if(das == "types")
	{
		var tdr = document.getElementById("types");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"tipo-datos.php","Introducción");
		addChil(fontt,"numericos-tipo-datos.php","Tipos numéricos");
		addChil(fontt,"fecha-tipo-datos.php","Fecha y hora");
		addChil(fontt,"cadena-tipo-datos.php","Cadena");
	}
	else if(das == "tables")
	{
		var tdr = document.getElementById("tables");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"creando-tablas.php","Creando");
		addChil(fontt,"listando-tablas.php","Listando");
		addChil(fontt,"borrando-tablas.php","Borrando");
		addChil(fontt,"renombrarando-tablas.php","Renombrarando");
		addChil(fontt,"alterar-tablas.php","Alterar");
	}
	else if(das == "insert")
	{
		var tdr = document.getElementById("insert");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"insertar.php","Añadir fila");
		addChil(fontt,"insertar-multiples-filas.php","Filas múltiples");
		addChil(fontt,"auto-incremento.php","Auto Incremento");
	}
	else if(das == "select")
	{
		var tdr = document.getElementById("select");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"selecto-contar.php","Contar Filas");
		addChil(fontt,"selecto.php","SELECT Consulta");
		addChil(fontt,"selecto-limite.php","Uso de Límite");
		addChil(fontt,"selecto-columnas.php","Seleccionar columnas");
		addChil(fontt,"selecto-ordenar.php","Clasificación");
		addChil(fontt,"selecto-where.php","where Cláusula");
		addChil(fontt,"selecto-patrones.php","Coincidencia de patrones");
		addChil(fontt,"selecto-groupby.php","Uso de Group By");
	}
	else if(das == "operators")
	{
		var tdr = document.getElementById("operators");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"operador-precedencia.php","Precedencia");
		addChil(fontt,"tipo-conversion.php","Tipo de conversión");
		addChil(fontt,"logico-operador.php","Lógico");
		addChil(fontt,"comparacion-operador.php","Comparación");
	}
	else if(das == "functions")
	{
		var tdr = document.getElementById("functions");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"numericas-functiones.php","Numéricas Funciones ");
		addChil(fontt,"cadena-functiones.php","Cadenas Funciones");
		addChil(fontt,"fecha-hora-functiones.php","Fecha y hora Funciones");
	}
}

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