size = { 268, 195 }

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

defineProperty("bg", loadImage("menu1.png", 158, 359, 251, 195))
defineProperty("pass_door_close", loadImage("menu1.png", 418, 567, 95, 146))
defineProperty("pass_door_open", loadImage("menu1.png", 517, 567, 95, 146))
defineProperty("cargo_door_close", loadImage("menu1.png", 418, 718, 95, 146))
defineProperty("cargo_door_open", loadImage("menu1.png", 517, 718, 95, 146))
defineProperty("emer_door_close", loadImage("menu1.png", 418, 869, 95, 146))
defineProperty("emer_door_open", loadImage("menu1.png", 517, 869, 95, 146))

defineProperty("cab_light_off", loadImage("menu1.png", 616, 567, 95, 146))
defineProperty("cab_light_on", loadImage("menu1.png", 715, 567, 95, 146))
defineProperty("lavatory_door_close", loadImage("menu1.png", 616, 868, 95, 146))
defineProperty("lavatory_door_open", loadImage("menu1.png", 715, 868, 95, 146))
defineProperty("baggage_door_close", loadImage("menu1.png", 616, 718, 95, 146))
defineProperty("baggage_door_open", loadImage("menu1.png", 715, 718, 95, 146))
defineProperty("jal_retr", loadImage("menu1.png", 815, 567, 95, 146))
defineProperty("jal_dep", loadImage("menu1.png", 915, 567, 95, 146))
defineProperty("tabl_retr", loadImage("menu1.png", 815, 718, 95, 146))
defineProperty("tabl_dep", loadImage("menu1.png", 915, 718, 95, 146))

defineProperty("customslider2", globalPropertyi("sim/custom/xap/customslider2"))
defineProperty("customslider3", globalPropertyi("sim/custom/xap/customslider3"))
defineProperty("customslider4", globalPropertyi("sim/custom/xap/customslider4"))
defineProperty("cablight_h", globalPropertyf("sim/custom/xap/cablight_h"))
defineProperty("cabin_lit", globalPropertyf("sim/cockpit2/switches/custom_slider_on[4]"))
defineProperty("lavat_door", globalPropertyf("sim/cockpit2/switches/custom_slider_on[6]"))
defineProperty("baggage_door", globalPropertyf("sim/cockpit2/switches/custom_slider_on[5]"))

defineProperty("jalousie1", globalPropertyf("sim/custom/xap/jalousie1"))
defineProperty("jalousie2", globalPropertyf("sim/custom/xap/jalousie2"))
defineProperty("jalousie3", globalPropertyf("sim/custom/xap/jalousie3"))
defineProperty("jalousie4", globalPropertyf("sim/custom/xap/jalousie4"))
defineProperty("jalousie5", globalPropertyf("sim/custom/xap/jalousie5"))
defineProperty("jalousie6", globalPropertyf("sim/custom/xap/jalousie6"))

defineProperty("jalousie7", globalPropertyf("sim/custom/xap/jalousie7"))
defineProperty("jalousie8", globalPropertyf("sim/custom/xap/jalousie8"))
defineProperty("jalousie9", globalPropertyf("sim/custom/xap/jalousie9"))
defineProperty("jalousie10", globalPropertyf("sim/custom/xap/jalousie10"))
defineProperty("jalousie11", globalPropertyf("sim/custom/xap/jalousie11"))
defineProperty("jalousie12", globalPropertyf("sim/custom/xap/jalousie12"))

defineProperty("table1", globalPropertyf("sim/custom/xap/table1"))
defineProperty("table2", globalPropertyf("sim/custom/xap/table2"))
defineProperty("table3", globalPropertyf("sim/custom/xap/table3"))
defineProperty("table4", globalPropertyf("sim/custom/xap/table4"))

components = {

    textureLit {
        position = {0,0,268,195},
        image = get(bg)

    },
-- pass door
    textureLit {
        position = {20,105,47,73},
        image = get(pass_door_close)

    },

	textureLit {
        position = {20,105,47,73},
        image = get(pass_door_open),
		visible = function()
		return get(customslider2) == 1
		end,
    },

		clickable {
       position = {  20, 105, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(customslider2) == 1 then
				set(customslider2, 0)
			else
				set(customslider2, 1)
			end

        end


    },


--cargo door
    textureLit {
        position = {80,105,47,73},
        image = get(cargo_door_close)

    },

	textureLit {
        position = {80,105,47,73},
        image = get(cargo_door_open),
		visible = function()
		return get(customslider3) == 1
		end,
    },

		clickable {
       position = {  80, 105, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(customslider3) == 1 then
				set(customslider3, 0)
			else
				set(customslider3, 1)
			end
        end


    },
-- emergency door
	    textureLit {
        position = {140,105,47,73},
        image = get(emer_door_close)

    },

	textureLit {
        position = {140,105,47,73},
        image = get(emer_door_open),
		visible = function()
		return get(customslider4) == 1
		end,
    },

		clickable {
       position = {  140, 105, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(customslider4) == 1 then
				set(customslider4, 0)
			else
				set(customslider4, 1)
			end
        end


    },

-- cabin light
	    textureLit {
        position = {20,20,47,73},
        image = get(cab_light_off)

    },

	textureLit {
        position = {20,20,47,73},
        image = get(cab_light_on),
		visible = function()
		return get(cabin_lit) == 1
		end,
    },

		clickable {
       position = {  20, 20, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(cabin_lit) == 1 then
				set(cablight_h, 0)
			else
				set(cablight_h, 1)
			end
        end


    },

-- lavatory door
	    textureLit {
        position = {80,20,47,73},
        image = get(lavatory_door_close)

    },

	textureLit {
        position = {80,20,47,73},
        image = get(lavatory_door_open),
		visible = function()
		return get(lavat_door) == 1
		end,
    },

		clickable {
       position = {  80, 20, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(lavat_door) == 1 then
				set(lavat_door, 0)
			else
				set(lavat_door, 1)
			end
        end


    },
-- baggage door
	    textureLit {
        position = {140,20,47,73},
        image = get(baggage_door_close)

    },

	textureLit {
        position = {140,20,47,73},
        image = get(baggage_door_open),
		visible = function()
		return get(baggage_door) == 1
		end,
    },

		clickable {
       position = {  140, 20, 47, 73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(baggage_door) == 1 then
				set(baggage_door, 0)
			else
				set(baggage_door, 1)
			end
        end


    },

-- Jal
	    textureLit {
        position = {200,105,47,73},
        image = get(jal_dep)

    },

	textureLit {
        position = {200,105,47,73},
        image = get(jal_retr),--
		visible = function()
		return get(jalousie1) == 1 and get(jalousie2) == 1 and get(jalousie3) == 1 and get(jalousie4) == 1 and get(jalousie5) == 1 and get(jalousie6) == 1 and get(jalousie7) == 1 and get(jalousie8) == 1 and get(jalousie9) == 1 and get(jalousie10) == 1 and get(jalousie11) == 1 and get(jalousie12) == 1
		end,
    },

		clickable {
       position = {  200,105,47,73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(jalousie1) == 1 and get(jalousie2) == 1 and get(jalousie3) == 1 and get(jalousie4) == 1 and get(jalousie5) == 1 and get(jalousie6) == 1 and get(jalousie7) == 1 and get(jalousie8) == 1 and get(jalousie9) == 1 and get(jalousie10) == 1 and get(jalousie11) == 1 and get(jalousie12) == 1 then
				set(jalousie1, 0)
				set(jalousie2, 0)
				set(jalousie3, 0)
				set(jalousie4, 0)
				set(jalousie5, 0)
				set(jalousie6, 0)
				set(jalousie7, 0)
				set(jalousie8, 0)
				set(jalousie9, 0)
				set(jalousie10, 0)
				set(jalousie11, 0)
				set(jalousie12, 0)
			else
				set(jalousie1, 1)
				set(jalousie2, 1)
				set(jalousie3, 1)
				set(jalousie4, 1)
				set(jalousie5, 1)
				set(jalousie6, 1)
				set(jalousie7, 1)
				set(jalousie8, 1)
				set(jalousie9, 1)
				set(jalousie10, 1)
				set(jalousie11, 1)
				set(jalousie12, 1)
			end
        end

   },

-- Tables
	    textureLit {
        position = {200,20,47,73},
        image = get(tabl_retr)

    },

	textureLit {
        position = {200,20,47,73},
        image = get(tabl_dep),--
		visible = function()
		return get(table1) == 1 and get(table2) == 1 and get(table3) == 1 and get(table4) == 1
		end,
    },

		clickable {
       position = {  200,20,47,73  },
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(table1) == 1 and get(table2) == 1 and get(table3) == 1 and get(table4) == 1 then
				set(table1, 0)
				set(table2, 0)
				set(table3, 0)
				set(table4, 0)
			else
				set(table1, 1)
				set(table2, 1)
				set(table3, 1)
				set(table4, 1)
			end
        end


    },

 		-- close zone
		clickable {
		position = {size[1]-16, size[2]-16, 16, 16 },

		cursor = {
			x = -16,
			y = 0,
			width = 32,
			height = 16,
			shape = loadImage("clickclose.png")
		},
		 onMouseClick = function()
			set(anim_panel_s, 0)
		 end
	},

}
