<?php

function navigator () {

	global $self;
	global $DOCURL;

	$TabList =  array ( 'Home', 'Flows', 'Packets', 'Traffic', 'Details', 'Stats', 'Plugins');

	$plugins  = GetPlugins ();
	$profiles = GetProfiles();

	print "<div id='navigation'>\n";
	print "<form action='$self' method='POST'>\n";
	print "<div style='text-align: right;'>";
	/* 
	 * uncomment the following line, if you want the docs available as Help link
	 * Copy the doc directory into HTML dir
	 */

	print "<a href='$DOCURL/NfSen.html' target='_blank' >Docu</a>\n";

	print "<a href='$self?bookmark=" . $_SESSION['bookmark'] . "'>Bookmark URL</a>\n";
	print "Selected Profile:&nbsp;\n";
	print "<select name='profile' onchange='this.form.submit();'>\n";

	foreach ( $profiles as $profile ) {
	if ( $profile == $_SESSION['profile'] )
			print "<option selected>$profile\n";
		else
			print "<option>$profile\n";
	}
	print "</select>\n";
	print "</div>\n";
	print "</form>\n";

	print "<ul>\n";

	$numtabs = count($TabList);

	for ( $i = 0; $i <  $numtabs; $i++ ) {
		if ( $i == $_SESSION['tab'] ) {
			if ( $i == 6 ) {
				print "<li><a href='$self?tab=$i' class='current_plugin'>" . $TabList[$i] . "</a></li>\n";
			} else {
				print "<li><a href='$self?tab=$i' class='current'>" . $TabList[$i] . "</a></li>\n";
			}
		} else {
			print "<li><a href='$self?tab=$i'>" . $TabList[$i] . "</a></li>\n";
		}
	}
	
	print "</ul>\n";

	if ( $_SESSION['tab'] < 4 ) {
		if ( $_SESSION['refresh'] ) 
			print "<div style='font-size:14px;font-weight:bold;display:inline'>Type: Continuous</div>";
		else
			print "<div style='font-size:14px;font-weight:bold;display:inline'>Type: History</div>";
	}


	if ( $_SESSION['tab'] == 6 ) {
		if ( count($plugins) == 0 ) {
			print "<div style='padding: 10px 0px 5px 20px;background-color: #88FF9E;'>\n";
			print "<h3>No plugins available!</h3>\n";
			print "</div>\n";
		} else {
			print "<div style='padding: 8px 0px 0px 0px;background-color: #88FF9E;'>\n";
			print "<ul>\n";

			for ( $i = 0; $i <  count($plugins); $i++ ) {
				if ( $i == $_SESSION['plugin_tab'] ) {
					print "<li><a href='$self?plugin_tab=$i' class='current'>" . $plugins[$i] . "</a></li>\n";
				} else {
					print "<li><a href='$self?plugin_tab=$i' style='background-color: #40BF52;'>" . $plugins[$i] . "</a></li>\n";
				}
			}
		
			print "</ul>\n";
			print "</div>\n";
		}
	}



	print "</div>\n";
	$bk = base64_decode(urldecode($_SESSION['bookmark']));

} // End of navigator

