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

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

	addChil(fontt,"form-mail.php","Form Mailer");
	addChil(fontt,"feedback-form.php","Feedback Page");
	addChil(fontt,"support-form.php","Support Page");
  addChil(fontt,"contact-form.php","Contact Form");
	}
  else if(das == "gbook")
	{
	var tdr = document.getElementById("gbook");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"guestbook.php","File Based GuestBook");
	addChil(fontt,"guest-book.php","DB Based GuestBook");
	}
  else if(das == "newst")
	{
	var tdr = document.getElementById("newst");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"newsTicker.php","Vertical NT");
	addChil(fontt,"horizontalTextMover.php","Horizontal NT");
	}
	 else if(das == "fileupld")
	{
	var tdr = document.getElementById("fileupld");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"file-upload.php","File Upload");
	addChil(fontt,"multiple-images-upload.php","Multiple Image Upload");
	}
  
  
  
  else if(das == "calen")
	{
	var tdr = document.getElementById("calen");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"event-calendar.php","Event Calendar");
	addChil(fontt,"calendar.php","Monthly Calendar");
	}
	else if(das == "rating")
	{
	var tdr = document.getElementById("rating");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"starrating.php","Star Rating System");
	addChil(fontt,"rating.php","Rating/Voting Script");
	}
	else if(das == "imager")
	{
	var tdr = document.getElementById("imager");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"imageRotate.php","Image Rotator");
	addChil(fontt,"randomImageChooser.php","Random Image");
        addChil(fontt,"thumbnail-generator.php","Thumbnail Generator");
	}
	else if(das == "banner")
	{
	var tdr = document.getElementById("banner");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"bannerRotator.php","Banner Ad Rotator");
	addChil(fontt,"randomAds.php","Random Ad");
	}
	else if(das == "counter")
	{
	var tdr = document.getElementById("counter");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"freeCounter.php","Hit Counter");
	addChil(fontt,"uniqueCounter.php","Unique Counter");
	}
	else if(das == "huo")
	{
	var tdr = document.getElementById("huo");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"usersOnline.php","Users Online");
	addChil(fontt,"visitorsOnline.php","Max Users");
	}
	else if(das == "bstats")
	{
	var tdr = document.getElementById("bstats");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"usageStatistics.php","Version 2.0");
	addChil(fontt,"browserStatistics.php","Version 1.0");
	}
	else if(das == "vtrack")
	{
	var tdr = document.getElementById("vtrack");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"uvt.php","DB Based");
	addChil(fontt,"visitorTracking.php","File Based");
	}
	else if(das == "dbquery")
	{
	var tdr = document.getElementById("dbquery");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"database-query-tool.php","HDBQ 2.1");
	addChil(fontt,"dbq.php","HDBQ 1.1");
	}
	else if(das == "mailman")
	{
	var tdr = document.getElementById("mailman");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);

	addChil(fontt,"registrationMailer.php","File Based(HMAD)");
	addChil(fontt,"mailManager.php","DB Based (DBMAD)");
	}
        else if(das == "capt")
        {
           var tdr = document.getElementById("capt");
           removeChilds(fontt);
           fontt = tdr.getElementsByTagName('font').item(0);
           removeChilds(fontt);
 
           addChil(fontt,"captcha.php","Captcha Image Creater");
           addChil(fontt,"math-captcha.php","Math Captcha Validation");
         }
	else if(das == "Date")
	{
	var tdr = document.getElementById("Date");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
	addChil(fontt,"date-range.php","Date Range");
	addChil(fontt,"sunrise-sunset.php","Sunrise/Sunset Time");
	addChil(fontt,"easter-sunday-calculation.php","Easter Date calculator");
	}
	else if(das == "chart")
	{
	var tdr = document.getElementById("chart");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
	addChil(fontt,"barchart.php","Bar Chart");
	addChil(fontt,"linechart.php","Line Chart");
	addChil(fontt,"piechart.php","Pie Chart");
	addChil(fontt,"bubblechart.php","Bubble Chart");
  }


}

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="12px";
divs.style.lineHeight="20px";
divs.style.border="0px green solid";
divs.style.textAlign="center";

if(love == "yes")
{
divs.style.backgroundColor="#ffefcf";
divs.style.fontSize="11px";
love = "no";
}
else
{
divs.style.backgroundColor="#efefff";
divs.style.fontSize="11px";
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);
}


