3 tiered menu loop issue

My issue is im implementing a new jquery drop down navigation to existing php code and
at the moment this php script basically is looking for a child menu element and if it exists it loops the script over and over until it finds all the child elements ( in this case all the data base only goes three deep)
On each loop Id like to assign a different ul li style to each rather than just duplicating the same ul li style over and over. Which does not work with the style sheet of dropdown nav.
Is it possible?

[php]
function unhtmlentities( $string ){
$trans_tbl = get_html_translation_table ( HTML_ENTITIES );
$trans_tbl = array_flip( $trans_tbl );
$ret = strtr( $string, $trans_tbl );
return preg_replace( ‘/&#(\d+);/me’ , “chr(’\1’)” , $ret );
}

/**
 * Loads up the Full Site Navigation from /uploads/_full-site-nav.dat or
 * calls the function to rebuild it and also get the copy.
 * @return string Full site nav an an Unordered list
 * @author Greg Kirsch <[email protected]>
 * @version 1.0
 */
function insert_TopNav() {
	global $aryMainSiteNav;

/* if (strpos($_SERVER[‘HTTP_USER_AGENT’],‘TKG.GGK’)) {
require_once(LOCAL_PATH.’/inc/site-map-rebuild2.php’);
$aryMainSiteNav = clientSiteNavRebuild();
}
*/

	if ($aryMainSiteNav===false) {
		if (is_file(LOCAL_UPLOAD_PATH.'_site-full-nav.dat')) {
			$strSiteNav = file_get_contents(LOCAL_UPLOAD_PATH.'_site-full-nav.dat');
			if ($strSiteNav!==false) {
					$aryMainSiteNav = unserialize($strSiteNav);
			}
			unset ($strSiteNav);
		}
		if ($aryMainSiteNav===false) {
			require_once(LOCAL_PATH.'/inc/site-map-rebuild.php');
			$aryMainSiteNav = clientSiteNavRebuild();
		}
	}

// echo “

”;
// var_dump($aryTree);
// die();
	$aryBrowser = clientDetectBrowser();


	$strNoJS  = "<ul class=\"menu\">\n";
	foreach($aryMainSiteNav as $aryItem) {
		$strNoJS .= '<li><a href="/' . $aryItem['PageName'] . '" >'. clientEntities($aryItem['LinkText']) . '</a></li>'."\n";
	}
	$strNoJS .= "</ul>\n";

	//return $strNoJS;

	if ($aryBrowser['browser']=='IE' && (float)$aryBrowser['version']<7.0) {
		return $strNoJS;
	}

	$strMenu  = '<ul class="menu">';
	$strMenu .= clientBuildTree($aryMainSiteNav);
	$strMenu .= '</ul>';

	// Uncomment the next line to have do a straight HTML nav to the site, ignoring javascript issues.
	//return $strMenu;

	$strReturn = "<script language=\"javascript\" type=\"text/javascript\" src=\"/uploads/_site-top-nav.js\"></script>\n";

// $strReturn .= “document.write(’”.str_replace("’","’",$strMenu)."’);\n";

	$strReturn .= "<noscript>\n".$strNoJS."</ul>\n</noscript>\n";

	return $strReturn;

}

function clientBuildTree($aryBranch,$intLevel = 1) {

	$strBranch = '';
	foreach($aryBranch as $key =>$aryItem) {
		$strBranch .= '<ul class=\"sub-menu\"><li><a class="haschild"  href="/' . $aryItem['PageName'] . '" ';
		if (strpos($_SERVER['HTTP_USER_AGENT'],'TKG.GGK')!==false) {
			$strBranch .= ' title="'.$key.'" ';
		}
		$strBranch .= '>';
		if ($intLevel > 1 && $aryItem['NavIcon'] != false) {
			$strBranch .= '<img src="/uploads/' . $aryItem['NavIcon'] . '" alt="' . clientEntities($aryItem['LinkText']) . '">';
		}
		$strBranch .= clientEntities($aryItem['LinkText']) . '</a>';
		if ($aryItem['Children'] != false) {
			$strBranch .= "<ul class=\"sub-menu\">".clientBuildTree($aryItem['Children'],$intLevel+1)."</ul>";
		}
		$strBranch .= "</li></ul>";
	}
	
	return $strBranch;
}

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service