size={900,80} 

local digital = loadFont('digital.ttf')
local clRed = {0.9,0.09,0.09, 0.9}
local clRedDark = {0.9, 0.09, 0.09, 0.25}

n2_freqM = globalProperty("sim/cockpit2/radios/actuators/nav2_frequency_Mhz")
n2_freqK = globalProperty("sim/cockpit2/radios/actuators/nav2_frequency_khz")

n2_s_freqM = globalProperty("sim/cockpit2/radios/actuators/nav2_standby_frequency_Mhz")
n2_s_freqK = globalProperty("sim/cockpit2/radios/actuators/nav2_standby_frequency_khz")

battery_on_0 = globalProperty("sim/cockpit2/electrical/battery_on[0]")
battery_on_1 = globalProperty("sim/cockpit2/electrical/battery_on[1]")



function draw()
	drawAll(components)
	if get(avionics_on) == 1 and (get(battery_on_0) == 1 or get(battery_on_1) == 1) then
		drawText(digital, 240, 25, string.format("%d.%.2d", get(n2_freqM), get(n2_freqK)), 25, false, false, TEXT_ALIGN_CENTER, clRed)
	end
	drawText(digital, 240, 25, "000.000", 25, false, false, TEXT_ALIGN_CENTER, clRedDark)
	if get(avionics_on) == 1 and (get(battery_on_0) == 1 or get(battery_on_1) == 1) then
		drawText(digital, 315, 25, string.format("%d.%.2d", get(n2_s_freqM), get(n2_s_freqK)), 25, false, false, TEXT_ALIGN_CENTER, clRed)
	end
	drawText(digital, 315, 25, "000.000", 25, false, false, TEXT_ALIGN_CENTER, clRedDark)
end