<html>

<head>

<!-- if you want black backgound, remove this style block -->
<style>
   BODY{background-color: white;
		font-family: verdana,helvetica; 
		font-size: 8pt;}
   TD {font-size: 8pt; 
       font-family: verdana,helvetica; 
	   text-decoration: none;
	   white-space:nowrap;}
   A  {font-size: 8pt;
		font-family: verdana,helvetica; 
	   text-decoration: none;
       color: black}
   
    .specialClass {font-family:garamond; font-size:12pt;color:green;font-weight:bold;text-decoration:underline}
</style>

<!-- if you want black backgound, remove this line and the one marked XXXX and keep the style block below 

<style>
   BODY {background-color: black}
   TD {font-size: 10pt; 
       font-family: verdana,helvetica 
	   text-decoration: none;
	   white-space:nowrap;}
   A  {text-decoration: none;
       color: white}
</style>

XXXX -->


<!-- NO CHANGES PAST THIS LINE -->


<!-- Code for browser detection -->
<script src="ua.js"></script>

<!-- Infrastructure code for the tree -->
<script src="ftiens4.js"></script>

<!-- Execution of the code that actually builds the specific tree.
     The variable foldersTree creates its structure with calls to
	 gFld, insFld, and insDoc -->

<script src="<?php echo "treeMenuDef.php?helpId=$helpId";?>"></script>

<?php
//echo "<br>helpId=$helpId";
if(strlen($helpId) > 0){
	echo "\n <script LANGUAGE=\"JavaScript\">";
	echo "\n SetCookie('clickedFolder', '');";
	echo "\n SetCookie('highlightedTreeviewLink', '');";
	echo "\n </script>";
}
?>

</head>

<body topmargin=16 marginheight=16>

<!-- By making any changes to this code you are violating your user agreement.
     Corporate users or any others that want to remove the link should check 
	 the online FAQ for instructions on how to obtain a version without the link -->
<!-- Removing this link will make the script stop from working -->
<div><a href="http://www.treemenu.net/" target=_blank></a></div>

<!-- Build the browser's objects and display default view of the 
     tree. -->
<script>initializeDocument()</script>

<?php
$DEBUG=0;
//echo "<br>level_1=$level_1";

$mysqluser=str_rot13('nccyvpngvba');
$mysqlpw=str_rot13('abvgnpvycCN#68*');

if(strlen($level_1) > 0){
	$dbLink = mysql_pconnect('localhost',$mysqluser,$mysqlpw);
	$pubDb = 'OMC_PUB';
	$menuTable='sysMenuConf';
	$sortNoArr=array(0,0,0,0,0);

	$menuIdArr=explode('.',$level_1);
	$levelWhere='';
	for($i=0;$i<sizeof($menuIdArr);$i++){
		$j=$i+1;
		if($i > 0){
			$levelWhere .= "AND level_$j = {$menuIdArr[$i]} ";
		}else{
			$levelWhere .= " level_$j = {$menuIdArr[$i]} ";
		}
		if($menuIdArr[$i] == 0) break; 
		$sortWhere='';
		switch($i){
			case 0:
				$sortWhere .= " level_1 < {$menuIdArr[0]} ";
				break;
			case 1:
				$sortWhere .= " level_1={$menuIdArr[0]} 
								AND level_2 < {$menuIdArr[1]} ";
				break;
			case 2:
				$sortWhere .= " level_1={$menuIdArr[0]} 
								AND level_2 = {$menuIdArr[1]}
								AND level_3 < {$menuIdArr[2]}";
				break;	
			case 3:
				$sortWhere .= " level_1={$menuIdArr[0]} 
								AND level_2 = {$menuIdArr[1]}
								AND level_3 = {$menuIdArr[2]}
								AND level_4 < {$menuIdArr[3]}";
				break;	
			case 4:
				$sortWhere .= " level_1={$menuIdArr[0]} 
								AND level_2 = {$menuIdArr[1]}
								AND level_3 = {$menuIdArr[2]}
								AND level_4 = {$menuIdArr[3]}
								AND level_5 < {$menuIdArr[4]}";
				break;	
		}

		$menuSql = "SELECT count(*) as sortNo
					FROM $menuTable 
					WHERE $sortWhere 
					";
		if($DEBUG) echo "<br>menuSql = $menuSql";
		$menuResult = @mysqli_query($pubConn,$menuSql);
		echo mysqli_error($pubConn);
		$menuRow=mysqli_fetch_array($menuResult);
		if($DEBUG) echo "<br>menuRow[sortNo]={$menuRow[sortNo]}";
		if($i > 0){
			$sortNoArr[$i]=$sortNoArr[$i-1] + $menuRow[sortNo];
		}else{
			$sortNoArr[$i]=$menuRow[sortNo] + 1;
		}
		if($DEBUG) echo "<br>sortNoArr[$i]={$sortNoArr[$i]}";
	}
	if($DEBUG) echo "<br>levelWhere=$levelWhere";
	if(!$DEBUG) echo "\n <script LANGUAGE=\"JavaScript\">";
	for($i=0;$i < sizeof($sortNoArr);$i++){
		if($DEBUG) echo "<br> sortNoArr[$i+1] ={$sortNoArr[$i+1]} ";
		if($sortNoArr[$i+1] == 0){
			$menuSql = "SELECT httpLink
						FROM $menuTable 
						WHERE $levelWhere 
						ORDER BY level_1,level_2,level_3,level_4,level_5
						";
			if($DEBUG) echo "<br>menuSql = $menuSql";
			$menuResult = @mysqli_query($pubConn,$menuSql);
			echo mysqli_error($pubConn);
			$menuRow=mysqli_fetch_array($menuResult);
			$linkPath="$menuRow[httpLink]";
			echo "\n clickOnLink(\"{$sortNoArr[$i]}\",\"$linkPath\",\"basefrm\");";
			break;
		}else{
			echo "\n clickOnNode(\"{$sortNoArr[$i]}\");";
		}
	}
	if(!$DEBUG) echo "\n </script>";
}
?>
<noscript>
A tree for site navigation will open here if you enable JavaScript in your browser.
</noscript>

</html>
