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

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

	addChil(fontt,"mailManager.php","DB Based (DBMAD)");
	addChil(fontt,"registrationMailer.php","File Based(HMAD)");

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

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

             addChil(fontt,"advanced-newsticker.php","Advanced Newsticker");
             addChil(fontt,"newsUpdate.php","News Update");

        }
}

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


