
	my $manage_quote_defaults_menu         = '' ;
	my $manage_price_list_menu             = '' ;
	
	my $rma_list_menu						= ($usertype eq 'it' || $usertype eq 'senior_manager' || $usertype eq 'manager' || $usertype eq 'support' || $usertype eq 'casual_c') ? qq~<li><a href="$useropts{'folder'}/list-rma">RMA List</a></li>~ : '' ;
	
	my $manage_price_list_menu_top         = '' ;
	
	my $manage_logistics_report_menu_top   = qq~<li><a href="$useropts{'folder'}/logistics-report"><i class="glyphicons glyphicons-transfer"></i>Logistics</a></li>~ ;
	my $manage_leave_menu                  = '' ;
	my $reports_menu_top                   = '' ;
	my $accounts_menu_top 				   = '' ;

	my $analytics_reports					= ($glod_user_level >= 5) ? qq~
												<li class="dropdown-submenu">
														<a tabindex="-1" href="#">Analytics</a>
														<ul class="dropdown-menu" role="menu">
															<li><a href="$useropts{'folder'}/fixtures-report">Fixtures Report</a></li> 
														</ul>
												</li>
												<li class="divider"></li>
												~ : qq~~ ;
	
	# my $calibration_menu_top               = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
	my $calibration_menu_top               = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
	
	
	
	my $fixedsystem_menu_top               = qq~<li><a href="$useropts{'folder'}/fixed-systems-report"><i class="glyphicon glyphicon-indent-left"></i>Fixed System</a></li>~ ;
	my $home_menu_top                      = '' ;
	my $search_menu_top                    = '' ;
	my $quotes_menu_top                    = '' ;
	my $events_menu_top                    = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
	# my $analytics_menu_top					= ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/filter-analytics-event-bookings"><i class="glyphicon glyphicon-th-list"></i> Analytics</a></li>~ : qq~~ ;
	
	
	my $analytics_menu_top					= ($glod_user_level >= 5) ?  qq~
													<li class="dropdown">
														<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Analytics <span class="caret"></span></a>
														<ul class="dropdown-menu" role="menu">
															<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
															<li><a href="$useropts{'folder'}/filter-analytics-event-credits">Credits</a></li>
														</ul>
													</li>
											~ : qq~~ ;
	
	
	
	# my $events_filter                    = qq~<li><a href="$useropts{'folder'}/filter-event-quotes">Search Events</a></li>~;
	# my $events_systems                   = '' ;
	my $cameras_menu_top                   = qq~<li><a href="$useropts{'folder'}/search-cameras"><i class="glyphicon glyphicon-camera"></i> Cameras</a></li>~;
	my $documents_menu_top                 = '' ;
	my $calendar_menu_top                  = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
	my $manage_camera_systems_menu         = '' ;
	my $manage_users_menu                  = '' ;
	my $manage_operators_menu              = '' ;
	my $manage_installation_partners_menu  = '' ; 
	my $manage_analytics_client_menu       = '' ;
	my $manage_coding_providers_menu       = '' ;
	my $manage_customers_menu              = '' ;
	my $manage_archive_menu                = '' ;
	my $manage_event_systems               = '' ;
	my $manage_logistics_suppliers         = '' ;
	my $manage_logistics_locations         = '' ;
	my $manage_logistics_items             = '' ;
	my $manage_sport_types                 = '' ;
	my $manage_cities                      = '' ;
	my $manage_organisations               = '' ;
	my $manage_regions                     = '' ;
	my $manage_teams						= '' ;
	my $manage_operator_payments           = '' ;
	my $manage_monitor_payments				= '' ;
	my $manage_troubleshoot_monitor_payments = '' ;
	my $manage_temp_calibrator_payments		= '' ;
	my $manage_event_invoicing			   = '' ; 
	my $manage_logistics_report			   = '' ;
	
	my $manage_logistics_payments_report	= '' ; 
	my $manage_logistics_shipment_costs_report = '' ; 
	
	my $quote_search_menu_top              = '' ;
	my $reports_event_quotes               = qq~<li><a href="$useropts{'folder'}/event-quotes-report">Event Quotes Report</a></li>~;
	my $reports_management_report          = '' ;
	my $logistics_costs_report				= '' ;
	my $events_reports 		               = '' ; 
	my $reports_active_camera              = '' ; 
	my $reports_active_camera              = qq~<li><a href="$useropts{'folder'}/cameras-report">Active Cameras Report</a></li>~;
	# my $reports_stock_report             = '' ;
	my $reports_delivered_report           = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
	# my $reports_delivered_report         = '' ; 
	my $reports_warranty_report            = '' ;
	my $reports_match_credits              = '' ;
	my $manage_fixedsystem                 = '' ; 
	# my $monitor_report_menu_top				= qq~<li><a href="$useropts{'folder'}/monitor-report"><i class="glyphicons glyphicons-eye"></i>Monitor Report</a></li>~ ;
	
	my $schedule_menu_top                   = '' ;
	my $reports_monitor_report				= ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/monitoring-report">Monitor Allocations</a></li>~ : '' ; 
	my $reports_temp_calibration			= ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/temp-calibrator-report">Temp Calibrator Allocations</a></li>~ : '' ; 
	my $reports_troubleshoot_monitor_report	= ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/troubleshoot-monitoring-report">Troubleshoot Monitor Allocations</a></li>~ : '' ; 
	my $reports_site_surveys				= ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-site-surveys-report">Mobile Site Surveys</a></li>~ : '' ; 
	my $reports_set_up_groups				= ($glod_user_level >= 2) ? qq~<li><a href="$useropts{'folder'}/set-up-groups-report">Set Up Groups</a></li>~ : '' ; 
	my $mobile_tracking_system				= ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-system-tracking-report">Mobile System Tracking</a></li>~ : qq~~ ; 
 
	my $report_audit_trial = ($glod_user_level > 3) ? qq~<li><a href="$useropts{'folder'}/search-audit-trial">Audit Trial</a></li>~ : '' ;
	
	if ($useropts{super}{$username} and $pixellot_limit{$username}!=1 and $events_limit{$username}!=1) { 
		# $manage_quote_defaults_menu      = qq~<li><a href="$useropts{'folder'}/list-quote-defaults">Quote Defaults</a></li>~ ;
		$manage_quote_defaults_menu        = qq~<li><a href="$useropts{'folder'}/list-quote-notes">Quote Defaults</a></li>~ ;
		$manage_price_list_menu            = qq~<li><a href="$useropts{'folder'}/summary-price-list">Price List</a></li>~ ;
		$manage_price_list_menu_top        = qq~<li><a href="$useropts{'folder'}/summary-price-list"><i class="glyphicon glyphicon-list"></i> Price List</a></li>~ ;
		# $manage_leave_menu               = qq~<li class="divider"></li>
			# <li><a href="$useropts{'folder'}/list-leave">List Leave</a></li>
			# <li><a href="$useropts{'folder'}/list-leave-settings">Leave Settings</a></li>
			# <li><a href="$useropts{'folder'}/leave-report">Leave Report</a></li>~ ;
			
		# $events_systems                  = qq~<li><a href="$useropts{'folder'}/list-event-systems"> Event Systems</a></li>~;
	}
		
	# unless ($pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager') {
	if ($glod_user_level >= 4) {
		$reports_stock_report              = qq~<li><a href="$useropts{'folder'}/stock-report">Stock Report</a></li>~;
	}                                      
									       
	if ($glod_user_level >= 5) {           
		# $reports_delivered_report        = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
		$reports_warranty_report           = qq~<li><a href="$useropts{'folder'}/warranty-report">Extended Warranty Report</a></li>~;
		$reports_match_credits             = qq~<li><a href="$useropts{'folder'}/match-credits-report">Match Credits Report</a></li>~;
		$reports_management_report         	= qq~<li><a href="$useropts{'folder'}/management-report">Management Report</a></li>~;
		$logistics_costs_report         	= qq~<li><a href="$useropts{'folder'}/logistics-costs-report">Logistics Costs Report</a></li>~;
		# $reports_operators_report        = qq~<li><a href="$useropts{'folder'}/operators-report">Operators Report</a></li>~;
		$events_reports 			       = qq~<li class="divider"></li>
									       	 <li class="dropdown-submenu">
									       		 <a tabindex="-1" href="#">Events Reports</a>
									       		 <ul class="dropdown-menu">
									       			 <li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
									       			 <li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
									       			 <li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
									       			 <li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
									       			 <li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
									       			 <li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
									       			 <li><a href="$useropts{'folder'}/operators-report">Operators Payments Report</a></li>
									       		 </ul>
									       	 </li>
									       	 <li class="divider"></li>
									       	~; 	
											
		 
											
		$events_menu_top                   = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
		$home_menu_top                     = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-home"></i></a></li>~;
		# $search_menu_top                   = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-search"></i> Search</a></li>~;
		$quotes_menu_top                   = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-th-large"></i> Quotes</a></li>~ unless $usertype eq 'manager' ;
		# $documents_menu_top              = qq~<li><a href="$useropts{'folder'}/search-documents"><i class="glyphicon glyphicon-list-alt"></i> Documents</a></li>~;
		# $calendar_menu_top               = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
									       
		$manage_camera_systems_menu        = qq~<li><a href="$useropts{'folder'}/list-camera-systems">Camera Systems</a></li>~;
		$manage_users_menu                 = qq~<li><a href="$useropts{'folder'}/list-users">All Users</a></li>~;
		$manage_operators_menu             = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
		$manage_school_managers_menu       = qq~<li><a href="$useropts{'folder'}/list-school-managers">School Managers</a></li>~;
		
		$manage_installation_partners_menu 	= qq~<li><a href="$useropts{'folder'}/list-installation-partners">Installation Partners</a></li>~;
		$manage_analytics_client_menu 		= ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-analytics-clients">Analytics Clients</a></li>~ : qq~~ ;
		$manage_coding_providers_menu 		= ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-coding-providers">Coding Providers</a></li>~   : qq~~ ;
		
		# $manage_logistics_shipment_costs_report = qq~<li><a href="$useropts{'folder'}/list-logistics-shipment-costs">Logistics Shipment Costs</a></li>~ ; 
		
		$manage_customers_menu             = qq~<li><a href="$useropts{'folder'}/list-customers">Customers</a></li>~;
		$manage_archive_menu               = qq~<li class="divider"></li><li><a href="/archive">Archive</a></li><li class="divider"></li>~;
		$manage_event_systems              = qq~<li><a href="$useropts{'folder'}/list-event-systems">Event Systems</a></li>
									       	 <li><a href="$useropts{'folder'}/list-event-types">Event Types</a></li>
									       	 <li><a href="$useropts{'folder'}/list-event-cost-items">Event Cost Items</a></li>
											 $manage_logistics_shipment_costs_report
									       	 <li class="divider"></li>~;
		
		# $manage_logistics_report				= qq~<li><a href="$useropts{'folder'}/logistics-report">Logistics Report</a></li>~ ;
		$manage_event_invoicing 				= qq~<li><a href="$useropts{'folder'}/event-invoicing-report">Event Invoicing</a></li>~ ;
		$manage_operator_payments	       		= qq~<li><a href="$useropts{'folder'}/operator-payments">Operator Payments</a></li>~ ; 		
		$manage_monitor_payments	       		= qq~<li><a href="$useropts{'folder'}/monitor-payments-report">Monitor Payments</a></li>~ ; 		
		$manage_troubleshoot_monitor_payments	= qq~<li><a href="$useropts{'folder'}/troubleshoot-monitor-payments-report">Troubleshoot Monitor Payments</a></li>~ ; 		
		$manage_temp_calibrator_payments		= qq~<li><a href="$useropts{'folder'}/temp-calibrator-payments-report">Temp Calibrator Payments</a></li>~ ; 
				
		$manage_logistics_payments_report	= qq~<li><a href="$useropts{'folder'}/logistics-payments">Logistics Payments</a></li>~ ; 
		
				
		$manage_regions 				   = qq~<li><a href="$useropts{'folder'}/list-regions">Regions</a></li>~ ;							       
		$manage_teams						= qq~<li><a href="$useropts{'folder'}/list-teams">Teams</a></li>~ if $glod_user_level >= 5 ;							       
		$manage_cities 		               = qq~<li><a href="$useropts{'folder'}/list-cities">Cities</a></li>~ ;
	    $manage_organisations			   = qq~<li><a href="$useropts{'folder'}/list-venue">Venue</a></li>~ ;
		$manage_sport_types                = qq~<li><a href="$useropts{'folder'}/list-sport-types">Sport Types</a></li> ~;
		$manage_logistics_suppliers		   = qq~<li><a href="$useropts{'folder'}/list-logistics-suppliers">Logistics Suppliers</a></li>~ ;
		$manage_logistics_items            = qq~<li><a href="$useropts{'folder'}/list-logistics-items">Logistics Items</a></li> ~;
		$manage_logistics_locations        = qq~<li><a href="$useropts{'folder'}/list-logistics-locations">Logistics Locations</a></li>~ ;
	
		  
		# $manage_fixedsystem               	= qq~<li><a href="$useropts{'folder'}/fixed-systems-report">Fixed System</a></li><li class="divider"></li>~ ;  
		  
		$quote_search_menu_top             = qq~<li>
									       	<form class="navbar-search pull-left"  method="post" action="/search-event-quotes">
									       		<input placeholder="Event Nr Search" class="search-query form-control col-md-10" name="quote_nr" type="text">
									       		<input name="iaction" type="hidden" value="report">
									       	</form>
									       </li>~;
										   
		# $reports_monitor_report				= qq~<li><a href="$useropts{'folder'}/monitor-report">Monitor Report</a></li>~ ; 
		# $reports_temp_calibration			= qq~<li><a href="$useropts{'folder'}/temp-calibration-report">Temp Calibration Report</a></li>~ ; 
	
		# $accounts_menu_top 					 = qq~<li class="dropdown">
												# <a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-bank"></span>Accounts <span class="caret"></span></a>
												# <ul class="dropdown-menu" role="menu">
													# $manage_event_invoicing
													# $manage_operator_payments
													# $manage_monitor_payments
													# $manage_temp_calibrator_payments
													# $manage_logistics_payments_report
													# $manage_logistics_shipment_costs_report
												# </ul>
											# </li>~;
			$accounts_menu_top				= qq~
													<li class="dropdown-submenu">
														<a tabindex="-1" href="#">Accounts</a>
														<ul class="dropdown-menu" role="menu">
															$manage_event_invoicing
															$manage_operator_payments
															$manage_monitor_payments
															$manage_troubleshoot_monitor_payments
															$manage_temp_calibrator_payments
															$manage_logistics_payments_report
														</ul>
												</li>
												<li class="divider"></li>
											~;
	
	}
	
	if ($events_limit{$username}) {
		$events_reports                    = qq~<li class="divider"></li>
											 <li class="dropdown-submenu">
												 <a tabindex="-1" href="#">Events Reports</a>
												 <ul class="dropdown-menu">
													 <li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
													 <li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
													 <li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
													 <li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
													 <li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
													 <li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
												 </ul>
											 </li>
											 <li class="divider"></li>
											~; 			
	}

	
	if ($pixellot_limit{$username} || $usertype eq 'external') {
		$events_filter                    	= '' ;
		$reports_event_quotes             	= '' ;
		$calendar_menu_top                	= '' ;
		$reports_management_report        	= '' ;
		$logistics_costs_report				= '' ;
		$events_menu_top                   	= '' if $glod_user_level < 2 ;
	}                                                                       
									       
	if ($events_limit{$username}) {        
		$cameras_menu_top                  = '' ; 
		$manage_operators_menu             = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
	}                                      
									       
	if ($glod_user_level < 5) {            
		$quotes_menu_top                   = '' ;
	}
	
	$reports_menu_top                      = qq~<li class="dropdown">
												<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-charts"></span>Reports <span class="caret"></span></a>
												<ul class="dropdown-menu" role="menu">
													$report_audit_trial
													$reports_active_camera
													$reports_stock_report
													$reports_delivered_report
													$reports_warranty_report
													$reports_match_credits
													$reports_event_quotes
													$reports_management_report
													$logistics_costs_report
													$events_reports 
													$accounts_menu_top 
													$analytics_reports
												</ul>
											</li>~;
	
	$schedule_menu_top 					 = qq~<li class="dropdown">
												<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-list-numbered"></span>Allocations <span class="caret"></span></a>
												<ul class="dropdown-menu" role="menu">
													$reports_monitor_report 
													$reports_temp_calibration
													$reports_troubleshoot_monitor_report
													$reports_site_surveys
													$reports_set_up_groups
													$mobile_tracking_system
												</ul>
											</li>~;
											# 
	
	# $calibration_menu_top               = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
		
	
	my $pre_sales_and_sales_menu_top	= ($glod_user_level >= 5 || $usertype eq 'support') ? qq~
											<li class="dropdown">
												<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-money"></span>Pre-Sales & Sales <span class="caret"></span></a>
												<ul class="dropdown-menu" role="menu">
													<li><a href="$useropts{'folder'}/filter-demos">Demos</a></li>		
												</ul>
											</li>
										~ : qq~~ ;
	
	# $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
	
	# # if ($useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} || $useropts{tickets}{$username}) {
		# my $msgtxt  = ($activetickets > 1) ? 'messages' : 'message' ;
		# my $notif   = ($activetickets > 0) ? qq~<span class="notification red" style="font-size:11px;">$activetickets</span>~ : '' ;
		# my $tooltip = ($activetickets > 0) ? qq~data-toggle="tooltip" data-title="$activetickets new $msgtxt" data-placement="left"~ : '' ;
		# my $top     = ($activetickets > 0) ? '10px' : '6px' ;
		# $tickets_menu_top  = qq~<div class="fleft top-block" style="margin:$top 15px 0 0;padding-bottom:2px;" $tooltip>
			# <a href="/active-tickets">
				# <i class="glyphicon glyphicon-envelope" style="font-size:18px;"></i>
				# $notif
			# </a>
		# </div>~ ;
	# # }
	
	if ($useropts{tickets}{$username} || $usertype eq 'nonquotes') {
		$search_menu_top                   = '' ;
        $quotes_menu_top                   = '' ;
        $manage_price_list_menu            = '' ;
        $manage_price_list_menu_top        = '' ;
	}
	
	# if ($usertype eq 'schools_manager') {
	if ($glod_user_level < 3) {
		$home_menu_top                     = '' ; 
		$search_menu_top                   = '' ; 
		$quotes_menu_top                   = '' ; 
		$cameras_menu_top                  = '' ; 
		$documents_menu_top                = '' ; 
		# $calendar_menu_top               = '' ; 
		$reports_menu_top                  = '' ;
		$schedule_menu_top			       = '' if $glod_user_level < 2 ;
		$manage_price_list_menu_top        = '' ; 
		# $manage_logistics_report_menu_top  = '' ; 
		$quote_search_menu_top             = '' ; 
		# unless ($usertype eq 'support') {
		if (($usertype eq 'schools_manager' || $glod_user_level < 2) && !$is_temp_calibrator) {
			$calibration_menu_top          = '' ;
			# $fixedsystem_menu_top        = '' ;
		}			
		$events_menu_top                   = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
	}
	
	if ($is_operator) {
		$events_menu_top                   = '' if $glod_user_level < 2 ;
		$reports_event_quotes              = '' ;
		$cameras_menu_top                  = '' ;
		$reports_menu_top                  = '' ;
		# $schedule_menu_top				= '' ;
		$reports_management_report         = '' ;
		$logistics_costs_report         	= '' ;
		# $calibration_menu_top            = '' ; 
		
		if ($glod_user_level == 3) {
			$manage_operators_menu         = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
			$events_menu_top               = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;																																	
		}                                 
	}                                     

	if ($is_installation_partner) {       
		$calendar_menu_top                 = '' ;
		$events_menu_top                   = '' ;
	}                                     

	if ($is_temp_calibrator) {            
		$fixedsystem_menu_top              = '' ;
	}

	if ($is_dcb_partner) {            
		$events_menu_top                   = '' ;
		$calendar_menu_top                 = '' ;
		$fixedsystem_menu_top              = '' ;
	}
	
	my $section_1 = ($manage_camera_systems_menu || $manage_customers_menu || $manage_quote_defaults_menu || $manage_price_list_menu || $rma_list_menu || $manage_leave_menu) ? qq~
			$manage_camera_systems_menu
			$manage_customers_menu
			$manage_quote_defaults_menu
			$manage_price_list_menu
			$rma_list_menu
			$manage_leave_menu
			<li class="divider"></li>
	~ : qq~~ ;
	
	my $users_section = ($manage_users_menu || $manage_analytics_client_menu || $manage_coding_providers_menu || $manage_installation_partners_menu || $manage_operators_menu || $manage_school_managers_menu) ? qq~
	
		<li class="dropdown-submenu open-left">
			<a tabindex="-1" href="#">Users</a>
			<ul class="dropdown-menu">
				$manage_users_menu
				$manage_analytics_client_menu
				$manage_coding_providers_menu 
				$manage_installation_partners_menu
				$manage_operators_menu
				$manage_school_managers_menu
			</ul>
		</li>
		<li class="divider"></li>	
	
	~ : qq~~  ;
	
	my $credits_section = ($glod_user_level >= 5) ? qq~
	
		<li class="dropdown-submenu open-left">
			<a tabindex="-1" href="#">Credits</a>
			<ul class="dropdown-menu">
				<li><a href="$useropts{'folder'}/list-allocate-credits">Allocate Credits</a></li>		
				<li><a href="$useropts{'folder'}/list-credits-bought">Credits Bought</a></li>		
				<li><a href="$useropts{'folder'}/list-live-reacon">Live Reacon</a></li>		
			</ul>
		</li>
		<li class="divider"></li>	
	
	~ : qq~~  ;
	
	my $section4 = ($manage_regions || $manage_cities || $manage_organisations || $manage_teams || $manage_sport_types) ? qq~
		$manage_regions 
		$manage_cities
		$manage_organisations 
		$manage_teams
		$manage_sport_types
		<li class="divider"></li>
	~ : qq~~ ;
	
	my $event_specifics = ($username eq 'handre' || $username eq 'rory' || $username eq 'vivian' || $usertype eq 'schools_manager' || $usertype eq 'manager' || $usertype eq 'senior_manager') ? qq~
		<li class="dropdown-submenu open-left">
			<a tabindex="-1" href="#">Event Specifics</a>
			<ul class="dropdown-menu">
				<li><a href="$useropts{'folder'}/list-pocs">POCs</a></li>		
				<li><a href="$useropts{'folder'}/list-recipients">Recipients</a></li>		
			</ul>
		</li>
		<li class="divider"></li>~ : qq~~ ;
		
	my $logistics_sub_menu = ($manage_logistics_suppliers || $manage_logistics_items || $manage_logistics_locations) ? qq~
	
		<li class="dropdown-submenu open-left">
			<a tabindex="-1" href="#">Logistics</a>
			<ul class="dropdown-menu">
				$manage_logistics_suppliers
				$manage_logistics_items
				$manage_logistics_locations
			</ul>
		</li>
		<li class="divider"></li> 	
	
	~ : qq~~ ;

	my $calibration_status_report = ($calibration_menu_top || $usertype eq 'support') ? qq~<li><a href="$useropts{'folder'}/calibration-status-report">Calibration Status Report</a></li>~ : qq~~ ;

	$calibration_menu_top = qq~
						<li class="dropdown">
							<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
							<ul class="dropdown-menu" role="menu">
								<li><a href="$useropts{'folder'}/calibration-report">Calibration Report</a></li>
								$calibration_status_report
							</ul>
						</li>~ if $calibration_menu_top ;
						
	$calibration_menu_top = qq~
						<li class="dropdown">
							<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
							<ul class="dropdown-menu" role="menu">
								$calibration_status_report
							</ul>
						</li>~ if $calibration_status_report && !$calibration_menu_top ;
 
print <<ENDOFTEXT;
<!DOCTYPE html>
<html lang="en">
<head>    
    <meta charset="utf-8">
    <title>$useropts{title}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <!-- The styles -->
    <link href="$useropts{'css'}/bootstrap-itv.min.css?1.0" rel="stylesheet">
    <link href="$useropts{'css'}/custom-itv.css" rel="stylesheet">
    $extra_css
    <link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
    <link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.css" rel='stylesheet'>
    <link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.print.css" rel='stylesheet' media='print'>
    <link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
    <link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
    <link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
    <link href="$useropts{'bower_components'}/bootstrap-tour/build/css/bootstrap-tour.min.css" rel='stylesheet'>
    <link href="$useropts{'css'}/jquery.noty.css" rel='stylesheet'>
    <link href="$useropts{'css'}/noty_theme_default.css" rel='stylesheet'>
    <link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
    <link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
    <link href="$useropts{'css'}/jquery.iphone.toggle.css" rel='stylesheet'>
    <link href="$useropts{'css'}/uploadify.css" rel='stylesheet'>
    <link href="$useropts{'css'}/animate.min.css" rel='stylesheet'>
    <link href="$useropts{'css'}/bootstrap-dialog.css" rel='stylesheet'>
	<link href="$useropts{'css'}/bootstrap-datetimepicker.min.css" rel='stylesheet'>
    <link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
    $typeahead_css

    <!-- jQuery -->
    <script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>    
    
    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- The fav icon -->
    <link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
    
    <style>
        $useropts{'common'}{'css'}
    </style>
    
    <script>
        $fullcalendar_events
    </script>


</head>

<body $onload>
    <!-- topbar starts -->
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">

        <div class="navbar-inner">
            <button type="button" class="navbar-toggle pull-left animated flip">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
             <a class="navbar-brand" href="/"> <img class="logfav" alt="ITV Logo" src="$useropts{'img'}/50_ITV.png" class="hidden-xs"/> 
				<!-- <span><img class="logotext" alt="ITV Admin Text" src="$useropts{'img'}/headerFinal.png" class="hidden-xs"/></span></a> -->
			</a>
            <!-- user dropdown starts -->
            <div class="btn-group pull-right">
                $tickets_menu_top
				<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                    <i class="glyphicon glyphicon-user"></i><span class="hidden-sm hidden-xs"> admin</span>
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    $section_1
					$users_section
					$credits_section
                    $manage_event_systems
					$section4
					$logistics_sub_menu
					$event_specifics
					<li><a href="/logout">Logout</a></li>
                </ul>
            </div>
            <!-- user dropdown ends -->

            <ul class="collapse navbar-collapse nav navbar-nav top-menu">
                $home_menu_top
                $search_menu_top
                $quotes_menu_top
				$events_menu_top  
				$analytics_menu_top
				$cameras_menu_top
                $documents_menu_top
                $calendar_menu_top
                $reports_menu_top
				$calibration_menu_top
				$fixedsystem_menu_top 
				$manage_logistics_report_menu_top 
				$schedule_menu_top	 
				$pre_sales_and_sales_menu_top
                $quote_search_menu_top
            </ul>

        </div>
    </div>
    <div style="height:69px;"></div>
    <!-- topbar ends -->
<div class="ch-container">
    <div class="row">
    
        <!-- left menu starts -->
        <div class="col-sm-2 col-lg-2" id="leftsidebar">
            <div class="sidebar-nav">
                <div class="nav-canvas">
                    <div class="nav-sm nav nav-stacked">
                    </div>
                    <ul class="nav nav-pills nav-stacked main-menu">
                        <li class="nav-header"></li>                        
                    </ul>                   
                </div>
            </div>
        </div>
        <!--/span-->
        <!-- left menu ends -->
        
        <noscript>
            <div class="alert alert-block col-md-12">
                <h4 class="alert-heading">Warning!</h4>

                <p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
                    enabled to use this site.</p>
            </div>
        </noscript>

ENDOFTEXT
#