size = { 670, 895 }
defineProperty("lan_gear_warn", globalPropertyi("sim/custom/xap/lan_gear_warn"))

defineProperty("fuel_pump_l_astate", globalPropertyi("sim/custom/xap/fuel_pump_l_astate"))
defineProperty("fuel_pump_r_astate", globalPropertyi("sim/custom/xap/fuel_pump_r_astate"))
defineProperty("paused", globalPropertyi("sim/time/sim_speed"))

defineProperty("gear1_fail", globalPropertyi("sim/operation/failures/rel_lagear1"))
defineProperty("gear2_fail", globalPropertyi("sim/operation/failures/rel_lagear2"))
defineProperty("gear3_fail", globalPropertyi("sim/operation/failures/rel_lagear3"))

defineProperty("acf_flap_deftime", globalPropertyi("sim/aircraft/controls/acf_flap_deftime"))
defineProperty("right_hydr_st", globalPropertyi("sim/custom/xap/right_hydr_st"))

defineProperty("true_airspeed", globalPropertyf("sim/flightmodel/position/true_airspeed"))
defineProperty("radio_altimeter_bug_ft_pilot", globalPropertyf("sim/cockpit2/gauges/actuators/radio_altimeter_bug_ft_pilot"))
defineProperty("flaps_warn", globalPropertyi("sim/custom/xap/flaps_warn"))
defineProperty("gear_warn", globalPropertyi("sim/custom/xap/gear_warn"))
defineProperty("gear_warn_w", globalPropertyi("sim/custom/xap/gear_warn_w"))
defineProperty("terr_warn", globalPropertyi("sim/custom/xap/terr_warn"))
defineProperty("vvi_fpm_pilot", globalPropertyf("sim/cockpit2/gauges/indicators/vvi_fpm_pilot"))


defineProperty("adf1_power", globalPropertyi("sim/cockpit2/radios/actuators/adf1_power"))
defineProperty("adf2_power", globalPropertyi("sim/cockpit2/radios/actuators/adf2_power"))

defineProperty("EFIS_1_selection_pilot", globalPropertyi("sim/cockpit2/EFIS/EFIS_1_selection_pilot"))
defineProperty("EFIS_2_selection_pilot", globalPropertyi("sim/cockpit2/EFIS/EFIS_2_selection_pilot"))
defineProperty("autop_brgsrc", globalPropertyi("sim/custom/xap/autop_brgsrc"))

defineProperty("dcp_refs_menu", globalPropertyi("sim/custom/xap/dcp_refs_menu"))
defineProperty("dcp_refs", globalPropertyi("sim/custom/xap/dcp_refs"))
defineProperty("refspds_v1", globalPropertyi("sim/custom/xap/refspds_v1"))
defineProperty("refspds_vr", globalPropertyi("sim/custom/xap/refspds_vr"))
defineProperty("refspds_v2", globalPropertyi("sim/custom/xap/refspds_v2"))
defineProperty("refspds_vt", globalPropertyi("sim/custom/xap/refspds_vt"))
defineProperty("refspds_vga", globalPropertyi("sim/custom/xap/refspds_vga"))
defineProperty("refspds_vref", globalPropertyi("sim/custom/xap/refspds_vref"))

defineProperty("rev_tune", globalPropertyi("sim/custom/xap/rev_tune"))
defineProperty("pitch_d_1", globalPropertyi("sim/custom/xap/pitch_d_1"))
defineProperty("pitch_d_2", globalPropertyi("sim/custom/xap/pitch_d_2"))
defineProperty("hstab_l", globalPropertyf("sim/custom/xap/hstab_l"))
defineProperty("hstab_r", globalPropertyf("sim/custom/xap/hstab_r"))

defineProperty("rel_gear_act", globalPropertyi("sim/operation/failures/rel_gear_act"))

defineProperty("rel_flap_act", globalPropertyi("sim/operation/failures/rel_flap_act"))
defineProperty("hydr_altn_flp_h", globalPropertyi("sim/custom/xap/hydr_altn_flp_h"))

defineProperty("spoil_inb_l", globalPropertyf("sim/custom/xap/spoil_inb_l"))
defineProperty("spoil_inb_r", globalPropertyf("sim/custom/xap/spoil_inb_r"))
defineProperty("sbrk_inb_l", globalPropertyf("sim/custom/xap/sbrk_inb_l"))
defineProperty("sbrk_inb_r", globalPropertyf("sim/custom/xap/sbrk_inb_r"))
defineProperty("spoil_outb_l", globalPropertyf("sim/custom/xap/spoil_outb_l"))
defineProperty("spoil_outb_r", globalPropertyf("sim/custom/xap/spoil_outb_r"))
defineProperty("sbrk_outb_l", globalPropertyf("sim/custom/xap/sbrk_outb_l"))
defineProperty("sbrk_outb_r", globalPropertyf("sim/custom/xap/sbrk_outb_r"))

defineProperty("outbrks_low", globalPropertyi("sim/custom/xap/outbrks_low"))
defineProperty("brks_low", globalPropertyi("sim/custom/xap/brks_low"))
defineProperty("hydraulic_fluid_ratio_1", globalPropertyf("sim/cockpit2/hydraulics/indicators/hydraulic_fluid_ratio_1"))
defineProperty("hydraulic_fluid_ratio_2", globalPropertyf("sim/cockpit2/hydraulics/indicators/hydraulic_fluid_ratio_2"))
defineProperty("rel_hydsys0", globalPropertyi("sim/operation/failures/rel_hydsys0"))
defineProperty("rel_hydsys2", globalPropertyi("sim/operation/failures/rel_hydsys2"))
defineProperty("electric_hydraulic_pump_on", globalPropertyi("sim/cockpit2/switches/electric_hydraulic_pump_on"))
defineProperty("hydr_l_sov_h", globalPropertyi("sim/custom/xap/hydr_l_sov_h"))
defineProperty("hydr_r_sov_h", globalPropertyi("sim/custom/xap/hydr_r_sov_h"))
defineProperty("aux_hpump_h", globalPropertyi("sim/custom/xap/aux_hpump_h"))
defineProperty("l_hpump_h", globalPropertyi("sim/custom/xap/l_hpump_h"))
defineProperty("r_hpump_h", globalPropertyi("sim/custom/xap/r_hpump_h"))
defineProperty("ptu_h", globalPropertyi("sim/custom/xap/ptu_h"))

defineProperty("flight_time", globalPropertyf("sim/time/total_flight_time_sec"))


defineProperty("test_data_1", globalPropertyf("sim/custom/xap/test_data_1"))
defineProperty("test_data_2", globalPropertyf("sim/custom/xap/test_data_2"))
defineProperty("test_data_3", globalPropertyf("sim/custom/xap/test_data_3"))
defineProperty("test_data_4", globalPropertyf("sim/custom/xap/test_data_4"))
defineProperty("test_data_5", globalPropertyf("sim/custom/xap/test_data_5"))



defineProperty("fuel_xflow_up_h", globalPropertyi("sim/custom/xap/fuel_xflow_up_h"))
defineProperty("fuel_xflow_dn_h", globalPropertyi("sim/custom/xap/fuel_xflow_dn_h"))
defineProperty("fuel_xpump_r", globalPropertyi("sim/custom/xap/fuel_xpump_r"))
defineProperty("fuel_xpump_l", globalPropertyi("sim/custom/xap/fuel_xpump_l"))



defineProperty("pressure_ditch_h", globalPropertyf("sim/custom/xap/pressure_ditch_h"))
defineProperty("pressure_diffential_psi", globalPropertyf("sim/cockpit2/pressurization/indicators/pressure_diffential_psi"))
defineProperty("pressure_lndg_alt_1", globalPropertyi("sim/custom/xap/pressure_lndg_alt_1"))
defineProperty("pressure_lndg_alt_2", globalPropertyf("sim/custom/xap/pressure_lndg_alt_2"))

defineProperty("antice_wshld_l_h", globalPropertyi("sim/custom/xap/antice_wshld_l_h"))
defineProperty("antice_wshld_r_h", globalPropertyi("sim/custom/xap/antice_wshld_r_h"))

defineProperty("night_lights", globalPropertyf("sim/graphics/scenery/percent_lights_on"))
defineProperty("view", globalPropertyf("sim/graphics/view/view_is_external"))
defineProperty("temp_cabin", globalPropertyf("sim/custom/xap/temp_cabin"))
defineProperty("glass_ice_cockpit", globalPropertyf("sim/custom/xap/glass_ice_cockpit"))
defineProperty("glass_ice_cockpit2", globalPropertyf("sim/custom/xap/glass_ice_cockpit2"))

defineProperty("frame_rate_period", globalPropertyf("sim/operation/misc/frame_rate_period"))


defineProperty("customslider4_r", globalPropertyf("sim/custom/xap/customslider4_r"))
defineProperty("customslider2_r", globalPropertyf("sim/custom/xap/customslider2_r"))

defineProperty("aircond_tempr_cock_ddial", globalPropertyf("sim/custom/xap/aircond_tempr_cock_ddial"))
defineProperty("aircond_tempr_cab_ddial", globalPropertyf("sim/custom/xap/aircond_tempr_cab_ddial"))
defineProperty("aircond_man_temp_h", globalPropertyi("sim/custom/xap/aircond_man_temp_h"))
defineProperty("aircond_airsource", globalPropertyi("sim/custom/xap/aircond_airsource"))
defineProperty("aircond_ramair_h", globalPropertyi("sim/custom/xap/aircond_ramair_h"))
defineProperty("bleed_xbleed_h", globalPropertyi("sim/custom/xap/bleed_xbleed_h"))
defineProperty("bleed_en_l_h", globalPropertyi("sim/custom/xap/bleed_en_l_h"))
defineProperty("bleed_en_r_h", globalPropertyi("sim/custom/xap/bleed_en_r_h"))
defineProperty("bleed_apu_h", globalPropertyi("sim/custom/xap/bleed_apu_h"))
defineProperty("bleed_status", globalPropertyi("sim/custom/xap/bleed_status"))

defineProperty("altitude_hold_status", globalPropertyi("sim/cockpit2/autopilot/altitude_hold_status"))


defineProperty("antice_wings_xbleed_valve", globalPropertyi("sim/custom/xap/antice_wings_xbleed_valve"))
defineProperty("antice_wing_h", globalPropertyi("sim/custom/xap/antice_wing_h"))
defineProperty("antice_wngsource_r", globalPropertyi("sim/custom/xap/antice_wngsource_r"))
defineProperty("antice_engn_l_h", globalPropertyi("sim/custom/xap/antice_engn_l_h"))
defineProperty("antice_engn_r_h", globalPropertyi("sim/custom/xap/antice_engn_r_h"))
defineProperty("ice_all_on", globalPropertyi("sim/cockpit2/ice/ice_all_on"))
defineProperty("ice_inlet_heat_on", globalPropertyi("sim/cockpit2/ice/ice_inlet_heat_on"))
defineProperty("ice_window_heat_on", globalPropertyi("sim/cockpit2/ice/ice_window_heat_on"))
defineProperty("ice_pitot_heat_on_pilot", globalPropertyi("sim/cockpit2/ice/ice_pitot_heat_on_pilot"))
defineProperty("ice_pitot_heat_on_copilot", globalPropertyi("sim/cockpit2/ice/ice_pitot_heat_on_copilot"))
defineProperty("ice_AOA_heat_on", globalPropertyi("sim/cockpit2/ice/ice_AOA_heat_on"))
defineProperty("ice_surfce_heat_left_on", globalPropertyi("sim/cockpit2/ice/ice_surfce_heat_left_on"))
defineProperty("ice_surfce_heat_right_on", globalPropertyi("sim/cockpit2/ice/ice_surfce_heat_right_on"))
defineProperty("ice_detect_on", globalPropertyi("sim/cockpit2/ice/ice_detect_on"))

defineProperty("mfdpan_lr_sw", globalPropertyi("sim/custom/xap/mfdpan_lr_sw"))

defineProperty("mfd_checkl_l", globalPropertyi("sim/custom/xap/mfd_checkl_l"))
defineProperty("mfd_hydr_l", globalPropertyi("sim/custom/xap/mfd_hydr_l"))
defineProperty("mfd_fuel_l", globalPropertyi("sim/custom/xap/mfd_fuel_l"))
defineProperty("mfd_flt_ctr_l", globalPropertyi("sim/custom/xap/mfd_flt_ctr_l"))
defineProperty("mfd_electr_l", globalPropertyi("sim/custom/xap/mfd_electr_l"))
defineProperty("mfd_ecs_l", globalPropertyi("sim/custom/xap/mfd_ecs_l"))
defineProperty("mfd_antice_l", globalPropertyi("sim/custom/xap/mfd_antice_l"))
defineProperty("mfd_frmt_l", globalPropertyi("sim/custom/xap/mfd_frmt_l"))
defineProperty("mfd_sumry_l", globalPropertyi("sim/custom/xap/mfd_sumry_l"))
defineProperty("map_mode", globalPropertyi("sim/cockpit2/EFIS/map_mode"))
defineProperty("map_mode_is_HSI", globalPropertyi("sim/cockpit2/EFIS/map_mode_is_HSI"))



defineProperty("mfd_checkl_r", globalPropertyi("sim/custom/xap/mfd_checkl_r"))
defineProperty("mfd_hydr_r", globalPropertyi("sim/custom/xap/mfd_hydr_r"))
defineProperty("mfd_fuel_r", globalPropertyi("sim/custom/xap/mfd_fuel_r"))
defineProperty("mfd_flt_ctr_r", globalPropertyi("sim/custom/xap/mfd_flt_ctr_r"))
defineProperty("mfd_electr_r", globalPropertyi("sim/custom/xap/mfd_electr_r"))
defineProperty("mfd_ecs_r", globalPropertyi("sim/custom/xap/mfd_ecs_r"))
defineProperty("mfd_antice_r", globalPropertyi("sim/custom/xap/mfd_antice_r"))
defineProperty("mfd_frmt_r", globalPropertyi("sim/custom/xap/mfd_frmt_r"))
defineProperty("mfd_sumry_r", globalPropertyi("sim/custom/xap/mfd_sumry_r"))
defineProperty("map_mode", globalPropertyi("sim/cockpit2/EFIS/map_mode"))

defineProperty("disp", globalPropertyf("sim/custom/xap/disp"))

defineProperty("onground_any", globalPropertyf("sim/flightmodel/failures/onground_any"))
defineProperty("totaltime", globalPropertyf("sim/time/total_running_time_sec"))

defineProperty("engn_mach_h", globalPropertyi("sim/custom/xap/engn_mach_h"))
defineProperty("engn_mach_status", globalPropertyi("sim/custom/xap/engn_mach_status"))
defineProperty("jet_sync_mode", globalPropertyi("sim/cockpit2/switches/jet_sync_mode"))

defineProperty("carets", globalPropertyi("sim/custom/xap/carets"))
defineProperty("CLB_n1", globalPropertyf("sim/custom/xap/CLB_n1"))
defineProperty("TO_n1", globalPropertyf("sim/custom/xap/TO_n1"))

defineProperty("menu1", loadImage("menu1.png", 265, 94, 69, 26))
defineProperty("n1_needle", loadImage("menu1.png", 338, 0, 10, 176))
defineProperty("stab_trim_s", loadImage("menu1.png", 265, 125, 55, 30))
defineProperty("ail_trim_s", loadImage("menu1.png", 272, 162, 42, 13))
defineProperty("rud_trim_s", loadImage("menu1.png", 318, 155, 17, 15))


defineProperty("gear_dn", loadImage("menu1.png", 268, 185, 31, 38))
defineProperty("gear_trans_red", loadImage("menu1.png", 268, 223, 31, 38))
defineProperty("gear_trans_white", loadImage("menu1.png", 268, 261, 31, 38))
defineProperty("gear_trans_yellow", loadImage("menu1.png", 268, 299, 31, 38))
defineProperty("gear_up_red", loadImage("menu1.png", 299, 185, 31, 38))
defineProperty("gear_up_white", loadImage("menu1.png", 299, 223, 31, 38))
defineProperty("gear_up_yellow", loadImage("menu1.png", 299, 261, 31, 38))


defineProperty("sbrake1_green", loadImage("menu1.png", 339, 192, 21, 9))
defineProperty("sbrake1_yellow", loadImage("menu1.png", 339, 206, 21, 9))
defineProperty("green_line", loadImage("menu1.png", 342, 183, 1, 1))
defineProperty("arrow_line", loadImage("menu1.png", 348, 181, 8, 7))
defineProperty("arrow_line2", loadImage("menu1.png", 356, 181, 8, 7))
defineProperty("arrow_cab_up", loadImage("menu1.png", 340, 226, 5, 32))
defineProperty("arrow_cab_down", loadImage("menu1.png", 347, 226, 5, 32))

defineProperty("arrow_line2", loadImage("menu1.png", 356, 181, 8, 7))
defineProperty("blue_arrow_line", loadImage("menu1.png", 356, 0, 12, 176))
defineProperty("blue_arrow_line2", loadImage("menu1.png", 371, 0, 12, 220))
defineProperty("blue_arrow_line3", loadImage("menu1.png", 386, 0, 18, 220))

defineProperty("black", loadImage("menu1.png", 1022, 1, 1, 1))

defineProperty("start", loadImage("menu1.png", 375, 231, 14, 75))

defineProperty("mfd_ctrl_l", loadImage("menu1.png", 927, 1, 52, 19))
defineProperty("mfd_ctrl_r", loadImage("menu1.png", 927, 22, 52, 19))

defineProperty("elec_page1", loadImage("menu1.png", 812, 2, 60, 48))
defineProperty("elec_page2", loadImage("menu1.png", 880, 6, 42, 40))
defineProperty("elec_page3", loadImage("menu1.png", 422, 2, 185, 64))
defineProperty("elec_page4", loadImage("menu1.png", 607, 2, 188, 64))

defineProperty("antice_page1", loadImage("menu1.png", 424, 68, 89, 27))
defineProperty("antice_page2", loadImage("menu1.png", 516, 68, 89, 27))
defineProperty("antice_page3", loadImage("menu1.png", 607, 70, 23, 23))
defineProperty("antice_page4", loadImage("menu1.png", 430, 94, 213, 113))
defineProperty("antice_page5", loadImage("menu1.png", 643, 94, 212, 113))
defineProperty("antice_page6", loadImage("menu1.png", 632, 70, 23, 23))
defineProperty("antice_page7", loadImage("menu1.png", 862, 57, 118, 55))

defineProperty("fltc_rudder_grn", loadImage("menu1.png", 311, 4, 7, 62))
defineProperty("fltc_rudder_yel", loadImage("menu1.png", 320, 4, 7, 62))
defineProperty("fltc_trngl_l_grn", loadImage("menu1.png", 397, 230, 15, 12))
defineProperty("fltc_trngl_l_yel", loadImage("menu1.png", 397, 244, 15, 12))
defineProperty("fltc_trngl_r_grn", loadImage("menu1.png", 397, 258, 15, 12))
defineProperty("fltc_trngl_r_yel", loadImage("menu1.png", 397, 272, 15, 12))

defineProperty("fltc_flap_l", loadImage("menu1.png", 860, 119, 62, 43))
defineProperty("fltc_flap_r", loadImage("menu1.png", 927, 119, 61, 43))

defineProperty("cabrate2_dn", loadImage("menu1.png", 999, 2, 10, 14))
defineProperty("cabrate2_up", loadImage("menu1.png", 1010, 2, 10, 14))


defineProperty("en_but_run_l", globalPropertyi("sim/custom/xap/en_but_run_l"))
defineProperty("en_but_run_r", globalPropertyi("sim/custom/xap/en_but_run_r"))
defineProperty("fuelp_pump", loadImage("menu1.png", 886, 180, 24, 23))
defineProperty("fuelp_pump_l", loadImage("menu1.png", 865, 166, 45, 58))
defineProperty("fuelp_pump_r", loadImage("menu1.png", 913, 166, 44, 58))
defineProperty("fuelp_engn_r", loadImage("menu1.png", 865, 228, 82, 22))
defineProperty("fuelp_engn_l", loadImage("menu1.png", 865, 254, 83, 22))
defineProperty("fuelp_rfport", loadImage("menu1.png", 991, 109, 15, 54))
defineProperty("fuelp_rfport2_l", loadImage("menu1.png", 960, 185, 55, 15))
defineProperty("fuelp_rfport2_r", loadImage("menu1.png", 960, 166, 55, 15))

defineProperty("hd_press_norm", loadImage("menu1.png", 434, 230, 40, 23))
defineProperty("hd_inb_brk", loadImage("menu1.png", 430, 266, 97, 21))
defineProperty("hd_outb_brk", loadImage("menu1.png", 777, 230, 51, 23))
defineProperty("hd_l_hs", loadImage("menu1.png", 529, 230, 124, 108))
defineProperty("hd_r_hs", loadImage("menu1.png", 654, 230, 123, 108))
defineProperty("hd_gear", loadImage("menu1.png", 778, 272, 35, 11))
defineProperty("hd_rudd", loadImage("menu1.png", 778, 257, 52, 10))


defineProperty("electr_ess_p_status", globalPropertyi("sim/custom/xap/electr_ess_p_status"))
defineProperty("APU_generator_amps", globalPropertyi("sim/cockpit2/electrical/APU_generator_amps"))
defineProperty("generator_amps_l", globalPropertyf("sim/cockpit2/electrical/generator_amps[0]"))
defineProperty("generator_amps_r", globalPropertyf("sim/cockpit2/electrical/generator_amps[1]"))
defineProperty("battery_voltage_indicated_volts_l", globalPropertyf("sim/cockpit2/electrical/battery_voltage_indicated_volts[0]"))
defineProperty("battery_voltage_indicated_volts_r", globalPropertyf("sim/cockpit2/electrical/battery_voltage_indicated_volts[1]"))
defineProperty("electr_extp", globalPropertyi("sim/custom/xap/electr_extp"))
defineProperty("electr_extp_avail", globalPropertyf("sim/custom/xap/electr_extp_avail"))
defineProperty("gpu_on", globalPropertyi("sim/cockpit/electrical/gpu_on"))
defineProperty("bus_tie", globalPropertyf("sim/custom/xap/bus_tie"))
defineProperty("elbus1", globalPropertyf("sim/cockpit2/electrical/bus_volts[0]"))
defineProperty("elbus2", globalPropertyf("sim/cockpit2/electrical/bus_volts[1]"))
defineProperty("APU_generator_on", globalPropertyi("sim/cockpit2/electrical/APU_generator_on"))
defineProperty("APU_running", globalPropertyi("sim/cockpit2/electrical/APU_running"))
defineProperty("generator_on_l", globalPropertyi("sim/cockpit2/electrical/generator_on[0]"))
defineProperty("generator_on_r", globalPropertyi("sim/cockpit2/electrical/generator_on[1]"))
defineProperty("bat_on", globalPropertyi("sim/cockpit2/electrical/battery_on[0]"))
defineProperty("bat_on2", globalPropertyi("sim/cockpit2/electrical/battery_on[1]"))
defineProperty("ENGN_running_l", globalPropertyi("sim/flightmodel/engine/ENGN_running[0]"))
defineProperty("ENGN_running_r", globalPropertyi("sim/flightmodel/engine/ENGN_running[1]"))
defineProperty("APU_switch", globalPropertyi("sim/cockpit/engine/APU_switch"))


defineProperty("carets", globalPropertyi("sim/custom/xap/carets"))
defineProperty("CLB_n1", globalPropertyf("sim/custom/xap/CLB_n1"))
defineProperty("TO_n1", globalPropertyf("sim/custom/xap/TO_n1"))
defineProperty("gust_lock", globalPropertyf("sim/custom/xap/gust_lock"))

defineProperty("cabin_altitude_ft", globalPropertyf("sim/cockpit2/pressurization/indicators/cabin_altitude_ft"))
defineProperty("cabin_vvi_fpm", globalPropertyf("sim/cockpit2/pressurization/indicators/cabin_vvi_fpm"))

defineProperty("sbrk_h", globalPropertyf("sim/custom/xap/sbrk_h"))
defineProperty("speedbrake1_deg_0", globalPropertyf("sim/flightmodel2/wing/speedbrake1_deg[0]"))
defineProperty("speedbrake1_deg_1", globalPropertyf("sim/flightmodel2/wing/speedbrake1_deg[1]"))
defineProperty("spoiler1_deg_0", globalPropertyf("sim/flightmodel2/wing/spoiler1_deg[0]"))
defineProperty("spoiler1_deg_1", globalPropertyf("sim/flightmodel2/wing/spoiler1_deg[1]"))
defineProperty("spoiler2_deg_0", globalPropertyf("sim/flightmodel2/wing/spoiler2_deg[0]"))
defineProperty("spoiler2_deg_1", globalPropertyf("sim/flightmodel2/wing/spoiler2_deg[1]"))

defineProperty("gear_handle_status", globalPropertyi("sim/cockpit/switches/gear_handle_status"))
defineProperty("gear_unsafe", globalPropertyi("sim/cockpit/warnings/annunciators/gear_unsafe"))
defineProperty("deploy_ratio_0", globalPropertyf("sim/flightmodel2/gear/deploy_ratio[0]"))
defineProperty("deploy_ratio_1", globalPropertyf("sim/flightmodel2/gear/deploy_ratio[1]"))
defineProperty("deploy_ratio_2", globalPropertyf("sim/flightmodel2/gear/deploy_ratio[2]"))


defineProperty("aileron1_deg_l", globalPropertyf("sim/flightmodel2/wing/aileron1_deg[0]"))
defineProperty("aileron1_deg_r", globalPropertyf("sim/flightmodel2/wing/aileron1_deg[1]"))
defineProperty("hstab1_elv1def", globalPropertyf("sim/flightmodel/controls/hstab1_elv1def"))
defineProperty("hstab2_elv1def", globalPropertyf("sim/flightmodel/controls/hstab2_elv1def"))
defineProperty("rudder1_deg_0", globalPropertyf("sim/flightmodel2/wing/rudder1_deg[1]"))
defineProperty("ldruddef", globalPropertyf("sim/flightmodel/controls/ldruddef"))



defineProperty("flaprqst", globalPropertyf("sim/flightmodel/controls/flaprqst"))
defineProperty("flaprat", globalPropertyf("sim/flightmodel/controls/flaprat"))
defineProperty("rudder_trim", globalPropertyf("sim/flightmodel2/controls/rudder_trim"))
defineProperty("aileron_trim", globalPropertyf("sim/flightmodel2/controls/aileron_trim"))
defineProperty("elevator_trim", globalPropertyf("sim/flightmodel2/controls/elevator_trim"))

defineProperty("temperature_ambient_c", globalPropertyf("sim/weather/temperature_ambient_c"))
defineProperty("APU_N1_percent", globalPropertyf("sim/cockpit2/electrical/APU_N1_percent"))

defineProperty("m_fuel1", globalPropertyf("sim/flightmodel/weight/m_fuel1"))
defineProperty("m_fuel2", globalPropertyf("sim/flightmodel/weight/m_fuel2"))




defineProperty("hydr_pres_1", globalPropertyf("sim/cockpit2/hydraulics/indicators/hydraulic_pressure_1"))
defineProperty("hydr_pres_2", globalPropertyf("sim/cockpit2/hydraulics/indicators/hydraulic_pressure_2"))

defineProperty("dtr_s_l", globalPropertyi("sim/custom/xap/s_l"))
defineProperty("dtr_s_r", globalPropertyi("sim/custom/xap/s_r"))
defineProperty("engine_speed_rpm_0", globalPropertyf("sim/cockpit2/engine/indicators/engine_speed_rpm[0]"))
defineProperty("engine_speed_rpm_1", globalPropertyf("sim/cockpit2/engine/indicators/engine_speed_rpm[1]"))
defineProperty("fadec_coeff1", globalPropertyf("sim/custom/xap/fadec_coeff1"))
defineProperty("fadec_coeff2", globalPropertyf("sim/custom/xap/fadec_coeff2"))
defineProperty("thrust_reverser_deploy_ratio_0", globalPropertyf("sim/flightmodel2/engines/thrust_reverser_deploy_ratio[0]"))
defineProperty("thrust_reverser_deploy_ratio_1", globalPropertyf("sim/flightmodel2/engines/thrust_reverser_deploy_ratio[1]"))
defineProperty("rel_ignitr0", globalPropertyi("sim/operation/failures/rel_ignitr0"))
defineProperty("rel_ignitr1", globalPropertyi("sim/operation/failures/rel_ignitr1"))
defineProperty("ENGN_FF_l", globalPropertyf("sim/flightmodel/engine/ENGN_FF_[0]"))
defineProperty("ENGN_FF_r", globalPropertyf("sim/flightmodel/engine/ENGN_FF_[1]"))
defineProperty("ENGN_oil_press_l", globalPropertyf("sim/flightmodel/engine/ENGN_oil_press_psi[0]"))
defineProperty("ENGN_oil_press_r", globalPropertyf("sim/flightmodel/engine/ENGN_oil_press_psi[1]"))
defineProperty("ENGN_oil_temp_c_l", globalPropertyf("sim/flightmodel/engine/ENGN_oil_temp_c[0]"))
defineProperty("ENGN_oil_temp_c_r", globalPropertyf("sim/flightmodel/engine/ENGN_oil_temp_c[1]"))
defineProperty("engine_fires_l", globalPropertyi("sim/cockpit/warnings/annunciators/engine_fires[0]"))
defineProperty("engine_fires_r", globalPropertyi("sim/cockpit/warnings/annunciators/engine_fires[1]"))
defineProperty("ENGN_ITT_c_L", globalPropertyf("sim/flightmodel/engine/ENGN_ITT_c[0]"))
defineProperty("ENGN_ITT_c_R", globalPropertyf("sim/flightmodel/engine/ENGN_ITT_c[1]"))
defineProperty("ENGN_N2_L", globalPropertyf("sim/flightmodel/engine/ENGN_N2_[0]"))
defineProperty("ENGN_N2_R", globalPropertyf("sim/flightmodel/engine/ENGN_N2_[1]"))
defineProperty("ENGN_N1_L", globalPropertyf("sim/flightmodel/engine/ENGN_N1_[0]"))
defineProperty("ENGN_N1_R", globalPropertyf("sim/flightmodel/engine/ENGN_N1_[1]"))
defineProperty("ENGN_thro_0", globalPropertyf("sim/flightmodel/engine/ENGN_thro[0]"))
defineProperty("ENGN_thro_1", globalPropertyf("sim/flightmodel/engine/ENGN_thro[1]"))

defineProperty("mfd_sel_state", globalPropertyi("sim/custom/xap/mfd_sel_state"))

defineProperty("com1_freq_hz", globalPropertyi("sim/cockpit/radios/com1_freq_hz"))
defineProperty("com1_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/com1_stdby_freq_hz"))
defineProperty("com2_freq_hz", globalPropertyi("sim/cockpit/radios/com2_freq_hz"))
defineProperty("com2_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/com2_stdby_freq_hz"))

defineProperty("nav1_freq_hz", globalPropertyi("sim/cockpit/radios/nav1_freq_hz"))
defineProperty("nav1_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/nav1_stdby_freq_hz"))
defineProperty("nav2_freq_hz", globalPropertyi("sim/cockpit/radios/nav2_freq_hz"))
defineProperty("nav2_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/nav2_stdby_freq_hz"))

defineProperty("adf1_freq_hz", globalPropertyi("sim/cockpit/radios/adf1_freq_hz"))
defineProperty("adf1_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/adf1_stdby_freq_hz"))
defineProperty("adf2_freq_hz", globalPropertyi("sim/cockpit/radios/adf2_freq_hz"))
defineProperty("adf2_stdby_freq_hz", globalPropertyi("sim/cockpit/radios/adf2_stdby_freq_hz"))

defineProperty("transponder_code", globalPropertyi("sim/cockpit/radios/transponder_code"))
defineProperty("transponder_mode", globalPropertyi("sim/cockpit/radios/transponder_mode"))
defineProperty("transponder_id", globalPropertyi("sim/cockpit/radios/transponder_id"))


defineProperty("dcp_data_mode", globalPropertyi("sim/custom/xap/dcp_data_mode"))
defineProperty("dcp_tune1_rot", globalPropertyi("sim/custom/xap/dcp_tune1_rot"))
defineProperty("dcp_tune2_rot", globalPropertyi("sim/custom/xap/dcp_tune2_rot"))
defineProperty("dcp_menu1_rot", globalPropertyi("sim/custom/xap/dcp_menu1_rot"))
defineProperty("dcp_menu2_rot", globalPropertyi("sim/custom/xap/dcp_menu2_rot"))

defineProperty("radio_altimeter_height_ft_pilot", globalPropertyf("sim/cockpit2/gauges/indicators/radio_altimeter_height_ft_pilot"))

local dcp_menu_right = createCommand("xap/DCP/dcp_menu_right", "turn right MENU knob on DCP")
local dcp_menu_left = createCommand("xap/DCP/dcp_menu_left", "turn left MENU knob on DCP")
local dcp_data_right = createCommand("xap/DCP/dcp_data_right", "turn right DATA knob on DCP")
local dcp_data_left = createCommand("xap/DCP/dcp_data_left", "turn left DATA knob on DCP")
local dcp_data_sel = createCommand("xap/DCP/dcp_data_sel", "press DATA SELECT knob on DCP")

local dcp_tune_left_coarse = createCommand("xap/DCP/dcp_tune_left_coarse", "turn left TUNE knob on DCP")
local dcp_tune_left_fine = createCommand("xap/DCP/dcp_tune_left_fine", "turn left TUNE knob on DCP")
local dcp_tune_right_coarse = createCommand("xap/DCP/dcp_tune_right_coarse", "turn right TUNE knob on DCP")
local dcp_tune_right_fine = createCommand("xap/DCP/dcp_tune_right_fine", "turn right TUNE knob on DCP")
local dcp_tune_stb = createCommand("xap/DCP/dcp_tune_stb", "press STB TUNE knob on DCP")



stby_nav1_coarse_down = findCommand("sim/radios/stby_nav1_coarse_down")
stby_nav1_coarse_up = findCommand("sim/radios/stby_nav1_coarse_up")
stby_nav2_coarse_down = findCommand("sim/radios/stby_nav2_coarse_down")
stby_nav2_coarse_up = findCommand("sim/radios/stby_nav2_coarse_up")
stby_com1_coarse_down = findCommand("sim/radios/stby_com1_coarse_down")
stby_com1_coarse_up = findCommand("sim/radios/stby_com1_coarse_up")
stby_com2_coarse_down = findCommand("sim/radios/stby_com2_coarse_down")
stby_com2_coarse_up = findCommand("sim/radios/stby_com2_coarse_up")

stby_com1_fine_down = findCommand("sim/radios/stby_com1_fine_down")
stby_com1_fine_up = findCommand("sim/radios/stby_com1_fine_up")
stby_com2_fine_down = findCommand("sim/radios/stby_com2_fine_down")
stby_com2_fine_up = findCommand("sim/radios/stby_com2_fine_up")

stby_nav1_fine_down = findCommand("sim/radios/stby_nav1_fine_down")
stby_nav1_fine_up = findCommand("sim/radios/stby_nav1_fine_up")
stby_nav2_fine_down = findCommand("sim/radios/stby_nav2_fine_down")
stby_nav2_fine_up = findCommand("sim/radios/stby_nav2_fine_up")


nav1_standy_flip = findCommand("sim/radios/nav1_standy_flip")
com1_standy_flip = findCommand("sim/radios/com1_standy_flip")
nav2_standy_flip = findCommand("sim/radios/nav2_standy_flip")
com2_standy_flip = findCommand("sim/radios/com2_standy_flip")
adf1_standy_flip = findCommand("sim/radios/adf1_standy_flip")
adf2_standy_flip = findCommand("sim/radios/adf2_standy_flip")

press_transponder_ident = findCommand("sim/transponder/transponder_ident")
apu_stop = findCommand("sim/electrical/APU_off")

local font1 = loadFont('font_7.fnt')
local font2 = loadFont('font_8.fnt')
local font3 = loadFont('font_9.fnt')
local font4 = loadFont('font_10.fnt')
local font5 = loadFont('font_11.fnt')
local com1_d = 0
local com1_s_d = 0
local com2_d = 0
local com2_s_d = 0

local nav1_d = 0
local nav1_s_d = 0
local nav2_d = 0
local nav2_s_d = 0

local adf1_d = 0
local adf1_s_d = 0
local adf2_d = 0
local adf2_s_d = 0

local oil_t_l_d = 0
local oil_t_r_d = 0

local oil_p_l_d = 0
local oil_p_r_d = 0
local eltrim_d = 0
local gear_disagree = 0

local cabin_alt_d = 0
local cabin_vvi_d = 0

local flp_sbr_blank = 0

local trans_temp2 = 0

local fuelp_ind_l = 0
local fuelp_ind_r = 0


local hd_ptu_state = 0
local hd_l_engn_state = 0
local hd_r_engn_state = 0
local hd_l_pump_state = 0
local hd_r_pump_state = 0
local hd_aux_state = 0

oil_temp_left = 0
oil_temp_right = 0

oil_temp_left_smooth = get(ENGN_oil_temp_c_l)
oil_temp_right_smooth = get(ENGN_oil_temp_c_r)

time_now_f = {get(totaltime)}
last_states = {get(deploy_ratio_0),get(deploy_ratio_1),get(deploy_ratio_2), get(cabin_altitude_ft), get(sbrk_h), get(flaprqst), get(gear_handle_status),get(mfd_sumry_l),get(mfd_antice_l),get(mfd_ecs_l),get(mfd_electr_l),get(mfd_flt_ctr_l),get(mfd_fuel_l),get(mfd_hydr_l),get(mfd_frmt_l),get(mfd_checkl_l)}
last_states2 = {get(mfd_sumry_r),get(mfd_antice_r),get(mfd_ecs_r),get(mfd_electr_r),get(mfd_flt_ctr_r),get(mfd_fuel_r),get(mfd_hydr_r),get(mfd_frmt_r),get(mfd_checkl_r), get(ENGN_running_l),get(ENGN_running_r), get(mfd_sel_state), get(autop_brgsrc), get(dcp_refs)}


line1 = {"0"}
line2 = {"0"}
line3 = {"0"}
line4 = {"0"}

line5 = {"0"}
line6 = {"0"}
line7 = {"0"}
line8 = {"0"}

line9 = {"0"}
line10 = {"0"}

line11 = {"0"}
line12 = {"0"}
line13 = {"0"}
line14 = {"0"}
line15 = {"0"}
line16 = {"0"}

line17 = {"0"}
line18 = {"0"}

line19 = {"0"}
line20 = {"0"}

line21 = {"0"}
line22 = {"0"}

line23 = {"0"}
line24 = {"0"}

line25 = {"0"}
line26 = {"0"}

line27 = {"0"}
line28 = {"0"}

line29 = {"0"}
line30 = {"0"}

line31 = {"0"}

line32 = {"0"}

line33 = {"0"}
line34 = {"0"}


line35 = {"0"}
line36 = {"0"}

line37 = {"0"}
line38 = {"0"}

line39 = {"0"}

line40 = {"0"}
line41 = {"0"}

line42 = {"0"}
line43 = {"0"}

line44 = {"0"}

line45 = {"0"}

line46 = {"0"}
line46b = {"0"}
line47 = {"0"}
line48 = {"0"}
line49 = {"0"}
line50 = {"0"}
line51 = {"0"}
line51b = {0}
line52 = {"0"}
line53 = {"0"}
line54 = {"0"}
line55 = {"0"}
line56 = {"0"}
line57 = {"0"}

line58 = {"0"}
line59 = {"0"}

line60 = {"0"}
line61 = {"0"}
line62 = {"0"}

line63 = {"0"}
line64 = {"0"}
line65 = {"0"}

line66 = {"MANUAL"}

line67 = {"0"}
line68 = {"0"}
line69 = {"0"}

line70 = {"0"}
line71 = {"0"}
line72 = {"0"}
line73 = {0}

line74 = {0}
line75 = {0}
line76 = {0}

line77 = {0}
line78 = {0}
line79 = {0}

line80 = {0,0,0,0}
line81 = {0,0,0,0}
line82 = {0,0,0,0}

line83 = {"0"}
line84 = {"0"}

gears_stat_d = {get(gear_trans_red),get(gear_trans_red),get(gear_trans_red)}


cabin_alt = {0}
cabin_vvi = {0}
cabin_alt_temp = {0}

eltrim = {0}

apu = {0,0}
apu_2 = {0,0}

fuel1 = {0,0}
fuel2 = {0,0}
fuel = {0}
fuel_used = {get(m_fuel1)+get(m_fuel2)}
fuel_used_t = {0}
fuel_temp = {0}


com1_d2 = {"0"}
com1_s_d2 = {"0"}
com2_d2 = {"0"}
com2_s_d2 = {"0"}

nav1_d2 = {"0"}
nav1_s_d2 = {"0"}
nav2_d2 = {"0"}
nav2_s_d2 = {"0"}

adf1_d2 = {"0"}
adf1_s_d2 = {"0"}
adf2_d2 = {"0"}
adf2_s_d2 = {"0"}

n1_l = {"0"}
n1_r = {"0"}

n1_l2 = {"0"}
n1_r2 = {"0"}

n2_l = {"0"}
n2_r = {"0"}

n2_l2 = {"0"}
n2_r2 = {"0"}

f_n1 = {"0"}
f_n1_1 = {"0"}
f_n1_2 = {"0"}

itt_l = {"0"}
itt_r = {"0"}

oil_t_l = {"0"}
oil_t_r = {"0"}

oil_p_l = {"0"}
oil_p_r = {"0"}

ff = {"0"}

flaps = {"0"}

ecs_temp = {0,0}

cock_tempr_tmp = {get(temperature_ambient_c),get(temperature_ambient_c)}

lndg_alt = {0}

batt_volts_l = {0}
batt_volts_r = {0}
gen_amps_l = {0}
gen_amps_r = {0}
gen_volts_l = {0}
gen_volts_r = {0}
apu_volts = {0}
extp_volts = {0}


transpond_temp = {0,0,0,0}




color1 = {0.8,0.8,0.8}
color2 = {0,0.8,0}--green
color3 = {0,0.8,0.8}-- magenta
color4 = {0.8,0.0,0.0}
color5 = {0.8,0.8,0.0}--yellow
color6 = {0,0,0.8}

color_n1_l = {0,0.8,0}
color_n1_r = {0,0.8,0}
color_n2_l = {0,0.8,0}
color_n2_r = {0,0.8,0}
color_itt_l = {0,0.8,0}
color_itt_r = {0,0.8,0}

color_oilt_l = {0,0.8,0}
color_oilt_r = {0,0.8,0}

color_oilp_l = {0,0.8,0}
color_oilp_r = {0,0.8,0}

color_fuel = {0,0.8,0}
color_fuel2 = {0,0.8,0}
color_fuel3 = {0,0.8,0}

color_rev1 = {0,0.8,0}
color_rev2 = {0,0.8,0}

color_sync = {0.6,0.6,0.6}

color_trans = {0.8,0.8,0.8}

color_mach = {0.6,0.6,0.6}

color_vgen_l = {0,0.8,0}
color_vgen_r = {0,0.8,0}

color_apu = {0,0.8,0}

color_batt_l = {0,0.8,0}
color_batt_r = {0,0.8,0}

color_extp = {0,0.8,0}

color_flp = {0,0.8,0}




pos_1 = {4, 20, 69, 26}
pos_2 = {300, 802, 55, 30}
pos_3 = {406, 758, 16, 19}
pos_4 = {215, -700, 15, 12}
pos_5 = {415, -700, 15, 12}
pos_6 = {165, -600, 15, 12}
pos_7 = {575, -600, 15, 12}

press_dif = {0}
apu_off_t = 1

set(map_mode_is_HSI, 0)
set(mfd_checkl_r, 1)
--set(mfd_flt_ctr_l, 1)
--set(mfd_frmt_l, 1)
set(mfd_electr_r, 1)

set(glass_ice_cockpit, get(temperature_ambient_c))

int_temp = {get(temperature_ambient_c), get(temperature_ambient_c),get(temperature_ambient_c), get(temperature_ambient_c)}






--- DCP TUNE knob

function dcptuneleftcoarseHandler(phase)
    if 0 == phase then
	set(dcp_tune1_rot, get(dcp_tune1_rot) + 2)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 4 then
			commandOnce(stby_com1_coarse_down)
			elseif pos_1[1] == 105 then commandOnce(stby_nav1_coarse_down)

			elseif pos_1[1] == 285 then set(adf1_stdby_freq_hz, get(adf1_stdby_freq_hz)-100)
			elseif pos_1[1] == 385 then set(adf2_stdby_freq_hz, get(adf2_stdby_freq_hz)-100)
			elseif pos_1[1] == 475 then commandOnce(stby_nav2_coarse_down)
			elseif pos_1[1] == 580 then commandOnce(stby_com2_coarse_down)

			else

			if pos_1[1] == 190 and get(rev_tune) < 3 then
				if transpond_temp[2] <= 7 and transpond_temp[2] > 0 and transpond_temp[1] <= 7 then
				set(transponder_code, get(transponder_code)-100)
				elseif transpond_temp[1] <= 7 and transpond_temp[1] > 0 then set(transponder_code, get(transponder_code)-300)
				end
			end

			end
			if get(adf1_stdby_freq_hz) <190 then set(adf1_stdby_freq_hz, 530) end
			if get(adf2_stdby_freq_hz) <190 then set(adf2_stdby_freq_hz, 530) end

			if get(transponder_code) <0 then set(transponder_code, 0) end
			if transpond_temp[1] > 7 or transpond_temp[2] > 7 or transpond_temp[3] > 7 or transpond_temp[4] > 7 then set(transponder_code, 7777) end


		end
			if get(dcp_refs) == 0 then
				if get(dcp_refs_menu) == 0 then set(refspds_v1, get(refspds_v1) - 10) end
				if get(dcp_refs_menu) == 1 then set(refspds_vr, get(refspds_vr) - 10) end
				if get(dcp_refs_menu) == 2 then set(refspds_v2, get(refspds_v2) - 10) end
			end
			if get(dcp_refs) == 1 then
				if get(dcp_refs_menu) == 0 then set(refspds_vt, get(refspds_vt) - 10) end
				if get(dcp_refs_menu) == 1 then set(refspds_vga, get(refspds_vga) - 10) end
				if get(dcp_refs_menu) == 2 then set(refspds_vref, get(refspds_vref) - 10) end
			end
    end
return 1
end
--
registerCommandHandler(dcp_tune_left_coarse, 1, dcptuneleftcoarseHandler)


function dcptunerightcoarseHandler(phase)
    if 0 == phase then
	set(dcp_tune1_rot, get(dcp_tune1_rot) - 2)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 4 then
			commandOnce(stby_com1_coarse_up)
			elseif pos_1[1] == 105 then commandOnce(stby_nav1_coarse_up)

			elseif pos_1[1] == 285 then set(adf1_stdby_freq_hz, get(adf1_stdby_freq_hz)+100)
			elseif pos_1[1] == 385 then set(adf2_stdby_freq_hz, get(adf2_stdby_freq_hz)+100)
			elseif pos_1[1] == 475 then commandOnce(stby_nav2_coarse_up)
			elseif pos_1[1] == 580 then commandOnce(stby_com2_coarse_up)

			else

			if pos_1[1] == 190 and get(rev_tune) < 3 then
				if transpond_temp[2] < 7 and transpond_temp[1] <= 7 then
				set(transponder_code, get(transponder_code)+100)
				elseif transpond_temp[1] < 7 then set(transponder_code, get(transponder_code)+300)
				end
			end

			end
			if get(adf1_stdby_freq_hz) > 1700 then set(adf1_stdby_freq_hz, 1700) end
			if get(adf2_stdby_freq_hz) > 1700 then set(adf2_stdby_freq_hz, 1700) end

			if get(transponder_code) > 7777 then set(transponder_code, 7777) end
			if transpond_temp[1] > 7 or transpond_temp[2] > 7 or transpond_temp[3] > 7 or transpond_temp[4] > 7 then set(transponder_code, 7777) end


		end
			if get(dcp_refs) == 0 then
				if get(dcp_refs_menu) == 0 then set(refspds_v1, get(refspds_v1) + 10) end
				if get(dcp_refs_menu) == 1 then set(refspds_vr, get(refspds_vr) + 10) end
				if get(dcp_refs_menu) == 2 then set(refspds_v2, get(refspds_v2) + 10) end
			end
			if get(dcp_refs) == 1 then
				if get(dcp_refs_menu) == 0 then set(refspds_vt, get(refspds_vt) + 10) end
				if get(dcp_refs_menu) == 1 then set(refspds_vga, get(refspds_vga) + 10) end
				if get(dcp_refs_menu) == 2 then set(refspds_vref, get(refspds_vref) + 10) end
			end
    end
return 1
end

registerCommandHandler(dcp_tune_right_coarse, 1, dcptunerightcoarseHandler)



function dcptuneleftfineHandler(phase)
    if 0 == phase then
	set(dcp_tune2_rot, get(dcp_tune2_rot) + 2)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 4 then
			commandOnce(stby_com1_fine_down)
			elseif pos_1[1] == 105 then commandOnce(stby_nav1_fine_down)
--			elseif pos_1[1] == 190 and get(rev_tune) < 3 then set(transponder_code, get(transponder_code)-1)
			elseif pos_1[1] == 285 then set(adf1_stdby_freq_hz, get(adf1_stdby_freq_hz)-1)
			elseif pos_1[1] == 385 then set(adf2_stdby_freq_hz, get(adf2_stdby_freq_hz)-1)
			elseif pos_1[1] == 475 then commandOnce(stby_nav2_fine_down)
			elseif pos_1[1] == 580 then commandOnce(stby_com2_fine_down)

			else

			if pos_1[1] == 190 and get(rev_tune) < 3 then
				if transpond_temp[4] <= 7 and transpond_temp[4] > 0 and transpond_temp[3] <= 7 then
				set(transponder_code, get(transponder_code)-1)
				elseif transpond_temp[3] <= 7 and transpond_temp[3] > 0 then set(transponder_code, get(transponder_code)-3)
				end
			end

			end
			if get(adf1_stdby_freq_hz) <190 then set(adf1_stdby_freq_hz, 530) end
			if get(adf2_stdby_freq_hz) <190 then set(adf2_stdby_freq_hz, 530) end

			if get(transponder_code) <0 then set(transponder_code, 0) end
			if transpond_temp[1] > 7 or transpond_temp[2] > 7 or transpond_temp[3] > 7 or transpond_temp[4] > 7 then set(transponder_code, 7777) end



		end
			if get(dcp_refs) == 0 then
				if get(dcp_refs_menu) == 0 then set(refspds_v1, get(refspds_v1) - 1) end
				if get(dcp_refs_menu) == 1 then set(refspds_vr, get(refspds_vr) - 1) end
				if get(dcp_refs_menu) == 2 then set(refspds_v2, get(refspds_v2) - 1) end
			end
			if get(dcp_refs) == 1 then
				if get(dcp_refs_menu) == 0 then set(refspds_vt, get(refspds_vt) - 1) end
				if get(dcp_refs_menu) == 1 then set(refspds_vga, get(refspds_vga) - 1) end
				if get(dcp_refs_menu) == 2 then set(refspds_vref, get(refspds_vref) - 1) end
			end
    end
return 1
end

registerCommandHandler(dcp_tune_left_fine, 1, dcptuneleftfineHandler)


function dcptunerightfineHandler(phase)
    if 0 == phase then
	set(dcp_tune2_rot, get(dcp_tune2_rot) - 2)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 4 then
			commandOnce(stby_com1_fine_up)
			elseif pos_1[1] == 105 then commandOnce(stby_nav1_fine_up)
--			elseif pos_1[1] == 190 and get(rev_tune) < 3 then set(transponder_code, get(transponder_code)+1)
			elseif pos_1[1] == 285 then set(adf1_stdby_freq_hz, get(adf1_stdby_freq_hz)+1)
			elseif pos_1[1] == 385 then set(adf2_stdby_freq_hz, get(adf2_stdby_freq_hz)+1)
			elseif pos_1[1] == 475 then commandOnce(stby_nav2_fine_up)
			elseif pos_1[1] == 580 then commandOnce(stby_com2_fine_up)

			else

			if pos_1[1] == 190 and get(rev_tune) < 3 then
				if transpond_temp[4] < 7 and transpond_temp[3] <= 7 then
				set(transponder_code, get(transponder_code)+1)
				elseif	transpond_temp[3] < 7 then set(transponder_code, get(transponder_code)+3)
				end
			end

			end
			if get(adf1_stdby_freq_hz) > 1700 then set(adf1_stdby_freq_hz, 1700) end
			if get(adf2_stdby_freq_hz) > 1700 then set(adf2_stdby_freq_hz, 1700) end

			if get(transponder_code) > 7777 then set(transponder_code, 7777) end
			if transpond_temp[1] > 7 or transpond_temp[2] > 7 or transpond_temp[3] > 7 or transpond_temp[4] > 7 then set(transponder_code, 7777) end

		end
			if get(dcp_refs) == 0 then
				if get(dcp_refs_menu) == 0 then set(refspds_v1, get(refspds_v1) + 1) end
				if get(dcp_refs_menu) == 1 then set(refspds_vr, get(refspds_vr) + 1) end
				if get(dcp_refs_menu) == 2 then set(refspds_v2, get(refspds_v2) + 1) end
			end
			if get(dcp_refs) == 1 then
				if get(dcp_refs_menu) == 0 then set(refspds_vt, get(refspds_vt) + 1) end
				if get(dcp_refs_menu) == 1 then set(refspds_vga, get(refspds_vga) + 1) end
				if get(dcp_refs_menu) == 2 then set(refspds_vref, get(refspds_vref) + 1) end
			end
    end
return 1
end

registerCommandHandler(dcp_tune_right_fine, 1, dcptunerightfineHandler)



function dcptunestbHandler(phase)
    if 0 == phase then
		if get(mfd_sel_state) == 1 and get(rev_tune) < 3 then
			if pos_1[1] == 4 then
			commandOnce(com1_standy_flip)
			elseif pos_1[1] == 105 then commandOnce(nav1_standy_flip)
--			elseif pos_1[1] == 190 then pos_1 = {285,20,69,26}
			elseif pos_1[1] == 285 then commandOnce(adf1_standy_flip)
			elseif pos_1[1] == 385 then commandOnce(adf2_standy_flip)
			elseif pos_1[1] == 475 then commandOnce(nav2_standy_flip)
			elseif pos_1[1] == 580 then commandOnce(com2_standy_flip)

			end
		end
    end
return 1
end

registerCommandHandler(dcp_tune_stb, 1, dcptunestbHandler)


--//


-- DCP MENU knob


function dcprightHandler(phase)
    if 0 == phase then
	set(dcp_menu1_rot, get(dcp_menu1_rot) - 8)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 4 then
			pos_1[1] = 105
			elseif pos_1[1] == 105 then pos_1 = {190,48,69,26}
			elseif pos_1[1] == 190 then pos_1 = {285,20,69,26}
			elseif pos_1[1] == 285 then pos_1 = {385,20,69,26}
			elseif pos_1[1] == 385 then pos_1 = {475,20,69,26}
			elseif pos_1[1] == 475 then pos_1 = {580,20,69,26}
--			elseif pos_1[1] == 580 then pos_1 = {4,20,69,26}

			end
		end
			if get(autop_brgsrc) > -1 then
				if get(autop_brgsrc) ~= 1 then set(autop_brgsrc, 1) else set(autop_brgsrc, 0) end
			end
			if get(dcp_refs) > -1 and get(dcp_refs) < 2 then
				if get(dcp_refs_menu) ~= 0 then set(dcp_refs_menu, get(dcp_refs_menu) - 1) else set(dcp_refs_menu, 2) end
			end
    end
return 1
end

registerCommandHandler(dcp_menu_right, 1, dcprightHandler)

function dcpleftHandler(phase)
    if 0 == phase then
	set(dcp_menu1_rot, get(dcp_menu1_rot) + 8)
		if get(mfd_sel_state) == 1 then
			if pos_1[1] == 580 then
			pos_1 = {475,20,69,26}
			elseif pos_1[1] == 475 then pos_1 = {385,20,69,26}
			elseif pos_1[1] == 385 then pos_1 = {285,20,69,26}
			elseif pos_1[1] == 285 then pos_1 = {190,48,69,26}
			elseif pos_1[1] == 190 then pos_1 = {105,20,69,26}
			elseif pos_1[1] == 105 then pos_1 = {4,20,69,26}
--			elseif pos_1[1] == 580 then pos_1 = {4,20,69,26}

			end
		end
			if get(autop_brgsrc) > -1 then
				if get(autop_brgsrc) ~= 0 then set(autop_brgsrc, 0) else set(autop_brgsrc, 1) end
			end
			if get(dcp_refs) > -1 and get(dcp_refs) < 2 then
				if get(dcp_refs_menu) ~= 2 then set(dcp_refs_menu, get(dcp_refs_menu) + 1) else set(dcp_refs_menu, 0) end
			end
    end
return 1
end

registerCommandHandler(dcp_menu_left, 1, dcpleftHandler)


-- DCP DATA knob


function dcpdatarightHandler(phase)
    if 0 == phase then
	set(dcp_menu2_rot, get(dcp_menu2_rot) - 8)
		if get(mfd_sel_state) == 1  and get(rev_tune) < 3 then
			if pos_1[1] == 190 then
			set(transponder_mode, get(transponder_mode)+1)
--			pos_1[1] = 105
--			elseif pos_1[1] == 105 then pos_1 = {190,48,69,26}
--			elseif pos_1[1] == 190 then pos_1 = {285,20,69,26}
--			elseif pos_1[1] == 285 then pos_1 = {385,20,69,26}
--			elseif pos_1[1] == 385 then pos_1 = {475,20,69,26}
--			elseif pos_1[1] == 475 then pos_1 = {580,20,69,26}
--			elseif pos_1[1] == 580 then pos_1 = {4,20,69,26}
			if get(transponder_mode) > 2 then set(transponder_mode, 2) end
			end
			if pos_1[1] == 285 and get(adf1_power) < 4 then set(adf1_power, get(adf1_power)+1) end
			if pos_1[1] == 385 and get(adf2_power) < 4 then set(adf2_power, get(adf2_power)+1) end
		end
		if get(autop_brgsrc) == 0 then
			if get(EFIS_1_selection_pilot) ~= 2 then set(EFIS_1_selection_pilot, 2) else set(EFIS_1_selection_pilot, 0) end
		end

		if get(autop_brgsrc) == 1 then
			if get(EFIS_2_selection_pilot)~= 2 then set(EFIS_2_selection_pilot, 2) else set(EFIS_2_selection_pilot, 0) end
		end
		if get(dcp_refs) == 2 then
			set(radio_altimeter_bug_ft_pilot, get(radio_altimeter_bug_ft_pilot) + 10)
		end
    end
return 1
end

registerCommandHandler(dcp_data_right, 1, dcpdatarightHandler)

function dcpdataleftHandler(phase)
    if 0 == phase then
	set(dcp_menu2_rot, get(dcp_menu2_rot) + 8)
		if get(mfd_sel_state) == 1 and get(rev_tune) < 3 then
			if pos_1[1] == 190 then
			set(transponder_mode, get(transponder_mode)-1)
--			pos_1 = {475,20,69,26}
--			elseif pos_1[1] == 475 then pos_1 = {385,20,69,26}
--			elseif pos_1[1] == 385 then pos_1 = {285,20,69,26}
--			elseif pos_1[1] == 285 then pos_1 = {190,48,69,26}
--			elseif pos_1[1] == 190 then pos_1 = {105,20,69,26}
--			elseif pos_1[1] == 105 then pos_1 = {4,20,69,26}
--			elseif pos_1[1] == 580 then pos_1 = {4,20,69,26}
			if get(transponder_mode) < 0 then set(transponder_mode, 0) end

			end
			if pos_1[1] == 285 and get(adf1_power) > 0 then set(adf1_power, get(adf1_power)-1) end
			if pos_1[1] == 385 and get(adf2_power) > 0 then set(adf2_power, get(adf2_power)-1) end
		end
		if get(autop_brgsrc) == 0 then
			if get(EFIS_1_selection_pilot) ~= 0 then set(EFIS_1_selection_pilot, 0) else set(EFIS_1_selection_pilot, 2) end
		end

		if get(autop_brgsrc) == 1 then
			if get(EFIS_2_selection_pilot)~= 0 then set(EFIS_2_selection_pilot, 0) else set(EFIS_2_selection_pilot, 2) end
		end
		if get(dcp_refs) == 2 then
			set(radio_altimeter_bug_ft_pilot, get(radio_altimeter_bug_ft_pilot) - 10)
		end
    end
return 1
end

registerCommandHandler(dcp_data_left, 1, dcpdataleftHandler)


function dcpdataselHandler(phase)
    if 0 == phase then
		if get(mfd_sel_state) == 1 and get(rev_tune) < 3 then
			if pos_1[1] == 190 then
			commandOnce(press_transponder_ident)
--			elseif pos_1[1] == 105 then commandOnce(nav1_standy_flip)
--			elseif pos_1[1] == 190 then pos_1 = {285,20,69,26}
--			elseif pos_1[1] == 285 then commandOnce(adf1_standy_flip)
--			elseif pos_1[1] == 385 then commandOnce(adf2_standy_flip)
--			elseif pos_1[1] == 475 then commandOnce(nav2_standy_flip)
--			elseif pos_1[1] == 580 then commandOnce(com2_standy_flip)

			end
		end
		if get(dcp_refs) == 2 then
			set(radio_altimeter_bug_ft_pilot, 600)
		end
    end
return 1
end

registerCommandHandler(dcp_data_sel, 1, dcpdataselHandler)

---//








	--

--[=[components = {
    rectangle {
        position = { 0, 0, size[1], size[2] };
        color = { 0.05, 0.05, 0.05, 1.0 };
    };

};
--]=]


function update()


-- essential power
if get(onground_any) == 0 and get(APU_generator_amps) < 0.01 and get(generator_amps_l) < 0.01 and get(generator_amps_r) < 0.01 and get(gpu_on) ~= 1 then set(electr_ess_p_status,1) else set(electr_ess_p_status,0) end













-- fuel pump auto states

if fuelp_ind_r == 1 and get(fuel_xpump_r) == 1 then set(fuel_pump_r_astate,1) else set(fuel_pump_r_astate,0) end
if fuelp_ind_l == 1 and get(fuel_xpump_l) == 1 then set(fuel_pump_l_astate,1) else set(fuel_pump_l_astate,0) end







-- antice xbleed valve



if get(ENGN_running_l) > 0 and get(antice_wngsource_r) == 0 and get(antice_wing_h) > 0 then set(antice_wings_xbleed_valve, 1) end
if get(ENGN_running_r) > 0 and get(antice_wngsource_r) == 2 and get(antice_wing_h) > 0 then set(antice_wings_xbleed_valve, 1) end
if get(antice_wngsource_r) == 0 and get(ENGN_running_l) < 1 then set(antice_wings_xbleed_valve, 0) end
if get(antice_wngsource_r) == 2 and get(ENGN_running_r) < 1 then set(antice_wings_xbleed_valve, 0) end
if get(antice_wngsource_r) == 1 or get(antice_wing_h) < 1 then set(antice_wings_xbleed_valve, 0) end









-- ref speeds limits

if get(refspds_v1) < 20 then set(refspds_v1, 20) elseif get(refspds_v1) > 200 then set(refspds_v1, 200) end
if get(refspds_vr) < 20 then set(refspds_vr, 20) elseif get(refspds_vr) > 200 then set(refspds_vr, 200) end
if get(refspds_v2) < 20 then set(refspds_v2, 20) elseif get(refspds_v2) > 200 then set(refspds_v2, 200) end
if get(refspds_vt) < 20 then set(refspds_vt, 20) elseif get(refspds_vt) > 200 then set(refspds_vt, 200) end
if get(refspds_vga) < 20 then set(refspds_vga, 20) elseif get(refspds_vga) > 200 then set(refspds_vga, 200) end
if get(refspds_vref) < 20 then set(refspds_vref, 20) elseif get(refspds_vref) > 200 then set(refspds_vref, 200) end










-- dcp menu logic

if last_states2[12] - get(mfd_sel_state) ~= 0 and get(mfd_sel_state) ~= 0 then
set(autop_brgsrc, -1)
set(dcp_refs, -1)
end



if last_states2[13] - get(autop_brgsrc) ~= 0 and get(autop_brgsrc) > -1 then
set(mfd_sel_state, 0)
set(dcp_refs, -1)
end

if last_states2[14] - get(dcp_refs) ~= 0 and get(dcp_refs) > -1 then
set(mfd_sel_state, 0)
set(autop_brgsrc, -1)
end



-- hdr ptu logic
if get(ptu_h) > 1 then
	if get(ENGN_running_r) > 0 then
	hd_ptu_state = 1
	end
else
	if get(ptu_h) == 1 then
		if hd_r_engn_state == 1 or hd_r_pump_state == 1 then
		hd_ptu_state = 1
		else
		hd_ptu_state = 0
		end
	else
	hd_ptu_state = 0
	end
end

-- hdr engn logic

if get(ENGN_running_l) > 0 and get(ENGN_running_r) > 0 and get(hydr_l_sov_h) > 0 then
hd_l_engn_state = 1
else
	if get(ENGN_running_l) > 0 and get(ENGN_running_r) < 1 and get(hydr_l_sov_h) > 0 then
	hd_l_engn_state = 1
	hd_r_engn_state = 0
	end
end

if get(ENGN_running_r) > 0 and get(ENGN_running_l) > 0 and get(hydr_r_sov_h) > 0 then
hd_r_engn_state = 1
else
	if get(ENGN_running_r) > 0 and get(ENGN_running_l) < 1 and get(hydr_r_sov_h) > 0 then
	hd_r_engn_state = 1
	hd_l_engn_state = 0
	end
end

if get(ENGN_running_l) < 1 and get(ENGN_running_r) < 1 and get(hydr_l_sov_h) < 2 and get(hydr_r_sov_h) < 2 then
hd_r_engn_state = 0
hd_l_engn_state = 0
end


-- hydr pumps logic

if get(ENGN_running_r) > 0 then
	if get(l_hpump_h) > 1 then
	hd_l_pump_state = 1
	else
		if get(l_hpump_h) == 1 then
			if get(flaprat) > 0 or get(flaprqst) > 0 then -- or hd_l_engn_state == 0
			hd_l_pump_state = 1
			else
			hd_l_pump_state = 0
			end
	--		if get(ENGN_running_l) < 1 then hd_l_pump_state = 1 end
		else
		hd_l_pump_state = 0
		end
	end
else
hd_l_pump_state = 0
	if get(l_hpump_h) > 1 then
	hd_l_pump_state = 1
	end
end

if get(ENGN_running_l) > 0 then
	if get(r_hpump_h) > 1 then
	hd_r_pump_state = 1
	else
		if get(r_hpump_h) == 1 then
			if get(flaprat) > 0 or get(flaprqst) > 0 then -- or hd_r_engn_state == 0
			hd_r_pump_state = 1
			else
			hd_r_pump_state = 0
			end
--			if get(ENGN_running_r) < 1 then hd_r_pump_state = 1 end
		else
		hd_r_pump_state = 0
		end
	end
else

hd_r_pump_state = 0
	if get(r_hpump_h) > 1 then
	hd_r_pump_state = 1
	end
end

if hd_l_pump_state == 1 or hd_r_pump_state == 1 or hd_l_engn_state == 1 or hd_r_engn_state == 1 then set(electric_hydraulic_pump_on, 1) else set(electric_hydraulic_pump_on, 0) end

if hd_r_engn_state == 0 then
set(right_hydr_st, 1)
else
set(right_hydr_st, 0)
end


--speedbrake1_deg_0

if hd_l_pump_state == 0 and hd_l_engn_state == 0 then set(rel_hydsys0, 6) else set(rel_hydsys0, 0) end

if hd_r_pump_state == 0 and hd_r_engn_state == 0 then set(rel_hydsys2, 6) else set(rel_hydsys2, 0) end



--if hd_l_pump_state == 1 or hd_l_engn_state == 1 then else end

if hd_r_pump_state == 1 or hd_r_engn_state == 1 then
set(spoil_outb_r, get(spoiler1_deg_1))
set(spoil_outb_l, get(spoiler1_deg_0))
set(sbrk_outb_r, get(speedbrake1_deg_1))
set(sbrk_outb_l, get(speedbrake1_deg_0))
if get(pitch_d_2) < 0 then set(hstab_r, get(hstab2_elv1def)*(1+get(pitch_d_2))) else set(hstab_r, get(hstab2_elv1def)) end
else
set(spoil_outb_l, 0)
set(spoil_outb_r, 0)
set(sbrk_outb_r, 0)
set(sbrk_outb_l, 0)
if get(pitch_d_2) < 0 then set(hstab_r, get(hstab2_elv1def)*0.6*(1+get(pitch_d_2))) else set(hstab_r, get(hstab2_elv1def)*0.6) end
end

if hd_l_pump_state == 1 or hd_l_engn_state == 1 then
set(spoil_inb_r, get(spoiler2_deg_1))
set(spoil_inb_l, get(spoiler2_deg_0))
set(sbrk_inb_r, get(speedbrake1_deg_1))
set(sbrk_inb_l, get(speedbrake1_deg_0))

if get(pitch_d_2) > 0 then set(hstab_l, get(hstab1_elv1def)*(1-get(pitch_d_2))) else set(hstab_l, get(hstab1_elv1def)) end
else
set(spoil_inb_r, 0)
set(spoil_inb_l, 0)
set(sbrk_inb_r, 0)
set(sbrk_inb_l, 0)
if get(pitch_d_2) > 0 then set(hstab_l, get(hstab1_elv1def)*0.6*(1-get(pitch_d_2))) else set(hstab_l, get(hstab1_elv1def)*0.6) end
end



if hd_r_pump_state == 1 or hd_r_engn_state == 1 or hd_r_pump_state == 1 or hd_r_engn_state == 1 then
set(rel_flap_act, 0)
else
	set(rel_flap_act, 6)
end


if hd_l_pump_state == 1 or hd_l_engn_state == 1 then
set(rel_gear_act, 0)
else
	if hd_r_pump_state == 1 or hd_r_engn_state == 1 then
		if hd_ptu_state < 1 then
		set(rel_gear_act, 6)
		else
		set(rel_gear_act, 0)
		end
	else
	set(rel_gear_act, 0)
	end
end

if get(aux_hpump_h) > 0 then
--	if hd_r_pump_state == 1 or hd_r_engn_state == 1 then
--	hd_aux_state = 0
--	else
	hd_aux_state = 1
--	end
else
hd_aux_state = 0
end



--
if get(hydr_altn_flp_h) > 0 or get(right_hydr_st) > 0 then
if get(flaprat) < 0.34 then set(acf_flap_deftime, 120) else set(acf_flap_deftime, 30) end
else
if get(flaprat) < 0.34 then set(acf_flap_deftime, 30) else set(acf_flap_deftime, 15) end
end



if get(hydr_pres_1) > 10 then
color_flp = {0,0.8,0}
else
color_flp = {0.8,0.8,0.0}
end



-- distinguishing flaps speedbrakes and gear menu

if get(sbrk_h) < 0.03 and get(flaprqst) == 0  and get(onground_any) == 0 and get(gear_handle_status) == 0 then
	if last_states[5] - get(sbrk_h) ~= 0 or last_states[6] - get(flaprqst) ~= 0 or last_states[7] - get(gear_handle_status) ~= 0 then
	time_now_f[1] = get(totaltime)
	end
else
flp_sbr_blank = 0
end

if get(totaltime) - time_now_f[1] > 30 and get(sbrk_h) < 0.03 and get(flaprqst) == 0 and get(onground_any) == 0 and get(gear_handle_status) == 0 then
flp_sbr_blank = 1
else
flp_sbr_blank = 0
end









-- com1
com1_d = get(com1_freq_hz)--13196

com1_d2[1] = math.floor(com1_d / 10000)--1
com1_d = com1_d - com1_d2[1]*10000--3196
com1_d2[2] = math.floor(com1_d / 1000)--3
com1_d = com1_d - com1_d2[2]*1000--196
com1_d2[3] = math.floor(com1_d / 100)--1
com1_d = com1_d - com1_d2[3]*100--96
com1_d2[4] = math.floor(com1_d / 10)--9
com1_d2[5] = com1_d - com1_d2[4]*10--6


com1_s_d = get(com1_stdby_freq_hz)

com1_s_d2[1] = math.floor(com1_s_d / 10000)--1
com1_s_d = com1_s_d - com1_s_d2[1]*10000--3196
com1_s_d2[2] = math.floor(com1_s_d / 1000)--3
com1_s_d = com1_s_d - com1_s_d2[2]*1000--196
com1_s_d2[3] = math.floor(com1_s_d / 100)--1
com1_s_d = com1_s_d - com1_s_d2[3]*100--96
com1_s_d2[4] = math.floor(com1_s_d / 10)--9
com1_s_d2[5] = com1_s_d - com1_s_d2[4]*10--6



line1 = {string.format("%s%s%s%s%s%s%s", com1_d2[1],com1_d2[2], com1_d2[3],".", com1_d2[4], com1_d2[5],"0")}
line2 = {string.format("%s%s%s%s%s%s%s", com1_s_d2[1],com1_s_d2[2], com1_s_d2[3],".", com1_s_d2[4], com1_s_d2[5],"0")}

--//
-- com2

com2_d = get(com2_freq_hz)--13196

com2_d2[1] = math.floor(com2_d / 10000)--1
com2_d = com2_d - com2_d2[1]*10000--3196
com2_d2[2] = math.floor(com2_d / 1000)--3
com2_d = com2_d - com2_d2[2]*1000--196
com2_d2[3] = math.floor(com2_d / 100)--1
com2_d = com2_d - com2_d2[3]*100--96
com2_d2[4] = math.floor(com2_d / 10)--9
com2_d2[5] = com2_d - com2_d2[4]*10--6


com2_s_d = get(com2_stdby_freq_hz)

com2_s_d2[1] = math.floor(com2_s_d / 10000)--1
com2_s_d = com2_s_d - com2_s_d2[1]*10000--3196
com2_s_d2[2] = math.floor(com2_s_d / 1000)--3
com2_s_d = com2_s_d - com2_s_d2[2]*1000--196
com2_s_d2[3] = math.floor(com2_s_d / 100)--1
com2_s_d = com2_s_d - com2_s_d2[3]*100--96
com2_s_d2[4] = math.floor(com2_s_d / 10)--9
com2_s_d2[5] = com2_s_d - com2_s_d2[4]*10--6



line3 = {string.format("%s%s%s%s%s%s%s", com2_d2[1],com2_d2[2], com2_d2[3],".", com2_d2[4], com2_d2[5],"0")}
line4 = {string.format("%s%s%s%s%s%s%s", com2_s_d2[1],com2_s_d2[2], com2_s_d2[3],".", com2_s_d2[4], com2_s_d2[5],"0")}

--//
--nav1

nav1_d = get(nav1_freq_hz)--13196

nav1_d2[1] = math.floor(nav1_d / 10000)--1
nav1_d = nav1_d - nav1_d2[1]*10000--3196
nav1_d2[2] = math.floor(nav1_d / 1000)--3
nav1_d = nav1_d - nav1_d2[2]*1000--196
nav1_d2[3] = math.floor(nav1_d / 100)--1
nav1_d = nav1_d - nav1_d2[3]*100--96
nav1_d2[4] = math.floor(nav1_d / 10)--9
nav1_d2[5] = nav1_d - nav1_d2[4]*10--6


nav1_s_d = get(nav1_stdby_freq_hz)

nav1_s_d2[1] = math.floor(nav1_s_d / 10000)--1
nav1_s_d = nav1_s_d - nav1_s_d2[1]*10000--3196
nav1_s_d2[2] = math.floor(nav1_s_d / 1000)--3
nav1_s_d = nav1_s_d - nav1_s_d2[2]*1000--196
nav1_s_d2[3] = math.floor(nav1_s_d / 100)--1
nav1_s_d = nav1_s_d - nav1_s_d2[3]*100--96
nav1_s_d2[4] = math.floor(nav1_s_d / 10)--9
nav1_s_d2[5] = nav1_s_d - nav1_s_d2[4]*10--6



line5 = {string.format("%s%s%s%s%s%s", nav1_d2[1],nav1_d2[2], nav1_d2[3],".", nav1_d2[4], nav1_d2[5])}
line6 = {string.format("%s%s%s%s%s%s", nav1_s_d2[1],nav1_s_d2[2], nav1_s_d2[3],".", nav1_s_d2[4], nav1_s_d2[5])}


--line1 = {string.format("%s%s%s%s%s%s", nav1_d2[1],nav1_d2[2], nav1_d2[3],".", nav1_d2[4], nav1_d2[5])}
--//
--nav2

nav2_d = get(nav2_freq_hz)--13196

nav2_d2[1] = math.floor(nav2_d / 10000)--1
nav2_d = nav2_d - nav2_d2[1]*10000--3196
nav2_d2[2] = math.floor(nav2_d / 1000)--3
nav2_d = nav2_d - nav2_d2[2]*1000--196
nav2_d2[3] = math.floor(nav2_d / 100)--1
nav2_d = nav2_d - nav2_d2[3]*100--96
nav2_d2[4] = math.floor(nav2_d / 10)--9
nav2_d2[5] = nav2_d - nav2_d2[4]*10--6


nav2_s_d = get(nav2_stdby_freq_hz)

nav2_s_d2[1] = math.floor(nav2_s_d / 10000)--1
nav2_s_d = nav2_s_d - nav2_s_d2[1]*10000--3196
nav2_s_d2[2] = math.floor(nav2_s_d / 1000)--3
nav2_s_d = nav2_s_d - nav2_s_d2[2]*1000--196
nav2_s_d2[3] = math.floor(nav2_s_d / 100)--1
nav2_s_d = nav2_s_d - nav2_s_d2[3]*100--96
nav2_s_d2[4] = math.floor(nav2_s_d / 10)--9
nav2_s_d2[5] = nav2_s_d - nav2_s_d2[4]*10--6



line7 = {string.format("%s%s%s%s%s%s", nav2_d2[1],nav2_d2[2], nav2_d2[3],".", nav2_d2[4], nav2_d2[5])}
line8 = {string.format("%s%s%s%s%s%s", nav2_s_d2[1],nav2_s_d2[2], nav2_s_d2[3],".", nav2_s_d2[4], nav2_s_d2[5])}

--//

--adf1 / adf2

adf1_d = get(adf1_freq_hz)*10--13196

adf1_d2[1] = math.floor(adf1_d / 10000)--1
adf1_d = adf1_d - adf1_d2[1]*10000--3196
adf1_d2[2] = math.floor(adf1_d / 1000)--3
adf1_d = adf1_d - adf1_d2[2]*1000--196
adf1_d2[3] = math.floor(adf1_d / 100)--1
adf1_d = adf1_d - adf1_d2[3]*100--96
adf1_d2[4] = math.floor(adf1_d / 10)--9
adf1_d2[5] = adf1_d - adf1_d2[4]*10--6



adf1_s_d = get(adf1_stdby_freq_hz)*10

adf1_s_d2[1] = math.floor(adf1_s_d / 10000)--1
adf1_s_d = adf1_s_d - adf1_s_d2[1]*10000--3196
adf1_s_d2[2] = math.floor(adf1_s_d / 1000)--3
adf1_s_d = adf1_s_d - adf1_s_d2[2]*1000--196
adf1_s_d2[3] = math.floor(adf1_s_d / 100)--1
adf1_s_d = adf1_s_d - adf1_s_d2[3]*100--96
adf1_s_d2[4] = math.floor(adf1_s_d / 10)--9
adf1_s_d2[5] = adf1_s_d - adf1_s_d2[4]*10--6





adf2_d = get(adf2_freq_hz)*10--13196

adf2_d2[1] = math.floor(adf2_d / 10000)--1
adf2_d = adf2_d - adf2_d2[1]*10000--3196
adf2_d2[2] = math.floor(adf2_d / 1000)--3
adf2_d = adf2_d - adf2_d2[2]*1000--196
adf2_d2[3] = math.floor(adf2_d / 100)--1
adf2_d = adf2_d - adf2_d2[3]*100--96
adf2_d2[4] = math.floor(adf2_d / 10)--9
adf2_d2[5] = adf2_d - adf2_d2[4]*10--6


adf2_s_d = get(adf2_stdby_freq_hz)*10

adf2_s_d2[1] = math.floor(adf2_s_d / 10000)--1
adf2_s_d = adf2_s_d - adf2_s_d2[1]*10000--3196
adf2_s_d2[2] = math.floor(adf2_s_d / 1000)--3
adf2_s_d = adf2_s_d - adf2_s_d2[2]*1000--196
adf2_s_d2[3] = math.floor(adf2_s_d / 100)--1
adf2_s_d = adf2_s_d - adf2_s_d2[3]*100--96
adf2_s_d2[4] = math.floor(adf2_s_d / 10)--9
adf2_s_d2[5] = adf2_s_d - adf2_s_d2[4]*10--6

--]=]

line9 = {string.format("%s%s%s%s%s%s", adf1_d2[1],adf1_d2[2], adf1_d2[3], adf1_d2[4], ".", adf1_d2[5])}
line10 = {string.format("%s%s%s%s%s%s", adf1_s_d2[1],adf1_s_d2[2], adf1_s_d2[3], adf1_s_d2[4], ".",adf1_s_d2[5])}

line40 = {string.format("%s%s%s%s%s%s", adf2_d2[1],adf2_d2[2], adf2_d2[3], adf2_d2[4], ".", adf2_d2[5])}
line41 = {string.format("%s%s%s%s%s%s", adf2_s_d2[1],adf2_s_d2[2], adf2_s_d2[3], adf2_s_d2[4], ".",adf2_s_d2[5])}


-- transponder 3436
transpond_temp[1] = math.floor(get(transponder_code)/1000) --3
trans_temp2 = get(transponder_code) - transpond_temp[1]*1000 -- 436
transpond_temp[2] = math.floor(trans_temp2/100) -- 4
trans_temp2 = trans_temp2 - transpond_temp[2]*100 -- 36
transpond_temp[3] = math.floor(trans_temp2/10) -- 3
transpond_temp[4] = trans_temp2 - transpond_temp[3]*10 -- 4
--//


line42 = {string.format("%s%s%s%s", transpond_temp[1],transpond_temp[2], transpond_temp[3], transpond_temp[4])}




if get(transponder_mode) >= 2 then
color_trans = {0,0.8,0}
line43 = {string.format("%s", "TA/RA")}
else
color_trans = {0.8,0.8,0.8}
end

if get(transponder_mode) == 1 then
line43 = {string.format("%s", "STBY")}
else
 if get(transponder_mode) == 0 then
 line43 = {string.format("%s", "OFF")}
 end
end

if get(transponder_id) == 1 then line44 = {string.format("%s", "IDENT")} else line44 = {string.format("%s", "")} end


-- N1 N2 & ITT  --

n1_l = {math.modf(get(ENGN_N1_L)*10)}
n1_r = {math.modf(get(ENGN_N1_R)*10)}

n1_l2[1] = math.floor(n1_l[1]/10)
n1_l2[2] = n1_l[1] - n1_l2[1]*10

n1_r2[1] = math.floor(n1_r[1]/10)
n1_r2[2] = n1_r[1] - n1_r2[1]*10

--N2
n2_l = {math.modf(get(ENGN_N2_L)*10)}
n2_r = {math.modf(get(ENGN_N2_R)*10)}

n2_l2[1] = math.floor(n2_l[1]/10)
n2_l2[2] = n2_l[1] - n2_l2[1]*10

n2_r2[1] = math.floor(n2_r[1]/10)
n2_r2[2] = n2_r[1] - n2_r2[1]*10

-- n1 fadec

f_n1 = {math.modf(get(TO_n1)*10)}
f_n1_1[1] = math.floor(f_n1[1]/10)
f_n1_1[2] = f_n1[1] - f_n1_1[1]*10





--//

itt_l = {math.modf(get(ENGN_ITT_c_L))}
itt_r = {math.modf(get(ENGN_ITT_c_R))}


--172.98
-- oil temp


if get(ENGN_running_l) > 0 then
oil_temp_left = math.max((get(ENGN_oil_temp_c_l) + 10)*0.61333 + 58, (get(temperature_ambient_c) + 10)*0.61333 + 58 )
else
oil_temp_left = math.max(get(ENGN_oil_temp_c_l),get(temperature_ambient_c))
end

if get(ENGN_running_r) > 0 then
oil_temp_right = math.max((get(ENGN_oil_temp_c_r) + 10)*0.61333 + 58, (get(temperature_ambient_c) + 10)*0.61333 + 58 )
else
oil_temp_right = math.max(get(ENGN_oil_temp_c_r), get(temperature_ambient_c))
end

if oil_temp_left_smooth < oil_temp_left then oil_temp_left_smooth = oil_temp_left_smooth + 0.005*(oil_temp_left - get(ENGN_oil_temp_c_l)) else oil_temp_left_smooth = oil_temp_left end
if oil_temp_right_smooth < oil_temp_right then oil_temp_right_smooth = oil_temp_right_smooth + 0.005*(oil_temp_right - get(ENGN_oil_temp_c_r)) else oil_temp_right_smooth = oil_temp_right end



oil_t_l = {math.modf(oil_temp_left_smooth)}--172&0.98
oil_t_r = {math.modf(oil_temp_right_smooth)}--

if oil_t_l[2] > 0.5 then oil_t_l_d = math.ceil(oil_temp_left_smooth) else oil_t_l_d = math.floor(oil_temp_left_smooth) end
if oil_t_r[2] > 0.5 then oil_t_r_d = math.ceil(oil_temp_right_smooth) else oil_t_r_d = math.floor(oil_temp_right_smooth) end


-- oil press
oil_p_l = {math.modf(get(ENGN_oil_press_l))}--172&0.98
oil_p_r = {math.modf(get(ENGN_oil_press_r))}--

if oil_p_l[2] > 0.5 then oil_p_l_d = math.ceil(get(ENGN_oil_press_l)) else oil_p_l_d = math.floor(get(ENGN_oil_press_l)) end
if oil_p_r[2] > 0.5 then oil_p_r_d = math.ceil(get(ENGN_oil_press_r)) else oil_p_r_d = math.floor(get(ENGN_oil_press_r)) end

-- fuel flow

--
ff = {math.floor(get(ENGN_FF_l)*7936.64), math.floor(get(ENGN_FF_r)*7936.64)}

-- APU N1 & temp
apu_2 = {math.modf(get(APU_N1_percent))}

if apu_2[2] > 0.5 then
apu[1] = math.ceil(get(APU_N1_percent))
else
apu[1] = math.floor(get(APU_N1_percent))
end

if get(APU_N1_percent) < 40 then
	apu[2] = get(APU_N1_percent)*24 + get(temperature_ambient_c)
else
	apu[2] = 960 - get(APU_N1_percent)*2.9 + get(temperature_ambient_c)
end


-- fuel
fuel1 = {math.modf(get(m_fuel1))}
fuel2 = {math.modf(get(m_fuel2))}

if fuel1[2] > 0.5 then
fuel[1] = math.ceil(get(m_fuel1)*2.20462262)
else
fuel[1] = math.floor(get(m_fuel1)*2.20462262)
end

if fuel2[2] > 0.5 then
fuel[2] = math.ceil(get(m_fuel2)*2.20462262)
else
fuel[2] = math.floor(get(m_fuel2)*2.20462262)
end

fuel[3] = fuel[1]+fuel[2]

if fuel[3] < 1400 then color_fuel = {0.8,0,0} else color_fuel = {0,0.8,0} end

if fuel[3] < 1400 then color_fuel2 = {0.8,0,0} else color_fuel2 = {0,0.8,0} end

color_fuel3 = {0,0.8,0}
if fuel[3] < 1400 then
color_fuel3 = {0.8,0,0}
else
if fuel[3] > 13700 and math.abs(fuel[1]-fuel[2]) > 260 then color_fuel3 = {0.8,0.8,0.0} end
if fuel[3] > 10000 and fuel[3] < 13700 and math.abs(fuel[1]-fuel[2]) > 315 then color_fuel3 = {0.8,0.8,0.0} end
if fuel[3] > 4700 and fuel[3] < 10000 and math.abs(fuel[1]-fuel[2]) > 450 then color_fuel3 = {0.8,0.8,0.0} end
if fuel[3] < 4700 and math.abs(fuel[1]-fuel[2]) > 600 then color_fuel3 = {0.8,0.8,0.0} end

end



if get(flight_time) > 0.5 and get(flight_time) < 1 then fuel_used[1] = get(m_fuel1)*2.20462262+get(m_fuel2)*2.20462262 end
if last_states2[10] - get(ENGN_running_l) < 0 or last_states2[11] - get(ENGN_running_r) < 0 then fuel_used[1] = get(m_fuel1)*2.20462262+get(m_fuel2)*2.20462262 end
fuel_used[2] = fuel_used[1] - (get(m_fuel1)*2.20462262+get(m_fuel2)*2.20462262)
fuel_used_t = {math.modf(fuel_used[2])}

if fuel_used[2] < 0 then fuel_used[2] = 0 end

if fuel_used_t[2] > 0.5 then
fuel_used[3] = math.ceil(fuel_used[2])
else
fuel_used[3] = math.floor(fuel_used[2])
end

line72 = {string.format("%s", fuel_used[3])}


fuel_temp[1] = math.atan(get(temperature_ambient_c)/106)*19 + 15
line73 = {string.format("%s", math.floor(fuel_temp[1]))}



-- ignitors

if get(rel_ignitr0) > 3 then
line29 = {string.format("%s", "IGN")}
else
line29 = {string.format("%s", "")}
end

if get(rel_ignitr1) > 3 then
line30 = {string.format("%s", "IGN")}
else
line30 = {string.format("%s", "")}
end


-- elev trim

eltrim = {math.modf((get(elevator_trim)/2+0.5)*15)}

--[=[if eltrim[2] > 0.5 then
eltrim_d = math.ceil((get(elevator_trim)+0.5)*15)
else
eltrim_d = math.floor((get(elevator_trim)+0.5)*15)
end--]=]

pos_2 = {300, 797 + get(elevator_trim)*43, 55, 30}

pos_4 = {215, -700 - get(hstab1_elv1def)*(1.3), 15, 12}
pos_5 = {441, -700 - get(hstab2_elv1def)*(1.3), 15, 12}
pos_6 = {73, -601 - get(aileron1_deg_l)*(1.43), 15, 12}
pos_7 = {582, -601 - get(aileron1_deg_r)*(1.43), 15, 12}



-- flaps

flaps = {math.floor(get(flaprat)*30)}


-- fuel
if fuel1[2] > 0.5 then
fuel[1] = math.ceil(get(m_fuel1)*2.20462262)
else
fuel[1] = math.floor(get(m_fuel1)*2.20462262)
end


-- rudder trim

pos_3 = {406 + get(rudder_trim)*30, 758, 16, 19}

-- landing gear

-- nose gear
if get(deploy_ratio_0) == 1 and last_states[1] - get(deploy_ratio_0) == 0 then
gears_stat_d[1] = get(gear_dn)
else
	if get(deploy_ratio_0) == 0 and last_states[1] - get(deploy_ratio_0) == 0 then
		if get(gear1_fail) == 6 then gears_stat_d[1] = get(gear_up_red) else gears_stat_d[1] = get(gear_up_white) end
--		if get(gear_handle_status) == 1 then gears_stat_d[1] = get(gear_up_yellow) end
	end
if last_states[1] - get(deploy_ratio_0) ~= 0 then
	gears_stat_d[1] = get(gear_trans_white)
	else
		if get(deploy_ratio_0) > 0 and get(deploy_ratio_0) < 1 and get(gear1_fail) == 6 then
			gears_stat_d[1] = get(gear_trans_red)
		end
	end
end

-- left gear
if get(deploy_ratio_1) == 1 and last_states[2] - get(deploy_ratio_1) == 0 then
gears_stat_d[2] = get(gear_dn)
else
	if get(deploy_ratio_1) == 0 and last_states[2] - get(deploy_ratio_1) == 0 then
		if get(gear2_fail) == 6 then gears_stat_d[2] = get(gear_up_red) else gears_stat_d[2] = get(gear_up_white) end
--		if get(gear_handle_status) == 1 then gears_stat_d[2] = get(gear_up_yellow) end
	end
if last_states[2] - get(deploy_ratio_1) ~= 0 then
	gears_stat_d[2] = get(gear_trans_white)
	else
		if get(deploy_ratio_1) > 0 and get(deploy_ratio_1) < 1 and get(gear2_fail) == 6 then
			gears_stat_d[2] = get(gear_trans_red)
		end
	end
end

-- right gear
if get(deploy_ratio_2) == 1 and last_states[3] - get(deploy_ratio_2) == 0 then
gears_stat_d[3] = get(gear_dn)
else
	if get(deploy_ratio_2) == 0 and last_states[3] - get(deploy_ratio_2) == 0 then
		if get(gear3_fail) == 6 then gears_stat_d[3] = get(gear_up_red) else gears_stat_d[3] = get(gear_up_white) end
--		if get(gear_handle_status) == 1 then gears_stat_d[3] = get(gear_up_yellow) end
	end
if last_states[3] - get(deploy_ratio_2) ~= 0 then
	gears_stat_d[3] = get(gear_trans_white)
	else
		if get(deploy_ratio_2) > 0 and get(deploy_ratio_2) < 1 and get(gear3_fail) == 6 then
			gears_stat_d[3] = get(gear_trans_red)
		end
	end
end


if get(lan_gear_warn) == 1 then
gears_stat_d[1] = get(gear_up_red)
gears_stat_d[2] = get(gear_up_red)
gears_stat_d[3] = get(gear_up_red)
end

if gears_stat_d[1] == get(gear_trans_red) or gears_stat_d[1] == get(gear_up_red) or gears_stat_d[2] == get(gear_trans_red) or gears_stat_d[2] == get(gear_up_red) or gears_stat_d[3] == get(gear_trans_red) or gears_stat_d[3] == get(gear_up_red) then
	if get(lan_gear_warn) ~= 1 then
	set(gear_warn,1)
	else
	set(gear_warn,0)
	end
else
set(gear_warn,0)
end











-- TAWS
if get(radio_altimeter_height_ft_pilot) < 1000 and get(flaprat) == 0 then
	if get(deploy_ratio_0) < 0.01 and get(deploy_ratio_1) < 0.01 and get(deploy_ratio_2) < 0.01 then
		if get(true_airspeed)*1.94385 > 190 and get(true_airspeed)*1.94385 < 400 then
			if get(true_airspeed)*1.94385 < 250 then
					if get(radio_altimeter_height_ft_pilot) < ((get(true_airspeed)*1.94385 - 190)*8.333) + 500 then
					set(terr_warn, 1)
					set(gear_warn_w, 0)
					set(flaps_warn, 0)
					else
					set(terr_warn, 0)
					end
			else
			set(terr_warn, 1)
			end
		else
			if get(true_airspeed)*1.94385 < 190 and get(radio_altimeter_height_ft_pilot) > 30 and get(radio_altimeter_height_ft_pilot) < 500 then
			set(gear_warn_w, 1)
			set(terr_warn, 0)
			set(flaps_warn, 0)
			else
			set(gear_warn_w, 0)
			end
		end

	else

		if get(deploy_ratio_0) > 0.99 and get(deploy_ratio_1) > 0.99 and get(deploy_ratio_2) > 0.99 then
			if get(true_airspeed)*1.94385 > 159 and get(true_airspeed)*1.94385 < 400 then
				if get(true_airspeed)*1.94385 < 250 then
					if get(radio_altimeter_height_ft_pilot) < ((get(true_airspeed)*1.94385 - 159)*5.5) + 500 then
					set(terr_warn, 1)
					set(gear_warn_w, 0)
					set(flaps_warn, 0)
					else
					set(terr_warn, 0)
					end
				else
				set(terr_warn, 1)
				end
			else
				if get(true_airspeed)*1.94385 < 159 and get(true_airspeed)*1.94385 > 30 and get(radio_altimeter_height_ft_pilot) < 500 then
				set(flaps_warn, 1)
				set(terr_warn, 0)
				set(gear_warn_w, 0)
				else
				set(flaps_warn, 0)
				end
			end
		end
	end
else
set(terr_warn, 0)
set(gear_warn_w, 0)
set(flaps_warn, 0)
end

--[=[
-- flaps warning
if get(radio_altimeter_height_ft_pilot) > 500 then
set(flaps_warn, 0)
else
	if get(vvi_fpm_pilot) < -10 and get(flaprat) < 1 and get(onground_any) == 0 and get(deploy_ratio_0) == 1 and get(deploy_ratio_1) == 1 and get(deploy_ratio_2) == 1  and get(true_airspeed)*1.94385 < 159 then
	set(flaps_warn, 1)
	else
	set(flaps_warn, 0)
	end
end
--]=]
--



-- cab alt
cabin_alt = {math.modf(get(cabin_altitude_ft))}
cabin_vvi = {math.modf(get(cabin_vvi_fpm))}

if math.abs(cabin_alt[2]) > 0.5 then cabin_alt_d = math.ceil(get(cabin_altitude_ft)) else cabin_alt_d = math.floor(get(cabin_altitude_ft)) end

if math.abs(cabin_vvi[2]) > 0.5 then cabin_vvi_d = math.ceil(math.abs(get(cabin_vvi_fpm))) else cabin_vvi_d = math.floor(math.abs(get(cabin_vvi_fpm))) end


--//

line11 = {string.format("%s%s%s", n1_l2[1], ".", n1_l2[2])}
line12 = {string.format("%s%s%s", n1_r2[1], ".", n1_r2[2])}

line17 = {string.format("%s%s%s", n2_l2[1], ".", n2_l2[2])}
line18 = {string.format("%s%s%s", n2_r2[1], ".", n2_r2[2])}

line13 = {string.format("%s", itt_l[1])}
line14 = {string.format("%s", itt_r[1])}

line19 = {string.format("%s", oil_t_l_d)}
line20 = {string.format("%s", oil_t_r_d)}

line21 = {string.format("%s", oil_p_l_d)}
line22 = {string.format("%s", oil_p_r_d)}

line23 = {string.format("%s", ff[1])}
line24 = {string.format("%s", ff[2])}

line25 = {string.format("%s",apu[1])}
line26 = {string.format("%s", math.floor(apu[2]))}


line27 = {string.format("%s",fuel[3])}
line28 = {string.format("%s%s%s", fuel[1],"             ", fuel[2])}

line70 = {string.format("%s", fuel[1])}
line71 = {string.format("%s", fuel[2])}

line31 = {string.format("%s%s%s",eltrim[1], ".", math.floor(eltrim[2]*10))}

line32 = {string.format("%s", flaps[1])}


line33 = {string.format("%i", cabin_alt_d)}
line34 = {string.format("%i", cabin_vvi_d)}

-- elec page

if get(bat_on) > 0 then color_batt_l = {0,0.8,0} end
if get(bat_on) < 1 then color_batt_l = {0.6,0.6,0.6} end

if get(bat_on2) > 0 then color_batt_r = {0,0.8,0} end
if get(bat_on2) < 1 then color_batt_r = {0.6,0.6,0.6} end





line46 = {string.format("%s","26")}
line46b = {string.format("%s","23")}


batt_volts_l[1] = math.floor(get(battery_voltage_indicated_volts_l)*10) --- 245.562647
batt_volts_l[2] = math.floor(batt_volts_l[1]/100)-- 2
batt_volts_l[1] = batt_volts_l[1] - batt_volts_l[2]*100--45
batt_volts_l[3] = math.floor(batt_volts_l[1]/10)--4
batt_volts_l[4] = batt_volts_l[1] - batt_volts_l[3]*10--5

batt_volts_r[1] = math.floor(get(battery_voltage_indicated_volts_r)*10) --- 245
batt_volts_r[2] = math.floor(batt_volts_r[1]/100)-- 2
batt_volts_r[1] = batt_volts_r[1] - batt_volts_r[2]*100--45
batt_volts_r[3] = math.floor(batt_volts_r[1]/10)--4
batt_volts_r[4] = batt_volts_r[1] - batt_volts_r[3]*10--5

line47 = {string.format("%s%s%s%s",batt_volts_l[2],batt_volts_l[3],".",batt_volts_l[4])}
line48 = {string.format("%s%s%s%s",batt_volts_r[2],batt_volts_r[3],".",batt_volts_r[4])}






gen_amps_r[1] = math.floor(get(generator_amps_r))
gen_amps_l[1] = math.floor(get(generator_amps_l))

line49 = {string.format("%s",gen_amps_l[1])}
line50 = {string.format("%s",gen_amps_r[1])}
line51 = {string.format("%s",get(APU_generator_amps))}


if get(APU_running) == 1 and line51b[1] < 28.5 then line51b[1] = math.floor((line51b[1] + 0.2)*10)/10 end
if get(APU_running) == 0 and line51b[1] > 0 then line51b[1] = math.floor((line51b[1] - 0.2)*10)/10 end
--]=]


if get(ENGN_running_l) > 0 and get(generator_on_l) > 0 then
gen_volts_l[1] = 28.2
color_vgen_l = {0,0.8,0}
end
if get(ENGN_running_l) > 0 and get(generator_on_l) < 1 then
gen_volts_l[1] = 28.5
color_vgen_l = {0.6,0.6,0.6}
end
if get(ENGN_running_l) < 1 then
gen_volts_l[1] = 0
color_vgen_l = {0.6,0.6,0.6}
end

line52 = {string.format("%s",gen_volts_l[1])}

if get(ENGN_running_r) > 0 and get(generator_on_r) > 0 then
gen_volts_r[1] = 28.2
color_vgen_r = {0,0.8,0}
end
if get(ENGN_running_r) > 0 and get(generator_on_r) < 1 then
gen_volts_r[1] = 28.5
color_vgen_r = {0.6,0.6,0.6}
end
if get(ENGN_running_r) < 1 then
gen_volts_r[1] = 0
color_vgen_r = {0.6,0.6,0.6}
end

line53 = {string.format("%s",gen_volts_r[1])}


if get(APU_running) > 0 and get(APU_generator_on) > 0 then
apu_volts[1] = 24.5
color_apu = {0,0.8,0}
end
if get(APU_running) > 0 and get(APU_generator_on) < 1 then
apu_volts[1] = 24.1
color_apu = {0.6,0.6,0.6}
end
if get(APU_running) < 1 then
apu_volts[1] = 0
color_apu = {0.6,0.6,0.6}
end


line54 = {string.format("%s",apu_volts[1])}

if get(electr_extp) > 0 then
extp_volts[1] = 28.4
color_extp = {0,0.8,0}
if get(gpu_on) > 0 then extp_volts[1] = 28.1 end
end
if get(electr_extp) < 0.1 then
extp_volts[1] = 28.4
color_extp = {0.6,0.6,0.6}
end


line55 = {string.format("%s",extp_volts[1])}



-- Anti Ice page


if get(ENGN_running_l) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_l_h) > 0 and get(antice_wngsource_r) == 0 and get(antice_wing_h) > 0 then line56 = {"34"} end
if get(ENGN_running_l) > 0 and get(antice_engn_l_h) < 1 and get(antice_wngsource_r) == 0 and get(antice_wing_h) > 0 then line56 = {"35"} end

if get(ENGN_running_l) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_l_h) > 0 and get(antice_wngsource_r) == 1 and get(antice_wing_h) > 0 then line56 = {"35"} end
if get(ENGN_running_l) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_l_h) > 0 and get(antice_wing_h) < 1 then line56 = {"37"} end
if get(ENGN_running_l) > 0 and get(antice_engn_l_h) < 1 and get(antice_wngsource_r) == 1 and get(antice_wing_h) > 0 then line56 = {"36"} end
if get(ENGN_running_l) > 0 and get(antice_engn_l_h) < 1 and get(antice_wing_h) < 1 then line56 = {"38"} end
if get(ENGN_running_l) < 1 then line56 = {"0"} end

if get(ENGN_running_r) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_r_h) > 0 and get(antice_wngsource_r) == 2 and get(antice_wing_h) > 0 then line57 = {"34"} end
if get(ENGN_running_r) > 0 and get(antice_engn_r_h) < 1 and get(antice_wngsource_r) == 2 and get(antice_wing_h) > 0 then line57 = {"35"} end

if get(ENGN_running_r) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_r_h) > 0 and get(antice_wngsource_r) == 1 and get(antice_wing_h) > 0 then line57 = {"35"} end
if get(ENGN_running_r) > 0 and get(ice_inlet_heat_on) > 0 and get(antice_engn_r_h) > 0 and get(antice_wing_h) < 1 then line57 = {"37"} end
if get(ENGN_running_r) > 0 and get(antice_engn_r_h) < 1 and get(antice_wngsource_r) == 1 and get(antice_wing_h) > 0 then line57 = {"36"} end
if get(ENGN_running_r) > 0 and get(antice_engn_r_h) < 1 and get(antice_wing_h) < 1 then line57 = {"38"} end
if get(ENGN_running_r) < 1 then line57 = {"0"} end

if get(antice_wngsource_r) == 2 then line56 = {"0"} end
if get(antice_wngsource_r) == 0 then line57 = {"0"} end









if math.abs(get(ENGN_N1_L) - get(ENGN_N1_R)) < 0.1 then
color_sync = {0,0.8,0}
else
color_sync = {0.8,0.8,0.0}
end

if get(engn_mach_status) == 1 then
color_mach = {0,0.8,0}
else
color_mach = {0.6,0.6,0.6}
if get(engn_mach_h) == 1 and get(carets) < 2 then
color_sync = {0.6,0.6,0.6}
end
end




if get(engn_mach_h) == 0 then
	if get(onground_any) == 0 and get(jet_sync_mode) > 0 and get(carets) < 3  and get(engine_speed_rpm_0) > 1000 and get(engine_speed_rpm_1) > 1000 and get(thrust_reverser_deploy_ratio_0)< 0.1 then

		line45 = {string.format("%s", "")}
		line39 = {string.format("%s", "SYNC")}
	else
		line45 = {string.format("%s", "")}
		line39 = {string.format("%s", "")}
	end
	else
		if get(onground_any) == 0 and get(engine_speed_rpm_0) > 1000 and get(engine_speed_rpm_1) > 1000 and get(carets) < 2 then
		line45 = {string.format("%s", "MACH")}
		line39 = {string.format("%s", "HOLD")}
		else
		line45 = {string.format("%s", "")}
		line39 = {string.format("%s", "")}
		if get(onground_any) == 0 and get(jet_sync_mode) > 0 and get(carets) >= 2 and get(carets) < 3  and get(engine_speed_rpm_0) > 1000 and get(engine_speed_rpm_1) > 1000 and get(thrust_reverser_deploy_ratio_0)< 0.1 then
		line45 = {string.format("%s", "")}
		line39 = {string.format("%s", "SYNC")}
		end
		end
end


--reversers
if get(thrust_reverser_deploy_ratio_0) < 0.1 and get(engine_speed_rpm_0) > 300 and get(gust_lock) == 0 then
	if get(ENGN_thro_0) > 0.85 and get(ENGN_thro_0) < 0.9 then
	line35 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," CLB")}
	elseif get(ENGN_thro_0) > 0.9 and get(ENGN_thro_0) < 0.95 then line35 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," TO")}
	elseif get(ENGN_thro_0) > 0.95 then line35 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," APR")}
	elseif get(ENGN_thro_0) < 0.85 and get(ENGN_thro_0) > 0.05 then line35 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," CRZ")}
	elseif get(ENGN_thro_0) < 0.05 then line35 = {string.format("%s", "")}
	elseif get(gust_lock) == 1 then line35 = {string.format("%s", "")}
	end
else
if   get(engine_speed_rpm_0) > 300 then
line35 = {string.format("%s", "70.7 REV")}
else
line35 = {string.format("%s", "")}
end
if get(gust_lock) == 1 then line35 = {string.format("%s", "")} end
end






if get(thrust_reverser_deploy_ratio_1) < 0.1  and get(engine_speed_rpm_1) > 300 and get(gust_lock) == 0 then
	if get(ENGN_thro_1) > 0.85 and get(ENGN_thro_1) < 0.9 then
	line36 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," CLB")}
	elseif get(ENGN_thro_1) > 0.9 and get(ENGN_thro_1) < 0.95 then line36 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," TO")}
	elseif get(ENGN_thro_1) > 0.95 then line36 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," APR")}
	elseif get(ENGN_thro_1) < 0.85 and get(ENGN_thro_1) > 0.05 then line36 = {string.format("%s%s%s%s", f_n1_1[1],".",f_n1_1[2]," CRZ")}
	elseif get(ENGN_thro_1) < 0.05 then line36 = {string.format("%s", "")}
	elseif get(gust_lock) == 1 then line36 = {string.format("%s", "")}
	end
else
if  get(engine_speed_rpm_1) > 300 then
line36 = {string.format("%s", "70.7 REV")}
else
line36 = {string.format("%s", "")}
end
if get(gust_lock) == 1 then line36 = {string.format("%s", "")} end
end






if get(thrust_reverser_deploy_ratio_0) < 0.1 then line37 = {string.format("%s", "")} else line37 = {string.format("%s", "REV")} end
if get(thrust_reverser_deploy_ratio_1) < 0.1 then line38 = {string.format("%s", "")} else line38 = {string.format("%s", "REV")} end

if get(thrust_reverser_deploy_ratio_0) < 0.9 then color_rev1 = color1 else color_rev1 = color2 end
if get(thrust_reverser_deploy_ratio_1) < 0.9 then color_rev2 = color1 else color_rev2 = color2 end



-- fire

if get(engine_fires_l) == 1 then line15 = {string.format("%s", "FIRE")} else line15 = {string.format("%s", "")} end
if get(engine_fires_r) == 1 then line16 = {string.format("%s", "FIRE")} else line16 = {string.format("%s", "")} end

if get(ENGN_N1_L) < 96.1 then color_n1_l = {0.0,0.8,0.0} else color_n1_l = {0.8,0.0,0.0} end
if get(ENGN_N1_R) < 96.1 then color_n1_r = {0.0,0.8,0.0} else color_n1_r = {0.8,0.0,0.0} end

if get(ENGN_N2_L) < 98.1 then color_n2_l = {0.0,0.8,0.0} else color_n2_l = {0.8,0.0,0.0} end
if get(ENGN_N2_R) < 98.1 then color_n2_r = {0.0,0.8,0.0} else color_n2_r = {0.8,0.0,0.0} end

if get(ENGN_ITT_c_L) < 948 then color_itt_l = {0.0,0.8,0.0} else color_itt_l = {0.8,0.0,0.0} end
if get(ENGN_ITT_c_R) < 948 then color_itt_r = {0.0,0.8,0.0} else color_itt_r = {0.8,0.0,0.0} end

if oil_temp_left_smooth < 138 and oil_temp_left_smooth > 27 then color_oilt_l = {0.0,0.8,0.0} else color_oilt_l = {0.8,0.0,0.0} end
if oil_temp_right_smooth < 138 and oil_temp_right_smooth > 27 then color_oilt_r = {0.0,0.8,0.0} else color_oilt_r = {0.8,0.0,0.0} end

if get(ENGN_oil_press_l) < 138 and get(ENGN_oil_press_l) > 27 then color_oilp_l = {0.0,0.8,0.0} else color_oilp_l = {0.8,0.0,0.0} end
if get(ENGN_oil_press_r) < 138 and get(ENGN_oil_press_r) > 27 then color_oilp_r = {0.0,0.8,0.0} else color_oilp_r = {0.8,0.0,0.0} end




-- cab_alt arrows

if last_states[4] - get(cabin_altitude_ft) > 0 then
cabin_alt_temp[1] = true
else
cabin_alt_temp[1] = false
end

if last_states[4] - get(cabin_altitude_ft) < 0 then
cabin_alt_temp[2] = true
else
cabin_alt_temp[2] = false
end






-- mfd controls

--left mfd
-- checklister

if last_states[16] - get(mfd_checkl_l) ~= 0 and get(mfd_checkl_l) > 0 then
set(mfd_antice_l, 0)
set(mfd_ecs_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_frmt_l, 0)
end
--]=]
-- map

if last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) > 0 then
set(mfd_antice_l, 0)
set(mfd_ecs_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- sumry

if last_states[8] - get(mfd_sumry_l) ~= 0 and get(mfd_sumry_l) == 1 then
set(mfd_frmt_l, 0)
set(mfd_antice_l, 0)
set(mfd_ecs_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_checkl_l, 0)
end

-- antice
if last_states[9] - get(mfd_antice_l) ~= 0 and get(mfd_antice_l) == 1 then
set(mfd_frmt_l, 0)
set(mfd_ecs_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- ECS
if last_states[10] - get(mfd_ecs_l) ~= 0 and get(mfd_ecs_l) == 1 then
set(mfd_antice_l, 0)
set(mfd_frmt_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- electr
if last_states[11] - get(mfd_electr_l) ~= 0 and get(mfd_electr_l) == 1 then
set(mfd_ecs_l, 0)
set(mfd_antice_l, 0)
set(mfd_frmt_l, 0)

set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- fltcontr
if last_states[12] - get(mfd_flt_ctr_l) ~= 0 and get(mfd_flt_ctr_l) == 1 then
set(mfd_ecs_l, 0)
set(mfd_antice_l, 0)
set(mfd_frmt_l, 0)
set(mfd_electr_l, 0)

set(mfd_fuel_l, 0)
set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- fuel
if last_states[13] - get(mfd_fuel_l) ~= 0 and get(mfd_fuel_l) == 1 then
set(mfd_ecs_l, 0)
set(mfd_antice_l, 0)
set(mfd_frmt_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)

set(mfd_hydr_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end

-- hydr
if last_states[14] - get(mfd_hydr_l) ~= 0 and get(mfd_hydr_l) == 1 then
set(mfd_ecs_l, 0)
set(mfd_antice_l, 0)
set(mfd_frmt_l, 0)
set(mfd_electr_l, 0)
set(mfd_flt_ctr_l, 0)
set(mfd_fuel_l, 0)
set(mfd_sumry_l, 0)
set(mfd_checkl_l, 0)
end





if last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) == 1 then
set(map_mode, 0)
elseif last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) == 2 then set(map_mode, 1)
elseif last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) == 3 then set(map_mode, 2)
elseif last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) == 4 then set(map_mode, 3)
elseif last_states[15] - get(mfd_frmt_l) ~= 0 and get(mfd_frmt_l) == 5 then set(map_mode, 4)
end


if last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 1 then
set(map_mode, 0)
elseif last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 2 then set(map_mode, 1)
elseif last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 3 then set(map_mode, 2)
elseif last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 4 then set(map_mode, 3)
elseif last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 5 then set(map_mode, 4)
end

-- right mfd buttons
-- map

if last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) > 0 then
set(mfd_antice_r, 0)
set(mfd_ecs_r, 0)
set(mfd_electr_r, 0)
set(mfd_flt_ctr_r, 0)
set(mfd_fuel_r, 0)
set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)

end

-- sumry

-- sumry

if last_states2[9] - get(mfd_checkl_r) ~= 0 and get(mfd_checkl_r) == 1 then
set(mfd_sumry_r, 0)
end

if last_states2[1] - get(mfd_sumry_r) ~= 0 and get(mfd_sumry_r) == 1 then
set(mfd_checkl_r, 0)
end

-- antice
if last_states2[2] - get(mfd_antice_r) ~= 0 and get(mfd_antice_r) == 1 then
set(mfd_frmt_r, 0)
set(mfd_ecs_r, 0)
set(mfd_electr_r, 0)
set(mfd_flt_ctr_r, 0)
set(mfd_fuel_r, 0)
set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)
end

-- ECS
if last_states2[3] - get(mfd_ecs_r) ~= 0 and get(mfd_ecs_r) == 1 then
set(mfd_antice_r, 0)
set(mfd_frmt_r, 0)
set(mfd_electr_r, 0)
set(mfd_flt_ctr_r, 0)
set(mfd_fuel_r, 0)
set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)
end

-- electr
if last_states2[4] - get(mfd_electr_r) ~= 0 and get(mfd_electr_r) == 1 then
set(mfd_ecs_r, 0)
set(mfd_antice_r, 0)
set(mfd_frmt_r, 0)

set(mfd_flt_ctr_r, 0)
set(mfd_fuel_r, 0)
set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)
end

-- fltcontr
if last_states2[5] - get(mfd_flt_ctr_r) ~= 0 and get(mfd_flt_ctr_r) == 1 then
set(mfd_ecs_r, 0)
set(mfd_antice_r, 0)
set(mfd_frmt_r, 0)
set(mfd_electr_r, 0)

set(mfd_fuel_r, 0)
set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)
end

-- fuel
if last_states2[6] - get(mfd_fuel_r) ~= 0 and get(mfd_fuel_r) == 1 then
set(mfd_ecs_r, 0)
set(mfd_antice_r, 0)
set(mfd_frmt_r, 0)
set(mfd_electr_r, 0)
set(mfd_flt_ctr_r, 0)

set(mfd_hydr_r, 0)
set(mfd_sumry_r, 0)
end

-- hydr
if last_states2[7] - get(mfd_hydr_r) ~= 0 and get(mfd_hydr_r) == 1 then
set(mfd_ecs_r, 0)
set(mfd_antice_r, 0)
set(mfd_frmt_r, 0)
set(mfd_electr_r, 0)
set(mfd_flt_ctr_r, 0)
set(mfd_fuel_r, 0)

set(mfd_sumry_r, 0)
end




if get(aircond_airsource) == 0 or get(aircond_airsource) == 3 then
ecs_temp[1] = 0
end

		if get(aircond_airsource) == 1 or get(aircond_airsource) == 2 then
			if get(aircond_airsource) == 2 and get(bleed_apu_h) > 0 and get(APU_running) > 0 and get(bleed_xbleed_h) > 0 then
			ecs_temp[1] = 1
			else
				if get(aircond_airsource) == 1 and get(bleed_apu_h) > 0 and get(APU_running) > 0 then
				ecs_temp[1] = 1
				else
					if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
					ecs_temp[1] = 1
					else
						if get(aircond_airsource) == 2 and get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 and get(bleed_xbleed_h) > 0 then
						ecs_temp[1] = 1
						else
							if get(aircond_airsource) == 1 and get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
							ecs_temp[1] = 1
							else
							ecs_temp[1] = 0
							end
						end
					end
				end
			end
end


if get(aircond_airsource) == 0 or get(aircond_airsource) == 2 then
		ecs_temp[2] = 0
		end

		if get(aircond_airsource) == 1 or get(aircond_airsource) == 3 then
			if get(bleed_apu_h) > 0 and get(APU_running) > 0 then
			ecs_temp[2] = 1
			else
				if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
				ecs_temp[2] = 1
				else
					if get(aircond_airsource) == 3 and get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 and get(bleed_xbleed_h) > 0 then
					ecs_temp[2] = 1
					else
						if get(aircond_airsource) == 1 and get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
						ecs_temp[2] = 1
						else
						ecs_temp[2] = 0
						end
					end
				end
			end
		end

if get(pressure_ditch_h) == 1 then
ecs_temp[1] = 0
ecs_temp[2] = 0
end


if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then ecs_temp[3] = 1 else ecs_temp[3] = 0 end
if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then ecs_temp[4] = 1 else ecs_temp[4] = 0 end
if get(bleed_apu_h) > 0 and get(APU_running) > 0 then ecs_temp[5] = 1 else ecs_temp[5] = 0 end

line59 = {"53"}




if ecs_temp[3] > 0 then
line58 = {"53"}


	if get(aircond_airsource) == 1 then
		if ecs_temp[4] > 0 and ecs_temp[5] > 0 then
		line58 = {"52"}
		else
		line58 = {"48"}
		if ecs_temp[4] > 0 or ecs_temp[5] > 0 then line58 = {"51"} end
		end
	end


	if get(aircond_airsource) == 2 and get(bleed_xbleed_h) > 0 then
		if ecs_temp[4] > 0 and ecs_temp[5] > 0 then
		line58 = {"52"}
		else
		if ecs_temp[4] < 1 and ecs_temp[5] < 1 then line58 = {"50"} end
		if ecs_temp[4] > 0 or ecs_temp[5] > 0 then line58 = {"51"} end
		end
	else
		if get(aircond_airsource) == 2 and get(bleed_xbleed_h) < 1 then line58 = {"50"} end
	end

	if get(aircond_airsource) == 3 and get(bleed_xbleed_h) > 0 then
		if ecs_temp[4] < 1 and ecs_temp[5] < 1 then line58 = {"50"} end
		if ecs_temp[4] > 0 and ecs_temp[5] < 1 then line58 = {"51"} end
		if ecs_temp[4] < 1 and ecs_temp[5] > 0 then line58 = {"51"} end
		if ecs_temp[4] > 0 and ecs_temp[5] > 0 then line58 = {"52"} end
	else
	if get(aircond_airsource) == 3 and get(bleed_xbleed_h) < 1 then line58 = {"53"} end

	end


else
line58 = {"0"}
end



if ecs_temp[4] > 0 then
line59 = {"53"}


	if get(aircond_airsource) == 1 then
		if ecs_temp[3] > 0 and ecs_temp[5] > 0 then
		line59 = {"52"}
		else
		line59 = {"48"}
		if ecs_temp[3] > 0 or ecs_temp[5] > 0 then line59 = {"51"} end
		end
	end


	if get(aircond_airsource) == 3 then
		if ecs_temp[3] > 0 and get(bleed_xbleed_h) > 0 and ecs_temp[5] > 0 then
		line59 = {"52"}
		else
		if ecs_temp[3] < 1 and ecs_temp[5] < 1 then line59 = {"50"} end
		if ecs_temp[3] > 0 and get(bleed_xbleed_h) > 0 or ecs_temp[5] > 0 then line59 = {"51"} end
		if ecs_temp[3] > 0 and get(bleed_xbleed_h) < 1 and ecs_temp[5] < 1 then line59 = {"50"} end

		end
	end

	if get(aircond_airsource) == 2 and get(bleed_xbleed_h) > 0 then
		if ecs_temp[3] < 1 and ecs_temp[5] < 1 then line59 = {"50"} end
		if ecs_temp[3] > 0 and ecs_temp[5] < 1 then line59 = {"51"} end
		if ecs_temp[3] < 1 and ecs_temp[5] > 0 then line59 = {"51"} end
		if ecs_temp[3] > 0 and ecs_temp[5] > 0 then line59 = {"52"} end
	else
	end


else
line59 = {"0"}
end


--[=[
if tonumber(line59[1]) == 0 and tonumber(line58[1]) == 0 then
	if get(bleed_apu_h) < 1 then
	set(bleed_status, 0)
	elseif get(APU_running) > 0 then set(bleed_status, 1)
	end
else
set(bleed_status, 1)
end--]=]
if get(bleed_en_l_h) < 1 and get(bleed_en_r_h) < 1 and get(bleed_apu_h) < 1 then set(bleed_status, 0) else set(bleed_status, 1) end





-- interior temperatures
if ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1 and get(pressure_ditch_h) == 0 then
	if math.floor(int_temp[1]) < math.floor(get(aircond_tempr_cab_ddial)) then
	int_temp[1] = int_temp[1] + 0.005*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider4_r)*0.001 - get(customslider2_r)*0.002
	end
	if math.floor(int_temp[1]) > math.floor(get(aircond_tempr_cab_ddial)) then
	int_temp[1] = int_temp[1] - 0.005*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider4_r)*0.001 + get(customslider2_r)*0.002
	end

	if math.floor(int_temp[2]) < math.floor(get(aircond_tempr_cock_ddial)) then
	int_temp[2] = int_temp[2] + 0.005*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider2_r)*0.002 - get(customslider4_r)*0.001
	end
	if math.floor(int_temp[2]) > math.floor(get(aircond_tempr_cock_ddial)) then
	int_temp[2] = int_temp[2] - 0.005*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider2_r)*0.002 + get(customslider4_r)*0.001
	end



	if math.floor(int_temp[3]) < math.floor(get(aircond_tempr_cock_ddial)) then
	int_temp[3] = int_temp[3] + 0.025*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused)
	end
	if math.floor(int_temp[3]) > math.floor(get(aircond_tempr_cock_ddial)) then
	int_temp[3] = int_temp[3] - 0.025*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused)
	end

	if math.floor(int_temp[4]) < math.floor(get(aircond_tempr_cab_ddial)) then
	int_temp[4] = int_temp[4] + 0.025*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused)
	end
	if math.floor(int_temp[4]) > math.floor(get(aircond_tempr_cab_ddial)) then
	int_temp[4] = int_temp[4] - 0.025*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused)
	end

else
	if math.floor(int_temp[1]) < math.floor(get(temperature_ambient_c)) then
	int_temp[1] = int_temp[1] + 0.001*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider4_r)*0.003 + get(customslider2_r)*0.007
	end
	if math.floor(int_temp[1]) > math.floor(get(temperature_ambient_c)) then
	int_temp[1] = int_temp[1] - 0.001*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider4_r)*0.003 - get(customslider2_r)*0.007
	end

	if math.floor(int_temp[2]) < math.floor(get(temperature_ambient_c)) then
	int_temp[2] = int_temp[2] + 0.001*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider2_r)*0.007 + get(customslider4_r)*0.003
	end
	if math.floor(int_temp[2]) > math.floor(get(temperature_ambient_c)) then
	int_temp[2] = int_temp[2] - 0.001*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider2_r)*0.007 - get(customslider4_r)*0.003
	end



	if math.floor(int_temp[3]) < math.floor(int_temp[1]) then
	int_temp[3] = int_temp[3] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider2_r)*0.007 + get(customslider4_r)*0.003
	end
	if math.floor(int_temp[3]) > math.floor(int_temp[1]) then
	int_temp[3] = int_temp[3] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider2_r)*0.007 - get(customslider4_r)*0.003
	end

	if math.floor(int_temp[4]) < math.floor(int_temp[2]) then
	int_temp[4] = int_temp[4] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) + get(customslider2_r)*0.007 + get(customslider4_r)*0.003
	end
	if math.floor(int_temp[4]) > math.floor(int_temp[2]) then
	int_temp[4] = int_temp[4] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) - get(customslider2_r)*0.007 - get(customslider4_r)*0.003
	end

end




if get(ice_window_heat_on) < 1 then
if cock_tempr_tmp[1] <  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5) end
if cock_tempr_tmp[1] >  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5) end
if cock_tempr_tmp[2] <  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5) end
if cock_tempr_tmp[2] >  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5) end
else
	if get(antice_wshld_l_h) > 0 then
		if cock_tempr_tmp[1] <  1 and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
		if cock_tempr_tmp[1] >  1 and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
	else
		if cock_tempr_tmp[1] <  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
		if cock_tempr_tmp[1] >  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[1] = cock_tempr_tmp[1] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
	end
	if get(antice_wshld_r_h) > 0 then
		if cock_tempr_tmp[2] <  1 and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
		if cock_tempr_tmp[2] >  1 and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
	else
		if cock_tempr_tmp[2] <  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] + 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
		if cock_tempr_tmp[2] >  int_temp[2] and get(paused) ~= 0 then cock_tempr_tmp[2] = cock_tempr_tmp[2] - 0.01*((get(frame_rate_period)-0.02)*25 + 0.5)*get(paused) end
	end
end





line60 = {string.format("%s%s",math.floor(int_temp[3]), "°")}
line61 = {string.format("%s%s",math.floor(get(aircond_tempr_cock_ddial)), "°")}
line62 = {string.format("%s%s",math.floor(int_temp[2]), "°")}

line63 = {string.format("%s%s",math.floor(int_temp[4]), "°")}
line64 = {string.format("%s%s",math.floor(get(aircond_tempr_cab_ddial)), "°")}
line65 = {string.format("%s%s",math.floor(int_temp[1]), "°")}



if get(aircond_man_temp_h) > 0 then line66 = {"MANUAL"} else line66 = {""} end




if get(view) < 1 then
set(temp_cabin, int_temp[1])
set(glass_ice_cockpit, cock_tempr_tmp[1])
set(glass_ice_cockpit2, cock_tempr_tmp[2])
else
set(temp_cabin, -((get(night_lights)^0.4)*int_temp[1])+int_temp[1])
set(glass_ice_cockpit, -((get(night_lights)^0.4)*cock_tempr_tmp[1])+cock_tempr_tmp[1])
set(glass_ice_cockpit2, -((get(night_lights)^0.4)*cock_tempr_tmp[2])+cock_tempr_tmp[2])
end



line67 = {"1200"} -- oxygen

--1.235
press_dif[1] = math.floor(math.abs(get(pressure_diffential_psi))*10) --12
press_dif[2] = math.floor(press_dif[1]/10)--1
press_dif[3] = press_dif[1] - press_dif[2]*10--2


line68 = {string.format("%s%s%s",press_dif[2],".",press_dif[3])}


if get(pressure_lndg_alt_1) == 0 then
lndg_alt[1] = 5000+math.floor(get(pressure_lndg_alt_2)*100)*50
end


line69 = {string.format("%s",lndg_alt[1])}








-- fuel indication


if get(fuel_xpump_l) == 1 then
	if get(en_but_run_l) > 0 and get(ENGN_N1_L) < 30 then
	fuelp_ind_l = 1
	else
	fuelp_ind_l = 0
	end
else
	if get(fuel_xpump_l) == 2 then
	fuelp_ind_l = 1
	else
	fuelp_ind_l = 0
	end
end


if get(fuel_xpump_r) == 1 then
	if get(APU_switch) > 0 and get(ENGN_N1_R) < 30 then
	fuelp_ind_r = 1
	else
		if get(en_but_run_r) > 0 and get(ENGN_N1_R) < 30 then
		fuelp_ind_r = 1
		else
		fuelp_ind_r = 0
		end
	end
else
	if get(fuel_xpump_r) == 2 then
	fuelp_ind_r = 1
	else
	fuelp_ind_r = 0
	end
end


--[=[
if get(fuel_xpump_l) == 0 then
fuelp_ind_l = 0

else
	if get(fuel_xpump_l) == 1 and get(dtr_s_l) == 1 then
	fuelp_ind_l = 1
	else
	if get(fuel_xpump_l) == 1 and get(dtr_s_l) == 0 then
		fuelp_ind_l = 0
		end
	end
	if get(fuel_xpump_l) == 2 then fuelp_ind_l = 1 end
end


if get(fuel_xpump_r) == 0 then
fuelp_ind_r = 0
else
	if get(fuel_xpump_r) == 1 and get(dtr_s_r) == 1 then
	fuelp_ind_r = 1
	else
		if get(fuel_xpump_r) == 1 and get(dtr_s_r) == 0 then
		fuelp_ind_r = 0
		end
	end
	if get(fuel_xpump_r) == 2 then fuelp_ind_r = 1 end

end

--]=]


line74 = {math.floor(get(hydr_pres_1))}
line75 = {math.floor(get(hydr_pres_2))}

line76 = {2981*hd_aux_state}

if get(deploy_ratio_0) > 0.5 and get(deploy_ratio_1) > 0.5 and get(deploy_ratio_2) > 0.5 then
line77 = {math.floor(get(hydraulic_fluid_ratio_1)*64.8)}
else
line77 = {math.floor(get(hydraulic_fluid_ratio_1)*100)}
end
line78 = {85}

line79 = {math.floor(get(hydraulic_fluid_ratio_2)*100)}



if hd_l_pump_state == 1 or hd_l_engn_state == 1 then
set(brks_low, 0)
line80 = {string.format("%s","NORM"),0,0.8,0}
line81 = {string.format("%s","NORM"),0,0.8,0}
line82 = {string.format("%s",2870),0,0.8,0}
else
set(brks_low, 1)
line80 = {string.format("%s","LOW"),0.8,0.8,0}
line81 = {string.format("%s","LOW"),0.8,0.8,0}
line82 = {string.format("%s",1200),0.8,0.8,0}
end

if hd_r_pump_state == 1 or hd_r_engn_state == 1 then
set(outbrks_low, 0)
else
set(outbrks_low, 1)
end

--[=[
if last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 1 then
set(map_mode, 2)
elseif last_states2[8] - get(mfd_frmt_r) ~= 0 and get(mfd_frmt_r) == 2 then set(map_mode, 4)
end
--]=]



if get(adf1_power) == 0 then
line83 = {string.format("%s","OFF")}
elseif get(adf1_power) == 1 then line83 = {string.format("%s","ANT")}
elseif get(adf1_power) == 2 then line83 = {string.format("%s","ON")}
elseif get(adf1_power) == 3 then line83 = {string.format("%s","BFO")}
elseif get(adf1_power) == 4 then line83 = {string.format("%s","TEST")}
end

if get(adf2_power) == 0 then
line84 = {string.format("%s","OFF")}
elseif get(adf2_power) == 1 then line84 = {string.format("%s","ANT")}
elseif get(adf2_power) == 2 then line84 = {string.format("%s","ON")}
elseif get(adf2_power) == 3 then line84 = {string.format("%s","BFO")}
elseif get(adf2_power) == 4 then line84 = {string.format("%s","TEST")}
end



if get(APU_running) == 0 and apu_off_t > -0.3 then apu_off_t = apu_off_t - 0.0012*((get(frame_rate_period)-0.02)*25 + 0.5) end
if get(APU_running) == 1 then apu_off_t = 1 end

--set(disp, apu_off_t)

--set(disp, get(glass_ice_cockpit) )


last_states = {get(deploy_ratio_0),get(deploy_ratio_1),get(deploy_ratio_2), get(cabin_altitude_ft), get(sbrk_h), get(flaprqst), get(gear_handle_status),get(mfd_sumry_l),get(mfd_antice_l),get(mfd_ecs_l),get(mfd_electr_l),get(mfd_flt_ctr_l),get(mfd_fuel_l),get(mfd_hydr_l),get(mfd_frmt_l),get(mfd_checkl_l)}
--						1					2					3						4					5			6					7					8				9				10				11					12					13				14			15				16
last_states2 = {get(mfd_sumry_r),get(mfd_antice_r),get(mfd_ecs_r),get(mfd_electr_r),get(mfd_flt_ctr_r),get(mfd_fuel_r),get(mfd_hydr_r),get(mfd_frmt_r),get(mfd_checkl_r), get(ENGN_running_l),get(ENGN_running_r), get(mfd_sel_state), get(autop_brgsrc), get(dcp_refs)}
--						1				2				3					4					5				6				7				8				9				10						11					12					13				14
end







components = {
    textureLit {
        position = function() return pos_1 end,
        image = get(menu1),
		visible = function()
            if get(mfd_sel_state)==1 then return true
			else return false
            end
        end,

    },
	-- N1 L arrow
	    needleLit {
        position = { 12, 806, 88, 88 },
        image = get(n1_needle),
        angle = function()

               return (get(ENGN_N1_L)*2.4+90)

        end,
		visible = true,
    },



		-- N1 L caret
	    needleLit {
        position = { 1, 795, 110, 110 },
        image = function()
		if get(carets) < 2 then return get(blue_arrow_line3) end
		if get(carets) >= 2 then return get(blue_arrow_line2) end
		end,


        angle = function()
		if get(carets) > 1 then
		return (get(TO_n1)*2.4+90)
		else
		return (get(TO_n1)*2.4+90+5)
		end

        end,
		visible = function()
		if get(thrust_reverser_deploy_ratio_0) < 0.1 and get(engine_speed_rpm_0) > 300 and get(gust_lock) == 0 then
		return get(carets) > 0
		else
		return false
		end
		end,
    },

			-- N1 R caret
	    needleLit {
        position = { 131, 795, 110, 110 },
        image = function()
		if get(carets) < 2 then return get(blue_arrow_line3) end
		if get(carets) >= 2 then return get(blue_arrow_line2) end
		end,


        angle = function()
		if get(carets) > 1 then
		return (get(TO_n1)*2.4+90)
		else
		return (get(TO_n1)*2.4+90+5)
		end

        end,
		visible = function()
		if get(thrust_reverser_deploy_ratio_1)< 0.1 and get(engine_speed_rpm_1) > 300 and get(gust_lock) == 0 then
		return get(carets) > 0
		else
		return false
		end
		end,
    },
		-- REV L caret
	    needleLit {
        position = { 1, 795, 110, 110 },
        image = get(blue_arrow_line2),

        angle = function()
		return (70.7*2.4+90)
        end,


		visible = function()
		return get(thrust_reverser_deploy_ratio_0) > 0.1
		end,
    },

				-- REV R caret
	    needleLit {
        position = { 131, 795, 110, 110 },
        image = get(blue_arrow_line2),

        angle = function()
		return (70.7*2.4+90)
        end,


		visible = function()
		return get(thrust_reverser_deploy_ratio_1) > 0.1
		end,
    },

	-- N1 R arrow
	    needleLit {
        position = { 142, 805, 88, 88 },
        image = get(n1_needle),
        angle = function()

               return (get(ENGN_N1_R)*2.38+90)

        end,
		visible = true,
    },

	-- ITT L
	    needleLit {
        position = { 10, 686, 88, 88 },
        image = get(n1_needle),
        angle = function()
		if get(ENGN_ITT_c_L) < 965 then
               return (get(ENGN_ITT_c_L)/4.2+90)
		else
		 return 320
		 end
        end,
		visible = true,
    },

		-- ITT R
	    needleLit {
        position = { 140, 686, 88, 88 },
        image = get(n1_needle),
        angle = function()
		if get(ENGN_ITT_c_R) < 965 then
               return (get(ENGN_ITT_c_R)/4.2+90)
		else
		 return 320
		 end
        end,
		visible = true,
    },
-- stab trim
	    textureLit {
        position = function() return pos_2 end,
        image = get(stab_trim_s),
		visible = true,

    },
-- flaps
	needleLit {
        position = { 263, 678, 70, 70 },
        image = get(n1_needle),
        angle = function()

               return (get(flaprat)*90+90)

        end,
		visible = true,
    },



	needleLit {
        position = { 255, 669, 88, 88 },
        image = get(blue_arrow_line),
        angle = function()

               return (get(flaprqst)*90+90)

        end,
		visible = true,
    },





--aileron trim

		    needleLit {
        position = { 391, 809, 44, 44 },
        image = get(ail_trim_s),
        angle = function()

               return (get(aileron_trim)*60)

        end,
		visible = true,
    },

	-- rudder trim
	textureLit {
        position = function() return pos_3 end,
        image = get(rud_trim_s),
		visible = true,

    },

-- gears --
	textureLit {
        position = { 403, 680, 31, 38 },
        image = function ()
		return gears_stat_d[1]
		end,
		visible = true,

    },

		textureLit {
        position = { 369, 665, 31, 38 },
         image = function ()
		return gears_stat_d[2]
		end,
		visible = true,

    },

	textureLit {
        position = { 437, 665, 31, 38 },
        image = function ()
		return gears_stat_d[3]
		end,
		visible = true,

    },

-- speed brake

	-- spoilers
	--spoiler2
	textureLit {
        position = { 416, 581, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 416, 581, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },


	-- line
		textureLit {
        position = function () return { 421, 590, 2, get(spoiler2_deg_1)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

		textureLit {
        position = function () return { 429, 590, 2, get(spoiler1_deg_1)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 429, 584+get(spoiler1_deg_1)*1.2, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 415, 584+get(spoiler2_deg_1)*1.2, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--
	-- spoilers
	--spoiler2 FLT page
	textureLit {
        position = { 418, -535, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 418, -535, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },


	-- line
		textureLit {
        position = function () return { 423, -526, 2, get(spoiler2_deg_1)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

		textureLit {
        position = function () return { 431, -526, 2, get(spoiler1_deg_1)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 431, -532+get(spoiler1_deg_1)*1.2, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 417, -532+get(spoiler2_deg_1)*1.2, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--



	-- spoiler1

		textureLit {
        position = { 305, 581, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 305, 581, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },





	-- line2
		textureLit {
        position = function () return { 310, 590, 2, get(spoiler1_deg_0)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 318, 590, 2, get(spoiler2_deg_0)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows2

	textureLit {
        position = function () return { 318, 584+get(spoiler2_deg_0)*1.2, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 304, 584+get(spoiler1_deg_0)*1.2, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--
	-- spoiler1 FLT PAGE

		textureLit {
        position = { 232, -535, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 232, -535, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },





	-- line2
		textureLit {
        position = function () return { 237, -526, 2, get(spoiler1_deg_0)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 245, -526, 2, get(spoiler2_deg_0)*1.2 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows2

	textureLit {
        position = function () return { 245, -532+get(spoiler2_deg_0)*1.2, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 231, -532+get(spoiler1_deg_0)*1.2, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(spoiler1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--
	-- speedbrakes




	textureLit {
        position = { 336, 581, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 336, 581, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },

		-- line
		textureLit {
        position = function () return { 341, 590, 2, get(speedbrake1_deg_0)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 349, 590, 2, get(speedbrake1_deg_0)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 349, 584+get(speedbrake1_deg_0)*0.9, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 335, 584+get(speedbrake1_deg_0)*0.9, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--sbrk right


	textureLit {
        position = { 385, 581, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 385, 581, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },

		-- line
		textureLit {
        position = function () return { 390, 590, 2, get(speedbrake1_deg_1)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 398, 590, 2, get(speedbrake1_deg_1)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 398, 584+get(speedbrake1_deg_1)*0.9, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 384, 584+get(speedbrake1_deg_1)*0.9, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },



	--
-- spbrakes flt


	textureLit {
        position = { 263, -535, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 263, -535, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },

		-- line
		textureLit {
        position = function () return { 268, -526, 2, get(speedbrake1_deg_0)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 276, -526, 2, get(speedbrake1_deg_0)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 276, -532+get(speedbrake1_deg_0)*0.9, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 262, -532+get(speedbrake1_deg_0)*0.9, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_0) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	--

--sbrk right


	textureLit {
        position = { 387, -535, 21, 9 },
        image = get(sbrake1_yellow),
		visible = function()
		if get(hydr_pres_1) < 10 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = { 387, -535, 21, 9 },
        image = get(sbrake1_green),
		visible = function()
		if get(hydr_pres_1) > 10 then
		return true
		else
		return false
		end
		end,

    },

		-- line
		textureLit {
        position = function () return { 392, -526, 2, get(speedbrake1_deg_1)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

			textureLit {
        position = function () return { 400, -526, 2, get(speedbrake1_deg_1)*0.9 } end,
        image = get(green_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	-- arrows

	textureLit {
        position = function () return { 400, -532+get(speedbrake1_deg_1)*0.9, 8, 7} end,
        image = get(arrow_line),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },

	textureLit {
        position = function () return { 386, -532+get(speedbrake1_deg_1)*0.9, 8, 7} end,
        image = get(arrow_line2),
		visible = function()
		if get(hydr_pres_1) > 5 and get(speedbrake1_deg_1) > 0.91 then
		return true
		else
		return false
		end
		end,

    },


	-- cabrate arrows

	textureLit {
        position = { 383, 503, 5, 32},
        image = get(arrow_cab_up),
		visible = function()
		return cabin_alt_temp[1]
		end,

    },

	textureLit {
        position = { 383, 503, 5, 32},
        image = get(arrow_cab_down),
		visible = function()
		return cabin_alt_temp[2]
		end,

    },




	textureLit {
        position = { 108, 278, 10, 14},
        image = get(cabrate2_up),
		visible = function()
		return cabin_alt_temp[1]
		end,

    },

	textureLit {
        position = { 108, 278, 10, 14},
        image = get(cabrate2_dn),
		visible = function()
		return cabin_alt_temp[2]
		end,

    },

	--

-- distinguishing flaps and spoilers
	textureLit {
        position = { 270, 560, 200, 180},
        image = get(black),
		visible = function()
		return flp_sbr_blank == 1
		end,

    },


	-- starter
	textureLit {
        position = { 207, 590, 14, 75},
        image = get(start),
		visible = function()
		return get(dtr_s_r) == 1
		end,

    },

		textureLit {
        position = { 16, 590, 14, 75},
        image = get(start),
		visible = function()
		return get(dtr_s_l) == 1
		end,

    },

	-- MFD control arrows


		textureLit {
        position = { -175, -433, 52, 19},
        image = function()
		if get(mfdpan_lr_sw) < 1 then return get(mfd_ctrl_l) else return get(mfd_ctrl_r) end
		end,
		visible = true,

    },




	-- ELECTRIC MFD

		-- Left bus

		textureLit {
        position = { 61, -213, 185, 64},
        image = get(elec_page3),
		visible = function()
		return get(elbus1) > 10
		end,

    },

		-- Right bus

		textureLit {
        position = { 422, -213, 188, 64},
        image = get(elec_page4),
		visible = function()
		return get(elbus2) > 10
		end,

    },


	-- batt L

		textureLit {
        position = { 176, -97, 60, 48},
        image = get(elec_page1),
		visible = function()
		return get(bat_on) == 1
		end,

    },


		textureLit {
        position = { 204, -150, 3, 56},
        image = get(green_line),
		visible = function()
		return get(bat_on) == 1
		end,

    },

	-- batt R

		textureLit {
        position = { 439, -97, 60, 48},
        image = get(elec_page1),
		visible = function()
		return get(bat_on2) == 1
		end,

    },


		textureLit {
        position = { 466, -150, 3, 56},
        image = get(green_line),
		visible = function()
		return get(bat_on2) == 1
		end,

    },

	-- GEN L

		textureLit {
        position = { 185, -343, 42, 40},
        image = get(elec_page2),
		visible = function()
		return get(generator_on_l) == 1 and get(ENGN_running_l) > 0
		end,

    },


		textureLit {
        position = { 204, -305, 3, 51},
        image = get(green_line),
		visible = function()
		return get(generator_on_l) == 1 and get(ENGN_running_l) > 0
		end,

    },

		textureLit {
        position = { 204, -232, 3, 21},
        image = get(green_line),
		visible = function()
		return get(generator_on_l) == 1 and get(ENGN_running_l) > 0
		end,

    },

	-- GEN R

		textureLit {
        position = { 447, -343, 42, 40},
        image = get(elec_page2),
		visible = function()
		return get(generator_on_r) == 1 and get(ENGN_running_r) > 0
		end,

    },


		textureLit {
        position = { 466, -305, 3, 51},
        image = get(green_line),
		visible = function()
		return get(generator_on_r) == 1 and get(ENGN_running_r) > 0
		end,

    },

		textureLit {
        position = { 466, -232, 3, 21},
        image = get(green_line),
		visible = function()
		return get(generator_on_r) == 1 and get(ENGN_running_r) > 0
		end,

    },
		-- GEN APU

		textureLit {
        position = { 313, -343, 42, 40},
        image = get(elec_page2),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },


		textureLit {
        position = { 333, -305, 3, 51},
        image = get(green_line),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 244, -203, 74, 4},
        image = get(green_line),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 315, -232, 4, 32},
        image = get(green_line),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 351, -203, 76, 4},
        image = get(green_line),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 350, -232, 4, 32},
        image = get(green_line),
		visible = function()
		return get(APU_generator_on) == 1 and get(APU_running) > 0
		end,

    },



	-- Bus tie

		textureLit {
        position = { 243, -163, 181, 4},
        image = get(green_line),
		visible = function()
		return get(bus_tie) > 0
		end,

    },

		-- ext power

		textureLit {
        position = { 315, -112, 42, 40},
        image = get(elec_page2),
		visible = function()
		return get(electr_extp) == 1
		end,

    },


		textureLit {
        position = { 333, -160, 4, 51},
        image = get(green_line),
		visible = function()
		return get(electr_extp) == 1
		end,

    },


	-- ANTICE PAGE

		textureLit {
        position = { 705, -673, 89, 27},
        image = get(antice_page1),
		visible = function()
		if get(ice_inlet_heat_on) > 0 and get(antice_engn_l_h) > 0 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,

    },

		textureLit {
        position = { 1220, -673, 89, 27},
        image = get(antice_page2),
		visible = function()
		if get(ice_inlet_heat_on) > 0 and get(antice_engn_r_h) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,

    },
-- ice engn running l
		textureLit {
        position = { 749, -695, 68, 4},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_l) > 0
		end,
    },

		textureLit {
        position = { 841, -695, 27, 4},
        image = get(green_line),
		visible = function()
		if get(antice_wngsource_r) < 2 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 898, -695, 29, 4},
        image = get(green_line),
		visible = function()
		if get(antice_wngsource_r) < 2 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    }, --

		textureLit {
        position = { 817, -705, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(antice_wngsource_r) < 2 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 806, -693, 4, 35},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_l) > 0
		end,
    },

		textureLit {
        position = { 794, -662, 15, 4},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_l) > 0
		end,
    },

		textureLit {
        position = { 928, -705, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(antice_wngsource_r) < 2 and get(ENGN_running_l) > 0 and get(antice_wing_h) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 953, -695, 108, 4},
        image = get(green_line),
		visible = function()
		if get(ENGN_running_l) > 0 and get(antice_wngsource_r) == 0 and get(antice_wing_h) > 0 then return true end
		if get(ENGN_running_r) > 0 and get(antice_wngsource_r) == 2 and get(antice_wing_h) > 0 then return true end
		if get(antice_wngsource_r) == 0 and get(ENGN_running_l) < 1 then return false end
		if get(antice_wngsource_r) == 2 and get(ENGN_running_r) < 1 then return false end
		if get(antice_wngsource_r) == 1 or get(antice_wing_h) < 1 then return false end

		end,
    },

		textureLit {
        position = { 995, -705, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(ENGN_running_l) > 0 and get(antice_wngsource_r) == 0 and get(antice_wing_h) > 0 then return true end
		if get(ENGN_running_r) > 0 and get(antice_wngsource_r) == 2 and get(antice_wing_h) > 0 then return true end
		if get(antice_wngsource_r) == 0 and get(ENGN_running_l) < 1 then return false end
		if get(antice_wngsource_r) == 2 and get(ENGN_running_r) < 1 then return false end
		if get(antice_wngsource_r) == 1 or get(antice_wing_h) < 1 then return false end
		end,
    },

		textureLit {
        position = { 964, -695, 4, 240},
        image = get(green_line),
		visible = function()
		if get(ice_surfce_heat_left_on) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 953, -695, 16, 4},
        image = get(green_line),
		visible = function()
		if get(ice_surfce_heat_left_on) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 750, -563, 213, 113},
        image = get(antice_page4),
		visible = function()
		if get(ice_surfce_heat_left_on) > 0 then
		return true
		else
		return false
		end
		end,
    },

-- ice engn running r
		textureLit {
        position = { 1197, -695, 68, 4},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_r) > 0
		end,
    },

		textureLit {
        position = { 1086, -695, 30, 4},
        image = get(green_line),
		visible = function()
		if get(antice_wngsource_r) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 1146, -695, 27, 4},
        image = get(green_line),
		visible = function()
		if get(antice_wngsource_r) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 1173, -705, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(antice_wngsource_r) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 1204, -693, 4, 35},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_r) > 0
		end,
    },

		textureLit {
        position = { 1204, -662, 15, 4},
        image = get(green_line),
		visible = function()
		return get(ENGN_running_r) > 0
		end,


    },

		textureLit {
        position = { 1062, -705, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(antice_wngsource_r) > 0 and get(ENGN_running_r) > 0 and get(antice_wing_h) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 1046, -695, 4, 240},
        image = get(green_line),
		visible = function()
		if get(ice_surfce_heat_right_on) > 0 then
		return true
		else
		return false
		end
		end,
    },

			textureLit {
        position = { 1046, -695, 16, 4},
        image = get(green_line),
		visible = function()
		if get(ice_surfce_heat_right_on) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { 1051, -563, 212, 113},
        image = get(antice_page5),
		visible = function()
		if get(ice_surfce_heat_right_on) > 0 then
		return true
		else
		return false
		end
		end,
    },


	-- ECS page






-- left engn bleed
		textureLit {
        position = { -578, -298, 101, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -451, -298, 43, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -412, -298, 4, 19},
        image = get(green_line),
		visible = function()
		if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -553, -308, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(bleed_en_l_h) > 0 and get(ENGN_running_l) > 0 then
		return true
		else
		return false
		end
		end,
    },

	-- right engn bleed

		textureLit {
        position = { -194, -298, 98, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -264, -298, 43, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -264, -298, 4, 19},
        image = get(green_line),
		visible = function()
		if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -148, -308, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(bleed_en_r_h) > 0 and get(ENGN_running_r) > 0 then
		return true
		else
		return false
		end
		end,
    },

-- apu bleed



		textureLit {
        position = { -300, -355, 4, 61},
        image = get(green_line),
		visible = function()
		if get(bleed_apu_h) > 0 and get(APU_running) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -309, -336, 23, 23},
        image = get(antice_page6),
		visible = function()
		if get(bleed_apu_h) > 0 and get(APU_running) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -264, -298, 4, 19},
        image = get(green_line),
		visible = function()
		if get(bleed_apu_h) > 0 and get(APU_running) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -300, -298, 37, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_apu_h) > 0 and get(APU_running) > 0 then
		return true
		else
		return false
		end
		end,
    },

-- xbleed

		textureLit {
        position = { -412, -298, 151, 4},
        image = get(green_line),
		visible = function()
		if get(bleed_en_l_h) > 0 or get(bleed_en_r_h) > 0 or get(bleed_apu_h) > 0 then
			if get(bleed_xbleed_h) > 0 then
			return true
			end
			else
			return false
		end
		end,
    },

		textureLit {
        position = { -350, -308, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(bleed_en_l_h) > 0 or get(bleed_en_r_h) > 0 or get(bleed_apu_h) > 0 then
			if get(bleed_xbleed_h) > 0 then
			return true
			end
			else
			return false
		end
		end,
    },

-- ram air

		textureLit {
        position = { -558, -145, 118, 4},
        image = get(green_line),
		visible = function()
		if get(aircond_ramair_h) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -530, -155, 23, 23},
        image = get(antice_page3),
		visible = function()
		if get(aircond_ramair_h) > 0 then
		return true
		else
		return false
		end
		end,
    },

		textureLit {
        position = { -558, -141, 4, 20},
        image = get(green_line),
		visible = function()
		if get(aircond_ramair_h) > 0 then
		return true
		else
		return false
		end
		end,
    },

-- cockpit and cabin

		textureLit {
        position = { -446, -145, 214, 4},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1
		end,
    },

		textureLit {
        position = { -445, -141, 4, 20},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1
		end,
    },

		textureLit {
        position = { -445, -100, 4, 33},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1
		end,
    },

		textureLit {
        position = { -235, -141, 4, 20},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1
		end,
    },

		textureLit {
        position = { -235, -100, 4, 33},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1 or ecs_temp[2] == 1 or get(aircond_ramair_h) == 1
		end,
    },


	-- ecs pack and trim


		textureLit {
        position = { -412, -295, 4, 81},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1
		end,
    },

		textureLit {
        position = { -412, -162, 4, 17},
        image = get(green_line),
		visible = function()
		return ecs_temp[1] == 1
		end,
    },

		textureLit {
        position = { -264, -295, 4, 81},
        image = get(green_line),
		visible = function()
		return ecs_temp[2] == 1
		end,
    },

		textureLit {
        position = { -264, -162, 4, 17},
        image = get(green_line),
		visible = function()
		return ecs_temp[2] == 1
		end,
    },

		textureLit {
        position = { -469, -215, 118, 55},
        image = get(antice_page7),
		visible = function()
		return ecs_temp[1] == 1
		end,
    },


		textureLit {
        position = { -421, -280, 23, 23},
        image = get(antice_page6),
		visible = function()
		return ecs_temp[1] == 1
		end,
    },


		textureLit {
        position = { -324, -215, 118, 55},
        image = get(antice_page7),
		visible = function()
		return ecs_temp[2] == 1
		end,
    },

		textureLit {
        position = { -274, -280, 23, 23},
        image = get(antice_page6),
		visible = function()
		return ecs_temp[2] == 1
		end,
    },

		textureLit {
        position = { -411, -241, 150, 4},
        image = get(green_line),
		visible = function()
		return ecs_temp[2] == 1 and ecs_temp[1] == 1
		end,
    },

		textureLit {
        position = { -349, -250, 23, 23},
        image = get(antice_page3),
		visible = function()
		return ecs_temp[2] == 1 and ecs_temp[1] == 1
		end,
    },

	-- ECS cabrate arrows

	textureLit {
        position = { -73, -60, 5, 22},
        image = get(arrow_cab_up),
		visible = function()
		return cabin_alt_temp[1]
		end,

    },

	textureLit {
        position = { -73, -58, 5, 22},
        image = get(arrow_cab_down),
		visible = function()
		return cabin_alt_temp[2]
		end,

    },

	-- FLTCtrl

	--rudder

	needleLit {
        position = { 297, -718, 67, 67 },
        image = function()
		if get(hydr_pres_1) > 10 then
		return get(fltc_rudder_grn)
		else
		return get(fltc_rudder_yel)
		end
		end,
		angle = function()
               return (-get(ldruddef)*2.1)
        end,
		visible = true,
    },
-- elev right
		    textureLit {
        position = function() return pos_4 end,
        image = function()
		if get(hydr_pres_1) > 10 then
		return get(fltc_trngl_l_grn)
		else
		return get(fltc_trngl_l_yel)
		end
		end,
		visible = true,

    },
-- elev left
		textureLit {
        position = function() return pos_5 end,
        image = function()
		if get(hydr_pres_1) > 10 then
		return get(fltc_trngl_r_grn)
		else
		return get(fltc_trngl_r_yel)
		end
		end,
		visible = true,

    },

	--ail left
		textureLit {
        position = function() return pos_6 end,
        image = get(fltc_trngl_l_grn),
		visible = true,

    },

	--ail right
		textureLit {
        position = function() return pos_7 end,
        image = (fltc_trngl_r_grn),
		visible = true,

    },
-- flaps
		textureLit {
        position = { 246, -585, 62, 43 },
        image = (fltc_flap_l),
		visible = function()
		return get(hydr_pres_1) > 10
		end,

    },

		textureLit {
        position = { 363, -585, 61, 43 },
        image = (fltc_flap_r),
		visible = function()
		return get(hydr_pres_1) > 10
		end,

    },
--get(fltc_trngl_l_grn),

--[=[
		textureLit {
        position = { 163, -741, 150, 150},
        image = get(green_line),
		visible = true,
    },--]=]


-- fuel
		textureLit {
        position = { 274, -896, 24, 23 },
        image = (fuelp_pump),
		visible = function()
		return fuelp_ind_l == 1
		end,

    },

		textureLit {
        position = { 376, -896, 24, 23 },
        image = (fuelp_pump),
		visible = function()
		return fuelp_ind_r == 1
		end,

    },

--right

		textureLit {
        position = { 386, -872, 4, 14 },
        image = (green_line),
		visible = function()
		return fuelp_ind_r == 1--get(ENGN_running_r) > 0 or get(APU_running) > 0 or
		end,

    },

		textureLit {
        position = { 386, -916, 4, 19 },
        image = (green_line),
		visible = function()
		return fuelp_ind_r == 1--get(ENGN_running_r) > 0 or get(APU_running) > 0 or
		end,

    },

		textureLit {
        position = { 386, -916, 37, 4 },
        image = (green_line),
		visible = function()
		return fuelp_ind_r == 1 --get(ENGN_running_r) > 0 or get(APU_running) > 0 or
		end,

    },


-- left
		textureLit {
        position = { 284, -872, 4, 14 },
        image = (green_line),
		visible = function()
		return fuelp_ind_l == 1--get(ENGN_running_l) > 0 or
		end,

    },

		textureLit {
        position = { 284, -916, 4, 19 },
        image = (green_line),
		visible = function()
		return fuelp_ind_l == 1--get(ENGN_running_l) > 0 or
		end,

    },

		textureLit {
        position = { 251, -916, 37, 4 },
        image = (green_line),
		visible = function()
		return fuelp_ind_l == 1--get(ENGN_running_l) > 0 or
		end,

    },


-- left refuel 1
		textureLit {
        position = { 244, -913, 15, 54 },
        image = (fuelp_rfport),
		visible = function()
		return true
		end,

    },

--right refuel 1
		textureLit {
        position = { 415, -913, 15, 54 },
        image = (fuelp_rfport),
		visible = function()
		return true
		end,

    },

	-- left refuel 2
		textureLit {
        position = { 184, -853, 55, 15 },
        image = (fuelp_rfport2_l),
		visible = function()
		return true
		end,

    },

	-- right refuel 2
		textureLit {
        position = { 435, -853, 55, 15 },
        image = (fuelp_rfport2_r),
		visible = function()
		return true
		end,

    },

-- grav flow valve

		textureLit {
        position = { 265, -805, 145, 4 },
        image = (green_line),
		visible = function()
		return get(fuel_xflow_up_h) > 0
		end,

    },

		textureLit {
        position = { 324, -817, 25, 25 },
        image = (antice_page3),
		visible = function()
		return get(fuel_xflow_up_h) > 0
		end,

    },

	-- xref valve

		textureLit {
        position = { 296, -886, 82, 4 },
        image = (green_line),
		visible = function()
		return get(fuel_xflow_dn_h) > 0
		end,

    },

		textureLit {
        position = { 324, -897, 25, 25 },
        image = (antice_page3),
		visible = function()
		return get(fuel_xflow_dn_h) > 0
		end,

    },

	-- left engine valve

		textureLit {
        position = { 250, -1010, 3, 97 },
        image = (green_line),
		visible = function()
		return fuelp_ind_l == 1 or get(ENGN_running_l) == 1 or get(en_but_run_l) == 1
		end,

    },

		textureLit {
        position = { 240, -988, 24, 24 },
        image = (antice_page6),
		visible = function()
		return fuelp_ind_l == 1 or get(ENGN_running_l) == 1 or get(en_but_run_l) == 1
		end,

    },

		textureLit {
        position = { 171, -1058, 82, 22 },
        image = (fuelp_engn_l),
		visible = function()
		return fuelp_ind_l == 1 or get(ENGN_running_l) == 1 or get(en_but_run_l) == 1
		end,

    },




		-- right engine valve

		textureLit {
        position = { 420, -1012, 4, 99 },
        image = (green_line),
		visible = function()
		return fuelp_ind_r == 1 or get(ENGN_running_r) == 1 or get(en_but_run_r) == 1--or get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 410, -988, 24, 24 },
        image = (antice_page6),
		visible = function()
		return fuelp_ind_r == 1 or get(ENGN_running_r) == 1 or get(en_but_run_r) == 1 --or get(APU_running) > 0
		end,

    },

		textureLit {
        position = { 419, -1058, 83, 22 },
        image = (fuelp_engn_r),
		visible = function()
		return fuelp_ind_r == 1 or get(ENGN_running_r) == 1 or get(en_but_run_r) == 1 --or get(APU_running) > 0
		end,

    },


		-- apu valve

		textureLit {
        position = { 335, -954, 86, 4 },
        image = (green_line),
		visible = function()
		return get(APU_running) == 1
		end,

    },

		textureLit {
        position = { 420, -954, 4, 50 },
        image = (green_line),
		visible = function()
		return get(APU_running) == 1
		end,

    },

		textureLit {
        position = { 335, -1049, 4, 95 },
        image = (green_line),
		visible = function()
		return get(APU_running) == 1
		end,

    },

		textureLit {
        position = { 325, -1007, 24, 24 },
        image = (antice_page6),
		visible = function()
		return get(APU_running) == 1
		end,

    },

	-- HYDRAULIC page


	-- left hs

	-- engn sov and pump


		textureLit {
        position = { 743, -210, 4, 41 },
        image = (green_line),
		visible = function()
		return hd_l_engn_state == 1
		end,

    },

		textureLit {
        position = { 799, -173, 4, 93 },
        image = (green_line),
		visible = function()
		return hd_l_engn_state == 1
		end,

    },

		textureLit {
        position = { 743, -210, 76, 4 },
        image = (green_line),
		visible = function()
		return hd_l_engn_state == 1
		end,

    },

		textureLit {
        position = { 743, -173, 60, 4 },
        image = (green_line),
		visible = function()
		return hd_l_engn_state == 1
		end,

    },

		textureLit {
        position = { 790, -127, 23, 23 },
        image = (antice_page6),
		visible = function()
		return get(hydr_l_sov_h) == 1
		end,

    },

		textureLit {
        position = { 733, -202, 23, 23 },
        image = (fuelp_pump),
		visible = function()
		return hd_l_engn_state == 1
		end,

    },



	-- left dc pump

		textureLit {
        position = { 888, -210, 4, 130 },
        image = (green_line),
		visible = function()
		return hd_l_pump_state == 1
		end,

    },

		textureLit {
        position = { 853, -210, 37, 4 },
        image = (green_line),
		visible = function()
		return hd_l_pump_state == 1
		end,

    },


		textureLit {
        position = { 879, -149, 23, 23 },
        image = (fuelp_pump),
		visible = function()
		return hd_l_pump_state == 1
		end,

    },

	-- PTU valve

		textureLit {
        position = { 922, -336, 4, 209 },
        image = (green_line),
		visible = function()
		if get(ptu_h) == 1 then
			if hd_l_pump_state ~= 1 and hd_l_engn_state ~= 1 then
			return hd_ptu_state == 1
			else
			return false
			end
		else
			if get(ptu_h) == 2 then
			return hd_ptu_state == 1
			else
			return false
			end
		end


		end,

    },

--[=[		textureLit {
        position = { 922, -127, 4, 28 },
        image = (green_line),
		visible = function()
		return true--hd_ptu_state == 1
		end,

    },

		textureLit {
        position = { 889, -100, 37, 4 },
        image = (green_line),
		visible = function()
		return true
		end,

    },
--]=]

		textureLit {
        position = { 913, -148, 23, 23 },
        image = (antice_page6),
		visible = function()
		if get(ptu_h) == 1 then
			if hd_l_pump_state ~= 1 and hd_l_engn_state ~= 1 then
			return hd_ptu_state == 1
			else
			return false
			end
		else
			if get(ptu_h) == 2 then
			return hd_ptu_state == 1
			else
			return false
			end
		end
		end,

    },

	-- ptu gear

		textureLit {
        position = { 905, -356, 35, 11 },
        image = (hd_gear),
		visible = function()
		return hd_ptu_state == 1
		end,

    },

	-- actual hydr left

	textureLit {
        position = { 719, -254, 119, 4 },
        image = (green_line),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },

	textureLit {
        position = { 719, -267, 4, 14 },
        image = (green_line),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },

	textureLit {
        position = { 834, -266, 4, 40 },
        image = (green_line),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },


	-- l hs inscripts
	textureLit {
        position = { 772, -383, 124, 108 },
        image = (hd_l_hs),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },


	-- left hs press norm

		textureLit {
        position = { 678, -295, 40, 23 },
        image = (hd_press_norm),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },

	-- left inb brks

		textureLit {
        position = { 673, -329, 97, 21 },
        image = (hd_inb_brk),
		visible = function()
		return hd_l_pump_state == 1 or hd_l_engn_state == 1
		end,

    },







	-- right hs

		-- right engn sov and pump


		textureLit {
        position = { 1266, -210, 4, 41 },
        image = (green_line),
		visible = function()
		return hd_r_engn_state == 1
		end,

    },

		textureLit {
        position = { 1209, -173, 4, 93 },
        image = (green_line),
		visible = function()
		return hd_r_engn_state == 1
		end,

    },

		textureLit {
        position = { 1187, -210, 79, 4 },
        image = (green_line),
		visible = function()
		return hd_r_engn_state == 1
		end,

    },

		textureLit {
        position = { 1209, -173, 60, 4 },
        image = (green_line),
		visible = function()
		return hd_r_engn_state == 1
		end,

    },

		textureLit {
        position = { 1200, -127, 23, 23 },
        image = (antice_page6),
		visible = function()
		return get(hydr_r_sov_h) == 1
		end,

    },

		textureLit {
        position = { 1256, -202, 23, 23 },
        image = (fuelp_pump),
		visible = function()
		return hd_r_engn_state == 1
		end,

    },



	-- right dc pump

		textureLit {
        position = { 1121, -210, 4, 130 },
        image = (green_line),
		visible = function()
		return hd_r_pump_state == 1
		end,

    },

		textureLit {
        position = { 1121, -210, 30, 4 },
        image = (green_line),
		visible = function()
		return hd_r_pump_state == 1
		end,

    },


		textureLit {
        position = { 1111, -149, 23, 23 },
        image = (fuelp_pump),
		visible = function()
		return hd_r_pump_state == 1
		end,

    },


	-- actual hydr right

	textureLit {
        position = { 1167, -254, 118, 4 },
        image = (green_line),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },

	textureLit {
        position = { 1281, -267, 4, 14 },
        image = (green_line),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },

	textureLit {
        position = { 1167, -266, 4, 40 },
        image = (green_line),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },

	-- right hs inscripts
	textureLit {
        position = { 1104, -383, 123, 108 },
        image = (hd_r_hs),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },



	-- right hs press norm

		textureLit {
        position = { 1262, -295, 40, 23 },
        image = (hd_press_norm),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },

	-- outb brks

		textureLit {
        position = { 1255, -329, 51, 23 },
        image = (hd_outb_brk),
		visible = function()
		return hd_r_pump_state == 1 or hd_r_engn_state == 1
		end,

    },




	-- AUX hs

		textureLit {
        position = { 1007, -266, 4, 59 },
        image = (green_line),
		visible = function()
		return hd_aux_state == 1
		end,

    },

		textureLit {
        position = { 1007, -174, 4, 74 },
        image = (green_line),
		visible = function()
		return hd_aux_state == 1
		end,

    },

		textureLit {
        position = { 998, -149, 23, 23 },
        image = (fuelp_pump),
		visible = function()
		return hd_aux_state == 1
		end,

    },

-- aux rudd
			textureLit {
        position = { 982, -284, 52, 10 },
        image = (hd_rudd),
		visible = function()
		return hd_aux_state == 1
		end,

    },
    rectangle {
        position = { 40, 548, 145, 35 };
        color = { 0.0, 0.0, 0.0, 1.0 };
		visible = function()
		return apu_off_t < 0.1
		end,

    };
--140, 548,
};


--
function draw()



drawText(font3, 8, 52, line1[1],  color2[1],color2[2],color2[3])
drawText(font2, 11, 26, line2[1],  color1[1],color1[2],color1[3])
drawText(font3, 578, 52, line3[1],  color2[1],color2[2],color2[3])
drawText(font2, 591, 26, line4[1],  color1[1],color1[2],color1[3])

drawText(font3, 114, 52, line5[1],  color2[1],color2[2],color2[3])
drawText(font2, 115, 26, line6[1],  color1[1],color1[2],color1[3])
drawText(font3, 484, 52, line7[1],  color2[1],color2[2],color2[3])
drawText(font2, 485, 26, line8[1],  color1[1],color1[2],color1[3])

drawText(font3, 290, 52, line9[1],  color2[1],color2[2],color2[3])
drawText(font2, 290, 26, line10[1],  color1[1],color1[2],color1[3])
drawText(font1, 290, 6, line83[1],  color3[1],color3[2],color3[3])

drawText(font3, 58, 854, line11[1],  color_n1_l[1],color_n1_l[2],color_n1_l[3])
drawText(font3, 188, 854, line12[1],  color_n1_r[1],color_n1_r[2],color_n1_r[3])

drawText(font3, 62, 737, line13[1],  color_itt_l[1],color_itt_l[2],color_itt_l[3])
drawText(font3, 192, 737, line14[1],  color_itt_r[1],color_itt_r[2],color_itt_r[3])

drawText(font4, 29, 817, line15[1],   color4[1],color4[2],color4[3])
drawText(font4, 159, 817, line16[1],   color4[1],color4[2],color4[3])

drawText(font5, 40, 647, line17[1],   color_n2_l[1],color_n2_l[2],color_n2_l[3])
drawText(font5, 170, 647, line18[1],   color_n2_r[1],color_n2_r[2],color_n2_r[3])

drawText(font5, 40, 613, line19[1],   color_oilt_l[1],color_oilt_l[2],color_oilt_l[3])
drawText(font5, 170, 613, line20[1],   color_oilt_r[1],color_oilt_r[2],color_oilt_r[3])

drawText(font5, 40, 630, line21[1],   color_oilp_l[1],color_oilp_l[2],color_oilp_l[3])
drawText(font5, 170, 630, line22[1],   color_oilp_r[1],color_oilp_r[2],color_oilp_r[3])

drawText(font5, 40, 596, line23[1],   color2[1],color2[2],color2[3])
drawText(font5, 170, 596, line24[1],   color2[1],color2[2],color2[3])

drawText(font5, 140, 564, line25[1],   color2[1],color2[2],color2[3])
drawText(font5, 140, 548, line26[1],   color2[1],color2[2],color2[3])

drawText(font5, 120, 505, line27[1],   color_fuel[1],color_fuel[2],color_fuel[3])
drawText(font5, 50, 489, line28[1],   color_fuel[1],color_fuel[2],color_fuel[3])

drawText(font5,70, 669, line29[1],   color5[1],color5[2],color5[3])
drawText(font5, 140, 669, line30[1],   color5[1],color5[2],color5[3])

drawText(font3, 311, pos_2[2]+7, line31[1],   color2[1],color2[2],color2[3])

drawText(font2, 332, 722, line32[1],  color2[1],color2[2],color2[3])

drawText(font5, 395, 522, line33[1],   color2[1],color2[2],color2[3])
drawText(font5, 395, 506, line34[1],   color2[1],color2[2],color2[3])
drawText(font1, -55, -44, line33[1],   color2[1],color2[2],color2[3])
drawText(font1, -55, -59, line34[1],   color2[1],color2[2],color2[3])


drawText(font1, 58, 875, line35[1],  color3[1],color3[2],color3[3])
drawText(font1, 188, 875, line36[1],  color3[1],color3[2],color3[3])

drawText(font5,40, 780, line37[1],   color_rev1[1],color_rev1[2],color_rev1[3])
drawText(font5, 170, 780, line38[1],   color_rev2[1],color_rev2[2],color_rev2[3])

drawText(font5,97, 780, line39[1],   color_sync[1],color_sync[2],color_sync[3])

drawText(font3, 390, 52, line40[1],  color2[1],color2[2],color2[3])
drawText(font2, 390, 26, line41[1],  color1[1],color1[2],color1[3])
drawText(font1, 390, 6, line84[1],  color3[1],color3[2],color3[3])

drawText(font4, 198, 49, line42[1],  color_trans[1],color_trans[2],color_trans[3])

drawText(font1, 198, 26, line43[1],  color3[1],color3[2],color3[3])
drawText(font1, 198, 9, line44[1],  color3[1],color3[2],color3[3])

drawText(font5,97, 795, line45[1],   color_mach[1],color_mach[2],color_mach[3])

drawText(font1,188, -48, line46[1],   color_batt_l[1],color_batt_l[2],color_batt_l[3])
drawText(font1,450, -48, line46b[1],   color_batt_r[1],color_batt_r[2],color_batt_r[3])
drawText(font1,185, -88, line47[1],   color_batt_l[1],color_batt_l[2],color_batt_l[3])
drawText(font1,446, -88, line48[1],   color_batt_r[1],color_batt_r[2],color_batt_r[3])
drawText(font1,195, -249, line49[1],   color_vgen_l[1],color_vgen_l[2],color_vgen_l[3])
drawText(font1,456, -249, line50[1],   color_vgen_r[1],color_vgen_r[2],color_vgen_r[3])
drawText(font1,325, -249, line51[1],   color_apu[1],color_apu[2],color_apu[3])

drawText(font1,188, -358, line52[1],   color_vgen_l[1],color_vgen_l[2],color_vgen_l[3])
drawText(font1,447, -358, line53[1],   color_vgen_r[1],color_vgen_r[2],color_vgen_r[3])

drawText(font1,315, -358, line54[1],   color_apu[1],color_apu[2],color_apu[3])

drawText(font1,307, -66, line55[1],   color_extp[1],color_extp[2],color_extp[3])


drawText(font1,876, -691, line56[1],   color1[1],color1[2],color1[3])
drawText(font1,1124, -691, line57[1],   color1[1],color1[2],color1[3])

drawText(font1,-472, -297, line58[1],   color1[1],color1[2],color1[3])
drawText(font1,-216, -297, line59[1],   color1[1],color1[2],color1[3])

drawText(font1,-463, -116, line60[1],   color1[1],color1[2],color1[3])
drawText(font1,-433, -89, line61[1],   color3[1],color3[2],color3[3])
drawText(font1,-463, -65, line62[1],   color1[1],color1[2],color1[3])

drawText(font1,-253, -116, line63[1],   color1[1],color1[2],color1[3])
drawText(font1,-223, -89, line64[1],   color3[1],color3[2],color3[3])
drawText(font1,-253, -65, line65[1],   color1[1],color1[2],color1[3])

drawText(font1,-365, -97, line66[1],   color1[1],color1[2],color1[3])

drawText(font1, -55, -27, line67[1],   color2[1],color2[2],color2[3])
drawText(font1, -55, -76, line68[1],   color2[1],color2[2],color2[3])
drawText(font1, -62, -91, line69[1],   color3[1],color3[2],color3[3])

drawText(font1, 103, -798, line27[1],   color_fuel[1],color_fuel[2],color_fuel[3])
drawText(font1, 143, -913, line70[1],   color_fuel3[1],color_fuel3[2],color_fuel3[3])
drawText(font1, 471, -913, line71[1],   color_fuel3[1],color_fuel3[2],color_fuel3[3])
drawText(font1, 505, -798, line72[1],   color2[1],color2[2],color2[3])
drawText(font1, 474, -884, line73[1],   color2[1],color2[2],color2[3])
-- sumry

drawText(font1,297, 289, line49[1],   color_vgen_l[1],color_vgen_l[2],color_vgen_l[3])
drawText(font1,388, 289, line50[1],   color_vgen_r[1],color_vgen_r[2],color_vgen_r[3])
drawText(font1,296, 274, line52[1],   color_vgen_l[1],color_vgen_l[2],color_vgen_l[3])
drawText(font1,387, 274, line53[1],   color_vgen_r[1],color_vgen_r[2],color_vgen_r[3])
drawText(font1,296, 259, line47[1],   color_batt_l[1],color_batt_l[2],color_batt_l[3])
drawText(font1,387, 259, line48[1],   color_batt_r[1],color_batt_r[2],color_batt_r[3])
drawText(font1,305, 244, line46[1],   color_batt_l[1],color_batt_l[2],color_batt_l[3])
drawText(font1,396, 244, line46b[1],   color_batt_r[1],color_batt_r[2],color_batt_r[3])
drawText(font1,344, 289, line51[1],   color_apu[1],color_apu[2],color_apu[3])
drawText(font1,344, 274, line51b[1],   color_apu[1],color_apu[2],color_apu[3])

drawText(font1,120, 310, line67[1],   color2[1],color2[2],color2[3])
drawText(font1,120, 295, line33[1],   color2[1],color2[2],color2[3])
drawText(font1,120, 280, line34[1],   color2[1],color2[2],color2[3])
drawText(font1,130, 265, line68[1],   color2[1],color2[2],color2[3])
drawText(font1,115, 250, line69[1],   color3[1],color3[2],color3[3])
drawText(font1,25, 200, line58[1],   color2[1],color2[2],color2[3])
drawText(font1,155, 200, line59[1],   color2[1],color2[2],color2[3])


drawAll(components)


drawText(font2, 269, -569, line32[1],  color_flp[1],color_flp[2],color_flp[3])
drawText(font2, 387, -569, line32[1],  color_flp[1],color_flp[2],color_flp[3])

drawText(font1, 820, -208, line74[1],  color2[1],color2[2],color2[3])
drawText(font1, 1153, -208, line75[1],  color2[1],color2[2],color2[3])
drawText(font1, 993, -189, line76[1],  color2[1],color2[2],color2[3])

drawText(font1, 833, -74, line77[1],  color2[1],color2[2],color2[3])
drawText(font1, 998, -93, line78[1],  color2[1],color2[2],color2[3])
drawText(font1, 1156, -74, line79[1],  color2[1],color2[2],color2[3])

drawText(font1, 833, -32, line73[1]+10,  color2[1],color2[2],color2[3])
drawText(font1, 998, -61, line73[1]+11,  color2[1],color2[2],color2[3])
drawText(font1, 1156, -32, line73[1]+10,  color2[1],color2[2],color2[3])

-- hydr sumry
drawText(font1, 544, 289, line74[1],  color2[1],color2[2],color2[3])
drawText(font1, 584, 289, line76[1],  color2[1],color2[2],color2[3])
drawText(font1, 622, 289, line75[1],  color2[1],color2[2],color2[3])

drawText(font1, 548, 274, line73[1]+10,  color2[1],color2[2],color2[3])
drawText(font1, 588, 274, line73[1]+11,  color2[1],color2[2],color2[3])
drawText(font1, 626, 274, line73[1]+10,  color2[1],color2[2],color2[3])

drawText(font1, 548, 259, line77[1],  color2[1],color2[2],color2[3])
drawText(font1, 588, 259, line78[1],  color2[1],color2[2],color2[3])
drawText(font1, 626, 259, line79[1],  color2[1],color2[2],color2[3])

drawText(font1, 544, 244, line80[1],  line80[2],line80[3],line80[4])
drawText(font1, 544, 229, line81[1],  line81[2],line81[3],line81[4])
drawText(font1, 544, 214, line82[1],  line82[2],line82[3],line82[4])

drawText(font1, 728, -288, line82[1],  line82[2],line82[3],line82[4])



--[=[
drawText(font5, 595, 522, get(test_data_1),   color2[1],color2[2],color2[3])
drawText(font5, 595, 542, get(test_data_2),   color2[1],color2[2],color2[3])
drawText(font5, 595, 562, get(test_data_3),   color2[1],color2[2],color2[3])
drawText(font5, 595, 582, get(test_data_4),   color2[1],color2[2],color2[3])
drawText(font5, 595, 602, get(test_data_5),   color2[1],color2[2],color2[3])--]=]



--246, -585, 62, 43

end

