nero = Color.new(0,0,0)
rosso = Color.new(255,0,0)
pic = Image.load("SYSTEM/resources/other/options5.png")

file = io.open("SYSTEM/resources/menu/UN.txt", "r") 
M = file:read("*n") 
file:close()

Selected = 20
timer1 = 0
timer2 = 0

setA = 0
setB = 0


while true do
pad = Controls.read()

if 1==1 then System.setcpuspeed(333) end

screen:blit(0,0,pic)
screen:print(7,7,"MENU LAYOUT SELECTION :",rosso)
screen:print(7,8,"MENU LAYOUT SELECTION :",rosso)

screen:print(10,240,"Press X to CONFIRM",rosso)


Mp3me.play()
if Mp3me.gettime() == Mp3me.songTime() then
Mp3me.stop()
Mp3me.load("SYSTEM/resources/music/SND1.mp3")
Mp3me.play()
end


if pad:up() then timer1 = timer1 + 1 end
if not pad:up() then timer1 = 0 end
if timer1 == 1 then Selected = Selected - 10 end

if pad:down() then timer2 = timer2 + 1 end
if not pad:down() then timer2 = 0 end 
if timer2 == 1 then Selected = Selected + 10 end


screen:print(10,25,"Layout 1",nero)
screen:print(10,35,"Layout 2 - (by G!@NG!X95)",nero)


if Selected==20 then screen:print(10,25,"Layout 1",rosso) end
if Selected==30 then screen:print(10,35,"Layout 2 - (by G!@NG!X95)",rosso) end


if Selected==20 and pad:cross() then file = io.open("SYSTEM/resources/menu/sel.txt","w");
                                     file:write("1");
                                     file:close(); 
                                     end

if Selected==30 and pad:cross() then file = io.open("SYSTEM/resources/menu/sel.txt","w");
                                     file:write("2");
                                     file:close(); 
                                     end


if M==0 then if Selected==10 then Selected=20 end
             if Selected==30 then Selected=20 end
             end

if M==1 then if Selected==10 then Selected=20 end
             if Selected==40 then Selected=30 end
             end

if pad:cross() then setA = setA + 1 end

if setA>0 and setA<20 then screen:print(10,230,"Layout successfully replaced !!",rosso) end
if setA>0 and setA<20 then setB=setB+1 end
if setB==80 then setA=0 end
if setB==80 then setB=0 end


screen:print(10,250,"Press O to return to the MAIN MENU",rosso)
if pad:circle() then dofile("SYSTEM/resources/options/options.lua") end


screen.waitVblankStart()
screen.flip()
screen:clear()
end













