Index: /trunk/www/db_po/get_date.php
===================================================================
--- /trunk/www/db_po/get_date.php	(revision 11598)
+++ /trunk/www/db_po/get_date.php	(revision 11599)
@@ -21,4 +21,6 @@
     if (empty($_GET["fDateValuePrev"]))
         $_GET["fDateValuePrev"]="";
+    if (empty($_GET["fStatusDate"]))
+        $_GET["fStatusDate"]="";
 
     include("db.php");
@@ -43,5 +45,5 @@
     if (strcmp("month",$_GET["fDateName"])==0)
     {
-        $identifier1="Y";
+        $identifier1="%Y";
         $identifier2="m";
         $newdatename="day";
@@ -49,5 +51,5 @@
     if (strcmp("day",$_GET["fDateName"])==0)
     {
-        $identifier1="m";
+        $identifier1="%Y-%m";
         $identifier2="d";
         $newdatename="hour";
@@ -55,5 +57,5 @@
     if (strcmp("hour",$_GET["fDateName"])==0)
     {
-        $identifier1="d";
+        $identifier1="%Y-%m-%d";
         $identifier2="H";
         $newdatename="min";
@@ -61,5 +63,5 @@
     if (strcmp("min",$_GET["fDateName"])==0)
     {
-        $identifier1="H";
+        $identifier1="%Y-%m-%d %H";
         $identifier2="i";
         $newdatename="sec";
@@ -67,5 +69,5 @@
     if (strcmp("sec",$_GET["fDateName"])==0)
     {
-        $identifier1="i";
+        $identifier1="%Y-%m-%d %H:%i";
         $identifier2="s";
         $newdatename="";
@@ -80,26 +82,16 @@
             $query0.=" WHERE NOT fValidFrom='0000-00-00 00:00:00' ";
         else
-            $query0.=" WHERE Date_Format(fValidFrom, '%". $identifier1."')=".$_GET["fDateValuePrev"];
+            $query0.=" WHERE Date_Format(fValidFrom, '". $identifier1."')='".$_GET["fStatusDate"]."'";
+            //$query0.=" WHERE Date_Format(fValidFrom, '%". $identifier1."')=".$_GET["fDateValuePrev"];
         $query0.=" GROUP BY valid";
         $result0=mysql_query($query0, $db_id);
     }
-    //echo $_GET["fDateValuePrev"];
+    //echo $query0;
 
-    //echo $query0;
     if (empty($newdatename))
         printf("<select id='%s%d'>\n", $_GET["fDateName"], $_GET["fIdx"]);
     else
-    {
-        //if (empty($identifier1))
-        //{
-            printf("<select id='%s%d' onchange=\"get_dates('%s', this.value, this.value, %d, 'yes')\">\n",
-                   $_GET["fDateName"], $_GET["fIdx"], $newdatename, $_GET["fIdx"]);
-        //}
-        //else
-        //{
-        //    printf("<select id='%s%d' onchange=\"get_dates('%s', this.value, '%s', %d, 'yes')\">\n",
-        //           $_GET["fDateName"], $_GET["fIdx"], $newdatename, $_GET["fDateValuePrev"], $_GET["fIdx"]);
-        //}
-    }
+        printf("<select id='%s%d' onchange=\"get_dates('%s', this.value, this.value, %d, 'yes')\">\n",
+               $_GET["fDateName"], $_GET["fIdx"], $newdatename, $_GET["fIdx"]);
     if (strcmp($_GET["fDateValue"],"empty")!=0)
         printf("<option value='empty'>%s</option>\n", $_GET["fDateName"]);
Index: /trunk/www/db_po/get_keys.php
===================================================================
--- /trunk/www/db_po/get_keys.php	(revision 11598)
+++ /trunk/www/db_po/get_keys.php	(revision 11599)
@@ -41,8 +41,14 @@
     if (strcmp($_GET["fMode"], "edit")==0)
         printf("select key: <br>\n");
+//    else
+//        printf("select key: \n");
+
+    if (strcmp($_GET["fMode"], "view")==0)//reload tables in case of mode 'view'
+        printf("<select style='width:200px' id='key' size='%s' onchange='get_values(1,\"%s\",this.value,\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n",
+               $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
     else
-        printf("select key: \n");
-    printf("<select style='width:200px' id='key' size='%s' onchange=\"get_values(1,'%s',this.value,'%s')\"class='Width'>\n",
-           $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
+        printf("<select style='width:200px' id='key' size='%s' onchange=\"get_values(1,'%s',this.value,'%s')\" class='Width'>\n",
+               $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
+
     if (!empty($_GET["fKey"]) && strcmp("all", $_GET["fKey"])==0)
         printf("<option value='all' selected> --- all keys --- </option>\n");
@@ -54,7 +60,7 @@
         else
             printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
-    printf("</select>\n<br>\n");
+    printf("</select>\n");
     if (strcmp($_GET["fMode"], "edit")==0)
-        printf("<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
+        printf("<br>\n<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
     mysql_free_result($result0);
 
Index: /trunk/www/db_po/get_progs.php
===================================================================
--- /trunk/www/db_po/get_progs.php	(revision 11598)
+++ /trunk/www/db_po/get_progs.php	(revision 11599)
@@ -33,8 +33,14 @@
     if (strcmp($_GET["fMode"], "edit")==0)
         printf("select program: <br>\n");
+//    else
+//        printf("select program: \n");
+
+    if (strcmp($_GET["fMode"], "view")==0)//reload tables in case of mode 'view'
+        printf("<select style='width: 120px' id='prog' size='%s' onchange='get_keys(this.value,\"\",\"%s\",\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n",
+               $_GET["fSelectSize"], $_GET["fSelectSize"], $_GET["fMode"]);
     else
-        printf("select program: \n");
-    printf("<select style='width: 120px' id='prog' size='%s' onchange=\"get_keys(this.value,'','%s','%s')\" class='Width'>\n",
-           $_GET["fSelectSize"], $_GET["fSelectSize"], $_GET["fMode"]);
+        printf("<select style='width: 120px' id='prog' size='%s' onchange=\"get_keys(this.value,'','%s','%s')\" class='Width'>\n",
+               $_GET["fSelectSize"], $_GET["fSelectSize"], $_GET["fMode"]);
+
     if (!empty($_GET["fProgram"]) && strcmp("all", $_GET["fProgram"])==0)
         printf("<option value='all' selected> --- all programs --- </option>\n");
@@ -46,7 +52,7 @@
         else
             printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
-    printf("</select>\n<br>\n");
+    printf("</select>\n");
     if (strcmp($_GET["fMode"], "edit")==0)
-        printf("<button onClick='addRow(1,\"\",\"\",\"\",\"\",\"\");' id='addrowprog' style='display:inline'>Add Prg/Key</button>\n");
+        printf("<br>\n<button onClick='addRow(1,\"\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowprog' style='display:inline'>Add Prg/Key</button>\n");
     mysql_free_result($result0);
 
Index: /trunk/www/db_po/get_values.php
===================================================================
--- /trunk/www/db_po/get_values.php	(revision 11598)
+++ /trunk/www/db_po/get_values.php	(revision 11599)
@@ -45,5 +45,5 @@
 
     //get key1 and key2 separately from DB (for function AddRow())
-    $query2 = "SELECT fKey1, SUBSTRING(fKey2,2), fType FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."'";
+    $query2 = "SELECT fKey1, SUBSTRING(fKey2,2), fType, fMin, fMax FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."'";
     $result2=mysql_query($query2, $db_id);
     $row2 = mysql_fetch_row($result2);
@@ -51,7 +51,11 @@
     $key2=$row2[1];
     $type=$row2[2];
+    $min=$row2[3];
+    $max=$row2[4];
     mysql_free_result($result2);
 
-    $query0 ="SELECT fIndex, fValidFrom, fProgram, Concat(fKey1,fKey2), fValue, fDescription, fCounter, fType, fMin, fMax, fKey1, SUBSTRING(fKey2,2), if(fOriginalIndex=0, fIndex, fOriginalIndex) FROM ProgramOption ";
+    $query0 ="SELECT fIndex, fValidFrom, fProgram, Concat(fKey1,fKey2), fValue, ";
+    $query0.="fDescription, fCounter, fType, fMin, fMax, fKey1, SUBSTRING(fKey2,2), ";
+    $query0.="if(fOriginalIndex=0, fIndex, fOriginalIndex), fUser FROM ProgramOption ";
     $query0.="WHERE 1=1 ";
     if (strcmp($_GET["fKey"],"all")!=0)
@@ -74,11 +78,17 @@
         printf("<button onClick='ShowCurrent();' id='showcurrent' style='display:none'>Show Current</button>\n");
         printf("<button onClick='ShowAll();' id='showall' style='display:inline'>Show History</button>\n");
-        printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
-               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type);
+        printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
+               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
     }
-    printf("<table font-size='-1' border='1' width='100px' height='100px'><tbody id='valtable%s'>\n", $_GET["fGetValCase"]);
+
+    if ($_GET["fGetValCase"]==1)//show only in edit mode
+        $generalshowhide='';
+    else
+        $generalshowhide='none';
+
+    printf("<table font-size='-1' border='0' cellspacing='5px' width='100%%'><tbody id='valtable%s'>\n", $_GET["fGetValCase"]);
     printf("<tr>");
-    printf("<th>Index / Orig / Counter</th>\n");
-    printf("<th>Valid since</th>\n");
+    printf("<th class='indices%d' style='display:%s'>Idx/Orig/Ctr</th>\n",$_GET["fGetValCase"], $generalshowhide);
+    printf("<th class='validsince%d' style='display:%s'>Valid since</th>\n", $_GET["fGetValCase"], $generalshowhide);
     printf("<th>Program</th>\n");
     //printf("<th>Key</th>\n");
@@ -87,12 +97,10 @@
     printf("<th>Value</th>\n");
     printf("<th>Type</th>\n");
-    if ($_GET["fGetValCase"]==1)//show only in edit mode
-        printf("<th class='description%d'>Description</th>\n", $_GET["fGetValCase"]);
-    else
-        printf("<th class='description%d' style='display:none'>Description</th>\n", $_GET["fGetValCase"]);
+    printf("<th class='minimum%d' style='display:%s'>Min</th>\n", $_GET["fGetValCase"], $generalshowhide);
+    printf("<th class='maximum%d' style='display:%s'>Max</th>\n", $_GET["fGetValCase"], $generalshowhide);
+    printf("<th class='description%d' style='display:%s'>Description</th>\n", $_GET["fGetValCase"], $generalshowhide);
     if ($_GET["fGetValCase"]==1)//show only in edit mode
         printf("<th>Action</th>\n");
-    printf("<th>Min</th>\n");
-    printf("<th>Max</th>\n");
+    printf("<th class='user%d' style='display:%s'>User</th>\n", $_GET["fGetValCase"], $generalshowhide);
     printf("</tr>\n");
     $maxindex=0;
@@ -103,27 +111,35 @@
             {
                 if ($row0[6]==$counter)
-                    printf("<tr id='new%s' style='display:'>\n", $row0[0]);
+                    printf("<tr id='new%s' style='display:' bgcolor='#E2E2E2'>\n", $row0[0]);
                 else
-                    printf("<tr id='old%s' style='display:none'>\n", $row0[0]);
+                    printf("<tr id='old%s' style='display:none' bgcolor='#EBEBEB'>\n", $row0[0]);
             }
             else
-                printf("<tr id='%scompare%s' style='display:'>\n", $_GET["fGetValCase"], $row0[12]);
+                printf("<tr id='%scompare%s' style='display:' bgcolor='white'>\n", $_GET["fGetValCase"], $row0[12]);
 
-            printf("<td> %s / %s / %s <div id='%dorigindex%s' style='display:none'>%s</div> </td>\n",
-                   $row0[0], $row0[12], $row0[6], $_GET["fGetValCase"], $row0[0], $row0[12]);
+            printf("<td class='indices%d' style='display:%s'> %s / %s / %s <div id='%dorigindex%s' style='display:none'>%s</div> </td>\n",
+                   $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[12], $row0[6], $_GET["fGetValCase"], $row0[0], $row0[12]);
+            //valid from
             if (strcmp('0000-00-00 00:00:00', $row0[1])==0)
-                printf("<td id='notyetvalid%s'> %s </td>\n", $row0[0], $row0[1]);
+                printf("<td class='validsince%d' style='display:%s' id='notyetvalid%s'> %s </td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[1]);
             else
-                printf("<td> %s </td>\n", $row0[1]);
+                printf("<td class='validsince%d' style='display:%s'> %s </td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[1]);
+            //program
             printf("<td id='prog%s'>%s</td>\n", $row0[0], $row0[2]);
+            //keys
             //printf("<td id='key%s'>%s</td>\n", $row0[0], $row0[3]);
             printf("<td id='1key%s'>%s</td>\n", $row0[0], $row0[10]);
             printf("<td id='2key%s'>%s</td>\n", $row0[0], $row0[11]);
+            //value
             printf("<td align='right' id='val%s'>%s</td>\n", $row0[0], $row0[4]);
+            //type
             printf("<td id='type%s'>%s</td>\n", $row0[0], $row0[7]);
-            if ($_GET["fGetValCase"]==1)//show only in edit mode
-                printf("<td class='description%d' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $row0[0], $row0[5]);
-            else
-                printf("<td class='description%d' style='display:none' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $row0[0], $row0[5]);
+            //min
+            printf("<td class='minimum%d' style='display:%s' id='min%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[8]);
+            //max
+            printf("<td class='maximum%d' style='display:%s' id='max%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[9]);
+            //descripton
+            printf("<td class='description%d' style='display:%s' id='descr%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[5]);
+            //action
             if ($_GET["fGetValCase"]==1)//show only in edit mode
             {
@@ -133,6 +149,6 @@
                     printf("<td id='action%s'></td>\n", $row0[0]);
             }
-            printf("<td id='min%s'>%s</td>\n", $row0[0], $row0[8]);
-            printf("<td id='max%s'>%s</td>\n", $row0[0], $row0[9]);
+            //user
+            printf("<td class='user%d' style='display:%s' id='user%s'>%s</td>\n", $_GET["fGetValCase"], $generalshowhide, $row0[0], $row0[13]);
             printf("</tr>\n");
             if ($row0[0]>$maxindex)
@@ -144,12 +160,18 @@
         printf("<button onClick='ShowCurrent();' id='showcurrent2' style='display:none'>Show Current</button>\n");
         printf("<button onClick='ShowAll();' id='showall2' style='display:inline'>Show History</button>\n");
-        printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
-               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type);
+        printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
+               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
     }
+    /*
     else
     {
-        printf("<button onClick='HideDescription(%d);' id='hidedescr%d' style='display:none'>Hide Description</button>\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
-        printf("<button onClick='ShowDescription(%d);' id='showdescr%d' style='display:'>Show Description</button>\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
+        printf("Show:\n");
+        printf("<input type='checkbox' id='sh_indices%d' onclick='ShowHide(\"indices\", \"sh_indices\", %d);'>indices\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
+        printf("<input type='checkbox' id='sh_validsince%d' onclick='ShowHide(\"validsince\", \"sh_validsince\", %d);'>validsince\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
+        printf("<input type='checkbox' id='sh_descr%d' onclick='ShowHide(\"description\", \"sh_descr\", %d);'>description\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
+        printf("<input type='checkbox' id='sh_min%d' onclick='ShowHide(\"minimum\", \"sh_min\", %d);'>min\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
+        printf("<input type='checkbox' id='sh_max%d' onclick='ShowHide(\"maximum\", \"sh_max\", %d);'>max\n", $_GET["fGetValCase"], $_GET["fGetValCase"]);
     }
+    */
 
     if ($_GET["fGetValCase"]==3)
Index: /trunk/www/db_po/insert_po.php
===================================================================
--- /trunk/www/db_po/insert_po.php	(revision 11598)
+++ /trunk/www/db_po/insert_po.php	(revision 11599)
@@ -46,5 +46,15 @@
     if (empty($_GET["fOriginalIndex"]))
         $_GET["fOriginalIndex"]="";
-
+    if (empty($_GET["fMin"]))
+        $_GET["fMin"]="";
+    if (empty($_GET["fMax"]))
+        $_GET["fMax"]="";
+
+    if (empty($_SERVER['PHP_AUTH_USER']))
+    {
+        // be careful, this output is evaluated by UpdateRow() in po.js
+        echo "user empty";
+        return;
+    }
     include("db.php");
     $db_id = mysqli_connect($host, $user, $pw, $db);
@@ -142,4 +152,9 @@
         if (!empty($_GET["fOriginalIndex"]))
             $query0.=", fOriginalIndex='".$_GET["fOriginalIndex"]."'";
+        if (!empty($_GET["fMin"]))
+            $query0.=", fMin='".$_GET["fMin"]."'";
+        if (!empty($_GET["fMax"]))
+            $query0.=", fMax='".$_GET["fMax"]."'";
+        $query0.=", fUser='".$_SERVER['PHP_AUTH_USER']."'";
         $query0.=", fKey1='".$_GET["fKey1"]."'";
         $query0.=", fKey2='.".$_GET["fKey2"]."'";
Index: /trunk/www/db_po/po.js
===================================================================
--- /trunk/www/db_po/po.js	(revision 11598)
+++ /trunk/www/db_po/po.js	(revision 11599)
@@ -60,28 +60,11 @@
         min=document.getElementById('min'+getvalcase).value;
         sec=document.getElementById('sec'+getvalcase).value;
-        if (year=="empty")
-            statusdate="";
-        else
-        {
-            statusdate=year;
-            if (month!="empty")
-            {
-                statusdate=statusdate+"-"+month;
-                if (day!="empty")
-                {
-                    statusdate=statusdate+"-"+day;
-                    if (hour!="empty")
-                    {
-                        statusdate=statusdate+" "+hour;
-                        if (min!="empty")
-                        {
-                            statusdate=statusdate+":"+min;
-                            if (sec!="empty")
-                                statusdate=statusdate+":"+sec;
-                        }
-                    }
-                }
-            }
-        }
+
+        statusdate=(year =='empty'? '':year);
+        statusdate=statusdate+(month=='empty'? '':'-'+month);
+        statusdate=statusdate+(day  =='empty'? '':'-'+day);
+        statusdate=statusdate+(hour =='empty'? '':' '+hour);
+        statusdate=statusdate+(min  =='empty'? '':':'+min);
+        statusdate=statusdate+(sec  =='empty'? '':':'+sec);
     }
     if (val=="textinput")
@@ -93,4 +76,5 @@
 function get_values(getvalcase, prog, key, mode)
 {
+    //in this case the given 'prog' and 'key' are ignored
     if (parseInt(getvalcase)>1)
     {
@@ -113,12 +97,10 @@
                 key="all";
     }
-    if (mode=="view" && getvalcase==1)
-        return;
-    //if (getvalcase==3)
-    //    document.getElementById('comparevals').style.display = "";
+    //if (mode=="view" && getvalcase==1)
+    //    return;
+
     if ((getvalcase==2 || getvalcase==3) && document.getElementById('statusdate'+getvalcase))
     {
         statusdate=get_statusdate(getvalcase);
-        //alert(statusdate);
         phpcall="get_values.php?fStatusDate="+statusdate+"&fGetValCase="+getvalcase+"&fKey="+key+"&fProgram="+prog;
     }
@@ -137,5 +119,5 @@
 }
 
-function addRow(addcase, prog, key, key1, key2, type)
+function addRow(addcase, prog, key, key1, key2, type, min, max)
 {
     if (!prog)
@@ -161,7 +143,7 @@
     {
     case 1:
-        get_keys(prog,key,"10", "edit");
+        get_keys(prog, key, "10", "edit");
     case 2:
-        get_values(1, prog, key);
+        get_values(1, prog, key, "edit");
     }
 
@@ -180,4 +162,5 @@
     row=document.createElement("TR");
     row.id='val0';
+    row.bgColor='#C8C8C8';
     cell0 = document.createElement("TD");
     cell1 = document.createElement("TD");
@@ -196,18 +179,22 @@
     // 1: add new prog+key, val=NULL
     // 2: add new key, val=NULL, prog=selected
-    // 3: add new val, prog=selected, key=selected, type fixed
+    // 3: add new val, prog=selected, key=selected, type/min/max fixed
     switch(addcase)
     {
     case 1:
+        updcase=5;
         //field for prog
         input1 = document.createElement("INPUT");
+        input1.style.width = 80;
         input1.id = 'prog0';
         cell1.appendChild(input1);
         //fields for keys
         input2 = document.createElement("INPUT");
+        input2.style.width = 100;
         input2.id = '1key0';
         cell2.appendChild(input2);
         input10 = document.createElement("INPUT");
         input10.id = '2key0';
+        input10.style.width = 100;
         cell10.appendChild(input10);
         //field for val
@@ -215,5 +202,4 @@
         textnode3=document.createTextNode("NULL");
         cell3.appendChild(textnode3);
-        updcase=5;
         //field type
         select7 = document.createElement("select");
@@ -245,6 +231,17 @@
         select7.appendChild(option7e);
         cell7.appendChild(select7);
+        //field for min
+        input8 = document.createElement("INPUT");
+        input8.id = 'newmin0';
+        input8.style.width = 50;
+        cell8.appendChild(input8);
+        //field for max
+        input9 = document.createElement("INPUT");
+        input9.id = 'newmax0';
+        input9.style.width = 50;
+        cell9.appendChild(input9);
         break;
     case 2:
+        updcase=1;
         //field for prog
         cell1.id = 'prog0';
@@ -254,7 +251,9 @@
         input2 = document.createElement("INPUT");
         input2.id = '1key0';
+        input2.style.width = 100;
         cell2.appendChild(input2);
         input10 = document.createElement("INPUT");
         input10.id = '2key0';
+        input10.style.width = 100;
         cell10.appendChild(input10);
         //field for val
@@ -262,5 +261,4 @@
         textnode3=document.createTextNode("NULL");
         cell3.appendChild(textnode3);
-        updcase=1;
         //field type
         select7 = document.createElement("select");
@@ -292,6 +290,17 @@
         select7.appendChild(option7e);
         cell7.appendChild(select7);
+        //field for min
+        input8 = document.createElement("INPUT");
+        input8.id = 'newmin0';
+        input8.style.width = 50;
+        cell8.appendChild(input8);
+        //field for max
+        input9 = document.createElement("INPUT");
+        input9.id = 'newmax0';
+        input9.style.width = 50;
+        cell9.appendChild(input9);
         break;
     case 3:
+        updcase=2;
         //field for prog
         cell1.id = 'prog0';
@@ -307,11 +316,19 @@
         //field for val
         input3 = document.createElement("INPUT");
+        input3.style.width = 100;
         input3.id = 'newval0';
         cell3.appendChild(input3);
-        updcase=2;
         //field type
         cell7.id = 'type0';
         textnode7 = document.createTextNode(type);
         cell7.appendChild(textnode7);
+        //field min
+        cell8.id = 'min0';
+        textnode8 = document.createTextNode(min);
+        cell8.appendChild(textnode8);
+        //field max
+        cell9.id = 'max0';
+        textnode9 = document.createTextNode(max);
+        cell9.appendChild(textnode9);
         break;
     default:
@@ -321,4 +338,5 @@
     //field descr
     input4 = document.createElement("INPUT");
+    input4.style.width = 200;
     input4.id = 'newdescr0';
     cell4.appendChild(input4);
@@ -342,11 +360,12 @@
     row.appendChild(cell3);//value
     row.appendChild(cell7);//type
+    row.appendChild(cell8);//min
+    row.appendChild(cell9);//max
     row.appendChild(cell4);//descr
     row.appendChild(cell5);//action
-    row.appendChild(cell8);//min
-    row.appendChild(cell9);//max
     tabBody.appendChild(row);
 
-    // to be removed later when solution for adding multiple new rows is found
+    //disabeling all other edit/add buttons
+    // (to be removed later when solution for adding multiple new rows is found)
     document.getElementById('addrowvals').style.display = "none";
     document.getElementById('addrowvals2').style.display = "none";
@@ -369,7 +388,8 @@
     }
     //reload the original content in case of cancel
-    get_values(1, prog, key);
-
-    // to be removed later when solution for adding multiple new rows is found
+    get_values(1, prog, key, "edit");
+
+    //disabeling all other edit/add buttons
+    // (to be removed later when solution for adding multiple new rows is found)
     document.getElementById('addrowvals').style.display = "";
     document.getElementById('addrowvals2').style.display = "";
@@ -381,4 +401,5 @@
 {
     //get select program and key
+    document.getElementById('addrowprog').style.display = "";
     progselect=document.getElementById("prog");
     prog=progselect.options[progselect.selectedIndex].value;
@@ -386,13 +407,18 @@
     key=keyselect.options[keyselect.selectedIndex].value;
     //reload the original table in case of cancel
-    get_values(1, prog, key);
+    get_values(1, prog, key, "edit");
 }
 
 function EditRow(index)
 {
+    //disabeling all other edit/add buttons
+    // (to be removed later when solution for adding multiple new rows is found)
     for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
         if(document.getElementById('action'+i) && i!=index)
-            //document.getElementById('action'+i).innerHTML = "";
             document.getElementById('action'+i).style.display = "none";
+    document.getElementById('addrowvals').style.display = "none";
+    document.getElementById('addrowvals2').style.display = "none";
+    document.getElementById('addrowkey').style.display = "none";
+    document.getElementById('addrowprog').style.display = "none";
 
     //get current values
@@ -458,7 +484,7 @@
     // 5: add new prog + key             addcase 1
     // 1: add new key                    addcase 2
-    // 2: add new val (for same key)     addcase 3        -> same type
-    // 3: edit val                                        -> same type
-    // 4: delete val (ie set to NULL)                     -> same type
+    // 2: add new val (for same key)     addcase 3        -> same type,min,max
+    // 3: edit val                                        -> same type,min,max
+    // 4: delete val (ie set to NULL)                     -> same type,min,max
     // 6: delete new key (ie val still NULL) -> real delete
     descr=document.getElementById('newdescr'+index).value;
@@ -472,4 +498,6 @@
         val=document.getElementById('newval'+index).innerHTML;
         type=document.getElementById('newtype'+index).value;
+        min=document.getElementById('newmin'+index).value;
+        max=document.getElementById('newmax'+index).value;
         break;
     case 1:
@@ -480,4 +508,6 @@
         val=document.getElementById('newval'+index).innerHTML;
         type=document.getElementById('newtype'+index).value;
+        min=document.getElementById('newmin'+index).value;
+        max=document.getElementById('newmax'+index).value;
         break;
     case 2:
@@ -488,4 +518,6 @@
         val=document.getElementById('newval'+index).value;
         type=document.getElementById('type'+index).innerHTML;
+        min=document.getElementById('min'+index).innerHTML;
+        max=document.getElementById('max'+index).innerHTML;
         break;
     case 3:
@@ -494,4 +526,6 @@
         key2=document.getElementById('2key'+index).innerHTML;
         type=document.getElementById('type'+index).innerHTML;
+        min=document.getElementById('min'+index).innerHTML;
+        max=document.getElementById('max'+index).innerHTML;
         val="hallo";
         if (type=="bool")
@@ -518,4 +552,6 @@
             val="NULL";
         type=document.getElementById('type'+index).innerHTML;
+        min=document.getElementById('min'+index).innerHTML;
+        max=document.getElementById('max'+index).innerHTML;
         origindex=document.getElementById('1origindex'+index).innerHTML;
         break;
@@ -533,6 +569,11 @@
     if (index==0)
         index=-1;
-
-    //check if value has correct type
+    if (!type && (updcase==2 || updcase==3 || updcase==4))
+    {
+        alert("Please select type!");
+        return;
+    }
+
+    //check if value has correct type and is within ranges
     //  for string no check needed
     if (updcase==3)
@@ -553,13 +594,67 @@
             return;
         }
-    }
-    if (!type && (updcase==2 || updcase==3 || updcase==4))
-    {
-        alert("Please select type!");
-        return;
-    }
-
-    phpcall="insert_po.php?fUpdCase="+updcase+"&fIndex="+index+"&fOriginalIndex="+origindex+"&fProgram="+prog
-        +"&fKey1="+key1+"&fKey2="+key2+"&fValue="+val+"&fDescription="+descr+"&fType="+type;
+        // check ranges for int
+        if (type=='int' && parseInt(val)>parseInt(max))
+        {
+            alert("You cannot enter a value larger than "+max+".");
+            return;
+        }
+        if (type=='int' && parseInt(val)<parseInt(min))
+        {
+            alert("You cannot enter a value smaller than "+min+".");
+            return;
+        }
+        // check ranges for float
+        if (type=='float' && parseFloat(val)>parseFloat(max))
+        {
+            alert("You cannot enter a value larger than "+max+".");
+            return;
+        }
+        if (type=='float' && parseFloat(val)<parseFloat(min))
+        {
+            alert("You cannot enter a value smaller than "+min+".");
+            return;
+        }
+    }
+
+    if (!min && (type=='int' || type=='float'))
+    {
+        alert("Please insert minimum!");
+        return;
+    }
+    if (!max && (type=='int' || type=='float'))
+    {
+        alert("Please insert maximum!");
+        return;
+    }
+    //check if min/max have correct type
+    //  for string no check needed
+    if (updcase==1 || updcase==5)
+    {
+        if (type=='int' && parseInt(min)!=min)
+        {
+            alert("Minimum is not a int.");
+            return;
+        }
+        if (type=='int' && parseInt(max)!=max)
+        {
+            alert("Maximum is not a int.");
+            return;
+        }
+        if (type=='float' && parseFloat(min)!=min)
+        {
+            alert("Minimum is not a float.");
+            return;
+        }
+        if (type=='float' && parseFloat(max)!=max)
+        {
+            alert("Maximum is not a float.");
+            return;
+        }
+    }
+
+    phpcall="insert_po.php?fUpdCase="+updcase+"&fIndex="+index+"&fOriginalIndex="+origindex
+        +"&fProgram="+prog+"&fKey1="+key1+"&fKey2="+key2+"&fValue="+val+"&fDescription="+descr
+        +"&fType="+type+"&fMin="+min+"&fMax="+max;
     //alert(phpcall);
 
@@ -584,4 +679,9 @@
         {
             alert("This program already exists. You cannot insert it a second time.");
+            return;
+        }
+        if (xmlhttp.responseText=="user empty")
+        {
+            alert("User name is missing. Please give a user name when logging in.");
             return;
         }
@@ -648,9 +748,7 @@
 {
     var x=document.getElementById('valtable'+table).insertRow(row);
-    for (var i = 0 ; i < 9 ; i++)
-    {
-        y=x.insertCell(i);
-        y.innerHTML="&nbsp;";
-    }
+    y=x.insertCell(0);
+    y.colSpan='5';
+    y.innerHTML="&nbsp;";
 }
 
@@ -660,6 +758,4 @@
     maxindex2=document.getElementById('maxindex').innerHTML;
     maxindex3=document.getElementById('maxindex3').innerHTML;
-    //alert(maxindex2);
-    //alert(maxindex3);
     if (parseInt(maxindex2)>parseInt(maxindex3))
         maxindex=maxindex2;
@@ -697,22 +793,26 @@
     }
     //document.getElementById('comparevals').style.display = "none";
-}
-
-function HideDescription(getvalcase)
-{
+
+    //reload all setting for show-menu
+    ShowHide('indices', 'sh_indices', 2)
+    ShowHide('indices', 'sh_indices', 3)
+    ShowHide('description', 'sh_descr', 2)
+    ShowHide('description', 'sh_descr', 3)
+    ShowHide('validsince', 'sh_validsince', 2)
+    ShowHide('validsince', 'sh_validsince', 3)
+    ShowHide('minimum', 'sh_min', 2)
+    ShowHide('minimum', 'sh_min', 3)
+    ShowHide('maximum', 'sh_max', 2)
+    ShowHide('maximum', 'sh_max', 3)
+}
+
+function ShowHide(column, idname, getvalcase)
+{
+    box=document.getElementById(idname+getvalcase);
+    text=box.checked? '':'none';
+
     for(var i=0;i<document.getElementsByTagName('*').length;i++)
-        if(document.getElementsByTagName('*')[i].className == 'description'+getvalcase)
-            document.getElementsByTagName('*')[i].style.display = 'none';
-    document.getElementById('hidedescr'+getvalcase).style.display = "none";
-    document.getElementById('showdescr'+getvalcase).style.display = "";
-}
-
-function ShowDescription(getvalcase)
-{
-    for(var i=0;i<document.getElementsByTagName('*').length;i++)
-        if(document.getElementsByTagName('*')[i].className == 'description'+getvalcase)
-            document.getElementsByTagName('*')[i].style.display = '';
-    document.getElementById('showdescr'+getvalcase).style.display = "none";
-    document.getElementById('hidedescr'+getvalcase).style.display = "";
+        if(document.getElementsByTagName('*')[i].className == column+getvalcase)
+            document.getElementsByTagName('*')[i].style.display = text;
 }
 
@@ -773,8 +873,14 @@
         document.getElementById('statusdate'+idx).value="";
 }
+
 function get_dates(datename, dateval, datevalprev, idx, reset)
 {
     //alert(datename+"_"+dateval+"_"+datevalprev+"_"+idx);
-    phpcall="get_date.php?fDateValue="+dateval+"&fDateValuePrev="+datevalprev+"&fDateName="+datename+"&fIdx="+idx;
+    statusdate=get_statusdate(idx);
+    //if (datename=="year")
+    //    statusdate="";
+    //alert(datename+" === "+statusdate+" --- "+datevalprev);
+    phpcall="get_date.php?fDateValue="+dateval+"&fDateValuePrev="+datevalprev+"&fDateName="+datename+"&fIdx="+idx+"&fStatusDate="+statusdate;
+    //phpcall="get_date.php?fDateValue="+dateval+"&fDateValuePrev="+statusdate+"&fDateName="+datename+"&fIdx="+idx;
     //alert(phpcall);
     xmlhttp.open("GET",phpcall,false);
@@ -792,87 +898,64 @@
 function set_statusdate(getvalcase, statusdate)
 {
-    //alert(statusdate);
-
+    //get info whether to get statusdate from pulldown or input
     radio=document.getElementsByName('dateformat'+getvalcase);
     for (i=0; i< radio.length; i++)
         if (radio[i].checked)
             val=radio[i].value;
-    if (val=="pulldown")
-    {
-        //check whole string
-        if (statusdate=="")
-        {
-            //set all values to 'empty'
-            get_dates("year", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        dates=statusdate.split("-",3);
-        //check year
-        if (!dates[0])
-        {
-            get_dates("year", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("year", dates[0], dates[0], getvalcase);
-        //check month
-        if (!dates[1])
-        {
-            get_dates("month", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("month", dates[1], dates[0], getvalcase);
-        //check rest of string
-        if (!dates[2])
-        {
-            get_dates("day", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        rests=dates[2].split(" ",2);
-        //check day
-        if (!rests[0])
-        {
-            get_dates("day", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("day", rests[0], dates[1], getvalcase);
-        //check rest of string
-        if (!rests[1])
-        {
-            get_dates("hour", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        times=rests[1].split(":",3);
-        //check hour
-        if (!times[0])
-        {
-            get_dates("hour", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("hour", times[0], rests[0], getvalcase);
-        //check minutes
-        if (!times[1])
-        {
-            get_dates("min", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("min", times[1], times[0], getvalcase);
-        //check seconds
-        if (!times[2])
-        {
-            get_dates("sec", "empty", "empty", getvalcase, "yes");
-            return;
-        }
-        else
-            get_dates("sec", times[2], times[1], getvalcase);
-
-    }
+
     if (val=="textinput")
+    {
         document.getElementById('statusdate'+getvalcase).value=statusdate;
-
+        return
+    }
+
+    //val=="pulldown"
+    //reset date pulldowns
+    get_dates("year", "empty", "empty", getvalcase, "yes");
+
+    //whole string (YYYY-MM-DD hh:mm:ss)
+    if (statusdate=="")
+        return;
+
+    dates=statusdate.split("-",3);
+    //years
+    if (!dates[0])
+        return;
+    get_dates("year", dates[0], dates[0], getvalcase);
+
+    //months
+    if (!dates[1])
+        return;
+    get_dates("month", dates[1], dates[0], getvalcase);
+
+    //rest of string (DD hh:mm:ss)
+    if (!dates[2])
+        return;
+
+    rests=dates[2].split(" ",2);
+    //days
+    if (!rests[0])
+        return;
+    get_dates("day", rests[0], dates[1], getvalcase);
+
+    //rest of string (hh:mm:ss)
+    if (!rests[1])
+        return;
+
+    times=rests[1].split(":",3);
+    //hours
+    if (!times[0])
+        return;
+    get_dates("hour", times[0], rests[0], getvalcase);
+
+    //minutes
+    if (!times[1])
+        return;
+    get_dates("min", times[1], times[0], getvalcase);
+
+    //seconds
+    if (!times[2])
+        return;
+    get_dates("sec", times[2], times[1], getvalcase);
 }
 
@@ -882,4 +965,5 @@
     statusdate=get_statusdate(getvalcase);
 
+    // get next or previous timestamp
     xmlhttp.open("GET","get_timestamp.php?fStatusDate="+statusdate+"&fDirection="+direction,false);
     xmlhttp.send();
@@ -891,2 +975,18 @@
     set_statusdate(getvalcase, newstatusdate);
 }
+
+function show_viewinfo()
+{
+    if (document.getElementById('showinfo').innerHTML=='Hide Info')
+    {
+        document.getElementById('viewinfo').style.display='none';
+        document.getElementById('showinfo').innerHTML='Show Info';
+    }
+    else
+    {
+        document.getElementById('viewinfo').style.display='';
+        document.getElementById('showinfo').innerHTML='Hide Info';
+    }
+
+}
+
Index: /trunk/www/db_po/view_po.php
===================================================================
--- /trunk/www/db_po/view_po.php	(revision 11598)
+++ /trunk/www/db_po/view_po.php	(revision 11599)
@@ -12,6 +12,10 @@
 
     include("db.php");
-    printf("This page is to <u>view</u> the DB <b>%s</b>.\n", $db);
+    printf("This page is to <u>view and compare</u> entries from the DB <b>%s</b>.\n", $db);
+    printf("<button onClick='show_viewinfo()' id='showinfo' style='display:inline'>More Info</button>\n");
     printf("For edit, please go <a href='edit_po.php'>here</a>.<br><br>\n");
+    printf("<div id='viewinfo' style='display:none'>\n");
+    echo (file_get_contents("view-info.html"));
+    printf("</div>\n");
 
     $db_id = mysql_pconnect($host, $user, $pw);
@@ -23,30 +27,17 @@
     mysql_select_db($db);
 
-    printf("<table><tbody>\n");
-
-    printf("<tr>\n");
-    printf("<td valign='top' id='progfield'></td>\n");
-    printf("<td valign='top' id='keyfield'></td>\n");
-    printf("</tr>\n");
-
-    printf("<tr><td colspan='2'>\n");
-    //printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");alert(\"wait\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
-    printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
-    printf("<button onClick='reset_dates(\"year\", \"empty\", \"empty\", 2);reset_dates(\"year\", \"empty\", \"empty\", 3)' id='resetdates' style='display:inline'>Reset Dates</button></div>\n");
-    printf("</td></tr>\n");
-
-    printf("<tr>\n");
-    for ($i=2; $i<4; $i++)
-    {
-        printf("<td>\n");
-        printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
-        printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
-        printf("</td>\n");
-    }
-    printf("</tr>\n");
-
     $query0="SELECT DATE_FORMAT(fValidFrom, '%Y') AS valid FROM History WHERE NOT fValidFrom='0000-00-00 00:00:00' group by valid";
     $result0=mysql_query($query0, $db_id);
 
+
+    printf("<table border='0' cellspacing='2px'><tbody>\n");
+
+    printf("<tr>\n");
+    printf("<th bgcolor='#DCFFDC'>Configuration 1</th>\n");
+    printf("<td colspan='2' align='center'>\n");
+    printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='showpo' style='display:inline'>Show /<br>Compare</button>\n");
+    printf("</td>\n");
+    printf("<th bgcolor='#DCDCFF'>Configuration 2</th>\n");
+    printf("</tr>\n");
 
     //date fields
@@ -55,13 +46,19 @@
     for ($i=2; $i<4; $i++)
     {
-        printf("<td>\n");
+        if ($i==2)
+            printf("<td bgcolor='#DCFFDC'>Date: &nbsp;\n");
+        else
+            printf("<td bgcolor='#DCDCFF'>Date: &nbsp;\n");
+        //buttons to show next/prev timestamp
+        printf("<button onClick='get_timestamp(%s, \"next\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='nexttimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
+        printf("<button onClick='get_timestamp(%s, \"prev\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='prevtimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
         //input field
-        printf("<div id='dateinput%d' style='display:none'>Date (YYYY-MM-DD hh:mm:ss) \n", $i);
-        printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\">\n", $i);
-        printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
-        printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
+        printf("<br>\n", $i);
+        printf("<div id='dateinput%d' style='display:none'>(YYYY-MM-DD hh:mm:ss) \n", $i);
+        printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\"><br>\n", $i);
         printf("</div>\n");
+
         //pull down menus
-        printf("<div id='datepulldown%d' style='display:inline'>Date:\n", $i);
+        printf("<div id='datepulldown%d' style='display:inline'>\n", $i);
         //select for years
         printf("<div id='yearselect%d' style='display:inline'>\n", $i);
@@ -77,40 +74,82 @@
         printf("<div id='monthselect%d' style='display:inline'>\n", $i);
         printf("<select id='month%d' onchange=\"get_dates('day', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
-        printf("<option value='empty'>-</option>\n");
-        printf("</select></div>\n");
+        printf("<option value='empty'>month</option>\n");
+        printf("</select>\n");
+        printf("</div>\n");
         //select for days
         printf("<div id='dayselect%d' style='display:inline'>\n", $i);
         printf("<select id='day%d' onchange=\"get_dates('hour', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
-        printf("<option value='empty'>-</option>\n");
-        printf("</select></div>\n");
+        printf("<option value='empty'>day</option>\n");
+        printf("</select>\n");
+        printf("</div>\n");
         //select for hours
         printf("<div id='hourselect%d' style='display:inline'>\n", $i);
         printf("<select id='hour%d' onchange=\"get_dates('min', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
-        printf("<option value='empty'>-</option>\n");
-        printf("</select></div>\n");
+        printf("<option value='empty'>hour</option>\n");
+        printf("</select>\n");
+        printf("</div>\n");
         //select for minutes
         printf("<div id='minselect%d' style='display:inline'>\n", $i);
         printf("<select id='min%d' onchange=\"get_dates('sec', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
-        printf("<option value='empty'>-</option>\n");
-        printf("</select></div>\n");
+        printf("<option value='empty'>min</option>\n");
+        printf("</select>\n");
+        printf("</div>\n");
         //select for seconds
-        printf("<div id='secselect%d' style='display:inline'><select id='sec%d'>\n", $i, $i);
-        printf("<option value='empty'>-</option>\n");
-        printf("</select></div>\n");
+        printf("<div id='secselect%d' style='display:inline'>\n", $i);
+        printf("<select id='sec%d'>\n", $i, $i);
+        printf("<option value='empty'>sec</option>\n");
+        printf("</select>\n");
+        printf("</div>\n");
         //buttton to show next timestamp
-        //printf("<button onClick='get_next_timestamp(%s);' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
-        printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
-        printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
+        //printf("<button onClick='get_timestamp(%s, \"next\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='nexttimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
+        //printf("<button onClick='get_timestamp(%s, \"prev\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='prevtimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
+        printf("</div>\n");
+        printf("<br>\n");
+
+        //radio button to select input-format for date
+        printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
+        printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
         printf("</td>\n");
+
+        //reset mysql result to loop again over it
         if ($i==2 && $rowcount > 0)
             mysql_data_seek($result0, 0);
+
+        if ($i==2)
+            printf("<td colspan='2' align='center'><button onClick='reset_dates(\"year\", \"empty\", \"empty\", 2);reset_dates(\"year\", \"empty\", \"empty\", 3);get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='resetdates' style='display:inline'>Reset Dates</button></td>\n");
     }
     printf("</tr>\n");
     mysql_free_result($result0);
 
+    //print pulldown for programs/key and buttons
+    printf("<tr><td colspan='4'>\n");
+    printf("<br>Select a subset of program options:\n");
+    printf("<div id='progfield' style='display:inline'></div>\n");
+    printf("<div id='keyfield' style='display:inline'></div>\n");
+    //printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");alert(\"wait\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
+    printf("</td></tr>\n");
+
+    //checkboxes to show/hide part of the table
+    printf("<tr>\n");
+    for ($i=2; $i<4; $i++)
+    {
+        if ($i==2)
+            printf("<td bgcolor='#DCFFDC' colspan='2'>\n");
+        else
+            printf("<td bgcolor='#DCDCFF' colspan='2'>\n");
+        printf("Show:\n");
+        printf("<input type='checkbox' id='sh_indices%d' onclick='ShowHide(\"indices\", \"sh_indices\", %d);'>indices\n", $i, $i);
+        printf("<input type='checkbox' id='sh_validsince%d' onclick='ShowHide(\"validsince\", \"sh_validsince\", %d);'>validsince\n", $i, $i);
+        printf("<input type='checkbox' id='sh_descr%d' onclick='ShowHide(\"description\", \"sh_descr\", %d);'>description\n", $i, $i);
+        printf("<input type='checkbox' id='sh_min%d' onclick='ShowHide(\"minimum\", \"sh_min\", %d);'>min\n", $i, $i);
+        printf("<input type='checkbox' id='sh_max%d' onclick='ShowHide(\"maximum\", \"sh_max\", %d);'>max\n", $i, $i);
+        printf("</td>\n");
+    }
+    printf("</tr>\n");
+
     //list of POs
     printf("<tr>\n");
-    printf("<td><div id='valuefield2'></div></td>\n");
-    printf("<td><div id='valuefield3'></div></td>\n");
+    printf("<td bgcolor='#BEFFBE' colspan='2'><div id='valuefield2'></div></td>\n");
+    printf("<td bgcolor='#BEBEFF' colspan='2'><div id='valuefield3'></div></td>\n");
     printf("</tr>\n");
 
