<?php
/*=================================================================================
 *
 * menu.php
 *
 * Autor: Marc Vollmann
 *
 * NOTE: Following steps are to do to include this menu page into another page:
 * [0.] Include file "../admin/menu.php"
 *      Attention: Include lib "../include/html.inc.php" after "menu.php"
 * [1.] Insert CSS-Lib. for navigation library (preparsed by PHP): 
 *      <style type="text/css">
 *        <?php include_once ("../css/navigation.css.php"); ?>
 *      </style>
 * [2.] Insert JS-Lib. for navigation library (preparsed by PHP): 
 *      <script type="text/javascript">
 *        <?php include_once ("../include/menu.js.php"); ?>
 *      </script>
 * [3.] Insert PHP-Parameter for output (menu, reduced menu, page title) into body of the page
 *      Attention: Do not forget the onLoad calls !!!
 *      <body ... onLoad="<?php echo $phpCurrentNavigationOnLoad ?> ..." ... >
 *        <?php echo $phpMenuOut ?>
 *        <?php echo $phpReducedMenuOut ?>
 *        <?php echo $phpPageTitelOut ?>
 * [4.] Insert PHP-Parameter for storing current navigation item in <input type="hidden">
 *      <form> ... <?php echo $phpCurrentNavigationInputHidden ?> ... </form>
 =================================================================================*/

include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_user.inc.php");


// Check HTTP-Parameters
$httpVars = array("statusMessage", "currentNavigationItem", "menuActiveByPageTitel", "deactivateMenu");
getSecHttpVars("1", $httpVars);

getLanguage(__FILE__);

// Check parameter to disable menu
if ($deactivateMenuStatic == "1" || $deactivateMenu == "1") : $menuDisabled = true; endif;
if (!isset($menuDisabled)) : $menuDisabled = false; endif;

if ($menuActiveByPageTitel == "1") : 
   $menuActiveByPageTitel = true;
elseif ($menuActiveByPageTitel == "0") : 
   $menuActiveByPageTitel = false;
else : 
   $menuActiveByPageTitel = false;
endif;

// Check for used JS framework
if ($usedFramework != "1" && $usedFramework != "2") :
   $usedFramework = getParameterValue("0", "FRAMEWORK_USED", "0", "0");
   if ($usedFramework != "1" && $usedFramework != "2") : 
      $usedFramework = "1"; 
   endif;
endif;

// Check kind of user agent
$isFirefox = true;
if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") === false) {
   $isFirefox = false;
}
$browser = $_SERVER['HTTP_USER_AGENT'] . "\n\n<br><br>";
$browserOk = false;
if (!(strpos($browser, "Firefox") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "FIREFOX") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "Edge") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "Chrome") === false)) : $browserOk = true; endif;


// Get user type
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");

// Get hq_workmode
$hq_workmode = getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_workmode");

// Get the rights of the employee logged in
$empRights = getRights($emp_id);

// Current activated navigation item
if ($currentNavigationItem == "") : $currentNavigationItem = ""; endif;
$currentNavigationLevel = 0;

// Get displayed background colors of the employee
$constMaskContentBgCol = getParameterValue($emp_id, "MASK_CONTENT_BGCOL", $hq_id);

// Constants
$constMenuItemWidth = "100px";
$constMenuColWidth  = "100px";
$constBackground = "#CDD9FD";
$constMenuBackground = array();
  $constMenuBackground[0] = "#1b12b9";
  $constMenuBackground[1] = "#1b12b9";
  $constMenuBackground[2] = "#4e45ec";
  $constMenuBackground[3] = "#97bcFF";
$constMenuBackgroundImage = array();
  $constMenuBackgroundImage[0] = "spacer_blue_menu_01.jpg";
  $constMenuBackgroundImage[1] = "spacer_blue_menu_01.jpg";
  $constMenuBackgroundImage[2] = "spacer_blue_menu_02.jpg";
  $constMenuBackgroundImage[3] = "spacer_blue_menu_03.jpg";
$constMenuColor = array();
  $constMenuColor[0] = "#FFFFFF";
  $constMenuColor[1] = "#FFFFFF";
  $constMenuColor[2] = "#FFFFFF";
  $constMenuColor[3] = "#FFFFFF";
$constMaincontentBackground = "#CDD9FD";
$constMaincontent2Background = "#CDD9FD";
$constButtonBackground = "#54b8fb";  // Classic dark blue: #1b12b9
$constButtonColor = "#000000";  // #FFFFFF
$constButtonColor2 = "#4e45ec";
$constButtonOnMouseOverColor = "#FFFFFF";  // #97bcFF
$constListBgCol1 = "#AAAAFF";
$constListBgCol2 = "#AAAAFF";
$constListBgCol3 = "#CCCCFF";
$constListBgCol4 = "#CCCCFF";
$constPageHeadlineBgCol = "#1b12b9";
$constTickerBgCol = "#CDD9FD";

// Overwrite colors by employee parameter
if ($constMaskContentBgCol == "1") :
   $constBackground = "#DDDDDD";
   $constMaincontentBackground = "#DDDDDD";
   $constMaincontent2Background = "#DDDDDD";
   $constButtonBackground = "#AAAAAA";
   $constButtonColor = "#FFFFFF";
   $constButtonColor2 = "#000000";
   $constButtonOnMouseOverColor = "#444444";
   $constListBgCol1 = "#AAAAAA";
   $constListBgCol2 = "#AAAAAA";
   $constListBgCol3 = "#CCCCCC";
   $constListBgCol4 = "#CCCCCC";
   $constPageHeadlineBgCol = "#888888";
   $constTickerBgCol = "#CDD9FD";
endif;
// *****************************************************************

// Navigation deep of the headquarters menu, number of sublevels
$jsMenuNavigationDeep = 2;

// Definition of the headquarters menu structure
$idColContainer = array();
$idColContainer[0] = array("menu_00");
$idColContainer[1] = array("menu_01", "menu_02", "menu_03");
$idColContainer[2] = array("menu_01_01", "menu_01_02", "menu_01_03", "menu_01_04", "menu_01_05", "menu_02_01", "menu_03_01", "menu_04_01", "menu_05_01");
// $idColContainer[3] = array("menu_01_02_01", "menu_01_02_02", "menu_01_02_03", "menu_01_02_04", "menu_01_02_05", "menu_01_02_06");
$idColContainer[3] = array("menu_01_02_01", "menu_01_02_02", "menu_01_02_03", "menu_01_02_05", "menu_01_02_06");  // Without "G�ter"
/* Frachtverg�tungsmatrizen (leider nicht genutzt):
$idColContainer[3] = array("menu_01_02_01", "menu_01_02_07", "menu_01_02_02", "menu_01_02_08", "menu_01_02_03", "menu_01_02_04", "menu_01_02_05", "menu_01_02_06");
*/



// The array consists of "name", "URL", "target" and "menu access".
// The first dimension is defined according to the (sub)menu level
$menu[0]["impressum"] = array(getLngt("Impressum"), "javascript:mkImpressumPopupWin();", "", "", "", "2", array(), "1", "");
if ($userType == "1") :
   $menu[0]["sprache"] = array(getLngt("Sprache"), "javascript:mkLanguagePopupWin();", "", "", "", "2", array(), "1", "");
endif;
$menu[0]["abmelden"] = array(getLngt("Abmelden"), "../admin/logout.php", "_top", "", "1", "2", array(), "", "");


// Headquarter   
if ($userType == "1") :

   // Get db-parameter for the number of lists (frames) to be displayed of the current employee
   $empMaskMultiJoblist = getParameterValue($emp_id, "MASK_MULTI_JOBLIST");
   $empMaskMultiJoblistMax = getParameterValue("0", "MASK_MULTI_JOBLIST_MAX", $hq_id);
   if (!(is_numeric($empMaskMultiJoblist) && $empMaskMultiJoblist > 0 && $empMaskMultiJoblist <= $empMaskMultiJoblistMax)) :
      $empMaskMultiJoblist = getParameterValue("0", "MASK_MULTI_JOBLIST", $hq_id);
      if (!(is_numeric($empMaskMultiJoblist)) || !($empMaskMultiJoblist > 0)) : $empMaskMultiJoblist = "4"; endif;
   endif;


   // Define items
   // [0]: Displayed text
   // [1]: URL 
   // [2]: Target
   // [3]: Access right
   // [4]: (= "1") <=> Defines last item of the current container like "menu_01_01"
   // [5]: (= "1") <=> Disables (!) container actions ("onMouseover", "onMouseout", "onClick")
   //      (= "2") <=> Disables (!) ONLY container action "onClick"
   // [6]: Array of containers be visible by hovering and click
   // [7]: (= "1") <=> Disables (!) navigation suffix "?currentNavigationItem=..." in navigation link
   // [8]: String of GET-parameters added to the navigation link
   $menu[1]["verwaltung"] = array(getLngt("Verwaltung"), "#", "", "", "", "", array("menu_01_01","menu_01_02","menu_01_03","menu_01_04","menu_01_05"), "1", "");
   $menu[1]["auftraege"] = array(getLngt("Auftr�ge"), "#", "", "", "", "", array("menu_02_01"), "1", "");
   $menu[1]["listen"] = array(getLngt("Listen"), "../admin/jb_list_fs.php?maskNumOfWins=" . $empMaskMultiJoblist, "_blank", substr($empRights,4,1), "1", "", array(), "1", "");
   $menu[1]["rechnungen"] = array(getLngt("Rechnungen"), "#", "", "", "", "", array("menu_03_01"), "1", "");
   $menu[1]["vertrieb"] = array(getLngt("Vertrieb"), "../groupware/appointment.php", "", substr($empRights,11,1), "", "", array(), "", "");
   $menu[1]["nachrichten"] = array(getLngt("Nachrichten"), "#", "", "", "1", "", array("menu_04_01"), "1", "");
   $menu[1]["datentransfer"] = array(getLngt("Datentransfer"), "#", "", "", "", "", array("menu_05_01"), "1", "");   
   $menu[1]["statistik"] = array(getLngt("Statistik"), "../statistic/statistic.php", "", substr($empRights,8,1), "", "", array(), "", "");
   $menu[1]["formulare"] = array(getLngt("Formulare"), "../admin/metafield_editor.php", "", substr($empRights,15,1), "1", "", array(), "", "");

   $menu[2]["kunden"] = array(getLngt("Kunden"), "../admin/customer_list.php", "", substr($empRights,0,1), "", "", array(), "", "");
   $menu[2]["transporteure"] = array(getLngt("Transporteure"), "../admin/courier_list.php", "", substr($empRights,1,1), "", "", array(), "", "");
   $menu[2]["map"] = array(getLngt("Karten�bersicht"), "../locating/map.php", "_blank", substr($empRights,19,1), "1", "", array(), "", "");
   // $menu[2]["gueter"] = array(getLngt("G�ter"), "#", "", "", "", "", array("menu_01_02_04"), "1", "");
   $menu[2]["berichte"] = array(getLngt("Berichte"), "#", "", "", "", "", array("menu_01_02_06"), "1", "");
   $menu[2]["preise"] = array(getLngt("Preise"), "#", "", "", "", "", array("menu_01_02_01"), "1", "");
   $menu[2]["rabatte"] = array(getLngt("Rabatte"), "#", "", "", "1", "", array("menu_01_02_02"), "1", "");
   /* Frachtverg�tungsmatrizen (leider nicht genutzt):
   $menu[2]["preise"] = array(getLngt("Preise/Frachtverg."), "#", "", "", "", "", array("menu_01_02_01","menu_01_02_07"), "1", "");
   $menu[2]["rabatte"] = array(getLngt("Rabatte"), "#", "", "", "1", "", array("menu_01_02_02","menu_01_02_08"), "1", "");
   */

   // $menu[2]["mitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "", "", "", array(), "", "");   // substr($empRights,3,1);
   // $menu[2]["mitarbeiter"] = array(getLngt("Mitarbeiter"), "#", "", "", "", "", array("menu_01_02_05"), "1", "");
   $menu[2]["niederlassungen"] = array(getLngt("Niederlassungen"), "#", "", "", "", "", array("menu_01_02_05"), "1", "");
   $menu[2]["feiertage"] = array(getLngt("Feiertage"), "../admin/public_holiday.php", "", substr($empRights,2,1), "", "", array(), "", "");
   $menu[2]["anfahrtszeiten"] = array(getLngt("Anfahrtszeiten"), "../admin/traveltime.php", "", substr($empRights,2,1), "1", "", array(), "", "");
   
   // $menu[2]["adressen"] = array(getLngt("Adressen"), "../admin/ad_admin.php", "", max(substr($empRights,0,1),substr($empRights,1,1)), "1", "", array(), "", "");
   $menu[2]["adressen"] = array(getLngt("Adressen"), "#", "", "", "", "", array("menu_01_02_03"), "1", "");
   $menu[2]["gruppen"] = array(getLngt("Gruppen"), "../admin/group.php", "", substr($empRights,8,1), "", "", array(), "", "");
   // $menu[2]["kontakte"] = array(getLngt("Kontakte"), "../admin/metafield_list.php", "", substr($empRights,11,1), "1", "", array(), "", "category=" . ec("1") . "&categoryPageTitel=KONTAKTE");
   // $menu[2]["extras"] = array(getLngt("Kessel Buntes"), "..//tools/statistic_finishment.php", "_blank", substr($empRights,46,1), "1", "", array(), "", "");
   $menu[2]["filter"] = array(getLngt("Filter"), "../admin/filter.php", "", substr($empRights,32,1), "1", "", array(), "", "crf_admin=" . ec("100") . "");
   // $menu[2]["berichte"] = array(getLngt("Berichte"), "#", "", "", "", "", array("menu_01_02_06"), "1", "");
   $menu[2]["bewertung"] = array(getLngt("Bewertungen"), "../admin/metafield_list.php", "", substr($empRights,8,1), "", "", array(), "", "category=" . ec("15") . "&objId=1&categoryPageTitel=BEWERTUNGEN&f_act_mtfl=search&viewItemsMode=0");
   // $menu[2]["filter"] = array(getLngt("Filter"), "../admin/filter.php", "", substr($empRights,32,1), "1", "", array(), "", "crf_admin=" . ec("100") . "");
   $menu[2]["extras"] = array(getLngt("Kessel Buntes"), "..//tools/statistic_finishment.php", "_blank", substr($empRights,46,1), "1", "", array(), "", "");

   $maskSingleJobedit = getParameterValue("0", "MASK_SINGLE_JOBEDIT", $hq_id);
   if ($maskSingleJobedit == "1") :
      $menu[2]["erfassung"] = array(getLngt("Einzelerfassung"), "javascript:actionEvent('job_edit')", "", substr($empRights,7,1), "", "", array(), "1", "");
   else :
      $menu[2]["erfassung"] = array(getLngt("Einzelerfassung"), "../jobs/job_edit.php", "_blank", substr($empRights,7,1), "", "", array(), "", "");
   endif;
   $menu[2]["listenerfassung"] = array(getLngt("Listenerfassung"), "../jobs/jb_edit_batch.php", "", substr($empRights,7,1), "1", "", array(), "", "");
   // $menu[2]["disposition"] = array(getLngt("Disposition"), "javascript:openVehicleDisposition();", "", substr($empRights,7,1), "1", "", array(), "1", "");

//   if (MASK_SINGLE_INVOICE == "1") :
      $menu[2]["uebersicht"] = array(getLngt("�bersicht"), "../invoice/invoice.php", "", substr($empRights,5,1), "", "", array(), "", "");
//   else :
//      $menu[2]["uebersicht"] = array(getLngt("�bersicht"), "../invoice/invoice.php", "_blank", substr($empRights,5,1), "", "", array(), "", "");
//   endif;
   $menu[2]["pdf_ausgabe"] = array(getLngt("PDF-Ausgabe"), "../jobs/jb_inv_assoc.php", "", substr($empRights,5,1), "", "", array(), "", "");
   $menu[2]["csv_ausgabe"] = array(getLngt("CSV-Ausgabe"), "../jobs/jb_exp_csv.php", "", substr($empRights,5,1), "1", "", array(), "", "");

   $menu[2]["devices"] = array(getLngt("Endger�te"), "../admin/mf_history.php", "", substr($empRights,4,1), "", "", array(), "", "");
   $menu[2]["newsticker"] = array(getLngt("Mitteilungen"), "../admin/newsticker.php", "", substr($empRights,18,1), "", "", array(), "", "");
   $menu[2]["newsletter"] = array(getLngt("Newsletter"), "../admin/metafield_list.php", "", substr($empRights,17,1), "1", "", array(), "", "category=" . ec("10") . "&objId=1&categoryPageTitel=NEWSLETTER&f_act_mtfl=search&viewItemsMode=0");
   
   $menu[2]["datenexport"] = array(getLngt("Datenexport"), "../export/export.php", "", substr($empRights,6,1), "", "", array(), "", "");
   $menu[2]["datenimport"] = array(getLngt("Datenimport"), "../import/data_transfer.php", "", (substr($empRights,22,1) == "1" || substr($empRights,23,1) == "1" ? "1" : "0"), "", "", array(), "", "");

   $menu[3]["servicepreise"] = array(getLngt("Servicepreise"), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price");
   $menu[3]["plz_preise"] = array(getLngt("PLZ-Preise"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price");
   $menu[3]["bereichspreise"] = array(getLngt("Bereichspreise"), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=price");
/* Frachtverg�tungsmatrizen (leider nicht genutzt):
   $menu[3]["servicefuhrlohn"] = array(getLngt("Servicefrachtverg."), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price&csId=-1");
   // $menu[3]["servicefuhrlohn"] = array(getLngt("Servicefrachtverg."), "../admin/services.php", "", "0", "", "", array(), "", "mode=price&csId=-1");
   $menu[3]["plz_fuhrlohn"] = array(getLngt("PLZ-Frachtverg."), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price&csId=-1");
   $menu[3]["bereichsfuhrlohn"] = array(getLngt("Bereichsfrachtverg."), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=price&csId=-1");
*/
   $menu[3]["servicerabatte"] = array(getLngt("Servicerabatte"), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount");
   $menu[3]["plz_rabatte"] = array(getLngt("PLZ-Rabatte"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount");
   $menu[3]["bereichsrabatte"] = array(getLngt("Bereichsrabatte"), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=discount");
/* Frachtverg�tungsmatrizen (leider nicht genutzt):
   $menu[3]["servicefuhrlohnrabatte"] = array(getLngt("Srv-Fv.-Rab."), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount&csId=-1");
   $menu[3]["plz_fuhrlohnrabatte"] = array(getLngt("PLZ-Fv.-Rabatte"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount&csId=-1");
   $menu[3]["bereichsfuhrlohnrabatte"] = array(getLngt("Bereichsfrachtv.rab."), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=discount&csId=-1");
*/
   $menu[3]["adressenverwaltung"] = array(getLngt("Allgemein"), "../admin/ad_admin.php", "", substr($empRights,2,1), "", "", array(), "", "");
   $menu[3]["plz_adressen"] = array(getLngt("PLZ-Adressen"), "../admin/srvpa_list.php", "", substr($empRights,2,1), "", "", array(), "", "");
   $menu[3]["bereichsadressen"] = array(getLngt("Bereichsadr."), "../admin/srvpaa_list.php", "", substr($empRights,2,1), "1", "", array(), "", "");
/*   
   $menu[3]["serviceeinheit"] = array(getLngt("Serviceeinheiten"), "../stock/article_list.php", "", substr($empRights,14,1), "", "", array(), "", "objecttypemode=" . ec("1"));
   $menu[3]["artikel"] = array(getLngt("Artikel"), "../stock/article_list.php", "", substr($empRights,14,1), "", "", array(), "", "");
   $menu[3]["lager"] = array(getLngt("L�ger"), "../stock/stock.php", "", substr($empRights,14,1), "1", "", array(), "", "");
*/
   $menu[3]["zentralenmitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "", "", "", array(), "", "");   // substr($empRights,3,1);
   // $menu[3]["lagerist"] = array(getLngt("Lageristen"), "../admin/user_list.php", "", substr($empRights,3,1), "", "", array(), "", "userListOfType=" . ec("4"));
   $menu[3]["zentralenkonfiguration"] = array(getLngt("Einstellungen"), "../admin/hq_admin.php", "", "", "1", "", array(), "", "");  

   $menu[3]["kd_berichte"] = array(getLngt("Kunden"), "../groupware/report.php", "_blank", (substr($empRights,0,1) == "1" && substr($empRights,16,1) == "1" ? "1" : "0"), "", "", array(), "", "rpObjType=cs");
   $menu[3]["un_berichte"] = array(getLngt("Transporteure"), "../groupware/report.php", "_blank", (substr($empRights,1,1) == "1" && substr($empRights,16,1) == "1" ? "1" : "0"), "1", "", array(), "", "rpObjType=cr");
endif;

// Customer
if ($userType == "2") :

   $jsMenuNavigationDeep = 1;

   $idColContainer = array();
   $idColContainer[0] = array("menu_00");
   $idColContainer[1] = array("menu_01", "menu_02");
   $idColContainer[2] = array("menu_01_01");
   $idColContainer[3] = array();
                                            
   // Get customer
   $cscId = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id");
   $csId = getFieldValueFromId("costcenter","csc_id",$cscId,"cs_id");
   $csJbedit = getFieldValueFromId("customer","cs_id",$csId,"cs_jbedit");

   if ($hq_workmode != "0") : 
      $tmpMenuAccess = "0"; 
      if ($csJbedit != "0") :
         $tmpMenuAccess = "1";
      endif;
   else : 
      $tmpMenuAccess = "1"; 
   endif;
// echo $customerId . "&nbsp;&nbsp;" . $cscIdRoot . "&nbsp;&nbsp;" . $cscIdActual . "<br>";
// echo ec($customerId) . "&nbsp;&nbsp;" . ec($cscIdRoot) . "&nbsp;&nbsp;" . ec($cscIdActual) . "<br>";
   $menu[1]["kostenstellen"] = array(getLngt("Kostenstellen"), "../customer/costcenter.php", "", "", "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   $menu[1]["auftraege"] = array(getLngt("Auftr�ge"), "#", "", "", "", "", array("menu_01_01"), "1", "");
   $menu[1]["zentralenmitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "1", "1", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   // $menu[1]["adressen"] = array(getLngt("Adressen"), "../customer/cscad_fs.php", "", substr($empRights,3,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   $menu[1]["datenexport"] = array(getLngt("Datenexport"), "../export/export.php", "", substr($empRights,7,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   $menu[1]["statistik"] = array(getLngt("Statistik"), "../statistic/statistic.php", "", substr($empRights,8,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   
   // Check for customer parameter for displaying the map view
   if ($customerId != "") :
       $constCsShowMapView = getParameterValue("0", "MASK_JB_MAP_VIEW_ENABLED_" . $customerId, "0");
       if ($constCsShowMapView == "1") : 
          $menu[1]["map"] = array(getLngt("Karten�bersicht"), "../locating/map.php", "_blank", "1", "1", "", array(), "", "");
       endif;
   endif;
   
   if (MASK_SINGLE_JOBEDIT == "1") :
      $menu[2]["erfassung"] = array(getLngt("Erfassung"), "javascript:actionEvent('job_edit2')", "", $tmpMenuAccess, "", "", array(), "1", "");
   else :
      $menu[2]["erfassung"] = array(getLngt("Erfassung"), "../jobs2/job_edit.php", "_blank", $tmpMenuAccess, "", "", array(), "1", "");
   endif;
   $menu[2]["listen"] = array(getLngt("Listen"), "../customer/jb_list.php", "", substr($empRights,4,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
   $menu[2]["uebersicht"] = array(getLngt("�bersicht"), "../invoice/invoice.php", "", substr($empRights,5,1), "1", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
endif;

// Courier
if ($userType == "3") :

   $jsMenuNavigationDeep = 0;

   $idColContainer = array();
   $idColContainer[0] = array("menu_00");
   $idColContainer[1] = array("menu_01");
   $idColContainer[2] = array();
   $idColContainer[3] = array();

   $menu[1]["auftraege"] = array(getLngt("Auftr�ge"), "../invoice/invoice_cr.php", "", "1", "", "", array(), "", "");
   $menu[1]["passwort"] = array(getLngt("Passwort"), "../courier/cr_changepwd.php", "", "1", "1", "", array(), "", "");
endif;

// Warehouseman
if ($userType == "4") :

   $jsMenuNavigationDeep = 0;

   $idColContainer = array();
   $idColContainer[0] = array("menu_00");
   $idColContainer[1] = array("menu_01");
   $idColContainer[2] = array();
   $idColContainer[3] = array();

   $menu[1]["lager"] = array(getLngt("L�ger"), "../stock/stock.php", "", "1", "1", "", array(), "", "");
   // $menu[1]["passwort"] = array(getLngt("Passwort"), "../courier/cr_changepwd.php", "", "1", "1", "", array(), "", "");
endif;


// Generate menu with structure and links
$jsMenuStruct = array();
$jsSubMenu = array();
$menuOut = "";

function generateMenu($menu, $idColContainer, $jsMenuStruct, $jsSubMenu, $menuStructPrefix) {
	global $constMenuBackground, $constMenuBackgroundImage, $currentNavigationItem, $currentNavigationLevel;
  $jsMenuStruct = array();
  $jsSubMenu = array();
  $menuOut = "";
  if ($menuStructPrefix == "") : $menuStructPrefix = "menu_"; endif;
  $menuLevels = count($menu);
  for ($j = 0; $j < $menuLevels; $j++) :
     $colCounter = 0;
     $keyArray = array_keys($menu[$j]);
     $keyArrayLen = count($keyArray);

     $menuOut .= "<div class=\"" . $menuStructPrefix . pad($j, 2) . "\" id=\"" . (isset($idColContainer[$j][$colCounter]) ? $idColContainer[$j][$colCounter] : "") . "\">\n";
     
     $jsMenuStruct[$j] = "\"";
  
     for ($i = 0; $i < $keyArrayLen; $i++) :

         if ($menu[$j][$keyArray[$i]][3] == "1" || $menu[$j][$keyArray[$i]][3] == "") :
  
            $menuOut .= "<div class=\"menu_item_" . pad($j, 2) . "\" id=\"" . $keyArray[$i] . "\" name=\"" . $keyArray[$i] . "\" ";
            if ($menu[$j][$keyArray[$i]][5] == "") :
               $menuOut .= "onClick=\"setMenu('" . $keyArray[$i] . "','" . ($j - 1) . "')\" onMouseover=\"changeContent('" . $keyArray[$i] . "','over','" . ($j - 1) . "')\" onMouseout=\"changeContent('" . $keyArray[$i] . "','off','" . ($j - 1) . "')\"";
            else :
               if ($menu[$j][$keyArray[$i]][5] == "2") :
                   $menuOut .= "onMouseover=\"changeContent('" . $keyArray[$i] . "','over','" . ($j - 1) . "')\" onMouseout=\"changeContent('" . $keyArray[$i] . "','off','" . ($j - 1) . "')\"";
               endif;
            endif;
            $menuOut .= ">";
            $menuOut .= "<div><img src=\"../images/" . $constMenuBackgroundImage[$j] . "\" width=\"100%\" height=\"4\" border=\"0\"></div>";
            // $menuOut .= "<div style=\"width:100px; height:4px; background:" . $constMenuBackground[$j] . ";\"></div>";

            $menuOut .= "&nbsp;<a class=\"a_menu\" href=\"" . $menu[$j][$keyArray[$i]][1];
            if ($menu[$j][$keyArray[$i]][7] != "1" || $menu[$j][$keyArray[$i]][8] != "") :
               $menuOut .= "?";
               if ($menu[$j][$keyArray[$i]][7] != "1") :
                  $menuOut .= "currentNavigationItem=" . $keyArray[$i];
                  if ($menu[$j][$keyArray[$i]][8] != "") :
                     $menuOut .= "&";
                  endif;
               endif;               
               if ($menu[$j][$keyArray[$i]][8] != "") :
                  $menuOut .= $menu[$j][$keyArray[$i]][8];
               endif;
            endif;
            $menuOut .= "\" ". ($menu[$j][$keyArray[$i]][2] != "" ? "target=\"" . $menu[$j][$keyArray[$i]][2] . "\"" : "") . ">&nbsp;" . $menu[$j][$keyArray[$i]][0];

            $tmpStrLen = strlen($menu[$j][$keyArray[$i]][0]);
            for ($k = $tmpStrLen; $k < 17; $k++) :
                $menuOut .= "&nbsp;";
            endfor;
            $menuOut .= "</a>";
            $menuOut .= "</div>\n";
         else :
            $menuOut .= "<div class=\"menu_item_" . pad($j, 2) . "\" id=\"" . $keyArray[$i] . "\" name=\"" . $keyArray[$i] . "\">";
            $menuOut .= "<div><img src=\"../images/" . $constMenuBackgroundImage[$j] . "\" width=\"100%\" height=\"4\" border=\"0\"></div>";
            // $menuOut .= "<div style=\"width:100px; height:4px; background:" . $constMenuBackground[$j] . ";\"></div>";
            $menuOut .=   "<span style=\"color:black;\">&nbsp;&nbsp;" . $menu[$j][$keyArray[$i]][0] . "</span>";
            $menuOut .= "</div>\n";
         endif;

         // Check for reaching last element of the container like "menu_01_01"
         if ($menu[$j][$keyArray[$i]][4] == "1") :
            $colCounter++;
  
            $tmpJ = $j;
            if ($i == ($keyArrayLen - 1)) : 
               $tmpJ = $j + 1;
               $colCounter = 0;
            endif;
            if ($i < ($keyArrayLen - 1)) : 
               $menuOut .= "</div>\n";
               $menuOut .= "<div class=\"" . $menuStructPrefix . pad($tmpJ, 2) . "\" id=\"" . (isset($idColContainer[$tmpJ][$colCounter]) ? $idColContainer[$tmpJ][$colCounter] : "") . "\">\n";
            endif;
         endif;

         // ONLY for remembering the current menu status (activated item)
         // Get the navigation level from the $currentNavigationItem
         if ($currentNavigationItem == $keyArray[$i]) :

            $currentNavigationLevel = ($j - 1);
            // Check for disabled navigation suffix
            if ($menu[$j][$keyArray[$i]][7] == "1") :

               $currentNavigationItem = "";
               $currentNavigationLevel = 0;
            endif;
         endif;
         
         //ONLY FOR JAVASCRIPT
         // Menu structure
         $jsMenuStruct[$j] .= $keyArray[$i];
         if ($i < ($keyArrayLen - 1)) : 
            $jsMenuStruct[$j] .= "\",\"";
         endif;
         // Array of containers be visible by hovering and click
         // Used for the structure in Javascript:
         // subMenu["verwaltung"] = new Array("menu_01_01","menu_01_02","menu_01_03"); ...
         $tmpLen = count($menu[$j][$keyArray[$i]][6]);
         if ($tmpLen > 0) :
            $jsSubMenu[] = array($keyArray[$i], $menu[$j][$keyArray[$i]][6]);
         endif;
     endfor;
     
     $menuOut .= "</div>\n";
     
     $jsMenuStruct[$j] .= "\"";
  endfor;
  return array($menuOut, $menuLevels, $jsMenuStruct, $jsSubMenu);
}

// Call generation of the MAIN MENU using globals
list ($menuOut, $menuLevels, $jsMenuStruct, $jsSubMenu) = generateMenu($menu, $idColContainer, $jsMenuStruct, $jsSubMenu, "");



// **********
// * OUTPUT *
// **********

$phpMenuOut = "";
$phpReducedMenuOut = "";
$phpPageTitelOut = "";
$phpHeadquartersOut = "";
$phpCurrentNavigationOnLoad = "";
$phpCurrentNavigationInputHidden = "";

if (!$menuDisabled) :

   // Check activation of the user state items
   $constMenuUserStateItems = getParameterValue("0", "MENU_USER_STATE_ITEMS", $hq_id);
   if ($constMenuUserStateItems == "") : $constMenuUserStateItems = getParameterValue("0", "MENU_USER_STATE_ITEMS", "0"); endif;

   // Get user states if activated
   $showUserStateInfo = false;
   $menuItemListArrayLen = 0;
   if ($browserOk && $constMenuUserStateItems == "1" && isset($usr_id) && $usr_id > 0 && $userType == "1") :
      // Global switch to show user state buttons
      $showUserStateInfo = true;
      $usrStateBoolArray = array();

      $parMenuUserStateItemListOutput = getParameterValue("0", "MENU_USER_STATE_ITEMLIST_OUTPUT", $hq_id);
      if ($parMenuUserStateItemListOutput == "") : $parMenuUserStateItemListOutput = getParameterValue("0", "MENU_USER_STATE_ITEMLIST_OUTPUT", "0"); endif;

      if ($parMenuUserStateItemListOutput != "") : 

         $menuItemListArray = getKeyValueArrayFromString($parMenuUserStateItemListOutput);
         $menuItemListArrayLen = count($menuItemListArray);
         if ($menuItemListArrayLen > 0) : 

            $menuItemListKeyArray = array_keys($menuItemListArray);
            $menuItemListKeyArrayLen = count($menuItemListKeyArray);
            for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :

                $menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
            
                // User states
                $usrStateBoolArray[$menuItemKey] = "0";
                if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname",$menuItemKey))) :
                   $usrStateBoolArray[$menuItemKey] = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = '" . $menuItemKey . "'");
                endif;
            endfor;
         endif;
      endif;

      // User state disposition [template]
      /*
      $usrStateDispo = "0";
      if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname","usr_state_dispo"))) :
         $usrStateDispo = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = 'usr_state_dispo'");
      endif;
      */

      // User state newsticker
      $usrLastTifId = 0;
      if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname","usr_state_newsticker"))) :
         $usrLastTifId = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = 'usr_state_newsticker'");
      endif;
      $tifIdLast = getMaxOfField("phoenix_group.tickerforum", "tif_id", "");
      $numOfNewsToBeRead = getUserMessages("2", $usrLastTifId);
   endif;

   $phpCurrentNavigationOnLoad .= "adjustWidthsOnLoad();";  // Resize headline, etc.
   $phpCurrentNavigationOnLoad .= "activateMenusByPageTitle();";
   if ($userType == "1") :
      $phpCurrentNavigationOnLoad .= "myhide('menu_reduced');";
   endif;
   if (!$isFirefox) :
      $phpCurrentNavigationOnLoad .= "hideFocusOfLinkClass();";
   endif;
   $phpCurrentNavigationInputHidden = "<input type=\"hidden\" name=\"currentNavigationItem\" value=\"\">\n";   
   
   if ($currentNavigationItem != "") :
      $phpCurrentNavigationOnLoad .= "setMenuOnLoad('" . $currentNavigationItem . "'," . $currentNavigationLevel . ");";
      $phpCurrentNavigationInputHidden = "<input type=\"hidden\" name=\"currentNavigationItem\" value=\"" . $currentNavigationItem . "\">\n";
   endif;

   $phpCurrentNavigationInputHidden .= "<input type=\"hidden\" id=\"menuActiveByPageTitel\" name=\"menuActiveByPageTitel\" value=\"" .  ($menuActiveByPageTitel ? "1" : "0") . "\">\n";

   if ($showUserStateInfo) :
      // Close "Info" per default
      $phpCurrentNavigationOnLoad .= "myhide('page_info');";
   
      // In the beginning of a script per default all state buttons are "off" (e.g. "red") and have individually to switched to "on" (e.g. "green")      
      if ($menuItemListKeyArrayLen > 0) :
         for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :
             $menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
             $phpCurrentNavigationOnLoad .= "changeButtonMenuState('" . $menuItemKey . "','" . $menuItemKey . "','','2','" . $usrStateBoolArray[$menuItemKey] . "');";
         endfor;
      endif;
      // $phpCurrentNavigationOnLoad .= "changeButtonMenuState('usr_state_dispo','menuUserStateDispo','','2','" . $usrStateDispo . "');";

      // User state newsticker
      if ($numOfNewsToBeRead == 0) :
         $phpCurrentNavigationOnLoad .= "changeButtonMenuState('usr_state_newsticker','menuUserStateNews','Mitteilungen','1','" . $tifIdLast . "');";
      endif;
   endif;
   
   // Complete menu
   $phpMenuOut .= "<div class=\"menu\" name=\"menu\" id=\"menu\">\n";
   // $phpMenuOut .= "  <div class=\"logo\" name=\"logo\" " . ($userType == "1" ? "onClick=\"switchTicker('on');activateMenu('menu_reduced','menu');ticker();\"" : "") . ">\n";
   $phpMenuOut .= "  <div class=\"logo\" name=\"logo\">\n";
   $phpMenuOut .= "    <div style=\"width:121px; height:65px;\">\n";
   $phpMenuOut .= "      <div><img src=\"../images/votian24.png\" width=\"121\" height=\"65\" border=\"0\"></div>\n";
   $phpMenuOut .= "    </div>\n";
   $phpMenuOut .= "  </div>\n";
   $phpMenuOut .= $menuOut;
   $phpMenuOut .= "</div>\n";
   
   // Reduced menu (only for headquarters)
   if ($userType == "1") :
     $reducedMenu[0]["mainmenu"] = array(getLngt("Menu") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "javascript:switchTicker('off');activateMenu('menu','menu_reduced');", "", "", "1", "2", array(), "1", "");
     $reducedMenu[0]["ticker"] = array(getLngt("Ticker") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "javascript:switchTicker();", "", "", "1", "2", array(), "1", "");
     $IdColContainerReducedMenu = array();
     $IdColContainerReducedMenu[0] = array("menu_00");
     $IdColContainerReducedMenu[1] = array();
     $jsReducedMenuStruct =  array();
     $jsSubReducedMenu =  array();
     list ($reducedMenuOut, $reducedMenuLevels, $jsReducedMenuStruct, $jsSubReducedMenu) = generateMenu($reducedMenu, $IdColContainerReducedMenu, $jsReducedMenuStruct, $jsSubReducedMenu, "reduced_menu_");
     $phpReducedMenuOut .= "<div class=\"menu_reduced\" name=\"menu_reduced\" id=\"menu_reduced\">\n";
     $phpReducedMenuOut .= $reducedMenuOut . "\n";
     // $phpReducedMenuOut .= "<img src=\"../images/spacer_bgcolor.jpg\" width=\"100%\" height=\"2\" border=\"0\">\n";
     $phpReducedMenuOut .= "<div class=\"tickerOut\" name=\"tickerOut\" id=\"tickerOut\"></div>\n";
     $phpReducedMenuOut .= "</div>\n";
   endif;
   
   // Check current employee for access to switch headquarters on the fly
   /*
   $empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
   $outHqSelection = "";
   if (!$menuDisabled && $hq_id != "" && $userType == "1" && $empHqList != "") :
      $empHqArray = getKeyValueArrayFromString($empHqList);
      $tmpKeysArray = array_keys($empHqArray);
      $tmpKeysArrayLen = count($tmpKeysArray);
      // Check access to multiple headquarters selection
      $showMultipleHqSelection = false;
      for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
          if ($emp_id == $empHqArray[$tmpKeysArray[$i]]) :
             $showMultipleHqSelection = true;
          endif;
      endfor;
      if ($showMultipleHqSelection) :
         $outHqSelection .= "<div style=\"float:left; font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal; vertical-align:middle;background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelectionReduced\" id=\"currHqSelectionReduced\" onClick=\"myshow('currHqSelection'); myhide('currHqSelectionReduced');\">\n";
         $outHqSelection .= "&nbsp;" . strtoupper(getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_mnemonic")) . "&nbsp;:&nbsp;:";
         $outHqSelection .= "</div>\n";
         $outHqSelection .= "<div style=\"float:left; background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelection\" id=\"currHqSelection\" onClick=\"myshow('currHqSelectionReduced'); myhide('currHqSelection');\">";
         for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
             $outHqSelection .= "&nbsp;<a class=\"a_menu\" href=\"../admin/relogin_old.php?currReferer=" . urlencode(getCurrentScript($_SERVER['REQUEST_URI'])) . "&currHqSelection=" . ec($tmpKeysArray[$i]) . "\">" . getFieldValueFromId("headquarters","hq_id",$tmpKeysArray[$i],"hq_mnemonic") . "</a>&nbsp;&nbsp;<br>";
         endfor;
         $outHqSelection .= "</div>";
         $phpCurrentNavigationOnLoad .= "myhide('currHqSelection'); myshow('currHqSelectionReduced');";
      endif;
   endif;
   */
   $outHqSelection = "";
   if ($hq_id != "") :
      $empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
      if (!$menuDisabled && $userType == "1" && $empHqList != "") :
         $showMultipleHqSelection = isInParameterString($emp_id, $empHqList);
         if ($showMultipleHqSelection) :
            $tmpHqIdArray = getColVectorFromDB2ArrayByClause("mandatorheadquarters AS mdhq, headquarters AS hq", "hq.hq_id", "mdhq.md_id = '" . $md_id . "' AND mdhq.hq_id = hq.hq_id AND hq.hq_disabled = '0'", "", "hq.hq_mnemonic", "");
            $tmpHqIdArrayLen = count($tmpHqIdArray);
            $outHqSelection .= "<div style=\"float:left; font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal; vertical-align:middle;background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelectionReduced\" id=\"currHqSelectionReduced\" onClick=\"myshow('currHqSelection'); myhide('currHqSelectionReduced');\">\n";
            $outHqSelection .= "&nbsp;" . strtoupper(getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_mnemonic")) . "&nbsp;:&nbsp;:";
            $outHqSelection .= "</div>\n";
            $outHqSelection .= "<div style=\"float:left; background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelection\" id=\"currHqSelection\" onClick=\"myshow('currHqSelectionReduced'); myhide('currHqSelection');\">";
            for ($i = 0; $i < $tmpHqIdArrayLen; $i++) :
                $outHqSelection .= "&nbsp;<a class=\"a_menu\" href=\"../admin/relogin.php?currReferer=" . urlencode(getCurrentScript($_SERVER['REQUEST_URI'])) . "&currHqSelection=" . ec($tmpHqIdArray[$i]) . "\">" . getFieldValueFromId("headquarters","hq_id",$tmpHqIdArray[$i],"hq_mnemonic") . "</a>&nbsp;&nbsp;<br>";
            endfor;
            $outHqSelection .= "</div>";
            $phpCurrentNavigationOnLoad .= "myhide('currHqSelection'); myshow('currHqSelectionReduced');";
         endif;
      endif;
   endif;

   // Titel
   $phpPageTitelOut .= $outHqSelection;
   $phpPageTitelOut .= "<div class=\"page_headline\" name=\"page_headline\" id=\"page_headline\" onClick=\"activateMenusByPageTitle();\">\n";
   $phpPageTitelOut .= "  <span style=\"display: inline-block; width:250px;\">&nbsp;" . mcIsSet($pageTitel) . "</span>\n";
   if ($showUserStateInfo) :
      $phpPageTitelOut .= "  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n";
      $phpPageTitelOut .= "  <button type=\"button\" class=\"buttonMenuUserInfo\" name=\"menuUserInfo\" id=\"menuUserInfo\" onClick=\"document.location.href = '../admin/start.php?noResetUserStates=1';\">" . getLngt("Info") . "</button>" . "\n";
      $phpPageTitelOut .= "  <button type=\"button\" class=\"buttonMenuUserState\" name=\"menuUserStateNews\" id=\"menuUserStateNews\" onClick=\"changeButtonMenuState('usr_state_newsticker','menuUserStateNews','Mitteilungen','1','" . $tifIdLast . "'); menuGetInfodata('usr_state_newsticker','3','" . $usrLastTifId . "');\">" . getLngt("Mitteilungen") . "</button>" . "\n";
      
      // $phpPageTitelOut .= "  <button type=\"button\" class=\"buttonMenuUserState\" name=\"menuUserStateDispo\" id=\"menuUserStateDispo\" onClick=\"menuGetInfodata('usr_state_dispo');\">" . getLngt("Vermittlung") . "</button>" . "\n";
      for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :
          $menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
          $menuItemValue = $menuItemListArray[$menuItemListKeyArray[$i]];
          $phpPageTitelOut .= "  <button type=\"button\" class=\"buttonMenuUserState\" name=\"" . $menuItemKey . "\" id=\"" . $menuItemKey . "\" onClick=\"menuGetInfodata('" . $menuItemKey . "');\">" . getLngt($menuItemValue) . "</button>" . "\n";
      endfor;
      
      if (substr($empRights,0,1) == "1" && substr($empRights,11,1) == "1" && substr($empRights,36,1) == "1") :
         $phpPageTitelOut .= "  <button type=\"button\" class=\"buttonMenuUserInfo\" name=\"menuUserDashboardCS\" id=\"menuUserDashboardCS\" onClick=\"redirectLocation('../admin/dashb_cs.php');\">" . getLngt("Kundenakte") . "</button>" . "\n";
      endif;
   endif;
   $phpPageTitelOut .= "</div>\n";

   // Info
   if ($showUserStateInfo) :
      $phpPageInfoOut = "";
      $phpPageInfoOut .= "<div class=\"page_info\" name=\"page_info\" id=\"page_info\">\n";
      $phpPageInfoOut .= "  <div name=\"page_info_menu\" id=\"page_info_menu\">\n";
      // $phpPageInfoOut .= "    <button class=\"buttonMenuUserInfo\" onClick=\"myhide('page_info');\">" . getLngt("Schlie�en") . "</button>" . "\n";
      $phpPageInfoOut .= "  </div>\n";
      $phpPageInfoOut .= "  <div style=\"padding:10px;\" name=\"page_info_content\" id=\"page_info_content\">\n";
      $phpPageInfoOut .= "  </div>\n";
      $phpPageInfoOut .= "</div>\n";
      $phpPageTitelOut .= $phpPageInfoOut;  // Add "Info" to "Title"
   endif;
endif;
?>
