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


Selected = 20
timer1 = 0
timer2 = 0

set = 0
set1 = 0

set2 = 0
set3 = 0

while true do
pad = Controls.read()

screen:blit(0,0,pic1)
screen:print(7,7,"BACKGROUND OPTIONS MENU :",rosso)
screen:print(7,8,"BACKGROUND OPTIONS MENU :",rosso)

screen:print(10,200,"PAGE 1",rosso)
screen:print(10,201,"PAGE 1",rosso)

screen:print(10,240,"Press X to CONFIRM".."        Press [] to SAVE IMAGE",rosso)



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


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

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

screen:print(31,80,"-[1]-",nero)
screen:print(31,81,"-[1]-",nero)
screen:print(127,80,"-[2]-",nero)
screen:print(127,81,"-[2]-",nero)
screen:print(217,80,"-[3]-",nero)
screen:print(217,81,"-[3]-",nero)
screen:print(315,80,"-[4]-",nero)
screen:print(315,81,"-[4]-",nero)
screen:print(411,80,"-[5]-",nero)
screen:print(411,81,"-[5]-",nero)
screen:print(31,160,"-[6]-",nero)
screen:print(31,161,"-[6]-",nero)
screen:print(127,160,"-[7]-",nero)
screen:print(127,161,"-[7]-",nero)
screen:print(217,160,"-[8]-",nero)
screen:print(217,161,"-[8]-",nero)
screen:print(315,160,"-[9]-",nero)
screen:print(315,161,"-[9]-",nero)
screen:print(408,160,"-[10]-",nero)
screen:print(408,161,"-[10]-",nero)

if Selected==20 then screen:print(31,80,"-[1]-",rosso) end
if Selected==20 then screen:print(31,81,"-[1]-",rosso) end
if Selected==30 then screen:print(127,80,"-[2]-",rosso) end
if Selected==30 then screen:print(127,81,"-[2]-",rosso) end
if Selected==40 then screen:print(217,80,"-[3]-",rosso) end
if Selected==40 then screen:print(217,81,"-[3]-",rosso) end
if Selected==50 then screen:print(315,80,"-[4]-",rosso) end
if Selected==50 then screen:print(315,81,"-[4]-",rosso) end
if Selected==60 then screen:print(411,80,"-[5]-",rosso) end
if Selected==60 then screen:print(411,81,"-[5]-",rosso) end
if Selected==70 then screen:print(31,160,"-[6]-",rosso) end
if Selected==70 then screen:print(31,161,"-[6]-",rosso) end
if Selected==80 then screen:print(127,160,"-[7]-",rosso) end
if Selected==80 then screen:print(127,161,"-[7]-",rosso) end
if Selected==90 then screen:print(217,160,"-[8]-",rosso) end
if Selected==90 then screen:print(217,161,"-[8]-",rosso) end
if Selected==100 then screen:print(315,160,"-[9]-",rosso) end
if Selected==100 then screen:print(315,161,"-[9]-",rosso) end
if Selected==110 then screen:print(408,160,"-[10]-",rosso) end
if Selected==110 then screen:print(408,161,"-[10]-",rosso) end


if Selected==120 then Selected=110 end
if Selected==10 then Selected=20 end


if Selected==20 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(1)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end 
if Selected==30 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(2)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==40 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(3)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==50 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(4)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==60 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(5)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==70 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(6)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==80 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(7)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==90 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(8)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==100 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(9)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end
if Selected==110 and pad:cross() then System.copyFile("SYSTEM/resources/background/background(10)/backg.png","SYSTEM/resources/background/usedbackground/backg.png",0) end


if Selected==20 and pad:square() then System.copyFile("SYSTEM/resources/background/background(1)/backg.png","ms0:/PICTURE/backg1.png",0) end 
if Selected==30 and pad:square() then System.copyFile("SYSTEM/resources/background/background(2)/backg.png","ms0:/PICTURE/backg2.png",0) end
if Selected==40 and pad:square() then System.copyFile("SYSTEM/resources/background/background(3)/backg.png","ms0:/PICTURE/backg3.png",0) end
if Selected==50 and pad:square() then System.copyFile("SYSTEM/resources/background/background(4)/backg.png","ms0:/PICTURE/backg4.pngg",0) end
if Selected==60 and pad:square() then System.copyFile("SYSTEM/resources/background/background(5)/backg.png","ms0:/PICTURE/backg5.png",0) end
if Selected==70 and pad:square() then System.copyFile("SYSTEM/resources/background/background(6)/backg.png","ms0:/PICTURE/backg6.png",0) end
if Selected==80 and pad:square() then System.copyFile("SYSTEM/resources/background/background(7)/backg.png","ms0:/PICTURE/backg7.png",0) end
if Selected==90 and pad:square() then System.copyFile("SYSTEM/resources/background/background(8)/backg.png","ms0:/PICTURE/backg8.png",0) end
if Selected==100 and pad:square() then System.copyFile("SYSTEM/resources/background/background(9)/backg.png","ms0:/PICTURE/backg9.png",0) end
if Selected==110 and pad:square() then System.copyFile("SYSTEM/resources/background/background(10)/backg.png","ms0:/PICTURE/backg10.png",0) end




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

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

if pad:square() then set2 = set2 + 1 end

if set2>0 and set2<20 then screen:print(10,230,"Background successfully saved !! (ms0:/PICTURE)",rosso) end
if set2>0 and set2<20 then set3=set3+1 end
if set3==80 then set2=0 end
if set3==80 then set3=0 end


screen:print(10,250,"Press O to GO BACK".."        Press R to go to PAGE 2",rosso)
if pad:circle() then dofile("SYSTEM/resources/options/options.lua") end
if pad:r() then dofile("SYSTEM/resources/options/optionsBackground2.lua") end



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













