size = { 698, 405 }

defineProperty("avion_lit1", globalPropertyf("cl300/avion_lit1"))
defineProperty("avion_lit2", globalPropertyf("cl300/avion_lit2"))
local font1 = loadFont('font_16.fnt')

cklst_pages = 0
counter3 = 1

color1 = {1,1,1}
color2 = {0.8,0.4,0.8}
color3 = {0,0.8,0}
colors = {color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1}

line = {"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}
line1 = {""}

last_states = {cklst_pages}


chklist_enter = findCommand("cl300/chklist_enter")
 function chklistHandler(phase)
     if 0 == phase then
	 colors[counter3] = color3
	 counter3 = counter3 + 1
     end
     return 1
 end

 registerCommandHandler(chklist_enter, 1, chklistHandler);

chklist_skip = findCommand("cl300/chklist_skip")
 function chklist2Handler(phase)
     if 0 == phase then
	 colors[counter3] = color1
	 counter3 = counter3 + 1
     end
     return 1
 end

 registerCommandHandler(chklist_skip, 1, chklist2Handler);

chklist_jright = findCommand("cl300/chklist_jright")
 function chklistjrightHandler(phase)
     if 0 == phase then
	 cklst_pages = cklst_pages + 1
     end
     return 1
 end

 registerCommandHandler(chklist_jright, 1, chklistjrightHandler);

chklist_jleft = findCommand("cl300/chklist_jleft")
 function chklistjleftHandler(phase)
     if 0 == phase then
	 cklst_pages = cklst_pages - 1
     end
     return 1
 end

 registerCommandHandler(chklist_jleft, 1, chklistjleftHandler);







function update()

line1 = {""}
line = {"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}

--colors = {color1,color1,color1,color1,color1,color1,color1,color1,color1,color1}

if cklst_pages < 0 then cklst_pages = 12 end
if cklst_pages > 12 then cklst_pages = 0 end

if last_states[1] - cklst_pages ~= 0 then
counter3 = 1
colors = {color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1,color1}
end

if get(cklst_pages) == 0 then
	line1 = {"                APU START"}
	line[1] = {"DOCS/ SAFETY EQP / VOR                            CHECKED"}
	line[2] = {"SWITCHES / CBS                                               CHECKED"}
	line[3] = {"GEAR HANDLE                                                         DOWN"}
	line[4] = {"L / R AND AUX HYD PUMPS                                       OFF"}
	line[5] = {"AIR SOURCE                                                                  OFF"}
	line[6] = {"STBY INST SWITCH                                ON/60 SEC MIN"}
	line[7] = {"L BATT                                                  ON/20 VOLTS MIN"}
	line[8] = {"R BATT                                                                               ON"}
	line[9] = {"CAS                                              APU/NORMAL FAULTS"}
	line[10] = {"LIGHTS                                                             NAV/AS REQ" }
	line[11] = {"L/R FUEL PUMPS                                                       AUTO" }
	line[12] = {"APU                                                                              START"}
	line[13] = {"ELECTRICS                                                               CHECK"}
	line[14] = {"L AND R BLEEDS                                                         OFF"}
	line[15] = {"APU BLEED                                                                      ON"}
	line[16] = {"XBLEED                                                                        OPEN"}
	line[17] = {"AIR SOURCE                                                              NORM"}



	if counter3 > 17 then
	counter3 = 1
	end
	colors[counter3] = color2

end

if get(cklst_pages) == 1 then
	if counter3 < 18 then
	line1 = {"            INITIAL CHECK 1/2"}
	else
	line1 = {"            INITIAL CHECK 2/2"}
	end
	line[1] = {"O2 MASKS/GOOGLES                                     CHECKED"}
	line[2] = {"OXYGEN QUANTITY                                              CHECK"}
	line[3] = {"FUEL QUANTITY                                                     CHECK"}
	line[4] = {"STBY INSTRUMENT                                         CHECKED"}
	line[5] = {"CLOCK                                                                        RESET"}
	line[6] = {"NWS                                                                                  OFF"}
	line[7] = {"RAM AIR                                                   CHECKED / OFF"}
	line[8] = {"AIR COND/BLEEDS                                 CHECKED/SET"}
	line[9] = {"PRESSURIZATION PANEL                SET/LNDG ELEV"}
	line[10] = {"ANTI-ICE                                      WING SOURCE NORM" }
	line[11] = {"PROBES                                                                          OFF" }
	line[12] = {"REVERSION PANEL                                           NORMAL"}
	line[13] = {"LTS/EMER LTS                                               SET/ARMED"}
	line[14] = {"L/R HYD PUMP/BRAKES                                      ON/SET"}
	line[15] = {"AUX HYD PUMP                                       AUTO/CHEKED"}
	line[16] = {"HYD PANEL                                                                 AUTO"}
	line[17] = {"GUST LOCK                                                                     ON"}
	line[18] = {"ENGINE RUN SWITCHES                                            OFF"}
	line[19] = {"TRIM SYSTEM                                       CHEKED/PRI/SET"}
	line[20] = {"SYSTEMS TEST                                              COMPLETE"}
	line[21] = {"ELT                                                                             AS REQ"}
	line[22] = {"CABIN CONTROL PANEL                                   AS REQ"}
	line[23] = {"PAX OXYGEN PANEL                                               AUTO"}
	line[24] = {"ALTIMETERS                                                                   SET"}
	line[25] = {"FMS                                                              INITIALIZE/SET"}
	line[26] = {"AVIONICS                                                                         SET"}
	line[27] = {"V-SPEEDS                                                               POSTED"}
	line[28] = {"CAS MESSAGES                                               CHECKED"}
	line[29] = {"AIRSHOW/LGTS/GALLEY                           ON/AS REQ"}

	if counter3 > 29 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 2 then
	line1 = {"             ENGINE START"}
	line[1] = {"WX/CLEARANCE/FMS                     BRIEFED/LOADED"}
	line[2] = {"DOOR/BCN/SIGNS                                CLOSED/ON/ON"}
	line[3] = {"PARK/EMER BRAKE                   SET/PRESS>2000 PSI"}
	line[4] = {"CHOCKS                                                              REMOVED"}
	line[5] = {"GUST LOCK                                                                   OFF"}
	line[6] = {"THRUST LEVERS                                                         IDLE"}
	line[7] = {"ENGINE RUN SWITCHES                                             ON"}
	line[8] = {"ENGINE START (<350°)                            AREA CLEAR", colors[8]}

	if counter3 > 8 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 3 then
	line1 = {"             AFTER START"}
	line[1] = {"YAW DAMPER                                                                  ON"}
	line[2] = {"WING ANTI-ICE                                   ON (2 MIN CHECK)"}
	line[3] = {"WINDSHIELD HEATS                                                      ON"}
	line[4] = {"FLAPS                                                SET FOR TAKE OFF"}
	line[5] = {"HYDRAULICS                                                      CHECKED"}
	line[6] = {"FLT AND GND SPOILERS                   CHECKED/AUTO"}
	line[7] = {"FLIGHT CONTROLS                                         CHECKED"}
	line[8] = {"GENS & ELECTRICS                                         CHECKED"}
	line[9] = {"TRIMS                                                   CALCULATED/SET"}
	line[10] = {"PFD BRIEF                                                        COMPLETE" }
	line[11] = {"DEPARTURE BRIEF                                       COMPLETE" }
	line[12] = {"RADAR/TERRAIN                                                   AS REQ"}
	line[13] = {"ANTI-ICE PANEL                               CHECKED/AS REQ"}
	line[14] = {"PASSENGERS                                                       BRIEFED"}
	line[15] = {"NWS                                                                                     ON"}
	line[16] = {"CAS                                                                        CHECKED"}


	if counter3 > 16 then
	counter3 = 1
	end
	colors[counter3] = color2

end

if get(cklst_pages) == 4 then
	line1 = {"                      TAXI"}
	line[1] = {"BRAKES/NWS                                                          CHECKED"}
	line[2] = {"FUEL BALANCE                                                      CHECKED"}
	line[3] = {"THRUST REV                                                            CHECKED"}
	line[4] = {"ENGINE INST & N1 BUGS          CHCKED & AGREE < 1 %"}
	line[5] = {"FLAPS                                                       SET FOR TAKEOFF"}


	if counter3 > 5 then
	counter3 = 1
	end
	colors[counter3] = color2

end

if get(cklst_pages) == 5 then
	line1 = {"                   LINE-UP"}
	line[1] = {"CABIN SIGN                                                           CYCLE / ON"}
	line[2] = {"PROBES / ANTI-ICE                                            ON / AS REQ"}
	line[3] = {"LIGHTS & STROBES                                          ON / AS REQ"}
	line[4] = {"TRANSPONDER                                                                    ON"}
	line[5] = {"CAS                                                     CHECKED & STACKED"}


	if counter3 > 5 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 6 then
	line1 = {"           AFTER TAKE-OFF"}
	line[1] = {"LDG GEAR & FLAPS                                                       UP"}
	line[2] = {"TAXI LGT                                                                         OFF"}
	line[3] = {"ANTI-ICE                                                                     AS REQ"}
	line[4] = {"THRUST LEVERS                  CLIMB DETENT / AS REQ"}
	line[5] = {"L / R HYDRAULIC PUMPS                                           OFF"}
	line[6] = {"BLEEDS                                   TRANSFERRED / AS REQ"}
	line[7] = {"PRESSURIZATION                                             CHECKED"}
	line[8] = {"APU                                                  SHUTDOWN / AS REQ"}
	line[9] = {"CAS                                                                         CHECKED"}


	if counter3 > 9 then
	counter3 = 1
	end
	colors[counter3] = color2

end



if get(cklst_pages) == 7 then
	line1 = {"  FL 180 CLIMB / TRANS ALT"}
	line[1] = {"ALTIMITERS                                                                     SET"}
	line[2] = {"O2 MASK                                                               CHECKED"}
	line[3] = {"CABIN SIGN                                                               AS REQ"}
	line[4] = {"EXTERIOR LIGHTS                                                 AS REQ"}

	if counter3 > 4 then
	counter3 = 1
	end
	colors[counter3] = color2

end

if get(cklst_pages) == 8 then
	line1 = {"    18,000 FT / TRANS LVL"}
	line[1] = {"ALTIMITERS                                                                     SET"}
	line[2] = {"FUEL QTY / BALANCE                                     CHECKED"}
	line[3] = {"LANDING ELEV                                              CONFIRMED"}
	line[4] = {"ANTI-ICE                                                                    AS REQ"}
	line[5] = {"EXTERIOR LIGHTS                                                         ON"}
	line[6] = {"LANDING DATA                                                    POSTED"}
	line[7] = {"LANDING / MFD BRIEF                                  COMPLETE"}

	if counter3 > 7 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 9 then
	line1 = {"          APPROACH 10,000 FT"}
	line[1] = {"APU & BLEEDS                                                        AS REQ"}
	line[2] = {"CABIN SIGN                                                              AS REQ"}
	line[3] = {"L/R HYDRALIC PUMPS                                             AUTO"}

	if counter3 > 3 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 10 then
	line1 = {"          BEFORE LANDING"}
	line[1] = {"LANDING GEAR                                    DOWN, 3 GREEN"}
	line[2] = {"N LDG LIGHT                             ON / CLEARED TO LND"}
	line[3] = {"FLAPS                                                                                SET"}
	line[4] = {"CAS                                                                        CHECKED"}

	if counter3 > 4 then
	counter3 = 1
	end
	colors[counter3] = color2

end

if get(cklst_pages) == 11 then
	line1 = {"           AFTER LANDING"}
	line[1] = {"PROBES                                                                            OFF"}
	line[2] = {"WINDSHIELD HEAT                                    OFF / AS REQ"}
	line[3] = {"ANTI-ICE                                                         OFF / AS REQ"}
	line[4] = {"FLAPS                                                              RETRACTED"}
	line[5] = {"LIGHTS / STROBES                                              AS / REQ"}
	line[6] = {"TRANSPONDER                                        STBY / AS REQ"}


	if counter3 > 6 then
	counter3 = 1
	end
	colors[counter3] = color2

end


if get(cklst_pages) == 12 then
	line1 = {"                 SHUTDOWN"}
	line[1] = {"CHOCKS / BRAKES                                                      SET"}
	line[2] = {"NWS                                                                                  OFF"}
	line[3] = {"ENGINE BLEEDS                                                          OFF"}
	line[4] = {"ENGINE RUN SWITCHES                                           OFF"}
	line[5] = {"ANTI-ICE / WINDSHIELD HEAT                                OFF"}
	line[6] = {"L / R PTU HYDRAULICS                                             OFF"}
	line[7] = {"AUX HYD                                    OFF (R HYD < 1800 PSI)"}
	line[8] = {"GUST LOCK                                                                    ON"}
	line[9] = {"COCKPIT LIGHTNING                      RESET FOR 'DAY'"}
	line[10] = {"APU                                                                  SHUTDOWN" }
	line[11] = {"AIR SOURCE                                                                 OFF" }
	line[12] = {"LTS / EMER LTS                                                           OFF"}
	line[13] = {"STBY INST                                                                     OFF"}
	line[14] = {"L / R BATT                                                                      OFF"}
	line[15] = {"PARK BRAKE                                                         AS REQ"}
	line[16] = {"CABIN                                            CLEAN / RESTOCKED"}


	if counter3 > 16 then
	counter3 = 1
	end
	colors[counter3] = color2

end







last_states = {cklst_pages}
end

----[==[
components = {

		rectangle {
        position = { 0, 0, 698, 405 };
        color = { 0.0, 0.0, 0.0, 1.0 };
		visible = function ()
		return get(avion_lit1) == 0 and get(avion_lit2) == 0
		end,
    },
};--]==]


function draw()



drawText(font1, 350, 346, line1[1],  color1[1],color1[2],color1[3])

if counter3 < 18 then
drawText(font1, 280, 316, line[1][1],  colors[1][1],colors[1][2],colors[1][3])
drawText(font1, 280, 298, line[2][1],  colors[2][1],colors[2][2],colors[2][3])
drawText(font1, 280, 280, line[3][1],  colors[3][1],colors[3][2],colors[3][3])
drawText(font1, 280, 262, line[4][1],  colors[4][1],colors[4][2],colors[4][3])
drawText(font1, 280, 244, line[5][1],  colors[5][1],colors[5][2],colors[5][3])
drawText(font1, 280, 226, line[6][1],  colors[6][1],colors[6][2],colors[6][3])
drawText(font1, 280, 208, line[7][1],  colors[7][1],colors[7][2],colors[7][3])
drawText(font1, 280, 190, line[8][1],  colors[8][1],colors[8][2],colors[8][3])
drawText(font1, 280, 172, line[9][1],  colors[9][1],colors[9][2],colors[9][3])
drawText(font1, 280, 154, line[10][1],  colors[10][1],colors[10][2],colors[10][3])
drawText(font1, 280, 136, line[11][1],  colors[11][1],colors[11][2],colors[11][3])
drawText(font1, 280, 118, line[12][1],  colors[12][1],colors[12][2],colors[12][3])
drawText(font1, 280, 100, line[13][1],  colors[13][1],colors[13][2],colors[13][3])
drawText(font1, 280, 82, line[14][1],  colors[14][1],colors[14][2],colors[14][3])
drawText(font1, 280, 64, line[15][1],  colors[15][1],colors[15][2],colors[15][3])
drawText(font1, 280, 46, line[16][1],  colors[16][1],colors[16][2],colors[16][3])
drawText(font1, 280, 28, line[17][1],  colors[17][1],colors[17][2],colors[17][3])
else
--drawText(font1, 350, 346, line1[1],  color1[1],color1[2],color1[3])
drawText(font1, 280, 316, line[18][1],  colors[18][1],colors[18][2],colors[18][3])
drawText(font1, 280, 298, line[19][1],  colors[19][1],colors[19][2],colors[19][3])
drawText(font1, 280, 280, line[20][1],  colors[20][1],colors[20][2],colors[20][3])
drawText(font1, 280, 262, line[21][1],  colors[21][1],colors[21][2],colors[21][3])
drawText(font1, 280, 244, line[22][1],  colors[22][1],colors[22][2],colors[22][3])
drawText(font1, 280, 226, line[23][1],  colors[23][1],colors[23][2],colors[23][3])
drawText(font1, 280, 208, line[24][1],  colors[24][1],colors[24][2],colors[24][3])
drawText(font1, 280, 190, line[25][1],  colors[25][1],colors[25][2],colors[25][3])
drawText(font1, 280, 172, line[26][1],  colors[26][1],colors[26][2],colors[26][3])
drawText(font1, 280, 154, line[27][1],  colors[27][1],colors[27][2],colors[27][3])
drawText(font1, 280, 136, line[28][1],  colors[28][1],colors[28][2],colors[28][3])
drawText(font1, 280, 118, line[29][1],  colors[29][1],colors[29][2],colors[29][3])
drawText(font1, 280, 100, line[30][1],  colors[30][1],colors[30][2],colors[30][3])
drawText(font1, 280, 82, line[31][1],  colors[31][1],colors[31][2],colors[31][3])
drawText(font1, 280, 64, line[32][1],  colors[32][1],colors[32][2],colors[32][3])
drawText(font1, 280, 46, line[33][1],  colors[33][1],colors[33][2],colors[33][3])
drawText(font1, 280, 28, line[34][1],  colors[34][1],colors[34][2],colors[34][3])
end

drawAll(components)

end
