Index: trunk/MagicSoft/Mars/datacenter/db/menu.js
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/menu.js	(revision 8475)
+++ trunk/MagicSoft/Mars/datacenter/db/menu.js	(revision 8476)
@@ -4,19 +4,33 @@
 statarr = new Array( 1, 0, 0, 0, 0, 0, 0, 0, 0, 0);
 
+//function to get the input for fShowHide from the page
+//called each time, when an element is changed with showhide()
+//and when the page is reloaded
 function setdisplays ()
 {
-    var blub="";
+    //reset variable for fShowHide
+    var sh="";
     for (var i = 0 ; i < ids.length ; i++)
     {
+        //get element for each possible menu element
         var d = document.getElementById(ids[i]);
+        //if element exists, check if it is currently displayed
+        //set the value in the status array accordingly
+        //0: element is not shown
+        //1: element is shown
         if (d)
             d.style.display == 'none' ? statarr[i]=0 : statarr[i]=1;
+        //set the value of 'all' to 0
+        //to make sure, that the whole menu is hidden in case of a query
         if (i==0)
             statarr[i]=0;
-        blub=blub+statarr[i];
-    }
-    return blub;
-}
-
+        //add value to the variable for fShowHide
+        sh=sh+statarr[i];
+    }
+    //return variable for fShowHide
+    return sh;
+}
+
+//function to hide one element of the menu and adapt the button accordingly
 function hide(el,img)
 {
@@ -29,4 +43,5 @@
 }
 
+//function to show one element of the menu and adapt the button accordingly
 function show(el,img)
 {
@@ -39,8 +54,11 @@
 }
 
+//function to show or hide one element of the menu
 function showhide (id)
 {
+    //get menu element and button for the element that has to be changed
     var el = document.getElementById(id);
     var img = document.getElementById(id+"button");
+    //query current status and change it accordingly
     if (el.style.display == 'block')
         hide(el,img);
@@ -48,4 +66,5 @@
     {
         show(el,img);
+        //expand the whole menu, when one element is shown
         if (id!="showquery")
         {
@@ -55,37 +74,62 @@
         }
     }
-
-    var soso = document.getElementById("sh");
-    soso.value = setdisplays();
-}
-
+    //update the value of fShowHide (id sh)
+    var fShowHide = document.getElementById("sh");
+    fShowHide.value = setdisplays();
+}
+
+//function getting the info, how the menu is from fShowHide
+//is called when the page is loaded (s. index-header.html)
 function getdisplay()
 {
+    //get value of fShowHide
     var stat = document.getElementById("sh");
     statvalue=stat.value;
+    //set menu variables for each element accordingly
     for (var i = 0 ; i < ids.length ; i++)
     {
+        //get value of this element from fShowHide
         var status = statvalue.slice(i,i+1);
+        //get elements of menu and button
         var el = document.getElementById(ids[i]);
         var img = document.getElementById(ids[i]+"button");
+        //not all element exist on each page
         if (!el)
             continue;
+        //show or hide element according to the status value
         status==0 ? hide(el,img) : show(el,img);
     }
-}
-
-//functions and arrays needed for the function for plotdb.php
+    //set the value of fShowHide (id sh)
+    // needed here to make sure, that the whole menu is hidden
+    //  even if nothing has been expanded (needed since 'ranges'
+    //  is expanded by default)
+    var fShowHide = document.getElementById("sh");
+    fShowHide.value = setdisplays();
+}
+
+
+//functions and arrays needed for the menu of plotdb.php
 primaries = new Array( "fSequenceFirst", "fRunNumber", "fDataSetNumber");
 
+//for each primary (run#, seq#, dataset#) two pulldowns exist
+//the first is needed when plotting versus primary ('prim' is chosen)
+//the second is only needed when plotting versus a second value ('val' is chosen)
+
+//shows the first pulldown for a given primary
+// and hides the ones of the other primaries
+// and hides the second one for the primary if needed
+//is called when a primary is chosen from the pulldown
 function showpulldown (id2)
 {
-    var el = document.getElementById(id2);
-    el.style.display="inline";
+    //loop over primaries
     for (var i = 0 ; i < primaries.length ; i++)
     {
+        //if primary is given id
         if (primaries[i]==id2)
         {
+            //show first pulldown
             var el2 = document.getElementById(primaries[i]);
             el2.style.display="inline";
+            //show pulldowns for limits
             var el4 = document.getElementById(primaries[i]+"3");
             el4.style.display="inline";
@@ -95,10 +139,19 @@
         else
         {
+            //hide first pulldown
             var el2 = document.getElementById(primaries[i]);
             el2.style.display="none";
+            //get element for second pulldown
             var el3 = document.getElementById(primaries[i]+"2");
+            //if second pulldown is shown,
+            // hide second pulldown
+            // and show second pulldown for chosen primary (id2)
             if (el3.style.display=='inline')
-                var add=id2;
-            el3.style.display="none";
+            {
+                var el6 = document.getElementById(id2+"2");
+                el6.style.display="inline";
+                el3.style.display="none";
+            }
+            //hide pulldowns for limits
             var el4 = document.getElementById(primaries[i]+"3");
             el4.style.display="none";
@@ -107,11 +160,7 @@
         }
     }
-    if (add)
-    {
-        var el5 = document.getElementById(id2+"2");
-        el5.style.display="inline";
-    }
-}
-
+}
+
+//shows the second pulldown and inputs for the ranges
 function showpulldown2 ()
 {
@@ -119,5 +168,7 @@
     for (var i = 0 ; i < primaries.length ; i++)
     {
+        //get element
         var el = document.getElementById(primaries[i]);
+        //if the first pulldown is shown, show also the second one
         if (el.style.display=='inline')
         {
@@ -128,4 +179,6 @@
             count++;
     }
+    //if no first pulldown is shown, i.e. the primary has not yet been chosen,
+    //all second pulldowns are shown
     if (count==3)
         for (var i = 0 ; i < primaries.length ; i++)
@@ -135,8 +188,11 @@
         }
 
+    //show the inputs for the ranges for the second pulldown
+    //there is only one element for this (not one for each primary)
     var el3 = document.getElementById("Range2");
     el3.style.display="inline";
 }
 
+//hides the second pulldown and inputs for the ranges
 function hidepulldown2 ()
 {
@@ -150,4 +206,5 @@
 }
 
+//show the element for inserting the second set
 function showset2()
 {
@@ -156,4 +213,5 @@
 }
 
+//hide the element for inserting the second set
 function hideset2()
 {
Index: trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php	(revision 8475)
+++ trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php	(revision 8476)
@@ -283,13 +283,13 @@
             printf("%s", $_GET["fShowHide"]);
         else
-            printf("1000000000");
+            printf("1000000010");
         printf("'>\n");
         printf("<img id='allbutton' src='minus.png' alt='-' onclick='showhide(\"all\")'> <b>Menu</b>&nbsp;&nbsp;&nbsp;&nbsp; \n");
-        printf("&nbsp;&nbsp;<img id='infobutton'   src='plus.png' alt='+' onClick='showhide(\"info\");showhide(\"info2\")'> SequInfo   \n");
-        printf("&nbsp;&nbsp;<img id='statbutton'   src='plus.png' alt='+' onClick='showhide(\"stat\");showhide(\"fail\")'>  StatusInfo \n");
-        printf("&nbsp;&nbsp;<img id='calbutton'    src='plus.png' alt='+' onClick='showhide(\"cal\")'>                      CalInfo    \n");
-        printf("&nbsp;&nbsp;<img id='starbutton'   src='plus.png' alt='+' onClick='showhide(\"star\")'>                     StarInfo   \n");
-        printf("&nbsp;&nbsp;<img id='limitsbutton' src='plus.png' alt='+' onClick='showhide(\"limits\")'>                   Limits     \n");
-        printf("&nbsp;&nbsp;<img id='rangesbutton' src='plus.png' alt='+' onClick='showhide(\"ranges\")'>                   Ranges     \n");
+        printf("&nbsp;&nbsp;<img id='infobutton'   src='plus.png'  alt='+' onClick='showhide(\"info\");showhide(\"info2\")'> SequInfo   \n");
+        printf("&nbsp;&nbsp;<img id='statbutton'   src='plus.png'  alt='+' onClick='showhide(\"stat\");showhide(\"fail\")'>  StatusInfo \n");
+        printf("&nbsp;&nbsp;<img id='calbutton'    src='plus.png'  alt='+' onClick='showhide(\"cal\")'>                      CalInfo    \n");
+        printf("&nbsp;&nbsp;<img id='starbutton'   src='plus.png'  alt='+' onClick='showhide(\"star\")'>                     StarInfo   \n");
+        printf("&nbsp;&nbsp;<img id='limitsbutton' src='plus.png'  alt='+' onClick='showhide(\"limits\")'>                   Limits     \n");
+        printf("&nbsp;&nbsp;<img id='rangesbutton' src='minus.png' alt='-' onClick='showhide(\"ranges\")'>                   Ranges     \n");
 
         printf(" <div id='all' style='display:block'>");
@@ -303,5 +303,5 @@
         PrintLimitsMenu($limitsmean, $limitsmin, $limitsmax, $alias, "");
 
-        printf(" <div id='ranges' style='display:none'>");
+        printf(" <div id='ranges' style='display:block'>");
         PrintZdRangeMenu($host,$user,$pw,$db);
         PrintSequRangeMenu($host,$user,$pw,$db);
