size={900,90} 

local digital = loadFont('digital.ttf')
local clRed = {0.9,0.0,0.0,0.9}
local clRedDim = {0.9,0.0,0.0,0.3}

n1_dme_nm = globalProperty("sim/cockpit2/radios/indicators/nav1_dme_distance_nm")
n2_dme_nm = globalProperty("sim/cockpit2/radios/indicators/nav2_dme_distance_nm")
n1_dme_kts = globalProperty("sim/cockpit2/radios/indicators/nav1_dme_speed_kts")
n2_dme_kts = globalProperty("sim/cockpit2/radios/indicators/nav2_dme_speed_kts")
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, 25,15, string.format("%.3d nm,   %.3d kts", get(n1_dme_nm), get(n1_dme_kts)), 90, false, false, TEXT_ALIGN_CENTER, clRed)
		drawText(digital, 25,15, string.format("%.3d nm,   %.3d kts", get(n1_dme_nm), get(n1_dme_kts)), 90, false, false, TEXT_ALIGN_CENTER, clRed)
	end
	drawText(digital, 25,15, "000 nm,   000 kts", 90, false, false, TEXT_ALIGN_CENTER, clRedDim)
end