var as = 1;
var fontt;
var expo;
var nav_val;
function addChilds(das,exps)
{
	var nam =das;
	expo = exps;
 nav_val=$('#'+das+' .topics1').html();
nav_lik=$('#'+das+' a').attr('href');     
      if(das == "operators")
	{

	var tdr = document.getElementById("operators");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
      addChil(fontt,"operators/oprpreced.php","Operator Precedence");
	addChil(fontt,"operators/arithmeticopr.php","Arithmetic");
	addChil(fontt,"operators/assignopr.php","Assignment");
	addChil(fontt,"operators/incrdcropr.php","Increment/Decrement");
	addChil(fontt,"operators/comparisonopr.php","Comparison");
      addChil(fontt,"operators/logical.php","Logical");
      addChil(fontt,"operators/bitwiseopr.php","Bitwise");
      }
	else if(das == "controlstructures")
	{
	var tdr = document.getElementById("controlstructures");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
	addChil(fontt,"controlstructures/ifelse.php","IF ELSE");
      addChil(fontt,"controlstructures/ifelsif.php","IF ELSIF");
	addChil(fontt,"controlstructures/for.php","FOR");
	addChil(fontt,"controlstructures/foreach.php","FOR EACH");
	addChil(fontt,"controlstructures/while.php","WHILE");
	}
      else if(das == "arrayfunctions")
	{
	var tdr = document.getElementById("arrayfunctions");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
	addChil(fontt,"arrayfunctions/pushpop.php","push pop");
	addChil(fontt,"arrayfunctions/shiftunshift.php","shift unshift");
      addChil(fontt,"arrayfunctions/splice.php","splice");
      addChil(fontt,"arrayfunctions/split.php","split");

      }
      else if(das == "hash")
	{
	var tdr = document.getElementById("hash");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
      addChil(fontt,"hash/hash.php","Hash");
      addChil(fontt,"hash/addhash.php","Adding to Hash");
      addChil(fontt,"hash/removehash.php","Removing From Hash");
      addChil(fontt,"hash/sizeofhash.php","Size of Hash");
      addChil(fontt,"hash/sorthash.php","Sorting a Hash");
       }
      else if(das == "regularexp")
	{
	var tdr = document.getElementById("regularexp");
	removeChilds(fontt);
	fontt = tdr.getElementsByTagName('font').item(0);
	removeChilds(fontt);
      addChil(fontt,"regularexp/regexp.php","Regular Expression");
      addChil(fontt,"regularexp/mnbindoperator.php","m//, bind Operator");
      addChil(fontt,"regularexp/metacharacter.php","Metacharacters");
      addChil(fontt,"regularexp/alternationmchr.php","Alternate Metacharacter");
      addChil(fontt,"regularexp/matchanymchr.php","Match Any Metacharacter");
      addChil(fontt,"regularexp/matchbegendmchr.php","Match Begin,End Metacharacter");
      addChil(fontt,"regularexp/quantifiers.php","Quantifiers");
      addChil(fontt,"regularexp/characterclass.php","Character Classes");
      addChil(fontt,"regularexp/backtracking.php","Backtracking");
      addChil(fontt,"regularexp/moperator.php","m// Operator");
      addChil(fontt,"regularexp/soperator.php","s/// Operator");
      }
      else if (das == "functionforstrings")
      {
       var tdr = document.getElementById("functionforstrings");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"functionforstrings/chomp.php","chomp");
       addChil(fontt,"functionforstrings/chop.php","chop");
       addChil(fontt,"functionforstrings/chr.php","chr");
       addChil(fontt,"functionforstrings/crypt.php","crypt");
       addChil(fontt,"functionforstrings/hex.php","hex");
       addChil(fontt,"functionforstrings/oct.php","oct");
       addChil(fontt,"functionforstrings/ord.php","ord");
       addChil(fontt,"functionforstrings/index.php","index");
       addChil(fontt,"functionforstrings/lc.php","lc");
       addChil(fontt,"functionforstrings/lcfirst.php","lcfirst");
       addChil(fontt,"functionforstrings/length.php","length");
       addChil(fontt,"functionforstrings/pack.php","pack");
       addChil(fontt,"functionforstrings/qstring.php","qstring");
       addChil(fontt,"functionforstrings/qqstring.php","qqstring");
       addChil(fontt,"functionforstrings/reverse.php","reverse");
       addChil(fontt,"functionforstrings/rindex.php","rindex");
       addChil(fontt,"functionforstrings/printf.php","printf ");
       addChil(fontt,"functionforstrings/substr.php","substr");
       addChil(fontt,"functionforstrings/troperator.php","tr/// Operator");
       addChil(fontt,"functionforstrings/uc.php","uc");
       addChil(fontt,"functionforstrings/ucfirst.php","ucfirst");
       addChil(fontt,"functionforstrings/yoperator.php","y/// Operator");
       
       }
       else if (das == "functionforregularexp")
       {
       var tdr = document.getElementById("functionforregularexp");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"functionforregularexp/pos.php","pos");
       addChil(fontt,"functionforregularexp/qrstring.php","qrstring");
       addChil(fontt,"functionforregularexp/qxstring.php","qxstring");
       addChil(fontt,"functionforregularexp/qqstring.php","qqstring");
       addChil(fontt,"functionforregularexp/quotemeta.php","quotemeta");
       addChil(fontt,"functionforregularexp/split.php","split");

       }
       else if (das == "numfunctions")
       {
       var tdr = document.getElementById("numfunctions");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"numfunctions/numberconversion.php","Conversion Functions");
       addChil(fontt,"numfunctions/numericalfunctions.php","Numerical Functions");
       addChil(fontt,"numfunctions/trignometricfunction.php","Trignometric Functions");
       }
       else if (das == "functionforlist")
       {
       var tdr = document.getElementById("functionforlist");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"functionforlist/grep.php","grep");
       addChil(fontt,"functionforlist/join.php","join");
       addChil(fontt,"functionforlist/map.php","map");
       addChil(fontt,"functionforlist/qwstring.php","qwstring");
       addChil(fontt,"functionforlist/sort.php","sort ");
       addChil(fontt,"functionforlist/unpack.php","unpack");
       }
       else if (das == "functionforhash")
       {
       var tdr = document.getElementById("functionforhash");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"functionforhash/delete.php","delete");
       addChil(fontt,"functionforhash/each.php","each");
       addChil(fontt,"functionforhash/exists.php","exists");
       addChil(fontt,"functionforhash/keys.php","keys");
       addChil(fontt,"functionforhash/values.php","values");
       }
        
       else if (das == "userdefinedfunction")
       {
       var tdr = document.getElementById("userdefinedfunction");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"userdefinedfunction/usrdeffunc.php","User Defined Function");
       addChil(fontt,"userdefinedfunction/passingarrays.php","Passing Value to Arrays");
       addChil(fontt,"userdefinedfunction/passinghash.php","Passing Value to Hash");
       addChil(fontt,"userdefinedfunction/passingvariable.php","Passing Variables");
       }
       else if (das == "filehandling")
       {
       var tdr = document.getElementById("filehandling");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);
       addChil(fontt,"filehandling/filehandle.php","File Handle");
       addChil(fontt,"filehandling/openfile.php","Open File");
       addChil(fontt,"filehandling/writingafile.php","Write into File");
       addChil(fontt,"filehandling/creatingafile.php","Create a File");
       addChil(fontt,"filehandling/copyingafile.php","Copy a File");
       addChil(fontt,"filehandling/deletingafile.php","Deleting a File");
       addChil(fontt,"filehandling/","");
      }
      else if (das == "filefunctions")
       {
       var tdr = document.getElementById("filefunctions");
	 removeChilds(fontt);
	 fontt = tdr.getElementsByTagName('font').item(0);
	 removeChilds(fontt);


       }

      /*
	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,"iframe.php","IFrame");
	addChil(fontt,"css.php","Simple 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",ajss+expo+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);
}


