--SimSoft Yellow -  Copyright by Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/)

--Desktop

BC(1)
Clear()

festSeite = 1

file = fs.open("SimSoft/Data/SystemColor","r")
local fileData = {}
local line = file.readLine()
repeat
table.insert(fileData,line)
line = file.readLine()
until line == nil
file.close()

SystemColor = fileData[3]

SystemColor = ((SystemColor-1)+1)


--Funktionen

function SideBarANZEIGE(seite)
	
	seite = seite
	
	w, h = term.getSize()
	
	BC(SystemColor)
	
	wC = 1
	hC = 1
	
	while true do

		wC = (wC+1)
	
		CP(wC, hC)
		BC(SystemColor)
		write(" ")
	
		if wC == 14 then
			if hC == (h) then
				break
			else
				hC = (hC+1)
				wC = 1
			end
		end
	
	end
	
	CP(3, (h-1))
	TC(128)
	print("<         >")
	
	
	--SappS
	
	AppListe = nil
	AppListe = {}
	
	AppListeRoh = nil
	AppListeRoh = fs.list("SimSoft/SappS")
	
	C = 0
	
	AppC = 0
	
	while true do
		
		C = (C+1)
		
		if AppListeRoh[C] == nil then
			C = (C-1)
			
			break
		else
			GibtEsSappS = fs.exists("SimSoft/SappS/"..AppListeRoh[C].."/SappS")
			
			if GibtEsSappS == true then
				
				file = fs.open("SimSoft/SappS/"..AppListeRoh[C].."/SappS","r")
				local fileData = {}
				local line = file.readLine()
				repeat
				table.insert(fileData,line)
				line = file.readLine()
				until line == nil
				file.close()
				
				PathOfApp = fileData[2]
				AppName = fileData[3]
				
				GibtEsMainApp = fs.exists(PathOfApp)
				
				if GibtEsMainApp == true and not (AppName == nil) and not (AppName == "") then
					
					table.insert(AppListe, ("SimSoft/SappS/"..AppListeRoh[C]))
					table.insert(AppListe, PathOfApp)
					table.insert(AppListe, AppName)
					
					AppC = (AppC+1)
					
				end
				
			end
		end
	end
	
	-- 14	
	
	if AppC <= 15 then
		MAXseiten = 1
	elseif AppC <= 30 then
		MAXseiten = 2
	elseif AppC <= 45 then
		MAXseiten = 3
	elseif AppC <= 60 then
		MAXseiten = 4
	elseif AppC <= 75 then
		MAXseiten = 5
	elseif AppC <= 90 then
		MAXseiten = 6
	elseif AppC <= 105 then
		MAXseiten = 7
	elseif AppC <= 120 then
		MAXseiten = 8
	elseif AppC >= 135 then
		MAXseiten = 9
	end
	
	C = 0
	
	while true do
		
		C = (C+1)
		
		if AppC <= (15*C) then
			MAXseiten = C
			break
		end
		
		
	end
	
	
	CP(7, (h-1))
	TC(1)
	
	print(seite.."/"..MAXseiten)
	
	
	if seite == 1 then
		seitenC = 0
		seitenCfest = 0
	else
		seitenC = (15*(seite-1))
		seitenCfest = (15*(seite-1))
	end	
	
	
	C = 0
	
	while true do
		
		seitenC = (seitenC+1)
		C = (C+1)
		
		if C <= AppC then
			
			TC(1)
			CP(4, (C+1))
			
			print(AppListe[(seitenC*3)])
			
		end
		
		if C == 15 or (C+seitenCfest) >= AppC then
			break
		end
		
		
	end
	
end


function SimSoftLineANZEIGE()
	
	
	w, h = term.getSize()
	
	
	wC = 0
	hC = 0
	
	while true do
		
		wC = (wC+1)
		
		BC(SystemColor)
		
		CP(((w-3)+wC), (hC))
		
		write(" ")
		
		if wC == 3 then
			if hC == h then
				break
			else
				wC = 0
				hC = (hC+1)
			end
		end		
		
	end
	
	CP((w-1), 2)
	BC(SystemColor)
	TC(1)
	write("=")
	
	CP((w-1), (h-1))
	BC(SystemColor)
	TC(1)
	write("=")
	
	CP(1,1)
	
end

function HintergrundBildANZEIGE()
	
	w, h = term.getSize()
	
	file = fs.open("SimSoft/Data/BackgroundConfig","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	IsBackground = fileData[3]
	
	if IsBackground == true or IsBackground == "true" then
		
		 _Background = paintutils.loadImage("SimSoft/Data/Background")
		paintutils.drawImage(_Background,15,(h-17))
		
	end
	
end

function LeftAppANZEIGE(x,y)
	
	w, h = term.getSize()
	
	TC(1)
	
	if (h-6) >= y then
		
		BC(128)
		
		CP(x,y)
		print("               ")
		CP(x,y)
		print(" "..AppListe[(((y-1)+seitenCfest)*3)])
		
		BC(256)
		
		CP(x,(y+1))
		print("               ")
		CP(x,(y+2))
		print(" Run           ")
		CP(x,(y+3))
		print(" Run with Arg. ")
		CP(x,(y+4))
		print(" Delete        ")
		CP(x,(y+5))
		print("               ")
		
		openUnten = "unten"
	
	elseif (h-6) < y then
	
		BC(128)
		
		CP(x,y)
		print("               ")
		CP(x,y)
		print(" "..AppListe[(((y-1)+seitenCfest)*3)])
		
		BC(256)
		
		CP(x,(y-1))
		print("               ")
		CP(x,(y-2))
		print(" Run           ")
		CP(x,(y-3))
		print(" Run with Arg. ")
		CP(x,(y-4))
		print(" Delete        ")
		CP(x,(y-5))
		print("               ")
		
		openUnten = "oben"
	
	end
end

function SimSoftOverviewANZEIGE()
	
	w, h = term.getSize()
	
	
	wC = 0
	hC = 0
	
	while true do
		
		wC = (wC+1)
		
		BC(SystemColor)
		
		CP(((w-18)+wC), (hC))
		
		write(" ")
		
		if wC == 3 then
			if hC == h then
				break
			else
				wC = 0
				hC = (hC+1)
			end
		end		
		
	end
	
	wC = 0
	hC = 0
	
	while true do
		
		wC = (wC+1)
		
		BC(SystemColor)
		
		CP(((w-15)+wC), (hC))
		
		write("                ")
		
		if wC == 3 then
			if hC == h then
				break
			else
				wC = 0
				hC = (hC+1)
			end
		end		
		
	end
	
	CP((w-16), 2)
	BC(SystemColor)
	TC(1)
	write("<")
	
	CP((w-16), (h-1))
	BC(SystemColor)
	TC(1)
	write("<")
	

	TC(1)
	BC(1)
	CP((w-17), 4)
	write("                  ")
	CP((w-17), 5)
	write("                  ")
	CP((w-17), 6)
	write("                  ")
	
	CP((w-15), 5)
	TC(SystemColor)
	write("SimSoft Yellow")
	
	--
	
	BC(SystemColor)
	TC(1)
	
	CP((w-9), 8)
	write("Settings")

	CP((w-12), 9)
	write("System Info")

	CP((w-10), 10)
	write("App Store")
	
	CP((w-6), 11)
	write("Shell")
	
	CP((w-7), 12)
	write("Update")

	CP((w-7), 13)
	write("Reboot")
	
	CP((w-9), 14)
	write("Shutdown")
	
end

function SystemInfoANZEIGE()
	
	BC(1)
	Clear()
	
	wC = 0
	hC = 1
	
	while true do

		wC = (wC+1)
	
		CP(wC, hC)
		BC(SystemColor)
		write(" ")
	
		if wC == w then
			if hC == 3 then
				break
			else
				hC = (hC+1)
				wC = 0
			end
		end
	
	end

	anzeige = "System Info"

	TC(1)
	CP(((w/2)-((#anzeige)/2)+1),2)

	print(anzeige)	
	
	
	BC(SystemColor)
	TC(1)
	
	CP((w-11), (h-3))
	print("           ")
	CP((w-11), (h-2))
	print("  Desktop  ")
	CP((w-11), (h-1))
	print("           ")
	
	
	file = fs.open("SimSoft/Data/Version","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	SystemVersion = fileData[3]
	SystemLanguage = fileData[4]
	
	
	BC(1)
	
	TC(128)
	CP(4,6)
	write("Version - ")
	TC(SystemColor)
	print(SystemVersion)
	
	TC(128)
	CP(4,8)
	write("Language - ")
	TC(SystemColor)
	print(SystemLanguage)
	
	TC(128)
	CP(4,10)
	write("Copyright - ")
	TC(SystemColor)
	print("simlor")
	
	TC(128)
	CP(4,12)
	write("PC-ID - ")
	TC(SystemColor)
	print(os.getComputerID())
	
	TC(128)
	CP(4,14)
	write("Forum - ")
	TC(SystemColor)
	print("https://goo.gl/Mo02cO")
	
	
	
	
end

function Settings_2_ANZEIGE()
	
	file = fs.open("SimSoft/Data/BackgroundConfig","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	IsBackground = fileData[3]
	
	file = fs.open("SimSoft/Data/UserData","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	OName = fileData[3]
	OPass = fileData[4]
	IsPass = fileData[5]
	
	file = fs.open("SimSoft/Data/BackgroundConfig","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	IsDesktop = fileData[3]
	
	if IsBackground == true or IsBackground == "true" then
	
		CP(23,12)
		
		BC(SystemColor)
		write("  ")
		
		BC(128)
		print(" ")
	
	else
		
		CP(23,12)
		
		BC(SystemColor)
		write(" ")
		
		BC(128)
		print("  ")
		
	end
	
		
	if IsPass == true or IsPass == "true" then
	
		CP(10,14)
		
		BC(SystemColor)
		write("  ")
		
		BC(128)
		print(" ")
	
	else
		
		CP(10,14)
		
		BC(SystemColor)
		write(" ")
		
		BC(128)
		print("  ")
		
	end
	
end

function LoadSettingsForColor()
	file = fs.open("SimSoft/Data/SystemColor","r")
	local fileData = {}
	local line = file.readLine()
	repeat
	table.insert(fileData,line)
	line = file.readLine()
	until line == nil
	file.close()
	
	SystemColor = nil
	SystemColor = fileData[3]
end

function SettingsANZEIGE()
	
	BC(1)
	Clear()
	
	wC = 0
	hC = 1
	
	while true do

		wC = (wC+1)
	
		CP(wC, hC)
		BC(SystemColor)
		write(" ")
	
		if wC == w then
			if hC == 3 then
				break
			else
				hC = (hC+1)
				wC = 0
			end
		end
	
	end

	anzeige = "Settings"

	TC(1)
	CP(((w/2)-((#anzeige)/2)+1),2)

	print(anzeige)	
	
	
	BC(SystemColor)
	TC(1)
	
	CP((w-11), (h-3))
	print("           ")
	CP((w-11), (h-2))
	print("  Desktop  ")
	CP((w-11), (h-1))
	print("           ")
	
	
	BC(1)
	
	TC(SystemColor)
	CP(4,6)
	write("Edit Username")
	
	TC(SystemColor)
	CP(4,8)
	write("Edit Password")
	
	TC(SystemColor)
	CP(4,10)
	write("Edit Desktop")
	
	TC(128)
	CP(4,12)
	write("Desktop Background")
	
	TC(128)
	CP(4,14)
	write("Login")
	
	Settings_2_ANZEIGE()
	
	BC(2)
	CP(4,(h-1))
	print("  ")
	
	BC(4)
	CP(7,(h-1))
	print("  ")
	
	BC(8)
	CP(10,(h-1))
	print("  ")
	
	BC(16)
	CP(13,(h-1))
	print("  ")
	
	BC(32)
	CP(16,(h-1))
	print("  ")
	
	BC(64)
	CP(19,(h-1))
	print("  ")
	
	BC(512)
	CP(4,(h-3))
	print("  ")
	
	BC(1024)
	CP(7,(h-3))
	print("  ")
	
	BC(2048)
	CP(10,(h-3))
	print("  ")
	
	BC(4096)
	CP(13,(h-3))
	print("  ")
	
	BC(8192)
	CP(16,(h-3))
	print("  ")
	
	BC(16384)
	CP(19,(h-3))
	print("  ")
	
end

--Standertseting
HintergrundBildANZEIGE()
SideBarANZEIGE(festSeite)
SimSoftLineANZEIGE()


--System

w, h = term.getSize()

DeskEXIT = false

while true do
	event, side, x, y = os.pullEvent()
	if event == "mouse_click" then
	
		if x >= (w-2) and x <= w and y >= 1 and y <= h and not (DeskEXIT == true) then
			
			SimSoftOverviewANZEIGE()
			
			while true do
				event, side, x, y = os.pullEvent()
				if event == "mouse_click" then
				
					if x >= (w-9) and x <= (w-2) and y == 8 then -- Settings
						
						SettingsANZEIGE()
						
						while true do
							event, side, x, y = os.pullEvent()
							if event == "mouse_click" then
								
								
								SettingsANZEIGE()
								
								--Farben
								
								if x >= 4 and x <= 5 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("2.0")
 									file.close()
									
									SystemColor = 2.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 7 and x <= 8 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("4.0")
 									file.close()
									
									SystemColor = 4.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 10 and x <= 11 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("8.0")
 									file.close()
									
									SystemColor = 8.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 13 and x <= 14 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("16.0")
 									file.close()
									
									SystemColor = 16.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 16 and x <= 17 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("32.0")
 									file.close()
									
									SystemColor = 32.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 19 and x <= 20 and y == (h-1) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("64.0")
 									file.close()
									
									SystemColor = 64
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								--zeile 2
								
								if x >= 4 and x <= 5 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("512.0")
 									file.close()
									
									SystemColor = 512.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 7 and x <= 8 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("1024.0")
 									file.close()
									
									SystemColor = 1024.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 10 and x <= 11 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("2048.0")
 									file.close()
									
									SystemColor = 2048.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 13 and x <= 14 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("4096.0")
 									file.close()
									
									SystemColor = 4096.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 16 and x <= 17 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("8192.0")
 									file.close()
									
									SystemColor = 8192.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								if x >= 19 and x <= 20 and y == (h-3) then
									local file = fs.open("SimSoft/Data/SystemColor", "w")
									file.writeLine("SimSoft System Color")
									file.writeLine("")
									file.writeLine("16384.0")
 									file.close()
									
									SystemColor = 16384.0
									Settings_2_ANZEIGE()
									SettingsANZEIGE()
									
								end
								
								
								--Farben ENDE
								
								if x >= 4 and x <= 16 and y == 6 then
									CP(4,6)
									BC(1)
									print("               ")
									CP(4,6)
									TC(SystemColor)
									
									NewName = read()
									
									CP(4,6)
									BC(1)
									print("Edit Username                       ")

 									local file = fs.open("SimSoft/Data/UserData", "w")
									file.writeLine("SimSoft System Version")
									file.writeLine("")
									file.writeLine(NewName)
									file.writeLine(OPass)
									file.writeLine(IsPass)
 									file.close()
									
									Settings_2_ANZEIGE()
								
								
								end
								
								if x >= 4 and x <= 16 and y == 8 then
									CP(4,8)
									BC(1)
									print("               ")
									CP(4,8)
									TC(SystemColor)
									
									NewPass = read()
									
									CP(4,8)
									BC(1)
									print("Edit Password                       ")

 									local file = fs.open("SimSoft/Data/UserData", "w")
									file.writeLine("SimSoft System Version")
									file.writeLine("")
									file.writeLine(OName)
									file.writeLine(NewPass)
									file.writeLine(IsPass)
 									file.close()
									
									Settings_2_ANZEIGE()
								
								
								end
								
								if x >= 4 and x <= 15 and y == 10 then
									
									shell.run("paint SimSoft/Data/Background")
									SettingsANZEIGE()
									
								end
								
								if x >= 23 and x <= 25 and y == 12 then
									
									if IsBackground == true or IsBackground == "true" then
										
										local file = fs.open("SimSoft/Data/BackgroundConfig", "w")
										file.writeLine("SimSoft Background Config")
										file.writeLine("")
										file.writeLine("false")
										file.close()
										
										Settings_2_ANZEIGE()
										
									else
										
										local file = fs.open("SimSoft/Data/BackgroundConfig", "w")
										file.writeLine("SimSoft Background Config")
										file.writeLine("")
										file.writeLine("true")
										file.close()
										
										Settings_2_ANZEIGE()
										
									end
									
								end
								
								if x >= 10 and x <= 12 and y == 14 then
									
									if IsPass == true or IsPass == "true" then
										
										local file = fs.open("SimSoft/Data/UserData", "w")
										file.writeLine("SimSoft System Version")
										file.writeLine("")
										file.writeLine(OName)
										file.writeLine(OPass)
										file.writeLine("false")
										file.close()
										
										Settings_2_ANZEIGE()
										
									else
										
										local file = fs.open("SimSoft/Data/UserData", "w")
										file.writeLine("SimSoft System Version")
										file.writeLine("")
										file.writeLine(OName)
										file.writeLine(OPass)
										file.writeLine("true")
										file.close()
										
										Settings_2_ANZEIGE()
										
									end
									
								end
								
								if x >= (w-11) and x <= (w-1) and y >= (h-3) and y <= (h-1) then
									
									break
									
								end
							
							end
						end
						
						break
						
					end
					
					if x >= (w-12) and x <= (w-2) and y == 9 then -- SystemInfo
						
						SystemInfoANZEIGE()
						
						while true do
							event, side, x, y = os.pullEvent()
							if event == "mouse_click" then
							
								
								if x >= (w-11) and x <= (w-1) and y >= (h-3) and y <= (h-1) then
									
									break
									
								end
							
							end
						end
						
						break
						
					end
					
					if x >= (w-10) and x <= (w-2) and y == 10 then -- AppStore
						
						shell.run("SimSoft/System/AppStore")
						break
						
					end
					
					if x >= (w-6) and x <= (w-2) and y == 11 then
						
						BC(32768)
						TC(1)
						Clear()
						print("Use 'exit' to return")
						shell.run("shell")
						break
						
					end
					
					if x >= (w-7) and x <= (w-2) and y == 12 then
						
						shell.run("SimSoft/System/Update")
						break
						
					end
					
					if x >= (w-7) and x <= (w-2) and y == 13 then
						
						os.reboot()
						
					end
					
					if x >= (w-9) and x <= (w-2) and y == 14 then
					
						os.shutdown()
					
					end
					
					if not (x >= (w-17) and x <= w and y >= 1 and y <= h) then
						break
					end
				
				end
			end
				
			DeskEXIT = true
			
		end
		
		if x >= 4 and x <= 12 and y >= 2 and y <= (h-3) and not (DeskEXIT == true) then
			
			if side == 1 then
			
				if not (((y-1)+seitenCfest) > AppC) then
					
					GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-1)]
					
					shell.run(GoForProgram)
					
					DeskEXIT = true
			
				end
			end
			
			if side == 2 then
			
				if not (((y-1)+seitenCfest) > AppC) then
					
					LeftAppANZEIGE(x,y)
					
					while true do
						event, side, xS, yS = os.pullEvent()
						if event == "mouse_click" then
							
							if openUnten == "unten" then
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y+2) then
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-1)]
					
									shell.run(GoForProgram)
									
									break
									
								end
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y+3) then
									
									BC(256)
									TC(1)
									CP((x+1),(y+3))
									print("             ")
									CP((x+1),(y+3))
									runWitchArg = read()
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-1)]
					
									shell.run(GoForProgram.." "..runWitchArg)
									
									break
									
								end
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y+4) then
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-2)]
									
									fs.delete(GoForProgram)
									
									break
									
								end
								
								if not (xS >= x and xS <= (x+14) and yS >= y and yS <= (y+5)) then
									
									break
										
								end
								
							end
							
							if openUnten == "oben" then
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y-2) then
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-1)]
					
									shell.run(GoForProgram)
									
									break
									
								end
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y-3) then
									
									BC(256)
									TC(1)
									CP((x+1),(y-3))
									print("             ")
									CP((x+1),(y-3))
									runWitchArg = read()
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-1)]
					
									shell.run(GoForProgram.." "..runWitchArg)
									
									break
									
								end
								
								if xS >= (x+1) and xS <= (x+13) and yS == (y-4) then
									
									GoForProgram = AppListe[((((y-1)+seitenCfest)*3)-2)]
									
									fs.delete(GoForProgram)
									
									break
									
								end
								
								if not (xS >= x and xS <= (x+14) and yS >= y and yS <= (y-5)) then
									
									break
										
								end
								
							end
							
						end
						
					end
					
					DeskEXIT = true
					
				end
			end
			
		end
		
		if x == 3 and y == (h-1) and not (DeskEXIT == true) then
			
			
			if MAXseiten == 1 then
				festSeite = festSeite
			elseif festSeite == 1 then
				festSeite = MAXseiten
			else
				festSeite = (festSeite-1)
			end
			
			SideBarANZEIGE(festSeite)
			
		end
		
		if x == 13 and y == (h-1) and not (DeskEXIT == true) then
			
			if MAXseiten == 1 then
				festSeite = festSeite
			elseif festSeite == MAXseiten then
				festSeite = 1
			else
				festSeite = (festSeite+1)
			end
			
			SideBarANZEIGE(festSeite)
			
		end
		
		if DeskEXIT == true then
			break
		end
		
	end
end

shell.run("SimSoft/System/Desktop")







--end