var as = 1;
var fontt;
var nav_val;
function addChilds(das)
{
	var nam =das;
  nav_val=$('#'+das+' .topics1').html();
nav_lik=$('#'+das+' a').attr('href');        
	if(das == "format")
	{
	var tdr = document.getElementById("format");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"style-types.php","Style Types");
	addChil(fontt,"universal.php","Universal");
	addChil(fontt,"identifiers.php","Identifiers");
	addChil(fontt,"format4.php","UserDefined");
	addChil(fontt,"format5.php","External CSS");
	}
	else if(das == "backp")
	{
	var tdr = document.getElementById("backp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"backp.php","Color");
	addChil(fontt,"backp2.php","Background Color");
	addChil(fontt,"backp3.php","Background Image");
	addChil(fontt,"backp4.php","Background Repeat");
	addChil(fontt,"backp5.php","Background Position");
	addChil(fontt,"backp6.php","BG Attachment");
	}
	else if(das == "textp")
	{
	var tdr = document.getElementById("textp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"word-spacing.php","Word Spacing");
	addChil(fontt,"letter-spacing.php","Letter Spacing");
	addChil(fontt,"text-decoration.php","Text Decoration");
	addChil(fontt,"vertical-align.php","Vertical Align");
	addChil(fontt,"text-transform.php","Text Transform");
	addChil(fontt,"text-align.php","Text Align");
	addChil(fontt,"text-indent.php","Text Indent");
	addChil(fontt,"line-height.php","Line Height");
	}
	else if(das == "fontp")
	{
	var tdr = document.getElementById("fontp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"fontp.php","Font Style");
	addChil(fontt,"fontp2.php","Font Weight");
	addChil(fontt,"fontp3.php","Font Size");
	addChil(fontt,"fontp4.php","Font Family");
	}
	else if(das == "borderp")
	{
	var tdr = document.getElementById("borderp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"border-color.php","Border Color");
	addChil(fontt,"border-width.php","Border Width");
	addChil(fontt,"border-style.php","Border Style");
	addChil(fontt,"side-borders.php","Side Borders");
	addChil(fontt,"border.php","Border");
	}
	else if(das == "marginp")
	{
	var tdr = document.getElementById("marginp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"marginp.php","Top Margin");
	addChil(fontt,"marginp2.php","Left Margin");
	addChil(fontt,"marginp3.php","Bottom Margin");
	addChil(fontt,"marginp4.php","Right Margin");
	addChil(fontt,"marginp5.php","Margin");
	}
	else if(das == "paddingp")
	{
	var tdr = document.getElementById("paddingp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"paddingp.php","Top Padding");
	addChil(fontt,"paddingp2.php","Left Padding");
	addChil(fontt,"paddingp3.php","Bottom Padding");
	addChil(fontt,"paddingp4.php","Right Padding");
	addChil(fontt,"paddingp5.php","Padding");
	}
	else if(das == "others")
	{
	var tdr = document.getElementById("others");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"link-styles.php","Link Styles");
	addChil(fontt,"mouse-over-effect.php","onMouseOver Effect");
	addChil(fontt,"scrollable-table.php","Scrollable Table");
	addChil(fontt,"cursor-types.php","Cursor Types");
	addChil(fontt,"comment-css.php","CSS Comment");
	}

}

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


