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","在 Windows");
		addChil(fontt,"linux-install.php","在 Linux");
		addChil(fontt,"mac-install.php","在 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","综述数据库");
		addChil(fontt,"starting-mysql.php","启动MySQL");
		addChil(fontt,"connect-mysql.php","MySQL的连接");
		addChil(fontt,"creating-database.php","创建数据库");
		addChil(fontt,"using-database.php","利用数据库");
		addChil(fontt,"remove-database.php","删除数据库");
	}
	else if(das == "types")
	{
		var tdr = document.getElementById("types");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"datatypes.php","介绍");
		addChil(fontt,"numeric-datatype.php","数值类型");
		addChil(fontt,"date-datatype.php","日期和时间类型");
		addChil(fontt,"string-datatype.php","字符串类型");
	}
	else if(das == "tables")
	{
		var tdr = document.getElementById("tables");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"creating-tables.php","创建表");
		addChil(fontt,"listing-tables.php","上市表");
		addChil(fontt,"deleting-tables.php","删除表");
		addChil(fontt,"rename-tables.php","重命名表");
		addChil(fontt,"alter-tables.php","改变表");
	}
	else if(das == "insert")
	{
		var tdr = document.getElementById("insert");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"insert.php","添加行");
		addChil(fontt,"insert-multiple-rows.php","多行");
		addChil(fontt,"insert-auto-increment.php","自动递增");
	}
	else if(das == "select")
	{
		var tdr = document.getElementById("select");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"select-count.php","计数行");
		addChil(fontt,"select.php","选择所有数据");
		addChil(fontt,"select-limit.php","使用极限");
		addChil(fontt,"select-column.php","选择特别专栏");
		addChil(fontt,"select-sort.php","选择使用排序");
		addChil(fontt,"select-where.php","where子句");
		addChil(fontt,"select-pattern.php","模式匹配");
		addChil(fontt,"select-groupby.php","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","运算符优先级");
		addChil(fontt,"typeconv.php","类型转换");
		addChil(fontt,"logical-operator.php","逻辑运算符");
		addChil(fontt,"comparison-operator.php","比较运算符");
	}
	else if(das == "functions")
	{
		var tdr = document.getElementById("functions");
		removeChilds(fontt);
		fontt = tdr.getElementsByTagName('font').item(0);
		removeChilds(fontt);

		addChil(fontt,"numeric-function.php","数值函数");
		addChil(fontt,"string-function.php","字符串函数");
		addChil(fontt,"date-time-function.php","日期及时间功能");
	}
}

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