﻿var as = 1;
var fontt;
function addChilds(das)
{
	var nam =das;

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

	addChil(fontt,"style-types.php","风格类型");
	addChil(fontt,"universal.php","普遍");
	addChil(fontt,"identifiers.php","标识符");
	addChil(fontt,"userdefined-styles.php","用户定义");
	addChil(fontt,"external-css.php","外部的CSS");
	}
	else if(das == "backp")
	{
	var tdr = document.getElementById("backp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"css-color.php","彩色");
	addChil(fontt,"background-color.php","背景颜色");
	addChil(fontt,"background-image.php","背景图像");
	addChil(fontt,"background-repeat.php","背景重复");
	addChil(fontt,"background-position.php","背景立场");
	addChil(fontt,"background-attachment.php","背景附件");
	}
	else if(das == "textp")
	{
	var tdr = document.getElementById("textp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"word-spacing.php","字间距");
	addChil(fontt,"letter-spacing.php","信间距");
	addChil(fontt,"text-decoration.php","课文装饰");
	addChil(fontt,"vertical-align.php","垂直对齐");
	addChil(fontt,"text-transform.php","课文变换");
	addChil(fontt,"text-align.php","课文对齐");
	addChil(fontt,"text-indent.php","课文缩进");
	addChil(fontt,"line-height.php","线高度");
	}
	else if(das == "fontp")
	{
	var tdr = document.getElementById("fontp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"font-style.php","字体样式");
	addChil(fontt,"font-weight.php","字体重量");
	addChil(fontt,"font-size.php","字体大小");
	addChil(fontt,"font-family.php","字体家族");	
	}
	else if(das == "borderp")
	{
	var tdr = document.getElementById("borderp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"border-color.php","边框颜色");
	addChil(fontt,"border-width.php","边界宽度");
	addChil(fontt,"border-style.php","边框风格");
	addChil(fontt,"side-borders.php","一方国界");
	addChil(fontt,"border.php","边界");
	}
	else if(das == "marginp")
	{
	var tdr = document.getElementById("marginp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"margin-top.php","顶边距");
	addChil(fontt,"margin-left.php","左边距");
	addChil(fontt,"margin-bottom.php","底部边距");
	addChil(fontt,"margin-right.php","右边边距");
	addChil(fontt,"margin.php","保证金");
	}
	else if(das == "paddingp")
	{
	var tdr = document.getElementById("paddingp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"padding-top.php","顶端填充");	
	addChil(fontt,"padding-left.php","左填充");
	addChil(fontt,"padding-bottom.php","底部填充");
	addChil(fontt,"padding-right.php","右填充");
	addChil(fontt,"padding.php","填充");
	}
	else if(das == "others")
	{
	var tdr = document.getElementById("others");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"link-styles.php","链接样式");
	addChil(fontt,"mouse-over-effect.php","onMouseOver效果");
	addChil(fontt,"scrollable-table.php","滚动表");
	addChil(fontt,"cursor-types.php","游标类型");
	addChil(fontt,"comment-css.php","评论的CSS");
	}

}

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",linkname);
link.style.color="#aa300a";
divs.style.marginLeft="8px";
divs.style.marginRight="4px";
divs.style.paddingLeft="3px";
divs.style.fontSize="11px";
divs.style.lineHeight="16px";
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);
}

