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 == "media")
	{
	var tdr = document.getElementById("media");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"audio.php"," Audio" );
	addChil(fontt,"video.php","Video");
	
	}
	
if(das == "main")
	{
	var tdr = document.getElementById("main");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"main.php","HTML Tag");
	addChil(fontt,"head.php","HEAD Tag");
	addChil(fontt,"body1.php","BODY Tag");
	addChil(fontt,"body2.php","bgcolor");
	addChil(fontt,"body3.php","background");
	}
	else if(das == "textp")
	{
	var tdr = document.getElementById("textp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"textp.php","b,u,i,center,br");
	addChil(fontt,"textp2.php","hr,ur,li,ol");
	addChil(fontt,"textp3.php","h1,space,div");
	addChil(fontt,"textp4.php","pre,font");
	addChil(fontt,"textp5.php","strike,power");
	}
	else if(das == "links")
	{
	var tdr = document.getElementById("links");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"links.php","Link Basics");
	addChil(fontt,"links2.php","Using Links");
	addChil(fontt,"links3.php","Email Link");
	}

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

	addChil(fontt,"marquee1.php","Marquee 1");
	addChil(fontt,"marquee2.php","Marquee 2");
	addChil(fontt,"blink.php","Blink");
	}
	else if(das == "tables")
	{
	var tdr = document.getElementById("tables");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"tables1.php","Tables");
	addChil(fontt,"table-border.php","Table Border");
	addChil(fontt,"table-color.php","Table Color");
	addChil(fontt,"table-size.php","Table Size");
	addChil(fontt,"table-align.php","Table Alignment");
	addChil(fontt,"tables6.php","Inner Tables");
	addChil(fontt,"colspan.php","Col Span");
	addChil(fontt,"rowspan.php","Row Span");
	}
	else if(das == "forms")
	{
	var tdr = document.getElementById("forms");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"form1.php","Basic Types");
	addChil(fontt,"text-field.php","Text Fields");
	addChil(fontt,"form-button.php","Buttons");
	addChil(fontt,"form-radiobutton.php","Radio Button");
	addChil(fontt,"form-checkbox.php","CheckBox");
	addChil(fontt,"form-textarea.php","TextArea");
	addChil(fontt,"form-combobox.php","Select Box");
	addChil(fontt,"form8.php","Password Field");
	addChil(fontt,"form9.php","Label");
	}
	else if(das == "others")
	{
	var tdr = document.getElementById("others");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"specialCharacter.php","Special Characters");
	addChil(fontt,"redirect.php","Page Redirect");
	addChil(fontt,"autorefresh.php","Auto Refresh");
	addChil(fontt,"iframe.php","IFrame");
	addChil(fontt,"favicon.php","AddressBar Icon");
	addChil(fontt,"css.php","Simple CSS");
	}


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

	addChil(fontt,"frameset.php","Frameset");
	addChil(fontt,"inline-frame.php","Inline frames");
	}
	else if(das == "images")
	{
	var tdr = document.getElementById("images");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"image-map.php","Image maps");
	addChil(fontt,"img-button.php","Image button");
	}

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

	addChil(fontt,"phrase.php","Phrase tag");
	addChil(fontt,"acron.php","Acronynm tag");
	addChil(fontt,"anchor.php","Anchor tag");
	}

}

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


