
thisPageId = ""
thisParentId = ""
for(i=0;i<mainNavTitle.length;i++){		//loop thru main navigation
	document.write("<a class=sm href=\"" + mainNavFileName[i] + "\">" + mainNavTitle[i] + "</a>")
	
	
	
	//now write sub Navs
	//for(i=0;i<subNavFileName[thisCatIndex].length;i++){
	//if (subNavInNav[thisCatIndex][i] != "0" && subNavParent[thisCatIndex][i] == ""){
	for (j=0;j<subNavTitle[i].length;j++) {
		thisParentId = subNavParent[i][j]
		thisPageId = subNavId[i][j]
		if(subNavInNav[i][j] != "0" && subNavParent[i][j] == ""){
			selectedPageId = subNavId[i][j]
			document.write("<div style=\"padding-left:15px;\"><a href=\"" + subNavFileName[i][j] + "\">" + subNavTitle[i][j] + "</a></div>")
		
		
		
			hasThirdLevel = false	
			//alert(selectedPageId + " - " + thisPageId + " - " + thisParentId)										
			if(selectedPageId == thisPageId || thisParentId == selectedPageId){	//if the selected page is the page we are looping thru
																																			//or a sub page of the page we are looping thru, then show 
				for(k=0;k<subNavFileName[i].length;k++){
																					
					if(subNavParent[i][k] == selectedPageId && subNavInNav[i][k] == "1"){
						hasThirdLevel = true
						document.write("<div style=\"padding-left:30px;\"><a class=third href=\"" + subNavFileName[i][k] + "\"> " + subNavTitle[i][k] + "</a></div>")
						
					
					}
				}
			}														
		
		
		
		
		}
	}
document.write("<br>")
	 
}