function optionen1()
screen:clear()
-- MENU --

Select = 1
maxSelect = 3
gamestate = "Menu"
IntroFrame = 1


-- ##### Load Sounds #####
Move = Sound.load("Sounds/Move.wav",false)
SelectSound = Sound.load("Sounds/Select.wav",false)
Music.playFile("Sounds/Title.xm", true)

MenuSelect = Image.load("icons/MenuSelection.png")
menuBackground = Image.load("background/mbg.png")
Back = Image.load("icons/Back.png")
usb = Image.load("icons/usb.png")
ton = Image.load("icons/ton.png")

 
 screen:blit(0, 0, menuBackground)

     if pad:down() and oldpad:down() ~= pad:down() and Select <= 3 then
          Select = Select + 1
          Move:play()
     end
     if pad:up() and oldpad:up() ~= pad:up() and Select >= 1 then
          Select = Select - 1
          Move:play()
     end



	if Select > maxSelect then
		Select = 1
	elseif Select <= 0 then
		Select = maxSelect
	end

     if Select == 1 then
          screen:blit(0,157,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end
     if Select == 2 then
          screen:blit(0,187,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end
     if Select == 3 then
          screen:blit(0,217,MenuSelect)
          screen:blit(15,170,usb)
          screen:blit(15,200,ton)
          screen:blit(15,230,Back)
     end

     if Select == 1 and pad:cross() and oldpad:cross() ~= pad:cross() then
                System.usbDiskModeActivate()
     end

     if Select == 1 and pad:circle() and oldpad:circle() ~= pad:circle() then
                System.usbDiskModeDeactivate()
     end

     if Select == 2 and pad:cross() and oldpad:cross() ~= pad:cross() then
                Music.volume(128)
     end


     if Select == 2 and pad:circle() and oldpad:circle() ~= pad:circle() then
                Music.volume(0)
     end

     if Select == 3 and pad:cross() and oldpad:cross() ~= pad:cross() then
          gamestate = "Menu"
     end

end


function main()
red = Color.new(255, 0, 0)
white = Color.new(255, 255, 255)
--unloadbuff()
Select = 1
maxSelect = 11
menuBackground=Image.load("background/mbg.png")
icon=Image.load("icons/icon.png")
icon0=Image.load("icons/icon0.png")
games=Image.load("icons/games.png")
games1=Image.load("icons/games1.png")
icon1=Image.load("icons/icon1.png")
icon11=Image.load("icons/icon11.png")
icon2=Image.load("icons/icon2.png")
icon22=Image.load("icons/icon22.png")
clock=Image.load("icons/clock.png")
clock1=Image.load("icons/clock1.png")
ownlua=Image.load("icons/ownlua.png")
ownlua1=Image.load("icons/ownlua1.png")
credits0=Image.load("icons/credits0.png")
credits1=Image.load("icons/credits1.png")
credit=Image.load("credit.png")
hud=Image.load("icons/hud.png")
sys=Image.load("icons/sysinfo1.png")
sys1=Image.load("icons/sysinfo.png")
full=Image.load("battery/full.png")
half=Image.load("battery/half.png")
third=Image.load("battery/last.png")
dead=Image.load("battery/dead.png")
keno=Image.load("icons/lotto.png")
keno1=Image.load("icons/pq.png")
usb1=Image.load("usb/usb1.png")
usb2=Image.load("usb/usb2.png")
oldpad = Controls.read()
--
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,menuBackground)
screen:blit(0,0,hud)
--
if pad:up() and oldpad:up() ~= pad:up() then
Select = Select - 1
end
if pad:down() and oldpad:down() ~= pad:down() then
Select = Select + 1
end
if pad:left() and oldpad:left() ~= pad:left() then
Select = Select + 3
end
if pad:right() and oldpad:right() ~= pad:right() then
Select = Select - 3
end

if Select > maxSelect then
Select = 1
elseif Select <= 0 then
Select = maxSelect
end
if Select == 1 then
screen:blit(380,15,icon0)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 2 then
screen:blit(380,15,icon)
screen:blit(380,100,icon11)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 3 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon22)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 4 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock1)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 5 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua1)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 6 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua1)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 7 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits1)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 8 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys1)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 9 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(225,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games)
end
if Select == 10 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(145,15,keno1)
screen:blit(140,100,games)
end

if Select == 11 then
screen:blit(380,15,icon)
screen:blit(380,100,icon1)
screen:blit(380,185,icon2)
screen:blit(300,15,clock)
screen:blit(300,100,ownlua)
screen:blit(300,185,ownlua)
screen:blit(220,15,credits0)
screen:blit(220,100,sys)
screen:blit(220,185,keno)
screen:blit(140,15,keno1)
screen:blit(140,100,games1)
end

if pad:cross() and Select == 1 then
dofile("game.lua") 
end
if pad:cross() and Select == 2 then
dofile("pxlmenu.lua")
end
if pad:cross() and Select == 3 then
dofile("browser.lua")
end
if pad:cross() and Select == 4 then
dofile("clock.lua")
end
if pad:cross() and Select == 5 then
dofile("ownlua.lua")
end
if pad:cross() and Select == 6 then
dofile("ownlua.lua")
end
if pad:cross() and Select == 7 then
screen:blit(0,0,credit)
end
if pad:cross() and oldpad:cross() ~= pad:cross() and Select == 8 then
dofile("sysinfomenu.lua")
end
if pad:cross() and Select == 9 then
dofile("lotto/start.lua")
end
if pad:cross() and Select == 10 then
dofile("index2.lua")
end
if pad:cross() and Select == 11 then
dofile("games.lua")
end

--------------------------------------------

if pad:r() then 
optionen1()
end

--------------------------------------------


batteryLife=System.powerGetBatteryLifePercent()

if batteryLife > 75 then
screen:blit(460,240,full)
end
if batteryLife < 75 and batteryLife > 50 then
screen:blit(460,240,half)
end
if batteryLife < 50 and batteryLife > 25 then
screen:blit(460,240,third)
end
if batteryLife < 25 and batteryLife > 0 then
screen:blit(460,240,dead)
end

screen.waitVblankStart()
screen.flip()
oldpad = pad
end
end


while true do
main()
end