size = { 251, 300 }

----[=[


defineProperty("bg1", loadImage("menu1.png", 158, 359, 251, 60))
defineProperty("bg2", loadImage("menu1.png", 158, 493, 251, 60))
defineProperty("bg3", loadImage("menu1.png", 158, 390, 251, 120))
defineProperty("box", loadImage("menu1.png", 419, 357, 19, 19))
defineProperty("green", loadImage("menu1.png", 441, 354, 17, 22))
defineProperty("cross", loadImage("menu1.png", 441, 382, 15, 15))
defineProperty("scale", loadImage("menu1.png", 462, 354, 122, 10))
defineProperty("knob", loadImage("menu1.png", 464, 368, 9, 15))
defineProperty("closing", loadImage("closing.png", 16, 16))

defineProperty("opt_p", globalPropertyi("cl300/opt_p"))
defineProperty("mmenu_athide", globalPropertyi("cl300/mmenu_athide"))
defineProperty("prflt_cam_lock", globalPropertyi("cl300/prflt_cam_lock"))

defineProperty("fms_selector", globalPropertyi("cl300/fms_selector"))
defineProperty("popup_mfd", globalPropertyi("cl300/popup_mfd"))
defineProperty("hide_pilots", globalPropertyi("cl300/hide_pilots"))

defineProperty("sound_vol", globalPropertyi("cl300/sound_vol"))
defineProperty("sound_mute", globalPropertyi("cl300/sound_mute"))
defineProperty("ext_sound_vol", globalPropertyf("cl300/ext_sound_vol"))
defineProperty("ext_sound_mute", globalPropertyi("cl300/ext_sound_mute"))

defineProperty("hide_pilots_slider", globalPropertyf("sim/cockpit2/switches/custom_slider_on[2]"))
--defineProperty("toe_autobrakes", globalPropertyi("cl300/toe_autobrakes"))

defineProperty("left_brake_ratio", globalPropertyf("sim/cockpit2/controls/left_brake_ratio"))
defineProperty("right_brake_ratio", globalPropertyf("sim/cockpit2/controls/right_brake_ratio"))



defineProperty("position_saving", globalPropertyi("cl300/position_saving"))

font1 = loadFont('font_5.fnt')

	color1 = {0.4,0.4,0.4}
	color2 = {0.4,0.4,0.4}

	pos = {150}

	val = get(sound_vol)
	v = {}

	mouse_stat = true
	count = 0



function update()

pos[1] = get(sound_vol)*0.055 + 30

pos[2] = get(ext_sound_vol)*100 + 30

set(hide_pilots_slider, get(hide_pilots))

--Disable toe auto brakes

--set(override_toe_brakes, get(toe_autobrakes))

end


components = {

    textureLit {
        position = {0,240,251,60},
        image = get(bg1)

    },

    textureLit {
        position = {0,0,251,60},
        image = get(bg2)

    },
    textureLit {
        position = {0,60,251,180},
        image = get(bg3)

    },
    textureLit {
        position = {200,255,19,19},
        image = get(box)

    },

    textureLit {
        position = {202,257,17,22},
        image = get(green),
		visible = function()
		return get(position_saving) == 1
		end,

    },

	    textureLit {
        position = {202,257,15,15},
        image = get(cross),
		visible = function()
		return get(position_saving) == 0
		end,
    },
    textureLit {
        position = {202,130,17,22},
        image = get(green),
		visible = function()
		return get(mmenu_athide) == 1
		end,

    },

	    textureLit {
        position = {202,130,15,15},
        image = get(cross),
		visible = function()
		return get(mmenu_athide) == 0
		end,
    },
    textureLit {
        position = {202,105,17,22},
        image = get(green),
		visible = function()
		return get(popup_mfd) == 1
		end,

    },

	    textureLit {
        position = {202,105,15,15},
        image = get(cross),
		visible = function()
		return get(popup_mfd) == 0
		end,
    },
    textureLit {
        position = {202,80,17,22},
        image = get(green),
		visible = function()
		return get(hide_pilots) == 1
		end,

    },

	    textureLit {
        position = {202,80,15,15},
        image = get(cross),
		visible = function()
		return get(hide_pilots) == 0
		end,
    },
    textureLit {
        position = {202,55,17,22},
        image = get(green),
		visible = function()
		return get(prflt_cam_lock) == 1
		end,

    },

	    textureLit {
        position = {202,55,15,15},
        image = get(cross),
		visible = function()
		return get(prflt_cam_lock) == 0
		end,
    },

   --[=[ textureLit {
        position = {202,30,17,22},
        image = get(green),
		visible = function()
		return get(toe_autobrakes) == 1
		end,

    },

	    textureLit {
        position = {202,30,15,15},
        image = get(cross),
		visible = function()
		return get(toe_autobrakes) == 0
		end,
    },--]=]

    textureLit {
        position = {200,205,19,19},
        image = get(box)

    },

    textureLit {
        position = {200,155,19,19},
        image = get(box)

    },
    textureLit {
        position = {200,130,19,19},
        image = get(box)

    },
    textureLit {
        position = {200,105,19,19},
        image = get(box)

    },
    textureLit {
        position = {200,80,19,19},
        image = get(box)

    },
    textureLit {
        position = {200,55,19,19},
        image = get(box)

    },
    --[=[textureLit {
        position = {200,30,19,19},
        image = get(box)

    },--]=]
    textureLit {
        position = {202,207,17,22},
        image = get(green),
		visible = function()
		return get(sound_mute) == 1
		end,

    },

	    textureLit {
        position = {202,207,15,15},
        image = get(cross),
		visible = function()
		return get(sound_mute) == 0
		end,
    },

	    textureLit {
        position = {202,157,17,22},
        image = get(green),
		visible = function()
		return get(ext_sound_mute) == 0
		end,

    },
	    textureLit {
        position = {202,157,15,15},
        image = get(cross),
		visible = function()
		return get(ext_sound_mute) == 1
		end,
    },

	    textureLit {
        position = {30,210,122,10},
        image = get(scale)

    },

		textureLit {
        position = {30,160,122,10},
        image = get(scale)

    },

		textureLit {
        position = function()
		return {pos[1],207,9,15}
		end,
        image = get(knob)

    },
		textureLit {
        position = function()
		return {pos[2],157,9,15}
		end,
        image = get(knob)

    },

	clickable {
       position = {200,205,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(sound_mute) == 1 then
				set(sound_mute, 0)
			else
				set(sound_mute, 1)
			end
        end


    },
	clickable {
       position = {200,155,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(ext_sound_mute) == 1 then
				set(ext_sound_mute, 0)
			else
				set(ext_sound_mute, 1)
			end
        end


    },

	clickable {
       position = {200,255,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(position_saving) == 1 then
				set(position_saving, 0)
			else
				set(position_saving, 1)
			end
        end,


    },
	clickable {
       position = {200,130,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(mmenu_athide) == 1 then
				set(mmenu_athide, 0)
			else
				set(mmenu_athide, 1)
			end
        end,


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


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


    },
	clickable {
       position = {200,55,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(prflt_cam_lock) == 1 then
				set(prflt_cam_lock, 0)
			else
				set(prflt_cam_lock, 1)
			end
        end,


    },
	--[=[clickable {
      position = {200,30,19,19},
       cursor = {
            x = 0,
            y = 0,
            width = 32,
            height = 16,
            shape = loadImage("clickable.png")
        },
        onMouseClick = function()
			if get(toe_autobrakes) == 1 then
				set(toe_autobrakes, 0)
			else
				set(toe_autobrakes, 1)
				set(left_brake_ratio, 0)
				set(right_brake_ratio, 0)
			end
       end,


    },--]=]
   lever{
       position = {30,207,129,17},
       value = {sound_vol},
       lever_img = get(knob),
       minimum = 0,
       maximum = 2200,
   },
   lever{
       position = {30,157,129,17},
       value = {ext_sound_vol},
       lever_img = get(knob),
       minimum = 0,
       maximum = 1.22,
   },
 		-- close zone
    textureLit {
        position = {size[1] - 16, size[2] - 16, 16, 16 },
        image = get(closing)

    },
		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(opt_p, 0)
		 end
	},

}
--]=]

function draw()

drawAll(components)

drawText(font1, 30, 260, "SAVE PLANE POSITION",  color1[1],color1[2],color1[3])
drawText(font1, 30, 235, "MASTER VOL ",  color2[1],color2[2],color2[3])
drawText(font1, 160, 210, "MUTE",  color2[1],color2[2],color2[3])
drawText(font1, 30, 185, "ENGINE VOL EXTERNAL",  color2[1],color2[2],color2[3])
drawText(font1, 160, 160, "MUTE",  color2[1],color2[2],color2[3])
drawText(font1, 30, 135, "MAIN MENU AUTOHIDE",  color2[1],color2[2],color2[3])
drawText(font1, 30, 110, "MFDCTL AUTO POP-UP",  color2[1],color2[2],color2[3])
drawText(font1, 30, 85, "HIDE PILOTS",  color2[1],color2[2],color2[3])
--drawText(font1, 30, 60, "USE DEFAULT FMS",  color2[1],color2[2],color2[3])
drawText(font1, 30, 60, "PRFLT CAMERA LOCK",  color2[1],color2[2],color2[3])
--drawText(font1, 30, 35, "DISABLE AUTOBRAKE",  color2[1],color2[2],color2[3])

end
