Index: code/branches/menu/data/gui/scripts/AudioMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/AudioMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/AudioMenu.lua	(revision 7687)
@@ -2,4 +2,11 @@
 
 local P = createMenuSheet("AudioMenu")
+
+P.buttonList = {}
+
+function P.onShow()
+    P.oldindex = -2
+    P.index = -1
+end
 
 function P.onLoad()
@@ -42,4 +49,10 @@
         listboxwindow:setItemSelectState(0,true)
     end
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/AudioBackButton"),
+            ["function"]  = P.AudioBackButton_clicked
+    }
+    P.buttonList[1] = item
 end
 
@@ -172,4 +185,8 @@
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 1, 1)
+end
+
 return P
 
Index: code/branches/menu/data/gui/scripts/ControlsMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/ControlsMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/ControlsMenu.lua	(revision 7687)
@@ -2,5 +2,36 @@
 
 local P = createMenuSheet("ControlsMenu")
+P.buttonList = {}
 P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" }
+
+function P.onLoad()
+    P.multiplayerMode = "startClient" 
+
+    --buttons are arranged in a 3x1 matrix:
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"),
+            ["function"]  = P.ControlsMouseControlsButton_clicked
+    }
+    P.buttonList[1] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"),
+            ["function"]  = P.ControlsKeyboardControlsButton_clicked
+    }
+    P.buttonList[2] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"),
+            ["function"]  = P.ControlsBackButton_clicked
+    }
+    P.buttonList[3] = item
+
+end
+
+function P.onShow()
+    --indices to iterate through buttonlist
+    P.oldindex = -2
+    P.index = -1
+end
 
 function P.ControlsMouseControlsButton_clicked(e)
@@ -16,4 +47,8 @@
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 3, 1)
+end
+
 return P
 
Index: code/branches/menu/data/gui/scripts/CreditsMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/CreditsMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/CreditsMenu.lua	(revision 7687)
@@ -14,4 +14,5 @@
 
 function P.onShow()
+    --indices to iterate through buttonlist
     P.oldindex = -2
     P.index = -1
Index: code/branches/menu/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/menu/data/gui/scripts/GUITools.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/GUITools.lua	(revision 7687)
@@ -55,13 +55,17 @@
 end
 
+--function to iterate through a menu sheet by using arrowkeys
 
 --@arguments:
 --  list: 2-dimensional table, arguments are items that contain a button and its function
+--        !!note: each button can only be in the list once!!
 --  code: code of any key on the keyboard
 --  P: menusheet
---  n: number of rows
---  m: number of colums
+--  n: number of rows of the buttontable
+--  m: number of colums of the buttontable
 
 function buttonIteratorHelper(list, code, P, n, m)
+
+    --after a key (down,up,left,right) is pressed the index of the current button has to be updated    
 
     --key down
@@ -72,7 +76,7 @@
         else
             P.oldindex = P.index
-            P.index = (P.index + m) % (m*n)
-
-            while list[P.index+1] == nil do
+            P.index = (P.index + m) % (m*n)     --modulo operation works as a "wrap around" in the button menu
+                                                
+            while list[P.index+1] == nil do     
                 P.oldindex = P.index
                 P.index = (P.index + m) % (m*n)
@@ -98,5 +102,4 @@
 
             while list[P.index+1] == nil do
-                cout(0,P.index)
                 P.oldindex = P.index
                 P.index = (P.index-m)%(m*n)
@@ -162,4 +165,5 @@
     end
        
+    --to update the new current button
     if (code == "208" or code == "200" or code == "203" or code == "205") and P.oldindex~= P.index then
 
@@ -171,5 +175,4 @@
 
         --teste ob der Button nicht schon gehighlightet ist
-        cout(0,child:getProperty("NormalImageRightEdge"))
         if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then
             --nop
@@ -189,4 +192,5 @@
         end
 
+        --for every highlighted button check if index is on its position. If not, set imageproperty on "normal"
         local i = 1
         while i < (n*m) do
@@ -220,9 +224,8 @@
     end
 
-    cout(0, P.oldindex)
-    cout(0, P.index)
-
-end
-
+end
+
+--write index and oldindex on the console
+--works like buttonIteratorHelper
 function indexTester(list,code,P,n,m)
     --key down
Index: code/branches/menu/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/GraphicsMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/GraphicsMenu.lua	(revision 7687)
@@ -2,4 +2,12 @@
 
 local P = createMenuSheet("GraphicsMenu")
+
+P.buttonList = {}
+
+function P.onShow()
+    --indices to iterate through buttonlist (trivial in this menu sheet)
+    P.oldindex = -2
+    P.index = -1
+end
 
 function P.onLoad()
@@ -83,4 +91,10 @@
     scrollbar_active = false
     block = false
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"),
+            ["function"]  = P.GraphicsBackButton_clicked
+    }
+    P.buttonList[1] = item
 end
 
@@ -195,4 +209,8 @@
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 1, 1)
+end
+
 return P
 
Index: code/branches/menu/data/gui/scripts/HostMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/HostMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/HostMenu.lua	(revision 7687)
@@ -4,4 +4,22 @@
 
 P.multiplayerMode = "startServer"
+
+P.buttonList = {}
+
+function P.onLoad()
+    P.multiplayerMode = "startClient" 
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"),
+            ["function"]  = P.HostMenuStartButton_clicked
+    }
+    P.buttonList[1] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"),
+            ["function"]  = P.HostMenuBackButton_clicked
+    }
+    P.buttonList[2] = item
+end
 
 function P.onShow()
@@ -19,4 +37,7 @@
         P.showLevelList()
     end
+
+    P.oldindex = -2
+    P.index = -1
 
 end
@@ -80,4 +101,9 @@
 
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
+end
+
+
 
 return P
Index: code/branches/menu/data/gui/scripts/MainMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/MainMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/MainMenu.lua	(revision 7687)
@@ -6,8 +6,6 @@
 P.buttonList = {}
 
-P.testArray = {}
-
-
 function P.onLoad()
+    --buttons are arranged in a 6x1 Matrix (list)
     local item = {
             ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"),
@@ -48,4 +46,5 @@
 
 function P.onShow()
+    --indices to iterate through buttonlist
     P.oldindex = -2
     P.index = -1
@@ -78,40 +77,6 @@
 end
 
-
---[[
-list = {}
-local item =
-{
-    ["button"] = buttonWindow,
-    ["function"]  = buttonFunction,
-}
-table.insert(list, item)
-item = list[i]
-
-for i,item in pairs(list) do
-    button = item["button"]
-end
-
---]]
---[[
-function createList()
-    list = {}
-
-    local j 
-    while j < P.loadAlong 
-        local item =
-        {
-            ["button"] = buttonWindow,
-            ["function"]  = buttonFunction,
-        }
-        table.insert(list, item)
-    end
-
---]]
-
 function P.onKeyPressed() 
-    cout(0,code)
     buttonIteratorHelper(P.buttonList, code, P, 6, 1)
-    --indexTester(P.buttonList,code,P,6,1)
 end
 
Index: code/branches/menu/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/MultiplayerMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/MultiplayerMenu.lua	(revision 7687)
@@ -8,7 +8,8 @@
     P.multiplayerMode = "startClient" 
 
+    --button are arranged in a 2x2 matrix, the left lower item is nil
     local item = {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton2"),
-            ["function"]  = P.MultiplayerJoinButton_clicked
+            ["function"]  = P.MultiplayerJoinButton2_clicked
     }
     P.buttonList[1] = item
@@ -16,5 +17,5 @@
     local item = {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton2"),
-            ["function"]  = P.MultiplayerHostButton_clicked
+            ["function"]  = P.MultiplayerHostButton2_clicked
     }
     P.buttonList[2] = item
@@ -30,4 +31,6 @@
 function P.onShow()
     P.showServerList()
+
+    --indices to iterate through buttonlist
     P.oldindex = -2
     P.index = -1
@@ -133,7 +136,5 @@
 
 function P.onKeyPressed() 
-    cout(0,code)
     buttonIteratorHelper(P.buttonList, code, P, 2, 2)
-    --indexTester(P.buttonList,code,P,2,3)
 end
 
Index: code/branches/menu/data/gui/scripts/SettingsMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/SettingsMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/SettingsMenu.lua	(revision 7687)
@@ -8,5 +8,5 @@
 function P.onLoad()
     --"Gameplay" and "Multiplayer Options" are not integrated in the list
-    
+    --buttons are arranged in a 4x2 matrix. The lower-right element is not in the matrix!
     local item = {
             ["button"] = winMgr:getWindow("orxonox/SettingsMenu/GraphicsButton"),
@@ -43,4 +43,5 @@
 
 function P.onShow()
+    --indices to iterate through buttonlist
     P.oldindex = 3
     P.index = 2
@@ -76,7 +77,5 @@
 
 function P.onKeyPressed() 
-    cout(0,code)
     buttonIteratorHelper(P.buttonList, code, P, 4, 2)
-    --indexTester(P.buttonList,code,P,4,2)
 end
 
Index: code/branches/menu/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/SingleplayerMenu.lua	(revision 7686)
+++ code/branches/menu/data/gui/scripts/SingleplayerMenu.lua	(revision 7687)
@@ -2,4 +2,6 @@
 
 local P = createMenuSheet("SingleplayerMenu")
+
+P.buttonList = {}
 
 function P.onLoad()
@@ -28,4 +30,23 @@
     end
 
+    --buttons are arranged in a 1x2 matrix
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
+            ["function"]  = P.SingleplayerStartButton_clicked
+    }
+    P.buttonList[1] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
+            ["function"]  = P.SingleplayerBackButton_clicked
+    }
+    P.buttonList[2] = item
+
+end
+
+function P.onShow()
+    --indices to iterate through buttonlist
+    P.oldindex = -2
+    P.index = -1
 end
 
@@ -43,4 +64,8 @@
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
+end
+
 return P
 
