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

		addChil(fontt,"overview.php","Overview of Database");
		addChil(fontt,"starting-mysql.php","Starting a MySQL");
		addChil(fontt,"connect-mysql.php","Connecting MySQL Server");
		addChil(fontt,"creating-database.php","Creating a Database");
		addChil(fontt,"using-database.php","Using a Database");
		addChil(fontt,"remove-database.php","Removing a Database");
	}
	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,"numeric-datatype.php","Numeric Types");
		addChil(fontt,"date-datatype.php","Date and Time Types");
		addChil(fontt,"string-datatype.php","String Types");
	}
	else if(das == "tables")
	{
		var tdr = document.getElementById("tables");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"creating-tables.php","Creating Tables");
		addChil(fontt,"listing-tables.php","Listing Tables");
		addChil(fontt,"deleting-tables.php","Deleting Tables");
		addChil(fontt,"rename-tables.php","Renaming Tables");
		addChil(fontt,"alter-tables.php","Alter Table");
	}
	else if(das == "insert")
	{
		var tdr = document.getElementById("insert");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"insert.php","Add Row");
		addChil(fontt,"insert-multiple-rows.php","Multiple Rows");
		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-count.php","Counting Rows");
		addChil(fontt,"select.php","Selecting all Datas");
		addChil(fontt,"select-limit.php","Using Limit");
		addChil(fontt,"select-column.php","Select particular Columns");
		addChil(fontt,"select-sort.php","Select using Sorting");
		addChil(fontt,"select-where.php","Select using Where");
		addChil(fontt,"select-pattern.php","Pattern Matching");
		addChil(fontt,"select-groupby.php","Using Group By");
	}
	else if(das == "operators")
	{
		var tdr = document.getElementById("operators");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"operator-precedence.php","Operator Precedence");
		addChil(fontt,"typeconv.php","Type conversion");
		addChil(fontt,"logical-operator.php","Logical Operators");
		addChil(fontt,"comparison-operator.php","Comparison Operators");
	}
	else if(das == "functions")
	{
		var tdr = document.getElementById("functions");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"numeric-function.php","Numeric functions");
		addChil(fontt,"string-function.php","String functions");
		addChil(fontt,"date-time-function.php","Date & Time functions");
	}
}

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