<?xml version="1.0" encoding="utf-8"?>
<Gauge Name="Nav Display" Version="1.0" Copryright="Yosuke Ube @ Project Open Sky">
  <Image Name="posky777_nd_back.bmp" Bright="Yes" />
  <!-- local vars
		activateLeg				- 1=display activate leg popup, 0=hide activate leg popup
		blinkingField			- 1-based index of field that is blinking, 0 if no blinking
		blinkingFieldEnabled1	- bool to indicate whether field is available for cursor scrolling/blinking
		blinkingFieldEnabled2	- "
		blinkingFieldEnabled3	- "
		blinkingFieldSaved		- saved when going from one blinking screen to another to blink correct field on close
		currentGroup			- 0=nav, 1=wpt, 2=nrst, 3=fpl, 4=proc
		currentPageNAV		- current sub-page for page group 0
		currentPageWPT		- "                               1
		currentPageNRST		- "                               2
		currentPageFPL		- "                               3
		menuBlinker
		messagePopup			- 1=display message popup, 0=hide message popup
		modeCDI
		navPage0DetailLevel		- level of detail for nav page 0 (0=most, 3=least)
		navPage1DetailLevel		- level of detail for nav page 1 (0=most, 3=least)
		numberOfBlinkingFields	- number of blinkingFields; set to non-zero to prepare for PushCRSRButton handling
		popupMenu				- popup menu parameter
		popupMenuCurrent		- popup menu parameter
		popupMenuHeaderHeight	- popup menu parameter
		popupMenuHeight			- popup menu parameter
		popupMenuLineHeight		- popup menu parameter
		popupMenuMaxElements	- popup menu parameter
		popupMenuWidth			- popup menu parameter
		popupMenuX				- popup menu parameter
		popupMenuY				- popup menu parameter
		scaleCDI
		smallmap_ZoomStepDone
	-->
  <!-- Constants -->
  <Macro Name="FPLLineSpacing">26</Macro>
  <Macro Name="c">C:fs9gps</Macro>
  <Macro Name="g">C:fs9gps</Macro>
  <Macro Name="kFalse">0</Macro>
  <Macro Name="kTrue">1</Macro>
  <Macro Name="kOff">0</Macro>
  <Macro Name="kOn">1</Macro>
  <Macro Name="kDisabled">0</Macro>
  <Macro Name="kEnabled">1</Macro>
  <!-- main page group constants -->
  <Macro Name="kNAVPageGroup">0</Macro>
  <Macro Name="kWPTPageGroup">1</Macro>
  <Macro Name="kNRSTPageGroup">2</Macro>
  <!-- standalone page group constants -->
  <Macro Name="kFPLPageGroup">3</Macro>
  <Macro Name="kPROCPageGroup">4</Macro>
  <!-- NAV page constants -->
  <Macro Name="kNAVPageCnt">2</Macro>
  <Macro Name="kNAVPageDflt">0</Macro>
  <Macro Name="kNAVPageMap">1</Macro>
  <!-- WPT page constants -->
  <Macro Name="kWPTPageCnt">7</Macro>
  <Macro Name="kWPTPageAptLoc">0</Macro>
  <Macro Name="kWPTPageAptRun">1</Macro>
  <Macro Name="kWPTPageAptFreq">2</Macro>
  <Macro Name="kWPTPageAptApproach">3</Macro>
  <Macro Name="kWPTPageInt">4</Macro>
  <Macro Name="kWPTPageNdb">5</Macro>
  <Macro Name="kWPTPageVor">6</Macro>
  <!-- NRST page constants -->
  <Macro Name="kNRSTPageCnt">5</Macro>
  <Macro Name="kNRSTPageApt">0</Macro>
  <Macro Name="kNRSTPageInt">1</Macro>
  <Macro Name="kNRSTPageNDB">2</Macro>
  <Macro Name="kNRSTPageVOR">3</Macro>
  <Macro Name="kNRSTPageASP">4</Macro>
  <!-- popup constants -->
  <Macro Name="kPopupMenuSelectApproach">2</Macro>
  <Macro Name="kPopupMenuSelectTransition">3</Macro>
  <!-- B, C, D, MOA, RESTRICTED, PROHIBITED, WARNING, ALERT, DANGER, MODE_C, RADAR, TRAINING -->
  <Macro Name="kDisplayedAirspaces">0xEFC038</Macro>
  <!-- MOA, RESTRICTED, PROHIBITED, WARNING, ALERT, DANGER -->
  <Macro Name="kAlwaysDisplayedAirspaces">0x0FC000</Macro>
  <!-- General purpose macros -->
  <Macro Name="AirportIcon">%((@1))%{case}%{:1}%((@2,degrees) 45 / near 4 %)%{case}%{:0}1%{:1}2%{:2}3%{:3}4%{end}%{:2}5%{:3}6%{:4}7%{:5}8%{end}</Macro>
  <Macro Name="FormatLatitudeTabbed">%((@1,degrees) d 0 &gt;=)%{if}N%{else}S%{end}\t%(abs 6000 * near 6000 / d flr - b)%!02d!\t°%(60 *)%!05.2f!'</Macro>
  <Macro Name="FormatLongitudeTabbed">%((@1,degrees) d 0 &gt;=)%{if}E%{else}W%{end}\t%(abs 6000 * near 6000 / d flr - b)%!03d!\t°%(60 *)%!05.2f!'</Macro>
  <Macro Name="BlinkerCode">(@g:menuBlinker) d 0 &gt; if{ -- (&gt;@g:menuBlinker) 15 sp0 1 } els{ l0 -- s0 d 0 &lt;= if{ 30 sp0 } 15 &gt; }</Macro>
  <Macro Name="RestoreBlinkingField">(@g:blinkingFieldSaved) (&gt;@g:blinkingField) 0 (&gt;@g:blinkingFieldSaved)</Macro>
  <Macro Name="InitBlinker">70 (&gt;@g:menuBlinker)</Macro>
  <Macro Name="NumberOfPagesInCurrentGroup">1 1 @kNRSTPageCnt @kWPTPageCnt @kNAVPageCnt 5 (@g:currentGroup) case</Macro>
  <Macro Name="InvokePopupMenu">
		@1 (&gt;@g:popupMenu) @2 (&gt;@g:popupMenuX) @3 (&gt;@g:popupMenuY) @4 (&gt;@g:popupMenuWidth) @5 (&gt;@g:popupMenuHeight) 
		@6 (&gt;@g:popupMenuHeaderHeight) @7 (&gt;@g:popupMenuLineHeight) @8 (&gt;@g:popupMenuMaxElements) 
		0 (&gt;@g:popupMenuCurrent) (@g:blinkingField) (&gt;@g:blinkingFieldSaved) 0 (&gt;@g:blinkingField) @InitBlinker
	</Macro>
  <Macro Name="InvokePopupSelectApproach">@InvokePopupMenu(@kPopupMenuSelectApproach, 144, 36, 90, 171, 19, 1, (@c:WaypointAirportApproachesNumber)) (@g:currentAirportApproach) (&gt;@g:popupMenuCurrent)</Macro>
  <Macro Name="InvokePopupSelectTransition">@InvokePopupMenu(@kPopupMenuSelectTransition, 144, 36, 90, 171, 19, 1, (@g:currentAirportApproach) (&gt;@c:WaypointAirportCurrentApproach) (@c:WaypointAirportApproachTransitionsNumber)) (@g:currentAirportTransition) (&gt;@g:popupMenuCurrent)</Macro>
  <Macro Name="CancelPopupMenu">0 (&gt;@g:popupMenu) (@g:blinkingFieldSaved) (&gt;@g:blinkingField) 0 (&gt;@g:blinkingFieldSaved) @InitBlinker</Macro>
  <Macro Name="CalculateZoomFactor">2000 1500 1000 500 350 200 150 100 50 35 20 15 10 5 3.5 2.0 1.5 1.0 0.576037 0.329164 0.246873 0.164582 0.082290 0 24 @1 case</Macro>
  <Macro Name="FitToZoom">@1 0.55 * sp1 1 sp0 :1 @CalculateZoomFactor(l0) 1852 * l1 &lt; if{ l0 ++ sp0 g1 } l0</Macro>
  <Macro Name="RecalcSmallZoom">0 (&gt;@g:smallmap_ZoomStepDone)</Macro>
  <Macro Name="SetPageGroup">@1 (&gt;@g:currentGroup)</Macro>
  <!-- Page macros -->
  <Macro Name="ProcedureScrollTop">
		(@g:currentGroup) @kPROCPageGroup == if{
			(@g:blinkingField) 1 == (@g:blinkingFieldEnabled1) 0 == and if{ 2 (&gt;@g:blinkingField) }
			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 3 (&gt;@g:blinkingField) }
		}
	</Macro>
  <Macro Name="ProcedureScrollUp">
		(@g:currentGroup) @kPROCPageGroup == if{
			(@g:blinkingField) 3 == (@g:blinkingFieldEnabled3) 0 == and if{ 2 (&gt;@g:blinkingField) }
			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 1 (&gt;@g:blinkingField) }
			(@g:blinkingField) 1 == (@g:blinkingFieldEnabled1) 0 == and if{ 2 (&gt;@g:blinkingField) }
			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 3 (&gt;@g:blinkingField) }
		}
	</Macro>
  <Macro Name="ProcedureScrollDown">
		(@g:currentGroup) @kPROCPageGroup == if{
			(@g:blinkingField) 1 == (@g:blinkingFieldEnabled1) 0 == and if{ 2 (&gt;@g:blinkingField) }
			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 3 (&gt;@g:blinkingField) }
			(@g:blinkingField) 3 == (@g:blinkingFieldEnabled3) 0 == and if{ 2 (&gt;@g:blinkingField) }
			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 1 (&gt;@g:blinkingField) }
		}
	</Macro>
  <Macro Name="ProcedurePageInit">
		3 (&gt;@g:numberOfBlinkingFields)
		<!-- enable appropriate fields -->
		0 (&gt;@g:blinkingFieldEnabled1)
		(@c:FlightPlanIsLoadedApproach) d (&gt;@g:blinkingFieldEnabled1) (&gt;@g:blinkingFieldEnabled2)
		1 (&gt;@g:blinkingFieldEnabled3)
		(@c:FlightPlanIsLoadedApproach) if{ (@c:FlightPlanApproachTransitionIndex) 0 != if{ 2 } els{ 1 } } els{ 3 } (&gt;@g:blinkingField)
		@InitBlinker
		@ProcedureScrollTop
	</Macro>
  <Macro Name="WaypointPagesInit">
		(@g:currentPageWPT) 0 == (@g:currentPageWPT) 1 == (@g:currentPageWPT) 2 == (@g:currentPageWPT) 3 == || || || if{
			(C:fs9gps:WaypointAirportIdent) slen 0 == if{ 0 (&gt;@c:NearestAirportCurrentLine) (@c:NearestAirportCurrentICAO) (&gt;@c:WaypointAirportICAO) }
		}
		(@g:currentPageWPT) 4 == if{
			(@c:WaypointIntersectionIdent) slen 0 == if{ 0 (&gt;@c:NearestIntersectionCurrentLine) (@c:NearestIntersectionCurrentICAO) (&gt;@c:WaypointIntersectionICAO) }
		}
		(@g:currentPageWPT) 5 == if{
			(@c:WaypointNdbIdent) slen 0 == if{ 0 (&gt;@c:NearestNdbCurrentLine) (@c:NearestNdbCurrentICAO) (&gt;@c:WaypointNdbICAO) }
		}
		(@g:currentPageWPT) 6 == if{
			(@c:WaypointVorIdent) slen 0 == if{ 0 (&gt;@c:NearestVorCurrentLine) (@c:NearestVorCurrentICAO) (&gt;@c:WaypointVorICAO) }
		}
		(@g:currentPageWPT) 3 == if{
			@kOff (&gt;@g:selectApproach)
		}
	</Macro>
  <Macro Name="PageInit">
		(C:fs9gps:currentGroup) 4 == (C:fs9gps:group4currentPage) 0 == &amp;&amp; if{ @ProcedurePageInit }
		(C:fs9gps:currentGroup) 1 == if{ @WaypointPagesInit }
		@RecalcSmallZoom
	</Macro>
  <!-- clear button macros -->
  <Macro Name="CancelInput">
		@InitBlinker 
		(@g:enteringInput) 0 != if{
			(@g:enteringInput) 100 &lt; if{ 
				(@g:enteringInput) 10 == if{ (@c:IcaoSearchInitialIcao) (&gt;@c:WaypointAirportICAO) } 
				(@g:enteringInput) 11 == if{ (@c:IcaoSearchInitialIcao) (&gt;@c:WaypointIntersectionICAO) } 
				(@g:enteringInput) 12 == if{ (@c:IcaoSearchInitialIcao) (&gt;@c:WaypointNdbICAO) } 
				(@g:enteringInput) 13 == if{ (@c:IcaoSearchInitialIcao) (&gt;@c:WaypointVorICAO) } 
				(@g:enteringInput) 31 == if{ (@c:IcaoSearchInitialIcao) (&gt;@c:FacilityICAO) } 
				0 (&gt;@c:IcaoSearchStopCursor) 
			}
			els{
				(@g:enteringInput) 110 == if{ (@c:NameSearchInitialIcao) (&gt;@c:WaypointAirportICAO) } 
				(@g:enteringInput) 131 == if{ (@c:NameSearchInitialIcao) (&gt;@c:FacilityICAO) } 
				0 (&gt;@c:NameSearchStopCursor) 
			}
			0 (&gt;@g:enteringInput)
		}
	</Macro>
  <Macro Name="EscapeMenu">
		@CancelInput
		0 (&gt;@g:blinkingField)
		0 (&gt;@g:popupMenu)
		0 (&gt;@g:listItems)
		0 (&gt;@g:directTo)
		0 (&gt;@g:activateLeg)
		0 (&gt;@g:noOptionMenu)
		@InitBlinker
	</Macro>
  <Macro Name="CLRButtonDelay">25</Macro>
  <Macro Name="CLRALLButton">
		@EscapeMenu
		0 (&gt;@g:messagePopup)
		0 (&gt;@g:setup_ColorTerrain)
		0 (&gt;@g:navPage0DetailLevel)
		0 (&gt;@g:navPage1DetailLevel)
		0 (&gt;@g:map_ZoomStep0)
		0 (&gt;@g:map_ZoomStep1)
		@RecalcSmallZoom
		@kNAVPageGroup (&gt;@g:currentGroup) 0 (&gt;@g:currentPageNAV) @PageInit
	</Macro>
  <Macro Name="MSGButtonDelay">25</Macro>
  <Macro Name="MSGToggle">(@g:messagesOff) ! (&gt;@g:messagesOff)</Macro>
  <Macro Name="FPLEnrouteHeader">(@c:FlightPlanIsActiveFlightPlan) (@c:FlightPlanIsLoadedApproach) and</Macro>
  <Macro Name="FPLLinesCount">
		0
		@FPLEnrouteHeader +
		(@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) + }
		(@c:FlightPlanIsLoadedApproach) if{ ++ (@c:FlightPlanApproachWaypointsNumber) + }
	</Macro>
  <Macro Name="FPLLineIndex">
		(@c:FlightPlanIsActiveApproach) if{
			(@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) } els{ 0 }
			++
			(@c:FlightPlanActiveApproachWaypoint) +
		} els{
			(@c:FlightPlanActiveWaypoint) 
		} 
		@FPLEnrouteHeader +
	</Macro>
  <Macro Name="FPLLegalLeg">
		@1
		@FPLEnrouteHeader - 
		sp0
		1 (@c:FlightPlanWaypointsNumber) 1 - l0 rng (@c:FlightPlanIsActiveFlightPlan) and
		(@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) } els{ 0 } ++ d
			(@c:FlightPlanApproachWaypointsNumber) + 1 - l0 rng (@c:FlightPlanIsLoadedApproach) and
				or
	</Macro>
  <Macro Name="FPLActivateLeg">
		@1
		@FPLEnrouteHeader -
		sp0
		1 (@c:FlightPlanWaypointsNumber) -- l0 rng (@c:FlightPlanIsActiveFlightPlan) and if{
			l0 (&gt;@c:FlightPlanActiveWaypoint)
		}
		els{
			l0 (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) } els{ 0 } ++ - sp0
			0 (@c:FlightPlanApproachWaypointsNumber) -- l0 rng (@c:FlightPlanIsLoadedApproach) and if{
				l0 (&gt;@c:FlightPlanActiveApproachWaypoint)
			}
		}		
	</Macro>
  <Macro Name="FPLLegName">
		@1
		@FPLEnrouteHeader -
		sp0
		1 (@c:FlightPlanWaypointsNumber) -- l0 rng (@c:FlightPlanIsActiveFlightPlan) and if{
			l0 (&gt;@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent)
		}
		els{
			l0 (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) } els{ 0 } ++ - sp0
			0 (@c:FlightPlanApproachWaypointsNumber) -- l0 rng (@c:FlightPlanIsLoadedApproach) and if{
				l0 (&gt;@c:FlightPlanWaypointApproachIndex) (@c:FlightPlanWaypointApproachName)
			}
		}		
	</Macro>
  <Macro Name="FPLPrevLegName">
		@1
		@FPLEnrouteHeader -
		sp0
		1 (@c:FlightPlanWaypointsNumber) -- l0 rng (@c:FlightPlanIsActiveFlightPlan) and if{
			l0 -- d 0 &gt;= if{ (&gt;@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent) } els{ p '' }
		}
		els{
			l0 (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) } els{ 0 } ++ - sp0
			0 (@c:FlightPlanApproachWaypointsNumber) -- l0 rng (@c:FlightPlanIsLoadedApproach) and if{
				l0 -- d 0 &gt;= if{ (&gt;@c:FlightPlanWaypointApproachIndex) (@c:FlightPlanWaypointApproachName) } els{ p '' }
			}
		}		
	</Macro>
  <Update Hidden="No">
    <!-- Calculate current mode: 0 no plan 1 en route 2 terminal mode 3 approach -->
		(A:GPS IS ACTIVE WAY POINT, bool) if{
			(A:GPS IS APPROACH ACTIVE, bool) if{
				3
			} els{
				(A:GPS FLIGHT PLAN WP COUNT, number) (A:GPS FLIGHT PLAN WP INDEX, number) ++ == (A:GPS WP DISTANCE, nmiles) s0 30 &lt; and if{ 
					l0 10 &lt; if{ 3 } els{ 2 } 
				} els{ 1 } 
			}
		} els{ 0 }
		(&gt;@g:modeCDI)
		<!-- calculate CDI range -->
		0.3 1 5 0.001 4 (@g:modeCDI) case (@g:scaleCDI) s0 0.1 &gt; if{ l0 - 0.002 min -0.002 max l0 + } (&gt;@g:scaleCDI)
		<!-- calculate default zoom factor for the small map -->
		(@g:directTo) @kOff == (@g:currentGroup) @kWPTPageGroup == (@g:currentPageWPT) 1 == and and (@g:smallmap_ZoomStepDone) 0 == and if{
			(@g:currentAirportRunway) (&gt;@c:WaypointAirportCurrentRunway)
			(@c:WaypointAirportRunwayLength, meters) 0 != if{
				@FitToZoom((@c:WaypointAirportRunwayLength, meters)) (&gt;@g:smallmap_ZoomStep) 
				1 (&gt;@g:smallmap_ZoomStepDone)
			}
		}
		(@g:directTo) @kOff == (@g:currentGroup) @kWPTPageGroup == (@g:currentPageWPT) 3 == and and if{
			(@g:currentAirportApproach) (@c:WaypointAirportApproachesNumber) -- min 0 max (&gt;@g:currentAirportApproach)
			(@g:currentAirportTransition) (@c:WaypointAirportApproachTransitionsNumber) -- min 0 max (&gt;@g:currentAirportTransition)
			(@g:smallmap_ZoomStepDone) 0 == if{
				(@g:currentAirportApproach) (&gt;@c:WaypointAirportCurrentApproach) (@g:currentAirportTransition) (&gt;@c:WaypointAirportApproachCurrentTransition)
				(@c:WaypointAirportApproachTransitionSize, meters) 0 != if{
					@FitToZoom((@c:WaypointAirportApproachTransitionSize, meters)) (&gt;@g:smallmap_ZoomStep) 
					1 (&gt;@g:smallmap_ZoomStepDone)
				}
			}
		}
		<!-- calculate zoom factor range -->
		(@g:map_ZoomStep0) 0 == if{ 13 (&gt;@g:map_ZoomStep0) } 
		(@g:map_ZoomStep1) 0 == if{ 15 (&gt;@g:map_ZoomStep1) } 
		(@g:currentPageNAV) @kNAVPageDflt == if{ (@g:map_ZoomStep0) } els{ (@g:map_ZoomStep1) } (&gt;@g:map_ZoomStep)
		@CalculateZoomFactor((@g:map_ZoomStep)) (&gt;@g:map_ZoomFactor)
		(@g:smallmap_ZoomStep) 0 == if{ 10 (&gt;@g:smallmap_ZoomStep) } @CalculateZoomFactor((@g:smallmap_ZoomStep)) (&gt;@g:smallmap_ZoomFactor)
		<!-- make sure current element exist -->
		0 sp1
		(@g:directTo) 0 == if{ 
			(@g:currentPageWPT) 2 == (@g:currentGroup) @kWPTPageGroup  == and if{ (@c:WaypointAirportFrequenciesNumber) sp1 17 sp2 180 sp3 }
			(@g:currentPageNRST) 0 == (@g:currentGroup) @kNRSTPageGroup  == and if{ (@c:NearestAirportItemsNumber) sp1 38 sp2 177 sp3 }
			(@g:currentPageNRST) 1 == (@g:currentGroup) @kNRSTPageGroup  == and if{ (@c:NearestIntersectionItemsNumber) sp1 17 sp2 177 sp3 }
			(@g:currentPageNRST) 2 == (@g:currentGroup) @kNRSTPageGroup  == and if{ (@c:NearestNdbItemsNumber) sp1 17 sp2 177 sp3 }
			(@g:currentPageNRST) 3 == (@g:currentGroup) @kNRSTPageGroup  == and if{ (@c:NearestVorItemsNumber) sp1 17 sp2 177 sp3 }
			(@g:currentPageNRST) 4 == (@g:currentGroup) @kNRSTPageGroup  == and if{ (@c:NearestAirspaceItemsNumber) sp1 38 sp2 177 sp3 }
			(@g:currentPageFPL) 0 == (@g:currentGroup) @kFPLPageGroup  == and if{ @FPLLinesCount sp1 17 sp2 159 sp3 }
		}
		l1 (&gt;@g:listMaxElements)
		(@g:listCurrent) (@g:listMaxElements) -- min d 0 max (&gt;@g:listCurrent) 0 &lt; if{ 0 (&gt;@g:listItems) }
		<!-- scroll list if neccesary -->
		(@g:listItems) 0 != if{
			l1 l2 * l3 &gt;= <!-- if text is bigger than the area -->
			if{
				:10 (@g:listCurrent) ++ l2 * (@g:listScroll) - 5 + l3 &gt;= if{ (@g:listScroll) l2 + (&gt;@g:listScroll) g10 } <!--scroll down up current is on screen -->
				:11 (@g:listScroll) 0 &gt; (@g:listCurrent) l2 * (@g:listScroll) - 5 - 0 &lt;= and if{ (@g:listScroll) l2 - 0 max (&gt;@g:listScroll) g11 } <!--scroll down until current is on screen -->
			} els{
				0 (&gt;@g:listScroll)
			}
		}
		<!-- calculate list scrollbar -->
		0 (&gt;@g:listScrollbarVisible)
		(@g:listMaxElements) 0 &gt;
		if{
			l1 l2 * l3 &gt;= if{ 
				1 (&gt;@g:listScrollbarVisible)
				l3 8 - d d (&gt;@g:listScrollbarSize)
				l3 l1 l2 * / * (&gt;@g:listScrollbarLength)
				(@g:listScroll) l1 l2 * / * (&gt;@g:listScrollbarOffset) 
			} els{ 
				0 (&gt;@g:listScroll)
			}
		} 
		<!-- scroll menu if neccesary -->
		(@g:popupMenu) 0 != if{
			(@g:popupMenu) @kPopupMenuSelectApproach == if{
				(@c:WaypointAirportApproachesNumber) (&gt;@g:popupMenuMaxElements)
				
				
			}
			(@g:popupMenu) @kPopupMenuSelectTransition == if{
				(@c:WaypointAirportApproachTransitionsNumber) (&gt;@g:popupMenuMaxElements)
				
			}
			(@g:popupMenuCurrent) 0 &lt; if{ 0 (&gt;@g:popupMenuCurrent) }
			(@g:popupMenuCurrent) (@g:popupMenuMaxElements) -- min (&gt;@g:popupMenuCurrent)
			(@g:popupMenuHeaderHeight) (@g:popupMenuMaxElements) (@g:popupMenuLineHeight) 17 * * + (@g:popupMenuHeight) &gt;= 
			if{
				:1 (@g:popupMenuHeaderHeight) (@g:popupMenuCurrent) ++ (@g:popupMenuLineHeight) 17 * * + (@g:popupMenuScroll) - (@g:popupMenuHeight) &gt;= if{ 
					(@g:popupMenuScroll) 17 (@g:popupMenuLineHeight) * + (&gt;@g:popupMenuScroll) g1 }
				:2 (@g:popupMenuScroll) 0 &gt; if{ (@g:popupMenuCurrent) (@g:popupMenuLineHeight) 17 * * (@g:popupMenuScroll) - 0 &lt;= if{ 
					(@g:popupMenuScroll) 17 (@g:popupMenuLineHeight) * - (&gt;@g:popupMenuScroll) g2 } }
			} els{
				0 (&gt;@g:popupMenuScroll)
			}
		}
		<!-- calculate popup menu scrollbar -->
		0 (&gt;@g:popupMenuScrollbarVisible)
		(@g:popupMenuMaxElements) 0 &gt;
		if{
			(@g:popupMenuHeaderHeight) (@g:popupMenuMaxElements) (@g:popupMenuLineHeight) 17 * * + sp1
			(@g:popupMenuHeight) sp3
			l1 l3 &gt;= if{ 
				1 (&gt;@g:popupMenuScrollbarVisible)
				l3 8 - d d (&gt;@g:popupMenuScrollbarSize)
				l3 l1 / * (&gt;@g:popupMenuScrollbarLength)
				(@g:popupMenuScroll) l1 / * (&gt;@g:popupMenuScrollbarOffset) 
			} els{ 
				0 (&gt;@g:popupMenuScroll)
			}
		} 
		<!-- calculate number of blinking fields -->
		0 sp0
		(@g:currentGroup) @kWPTPageGroup == if{
			1 sp0
			(@g:currentPageWPT) @kWPTPageAptLoc == if{ 2 sp0 }
			(@g:currentPageWPT) @kWPTPageAptRun == if{ 2 sp0 }
			(@g:currentPageWPT) @kWPTPageAptApproach == if{ (@g:selectApproach) @kOn == (@g:currentAirportApproach) (@c:WaypointAirportApproachesNumber) &lt; and if{ 5 } els{ 3 } sp0 }
			(@g:currentPageWPT) @kWPTPageNdb == if{ 2 sp0 }
			(@g:currentPageWPT) @kWPTPageVor == if{ 2 sp0 }
		}
		(@g:currentGroup) @kPROCPageGroup == if{ 3 sp0 }
		(@g:directTo) @kOn == if{ 5 sp0 }
		l0 (&gt;@g:numberOfBlinkingFields)
		l0 (@g:blinkingField) min (&gt;@g:blinkingField)
		<!-- enable blinking fields -->	
		(@g:currentGroup) @kPROCPageGroup== if{
			(@c:FlightPlanIsLoadedApproach) d (&gt;@g:blinkingFieldEnabled1) (&gt;@g:blinkingFieldEnabled2)
		}
		<!-- update pages while typing -->
		(@g:enteringInput) 10 == if{ (@c:IcaoSearchCurrentIcao) (&gt;@c:WaypointAirportICAO) }
		(@g:enteringInput) 11 == if{ (@c:IcaoSearchCurrentIcao) (&gt;@c:WaypointIntersectionICAO) }
		(@g:enteringInput) 12 == if{ (@c:IcaoSearchCurrentIcao) (&gt;@c:WaypointNdbICAO) }
		(@g:enteringInput) 13 == if{ (@c:IcaoSearchCurrentIcao) (&gt;@c:WaypointVorICAO) }
		(@g:enteringInput) 31 == if{ (@c:IcaoSearchCurrentIcao) (&gt;@c:FacilityICAO) }
		(@g:enteringInput) 110 == if{ (@c:NameSearchCurrentIcao) (&gt;@c:WaypointAirportICAO) }
		(@g:enteringInput) 131 == if{ (@c:NameSearchCurrentIcao) (&gt;@c:FacilityICAO) }
		<!-- update coords for the nearest pages -->
		(A:GPS POSITION LAT, Radians) (&gt;@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (&gt;@c:NearestAirportCurrentLongitude, Radians) 9 (&gt;@c:NearestAirportMaximumItems) 200 (&gt;@c:NearestAirportMaximumDistance, NMiles) 
		(A:GPS POSITION LAT, Radians) (&gt;@c:NearestIntersectionCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (&gt;@c:NearestIntersectionCurrentLongitude, Radians) 9 (&gt;@c:NearestIntersectionMaximumItems) 200 (&gt;@c:NearestIntersectionMaximumDistance, NMiles)
		(A:GPS POSITION LAT, Radians) (&gt;@c:NearestNdbCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (&gt;@c:NearestNdbCurrentLongitude, Radians) 9 (&gt;@c:NearestNdbMaximumItems) 200 (&gt;@c:NearestNdbMaximumDistance, NMiles)
		(A:GPS POSITION LAT, Radians) (&gt;@c:NearestVorCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (&gt;@c:NearestVorCurrentLongitude, Radians) 9 (&gt;@c:NearestVorMaximumItems) 200 (&gt;@c:NearestVorMaximumDistance, NMiles)
		(A:GPS POSITION LAT, Radians) (&gt;@c:NearestAirspaceCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (&gt;@c:NearestAirspaceCurrentLongitude, Radians) (A:GPS POSITION ALT, Meters) (&gt;@c:NearestAirspaceCurrentAltitude, Meters)
			(A:GPS GROUND MAGNETIC TRACK, Radians) (&gt;@c:NearestAirspaceMagneticGroundTrack, Radians) (A:GPS GROUND SPEED, knots) (&gt;@c:NearestAirspaceGroundSpeed, knots) 
			2 (&gt;@c:NearestAirspaceNearDistance, nmiles) 200 (&gt;@c:NearestAirspaceNearAltitude, feet) 10 (&gt;@c:NearestAirspaceAheadTime, minutes)
			9 (&gt;@c:NearestAirspaceMaximumItems) 100 (&gt;@c:NearestAirspaceMaximumDistance, NMiles)
			@kDisplayedAirspaces (&gt;@c:NearestAirspaceQuery)
		<!-- check CLR button -->
		(@g:clrButtonDown) 0 != if{
			(@g:clrButtonCount) ++ d (&gt;@g:clrButtonCount) @CLRButtonDelay == if{ @CLRALLButton }
		}
		<!-- check MSG button -->
		(@g:msgButtonDown) 0 != if{
			(@g:msgButtonCount) ++ d (&gt;@g:msgButtonCount) @MSGButtonDelay == if{ @MSGToggle }
		}
		
	</Update>
  <Element>
    <Position X="1" Y="1" />
    <Container />
    <Update Frequency="7" />
    <Element>
      <Size X="189" Y="197" />
      <Visible>(A:Circuit general panel on, bool)
</Visible>
      <Element>
        <Element>
          <Position X="0" Y="44" />
          <CustomDraw Name="fs9gps:map" X="400" Y="357" LayerTerrain="No" LayerBorders="No" LayerFlightPlan="Yes" FlightPlanLineWidth="1" ActiveColorLayerFlightPlan="0xFF00CC" PastColorLayerFlightPlan="0xFF00CC" ColorLayerFlightPlan="0xFF00CC" Bright="Yes" CenterX="200" BackgroundColor="Black">
            <UpdateAlways>1</UpdateAlways>
            <BackgroundColor>black</BackgroundColor>
            <CenterY>(@g:currentPageNAV) @kNAVPageDflt == if{ 270 } els{ 270 }</CenterY>
            <Zoom>49078</Zoom>
            <Latitude>(A:GPS POSITION LAT, Radians)</Latitude>
            <Longitude>(A:GPS POSITION LON, Radians)</Longitude>
            <Heading>(A:GPS GROUND TRUE TRACK, radians)</Heading>
            <DetailLayerTerrain>0xFFCC66</DetailLayerTerrain>
            <ObjectDetailLayerFlightPlan>0xE 0xF (@c:FlightPlanIsActiveApproach) ?</ObjectDetailLayerFlightPlan>
            <TrackUp>(A:GPS GROUND TRUE TRACK, radians)</TrackUp>
          </CustomDraw>
        </Element>
        <Element>
          <Element>
            <MaskImage Name="nd_arc_mask.bmp" Bright="Yes">
              <Axis X="200" Y="310" />
            </MaskImage>
            <Image Name="nd_arc.bmp" Bright="Yes">
              <Axis X="271" Y="271" />
            </Image>
            <Rotate>
              <Value>(A:GPS GROUND TRUE TRACK, radians) /-/</Value>
            </Rotate>
          </Element>
          <Element>
            <Position X="200" Y="329" />
            <Image Name="mfd_airplane.bmp" Bright="Yes">
              <Axis X="12" Y="16" />
            </Image>
          </Element>
          <Element>
            <Image Name="nd_arc_top_mask.bmp" Bright="Yes" />
          </Element>
          <Element>
            <Position X="306" Y="381" />
            <Image Name="nd_gps.bmp" Bright="Yes">
            </Image>
          </Element>
        </Element>
        <Element>
          <Position X="180" Y="175" />
          <Image Name="nd_gps_range_20.bmp" Bright="Yes" />
        </Element>
      </Element>
      <Element>
        <Element>
          <Position X="30" Y="52" />
          <Visible>(A:Ambient Wind Velocity,knots) 5 &gt;</Visible>
          <Image Name="wind_vector.bmp" Bright="Yes">
            <Axis X="5" Y="16" />
          </Image>
          <Rotate>
            <Value>(A:Ambient Wind Direction,degrees) (A:MAGVAR, degrees) - 180 - (A:PLANE HEADING DEGREES TRUE,degrees) - dgrd</Value>
          </Rotate>
        </Element>
        <Element>
          <Position X="13" Y="24" />
          <Visible>(A:Ambient Wind Velocity,knots) 5 &gt;</Visible>
          <Text Bright="Yes" X="22" Y="12" Fixed="Yes" Font="Msgothic" Color="#EEEEEE" Adjust="Center" VerticalAdjust="Center" Length="3">
            <String>%((A:Ambient Wind Direction,degrees) (A:MAGVAR, degrees) - dnor s0 (A:Ambient Wind Velocity,knots) 0 &gt;)%{if}%(l0)%!03d!%{else}---%{end}</String>
          </Text>
        </Element>
        <Element>
          <Position X="43" Y="24" />
          <Visible>(A:Ambient Wind Velocity,knots) 5 &gt;</Visible>
          <Text Bright="Yes" X="24" Y="12" Fixed="Yes" Font="Msgothic" Color="#EEEEEE" Adjust="Center" VerticalAdjust="Center" Length="4">
            <String>/%((A:Ambient Wind Velocity,knots) s0 0 &gt;)%{if}%(l0)%!3d!%{else}---%{end}</String>
          </Text>
        </Element>
        <Element>
          <Position X="36" Y="26" />
          <Visible>(A:Ambient Wind Velocity,knots) 5 &gt;</Visible>
          <Image Name="nd_degree_dot.bmp" Bright="Yes">
          </Image>
        </Element>
        <Element>
          <Position X="335" Y="35" />
          <FormattedText X="100" Y="30" Font="Msgothic" FontSize="13" Adjust="Left" VerticalAdjust="Center" Color="#EEEEEE" Bright="Yes">
            <String>%((A:HSI distance, nmiles) s1 0 &gt;=)%{if}%(l1 100 &gt;=)%{if}%(l1)%!d!%{else}%(l1)%!0.1f!%{end}%{else}----%{end}nm</String>
          </FormattedText>
        </Element>
        <Element>
          <Position X="335" Y="22" />
          <FormattedText X="100" Y="30" Font="Msgothic" FontSize="13" Adjust="Left" VerticalAdjust="Center" Color="#EEEEEE" Bright="Yes">
            <String>%((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS WP ETA, hours) flr 100 %)%!02d!%((A:GPS WP ETA, minutes) 60 %)%!4.1f!%{end}z</String>
          </FormattedText>
        </Element>
        <Element>
          <Position X="335" Y="9" />
          <FormattedText X="100" Y="30" Font="Msgothic" FontSize="13" Adjust="Left" VerticalAdjust="Center" Color="#FF00CC" Bright="Yes">
            <String>%((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS WP NEXT ID, string))%!s!%{end}</String>
          </FormattedText>
        </Element>
      </Element>
      <Element>
        <Position X="0" Y="0" />
        <Element>
          <Position X="152" Y="12" />
          <Image Name="nd_track_box.bmp" Bright="Yes" />
        </Element>
        <Element>
          <MaskImage Name="nd_arc_mask.bmp" Bright="Yes">
            <Axis X="200" Y="310" />
          </MaskImage>
          <Image Name="nd_heading_pointer.bmp" Bright="Yes">
            <Axis X="7" Y="278" />
          </Image>
          <Rotate>
            <Value>(A:PLANE HEADING DEGREES TRUE, radians) (A:GPS GROUND TRUE TRACK, radians) -</Value>
          </Rotate>
        </Element>
        <Element>
          <Position X="196" Y="34" />
          <Image Name="nd_track_bar.bmp" Bright="Yes" />
        </Element>
        <Element>
          <Position X="186" Y="15" />
          <Select>
            <Value>(A:GPS GROUND TRUE TRACK, degrees) 0 max 1000 % 100 / flr</Value>
            <Case Value="0">
              <Image Name="airspeed_numbers_0.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="airspeed_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="airspeed_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="airspeed_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="airspeed_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="airspeed_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="airspeed_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="airspeed_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="airspeed_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="airspeed_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="196" Y="15" />
          <Select>
            <Value>(A:GPS GROUND TRUE TRACK, degrees) 0 max 100 % 10 / flr</Value>
            <Case Value="0">
              <Image Name="airspeed_numbers_0.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="airspeed_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="airspeed_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="airspeed_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="airspeed_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="airspeed_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="airspeed_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="airspeed_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="airspeed_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="airspeed_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="206" Y="15" />
          <Select>
            <Value>(A:GPS GROUND TRUE TRACK, degrees) 0 max 10 % 1 / flr</Value>
            <Case Value="0">
              <Image Name="airspeed_numbers_0.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="airspeed_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="airspeed_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="airspeed_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="airspeed_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="airspeed_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="airspeed_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="airspeed_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="airspeed_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="airspeed_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
      </Element>
      <Element>
        <Position X="0" Y="0" />
        <Element>
          <Position X="13" Y="12" />
          <Image Name="nd_gs.bmp" Bright="Yes" />
        </Element>
        <Element>
          <Position X="56" Y="12" />
          <Visible>(A:AIRSPEED TRUE,knots) 100 &gt;</Visible>
          <Image Name="nd_tas.bmp" Bright="Yes" />
        </Element>
        <Element>
          <Position X="26" Y="7" />
          <Visible>(A:GROUND VELOCITY,knots) 30 &lt;=</Visible>
          <Select>
            <Value>(A:GROUND VELOCITY,knots) 0 max 100 % 10 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_number_blank.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="airspeed_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="airspeed_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="airspeed_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="airspeed_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="airspeed_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="airspeed_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="airspeed_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="airspeed_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="airspeed_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="36" Y="7" />
          <Visible>(A:GROUND VELOCITY,knots) 30 &lt;=</Visible>
          <Select>
            <Value>(A:GROUND VELOCITY,knots) 0 max 10 % 1 / flr</Value>
            <Case Value="0">
              <Image Name="airspeed_numbers_0.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="airspeed_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="airspeed_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="airspeed_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="airspeed_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="airspeed_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="airspeed_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="airspeed_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="airspeed_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="airspeed_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="26" Y="9" />
          <Visible>(A:GROUND VELOCITY,knots) 30 &gt;</Visible>
          <Select>
            <Value>(A:GROUND VELOCITY,knots) 0 max 1000 % 100 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_number_blank.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="33" Y="9" />
          <Visible>(A:GROUND VELOCITY,knots) 30 &gt;</Visible>
          <Select>
            <Value>(A:GROUND VELOCITY,knots) 0 max 100 % 10 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_numbers_00.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="40" Y="9" />
          <Visible>(A:GROUND VELOCITY,knots) 30 &gt;</Visible>
          <Select>
            <Value>(A:GROUND VELOCITY,knots) 0 max 10 % 1 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_numbers_00.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="76" Y="9" />
          <Visible>(A:AIRSPEED TRUE,knots) 100 &gt;</Visible>
          <Select>
            <Value>(A:AIRSPEED TRUE,knots) 0 max 1000 % 100 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_number_blank.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="83" Y="9" />
          <Visible>(A:AIRSPEED TRUE,knots) 100 &gt;</Visible>
          <Select>
            <Value>(A:AIRSPEED TRUE,knots) 0 max 100 % 10 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_numbers_00.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
        <Element>
          <Position X="90" Y="9" />
          <Visible>(A:AIRSPEED TRUE,knots) 100 &gt;</Visible>
          <Select>
            <Value>(A:AIRSPEED TRUE,knots) 0 max 10 % 1 / flr</Value>
            <Case Value="0">
              <Image Name="altitude_numbers_00.bmp" Bright="Yes" />
            </Case>
            <Case Value="1">
              <Image Name="altitude_numbers_1.bmp" Bright="Yes" />
            </Case>
            <Case Value="2">
              <Image Name="altitude_numbers_2.bmp" Bright="Yes" />
            </Case>
            <Case Value="3">
              <Image Name="altitude_numbers_3.bmp" Bright="Yes" />
            </Case>
            <Case Value="4">
              <Image Name="altitude_numbers_4.bmp" Bright="Yes" />
            </Case>
            <Case Value="5">
              <Image Name="altitude_numbers_5.bmp" Bright="Yes" />
            </Case>
            <Case Value="6">
              <Image Name="altitude_numbers_6.bmp" Bright="Yes" />
            </Case>
            <Case Value="7">
              <Image Name="altitude_numbers_7.bmp" Bright="Yes" />
            </Case>
            <Case Value="8">
              <Image Name="altitude_numbers_8.bmp" Bright="Yes" />
            </Case>
            <Case Value="9">
              <Image Name="altitude_numbers_9.bmp" Bright="Yes" />
            </Case>
          </Select>
        </Element>
      </Element>
    </Element>
  </Element>
  <Mouse>
    <Help ID="HELPID_GAUGE_PFD" />
  </Mouse>
</Gauge>