-- ########################## -- Funktionen -- ############################ -- 
local function s(...) return sleep(...) end
local function w(...) return write(...) end
local function p(...) return print(...) end
local function tw(...) return term.write(...) end
local function scp(...) return term.setCursorPos(...) end
local function sbc(...) return term.setBackgroundColor(...) end
local function stc(...) return term.setTextColor(...) end
local function tc(...) return term.clear(...) end
local function tcl(...) return term.clearLine() end
local function scb(...) return term.setCursorBlink(...) end
local function ts(...) return term.scroll(...) end
local function r(...) return shell.run(...) end
local function para(...) return parallel.waitForAny(...) end
local function sw(...) return textutils.slowWrite(...) end
local function sp(...) return textutils.slowPrint(...) end
-- ########################## -- Einstellungen -- ############################ -- 
sbc(32768)
stc(1)
fs.makeDir("LabyOS/Task")
writetask = fs.open("LabyOS/Task/task", "w")
writetask.write([[]])
writetask.close()
-- ########################## -- ABOUT -- ############################ -- 
wEdition = "Windows XP"
wExtraStatus = "Beta"
wOSName = "LabyOS"
wDeveloper = "LabyStudio"

wVersionS = fs.open("LabyOS/Config/OSversion", "r")
wVersion = wVersionS.readLine()
wVersionS.close()

-- Show real FreeSpace --
realFreeSpace = false
MySpace = "800"
-- Standard files --
ChangedName1 = "Guest"
ChangedPass1 = "no password"

ChangedName2 = "Free slot"
ChangedPass2 = "no password"

ChangedName3 = "Free slot"
ChangedPass3 = "no password"
-- ########################## -- CLEAR -- ############################ --
function SystemClear()
 sbc(1)
 r("clear")
 sbc(2048)
 scp(1,1)
 write("                                                   ")
 scp(1,1)
 stc(1)
 w([[Settings]])
 scp(51,1)
 sbc(16384)
 write("X")
stc(1)
sbc(8192)
scp(1,19)
w([[ Start ]])
sbc(2048)
w([[                                              ]])
timeprint1()
   scp(8,19)
   sbc(8)
r("LabyOS/Task/task")
   sbc(2048)
sbc(1)
stc(32768)
end
--############################ Get Size ################################--
function getSize(path)
  local size = 0
  for _, file in ipairs(fs.list(path)) do
    if fs.isDir(fs.combine(path, file)) then
      --# if it is a directory, recurse.
      size = size + getSize(fs.combine(path, file))
    else
      size = size + fs.getSize(fs.combine(path, file))
    end
  end
  return size
end
--############################### Design ##################################--
function setLayout()
scp(1,2)
w("            :")
scp(1,3)
w("System Info :")
scp(1,4)
w("Profiles    :")
scp(1,5)
w("Background  :")
scp(1,6)
w("Settings    :")
scp(1,7)
w("            :")
scp(1,8)
w("            :")
scp(1,9)
w("            :")
scp(1,10)
w("            :")
scp(1,11)
w("            :")
scp(1,12)
w("            :")
scp(1,13)
w("            :")
scp(1,14)
w("            :")
scp(1,15)
w("            :")
scp(1,16)
w("            :")
scp(1,17)
w("            :")
scp(1,18)
w("            :")
end

--############################### System Settings ##################################--
function SystemSettings()
sbc(256)
scp(1,6)
stc(32768)
write("Settings    ")

sbc(1)
scp(14,18)
write("Downloading clocks..")
scp(14,17)
sbc(1)
write("0/3 loaded")
USATime = "00:00"
--	USATime = http.get("http://www.timeapi.org/edt/now?format=%25k:%25M")
--	USATime = USATime.readAll()
scp(14,17)
sbc(1)
write("1/3 loaded")
DETime = "00:00"
--	DETime = http.get("http://www.timeapi.org/cet/now?format=%25k:%25M")
--	DETime = DETime.readAll()
scp(14,17)
sbc(1)
write("2/3 loaded")
ENTime = "00:00"
--	ENTime = http.get("http://www.timeapi.org/utc/now?format=%25k:%25M")
--	ENTime = ENTime.readAll()
scp(14,17)
sbc(1)
write("3/3 loaded")
sleep(0.1)
scp(14,18)
sbc(1)
write("                    ")
scp(14,17)
write("                    ")


function SystemSettingsReload()
sbc(1)
stc(32768)
scp(15,3)
write("Clock settings:")
sbc(256)
scp(16,4)
write(" England ")
sbc(1)
write(" ")
sbc(256)
write(" America ")
sbc(1)
write(" ")
sbc(256)
write(" Germany ")
sbc(1)
write(" ")
sbc(256)
write(" MC ")

sbc(1)
scp(18,5)
write(ENTime)
scp(28,5)
write(USATime)
scp(38,5)
write(DETime)

scp(15,7)
write("Bootscreen:")
scp(16,8)
sbc(256)
write("ON ")
sbc(1)
write(" ")
sbc(256)
write("OFF")

saveSK = fs.open("LabyOS/Config/SaveStart", "r")
SaveStart = saveSK.readLine()
saveSK.close()

if SaveStart == "false" then -- false for no fast start
scp(16,8)
sbc(16384)
write("ON ")
elseif SaveStart == "trueKeep" then -- true for fast start
scp(20,8)
sbc(16384)
write("OFF")
end

TimeAPI = "EN"
   TimeAPIR = fs.open("LabyOS/Config/TimeAPI", "r")
   TimeAPI = TimeAPIR.readLine()
   TimeAPIR.close()
   
if TimeAPI == "EN" then
	scp(16,4)
	sbc(16384)
	write(" England ")
elseif TimeAPI == "USA" then
	scp(26,4)
	sbc(16384)
	write(" America ")
elseif TimeAPI == "DE" then
	scp(36,4)
	sbc(16384)
	write(" Germany ")
elseif TimeAPI == "MC" then
	scp(46,4)
	sbc(16384)
	write(" MC ")
end
end
SystemSettingsReload()
end
--############################### System Info ##################################--
function SystemInfo()
sbc(256)
scp(1,3)
stc(32768)
write("System Info ")
sbc(1)
scp(15,3)
write("Windows Edition:")
scp(15,4)
stc(256)
write(" "..wEdition.." "..wVersion.." "..wExtraStatus)
scp(15,5)
write(" "..wOSName.." by "..wDeveloper)
scp(15,7)
stc(32768)
write("System Information:")

scp(16,8)
stc(256)
usedSpace = getSize("LabyOS/")
write(math.ceil(usedSpace/1048))
w("KB used of ")

if realFreeSpace == true then
FreeSpace = tostring(fs.getFreeSpace("/"))
write(math.ceil(FreeSpace/9048))
else
FreeSpace = MySpace
write(FreeSpace)
end
w("KB")

scp(15,11)
stc(32768)
write("User Information:")
stc(256)
scp(16,12)
write("Name: "..dataname1a)


scp(16,9)
if realFreeSpace == true then
FreeSpace=FreeSpace-usedSpace
write(math.ceil(FreeSpace/9048))
else


fakespace = (math.ceil(usedSpace/1048))
FreeSpace=FreeSpace-fakespace
write(FreeSpace)
end

w("KB Available")

Zoom = "40000"

scp(15,15)
sbc(256)
fs.makeDir("LabyOS/Documents")
write("                                 ")
SystemSpace = getSize("LabyOS/Programme")
UserSpace = getSize("LabyOS/Documents")
ProgramSpace1 = getSize("LabyOS/Backup")
ProgramSpace2 = getSize("LabyOS/Config")
ProgramSpace3 = getSize("LabyOS/Texture")
ProgramSpace4 = getSize("LabyOS/Profile")
ProgramSpace5 = getSize("LabyOS/Task")
ProgramSpace6 = getSize("LabyOS/Online")
ProgramSpace=ProgramSpace1+ProgramSpace2+ProgramSpace3+ProgramSpace4+ProgramSpace5+ProgramSpace6
scp(15,15)
stc(32768)
SystemSpaceLine = (math.ceil(SystemSpace/Zoom))
ProgramSpaceLine = (math.ceil(ProgramSpace/Zoom))
UserSpaceLine = (math.ceil(UserSpace/Zoom))

for SSL=0,SystemSpaceLine do
sbc(16384)
write(" ")
end

for PSL=0,ProgramSpaceLine do
sbc(2048)
write(" ")
end

for USL=0,UserSpaceLine do
sbc(16)
write(" ")
end

scp(15,14)
sbc(1)
stc(16384)
w("  ")
write(math.ceil(SystemSpace/1048))
w("KB    ")

stc(2048)
write(math.ceil(ProgramSpace/1048))
w("KB    ")

stc(16)
write(math.ceil(UserSpace/1048))
w("KB    ")

stc(256)

if realFreeSpace == true then
write(math.ceil(FreeSpace/9048))
else
write(FreeSpace)
end

w("KB")

scp(15,17)
stc(128)

sbc(16384)
write(" ")
sbc(1)
write(" System ")

sbc(2048)
write(" ")
sbc(1)
write(" Programs ")

sbc(16)
write(" ")
sbc(1)
write(" User ")

sbc(256)
write(" ")
sbc(1)
write(" Free ")
end
--############################### Profiles ##################################--
function SystemProfiles()
UserEdit = fs.open("LabyOS/Profile/User1", "r")
         if UserEdit then
          EditName1 = UserEdit.readLine()
		  EditPass1  = UserEdit.readLine()
         end
UserEdit = fs.open("LabyOS/Profile/User2", "r")
         if UserEdit then
          EditName2 = UserEdit.readLine()
		  EditPass2  = UserEdit.readLine()
         end
UserEdit = fs.open("LabyOS/Profile/User3", "r")
         if UserEdit then
          EditName3 = UserEdit.readLine()
		  EditPass3  = UserEdit.readLine()
         end
--############################### Design ####################################-- 
sbc(256)
scp(1,4)
stc(32768)
write("Profiles    ")
sbc(1)
if dataname1a == EditName1 then
sbc(128)
scp(15,3)
stc(1)
write("1     ")
scp(15,4)
write("      ")
scp(15,5)
write("      ")
scp(15,6)
write("      ")
else
sbc(256)
scp(15,3)
stc(32768)
write("1     ")
scp(15,4)
write("      ")
scp(15,5)
write("      ")
scp(15,6)
write("      ")
end

stc(32768)
sbc(1)
scp(22,3)
write("Username:")
scp(22,4)
sbc(256)
write("                             ")
scp(22,4)
write(EditName1)
scp(22,5)
sbc(1)
write("Password:")
scp(22,6)
sbc(256)
write("                             ")
scp(22,6)
if EditPass1 == "no password" then
write("")
else
write("********")
end



if dataname1a == EditName2 then
sbc(128)
scp(15,8)
stc(1)
write("2     ")
scp(15,9)
write("      ")
scp(15,10)
write("      ")
scp(15,11)
write("      ")
else
sbc(256)
scp(15,8)
stc(32768)
write("2     ")
scp(15,9)
write("      ")
scp(15,10)
write("      ")
scp(15,11)
write("      ")
end



stc(32768)
sbc(1)
scp(22,8)
write("Username:")
scp(22,9)
sbc(256)
write("                             ")
scp(22,9)
write(EditName2)
scp(22,10)
sbc(1)
write("Password:")
scp(22,11)
sbc(256)
write("                             ")
scp(22,11)
if EditPass2 == "no password" then
write("")
else
write("********")
end


if dataname1a == EditName3 then
sbc(128)
scp(15,13)
stc(1)
write("3     ")
scp(15,14)
write("      ")
scp(15,15)
write("      ")
scp(15,16)
write("      ")
else
sbc(256)
stc(32768)
scp(15,13)
write("3     ")
scp(15,14)
write("      ")
scp(15,15)
write("      ")
scp(15,16)
write("      ")
end





stc(32768)
sbc(1)
scp(22,13)
write("Username:")
scp(22,14)
sbc(256)
write("                             ")
scp(22,14)
write(EditName3)
scp(22,15)
sbc(1)
write("Password:")
scp(22,16)
sbc(256)
write("                             ")
scp(22,16)
if EditPass3 == "no password" then
write("")
else
write("********")
end
end
--############################### Background ##################################--
function SystemBackground()
sbc(256)
scp(1,5)
stc(32768)
write("Background  ")
sbc(1)
scp(15,3)
write("Standard backgrounds:")
sbc(256)
scp(15,4)
write(" Minecraft ")
sbc(1)
write(" ")
sbc(256)
write(" Computer  ")
sbc(1)
write(" ")
sbc(256)
write("     ?     ")
scp(15,6)
write("     ?     ")
sbc(1)
write(" ")
sbc(256)
write("     ?     ")
sbc(1)
write(" ")
sbc(256)
write("     ?     ")

sbc(1)
scp(15,8)
write("Custom backgrounds:")
sbc(256)
scp(15,9)
write(" New ")
sbc(1)
write(" ")
sbc(256)
write(" Open ")
sbc(1)
write(" ")
sbc(256)
write(" Pastebin ")
end
--############################### Autorun ##################################--
SystemClear()
setLayout()
SystemInfo()
--############################### Mouse ##################################--
function SystemMouse()
while true do
event, button, X, Y = os.pullEvent("mouse_click")
  if X >= 51 and X <= 51 and Y == 1 then
   resetDesktop()
   error("Terminated")
  break
  end
    if X >= 1 and X <= 12 and Y == 3 then
	  SystemClear()
	  setLayout()
      SystemInfo()
	end
    if X >= 1 and X <= 12 and Y == 4 then
	  SystemClear()
	  setLayout()
      SystemProfiles()
                while true do
                   event, button, X, Y = os.pullEvent("mouse_click")
--############################### Profiles ##################################--
if X >= 22 and X <= 50 and Y == 4 then
	                     scp(22,4)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,4)
						 ChangedName1 = read()
						 
						 if ChangedName1 == "" then
						 ChangedName1 = "Guest"
						 end
						 
							if fs.exists("LabyOS/Profile/User1") then
								ChangedNameO1 = fs.open("LabyOS/Profile/User1", "w")
								ChangedNameO1.write(ChangedName1.."\n")
								ChangedNameO1.write(ChangedPass1)
								ChangedNameO1.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
	                    if X >= 22 and X <= 50 and Y == 6 then
	                     scp(22,6)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,6)
						 ChangedPass1 = read("*")
						 
						 if ChangedPass1 == "" then
						 ChangedPass1 = "no password"
						 end
						 
							if fs.exists("LabyOS/Profile/User1") then
								ChangedNameO1 = fs.open("LabyOS/Profile/User1", "w")
								ChangedNameO1.write(ChangedName1.."\n")
								ChangedNameO1.write(ChangedPass1)
								ChangedNameO1.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
if X >= 22 and X <= 50 and Y == 9 then
	                     scp(22,9)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,9)
						 ChangedName2 = read()
						 
						 if ChangedName2 == "" then
						 ChangedName2 = "Free slot"
						 end
						 
							if fs.exists("LabyOS/Profile/User2") then
								ChangedNameO2 = fs.open("LabyOS/Profile/User2", "w")
								ChangedNameO2.write(ChangedName2.."\n")
								ChangedNameO2.write(ChangedPass2)
								ChangedNameO2.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
	                    if X >= 22 and X <= 50 and Y == 11 then
	                     scp(22,11)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,11)
						 ChangedPass2 = read("*")
						 
						 if ChangedPass2 == "" then
						 ChangedPass2 = "no password"
						 end
						 
							if fs.exists("LabyOS/Profile/User2") then
								ChangedNameO2 = fs.open("LabyOS/Profile/User2", "w")
								ChangedNameO2.write(ChangedName2.."\n")
								ChangedNameO2.write(ChangedPass2)
								ChangedNameO2.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
if X >= 22 and X <= 50 and Y == 14 then
	                     scp(22,14)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,14)
						 ChangedName3 = read()
						 
						 if ChangedName3 == "" then
						 ChangedName3 = "Free slot"
						 end
						 
							if fs.exists("LabyOS/Profile/User3") then
								ChangedNameO3 = fs.open("LabyOS/Profile/User3", "w")
								ChangedNameO3.write(ChangedName3.."\n")
								ChangedNameO3.write(ChangedPass3)
								ChangedNameO3.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
	                    if X >= 22 and X <= 50 and Y == 16 then
	                     scp(22,16)
						 sbc(256)
						 w("                           ")
	                     stc(32768)
						 scp(22,16)
						 ChangedPass3 = read("*")
						 
						 if ChangedPass3 == "" then
						 ChangedPass3 = "no password"
						 end
						 
							if fs.exists("LabyOS/Profile/User3") then
								ChangedNameO3 = fs.open("LabyOS/Profile/User3", "w")
								ChangedNameO3.write(ChangedName3.."\n")
								ChangedNameO3.write(ChangedPass3)
								ChangedNameO3.close()
							end
		
							SystemClear()
							setLayout()
							SystemProfiles()
						end
    if X >= 1 and X <= 12 and Y == 6 then
	  SystemClear()
	  setLayout()
      SystemSettings()
	  break
	end
    if X >= 1 and X <= 12 and Y == 3 then
	  SystemClear()
	  setLayout()
      SystemInfo()
	  break
	end
    if X >= 1 and X <= 12 and Y == 5 then
	  SystemClear()
	  setLayout()
      SystemBackground()
	  break
	end
	if X >= 1 and X <= 6 and Y == 19 then
      startmenu()
	  error("Terminated!")
	  break
	end		
  if X >= 51 and X <= 51 and Y == 1 then
   resetDesktop()
   error("Terminated")
  break
  end		  
 end	  
end

    if X >= 1 and X <= 12 and Y == 5 then
	  SystemClear()
	  setLayout()
       SystemBackground()
                while true do
                   event, button, X, Y = os.pullEvent("mouse_click")
--############################### Background ##################################--
--############## Design 1 ################--
if X >= 15 and X <= 25 and Y == 4 then 
fs.delete("LabyOS/Texture/Desktop/"..dataname1a.."/1")
fs.copy("LabyOS/Texture/Desktop/1", "LabyOS/Texture/Desktop/"..dataname1a.."/1")
scp(15,4)
sbc(16384)
write(" Minecraft ")
sbc(256)
sleep(0.2)
scp(15,4)
write(" Minecraft ")
sbc(1)
end
--############## Design 2 ################--
if X >= 27 and X <= 37 and Y == 4 then 
fs.delete("LabyOS/Texture/Desktop/"..dataname1a.."/1")
fs.copy("LabyOS/Texture/Desktop/2", "LabyOS/Texture/Desktop/"..dataname1a.."/1")
scp(27,4)
sbc(16384)
write(" Computer  ")
sbc(256)
sleep(0.2)
scp(27,4)
write(" Computer  ")
sbc(1)
end
--############## Custom # NEW ###############--
if X >= 15 and X <= 19 and Y == 9 then
r("LabyOS/Programme/Paint LabyOS/Texture/Desktop/"..dataname1a.."/1")
r("LabyOS/Programme/Settings")
end
--############## Custom # Open ###############--
if X >= 21 and X <= 26 and Y == 9 then 
	sbc(2048)
	stc(1)
	scp(15,5)
	w("Open File         ")
	sbc(16384)
	w("X")
	sbc(1)
	stc(32768)
	scp(15,6)
	w(": Name:           :")
	scp(15,7)
	sbc(1)
	w(": ")
	sbc(258)
	w("               ")
	sbc(1)
	w(" :")
	sbc(1)
	scp(15,8)
	w(":                 :")
	scp(15,9)
	w("+-----------------+")
	scp(17,7)
	sbc(258)
	stc(128)
	w("")
	scp(17,7)
	stc(32768)
	fileaddB = read()
	  if fileaddB == "" then
r("LabyOS/Programme/Settings")
error("Terminated")
	  elseif fs.exists(fileaddB) then
	  sbc(1)
	  scp(1,17)
	    fs.delete("LabyOS/Texture/Desktop/"..dataname1a.."/1")
	    fs.copy(fileaddB, "LabyOS/Texture/Desktop/"..dataname1a.."/1")
		sbc(256)
		scp(17,7)
		stc(16384)
		w("File added!    ")
        sleep(1)
r("LabyOS/Programme/Settings")
error("Terminated")
	  elseif not fs.exists(fileaddB) then
	    scp(17,7)
		stc(16384)
		w("File not found!")
        sleep(2)
r("LabyOS/Programme/Settings")
error("Terminated")
	  end
    break
   end
--############## Custom # Pastebin ###############--
if X >= 26 and X <= 35 and Y == 9 then 
	sbc(2048)
	stc(1)
	scp(15,5)
	w("Download file     ")
	sbc(16384)
	w("X")
	sbc(1)
	stc(32768)
	scp(15,6)
	w(": Code:           :")
	scp(15,7)
	sbc(1)
	w(": ")
	sbc(258)
	w("               ")
	sbc(1)
	w(" :")
	sbc(1)
	scp(15,8)
	w(":                 :")
	scp(15,9)
	w("+-----------------+")
	scp(17,7)
	sbc(258)
	stc(128)
	w("")
	scp(17,7)
	stc(32768)
	fileaddB2 = read()
	  if fileaddB2 == "" then
        r("LabyOS/Programme/Settings")
        error("Terminated")
      else

	local response = http.get(
		"http://pastebin.com/raw.php?i="..textutils.urlEncode( fileaddB2 )
		)
		
	if response then
fs.delete("LabyOS/Texture/Desktop/"..dataname1a.."/1")
		local sResponse = response.readAll()
		response.close()
		
		local file = fs.open("LabyOS/Texture/Desktop/"..dataname1a.."/1", "w" )
		file.write( sResponse )
		file.close()
	else
r("LabyOS/Programme/Settings")
error("Terminated")
end
	  sbc(1)
	  scp(1,17)
		sbc(256)
		scp(17,7)
		stc(16384)
		w("File added!    ")
        sleep(1)
r("LabyOS/Programme/Settings")
error("Terminated")
	  end
    break
   end
--########################################--
    if X >= 1 and X <= 12 and Y == 3 then
	  SystemClear()
	  setLayout()
      SystemInfo()
	  break
	end
    if X >= 1 and X <= 12 and Y == 4 then
	  SystemMouse()
	  SystemClear()
	  setLayout()
      SystemProfiles()
	  break
	end
    if X >= 1 and X <= 12 and Y == 6 then
	  SystemClear()
	  setLayout()
      SystemSettings()
	  break
	end
	if X >= 1 and X <= 6 and Y == 19 then
      startmenu()
	  error("Terminated!")
	  break
	end	
  if X >= 51 and X <= 51 and Y == 1 then
   resetDesktop()
   error("Terminated")
  break
  end
end

--############################################################################--
end
    if X >= 1 and X <= 12 and Y == 6 then
	  SystemClear()
	  setLayout()
      SystemSettings()
                while true do
                   event, button, X, Y = os.pullEvent("mouse_click")
				     if X >= 16 and X <= 24 and Y == 4 then
						TimeAPI = fs.open("LabyOS/Config/TimeAPI", "w")
						TimeAPI.write("EN")
						TimeAPI.close()
      SystemSettings()
				     end
				     if X >= 26 and X <= 34 and Y == 4 then
						TimeAPI = fs.open("LabyOS/Config/TimeAPI", "w")
						TimeAPI.write("USA")
						TimeAPI.close()
      SystemSettings()
				     end
				     if X >= 36 and X <= 44 and Y == 4 then 
						TimeAPI = fs.open("LabyOS/Config/TimeAPI", "w")
						TimeAPI.write("DE")
						TimeAPI.close()
      SystemSettings() 
				     end
				     if X >= 46 and X <= 50 and Y == 4 then 
						TimeAPI = fs.open("LabyOS/Config/TimeAPI", "w")
						TimeAPI.write("MC")
						TimeAPI.close()
      SystemSettings() 
				     end
				     if X >= 16 and X <= 18 and Y == 8 then 
						saveSK = fs.open("LabyOS/Config/SaveStart", "w")
						saveSK.write("false") -- false for no fast start
						saveSK.close()
      SystemSettingsReload() 
                     end
				     if X >= 20 and X <= 23 and Y == 8 then 
						saveSK = fs.open("LabyOS/Config/SaveStart", "w")
						saveSK.write("trueKeep") -- true for fast start
						saveSK.close()
      SystemSettingsReload() 
                     end
--########################################--
    if X >= 1 and X <= 12 and Y == 3 then
	  SystemClear()
	  setLayout()
      SystemInfo()
	  break
	end
    if X >= 1 and X <= 12 and Y == 4 then
	  SystemMouse()
	  SystemClear()
	  setLayout()
      SystemProfiles()
	  break
	end
	if X >= 1 and X <= 6 and Y == 19 then
      startmenu()
	  error("Terminated!")
	  break
	end	
    if X >= 1 and X <= 12 and Y == 5 then
      SystemMouse()
	  SystemClear()
	  setLayout()
      SystemBackground()
	 break
	end
  if X >= 51 and X <= 51 and Y == 1 then
   resetDesktop()
   error("Terminated")
  break
  end
   end
  end
				   
				   
	if X >= 1 and X <= 6 and Y == 19 then
      startmenu()
	end
 end
end
SystemMouse()