Index: /trunk/www/db_po/insert_po.php
===================================================================
--- /trunk/www/db_po/insert_po.php	(revision 11770)
+++ /trunk/www/db_po/insert_po.php	(revision 11771)
@@ -4,4 +4,7 @@
     ini_set("mysql.trace_mode", "On");
 
+    // init
+    //
+    // values which cannot be empty
     if (empty($_GET["fUpdCase"]))
     {
@@ -24,24 +27,22 @@
         return;
     }
+    if (empty($_GET["fValue"]))
+    {
+        echo "Please insert a value.<br>";
+        return;
+    }
+    if (empty($_GET["fDescription"]))
+    {
+        echo "Please insert a description.<br>";
+        return;
+    }
+    if (empty($_GET["fType"]))
+    {
+        echo "Please select a type.<br>";
+        return;
+    }
+    // values which may be empty
     if (empty($_GET["fKey2"]))
-    {
-        echo "Please select a key2.<br>";
-        return;
-    }
-    if (empty($_GET["fValue"]))
-    {
-        echo "Please insert a value.<br>";
-        return;
-    }
-    if (empty($_GET["fDescription"]))
-    {
-        echo "Please insert a description.<br>";
-        return;
-    }
-    if (empty($_GET["fType"]))
-    {
-        echo "Please select a type.<br>";
-        return;
-    }
+        $_GET["fKey2"]="";
     if (empty($_GET["fOriginalIndex"]))
         $_GET["fOriginalIndex"]="";
@@ -97,5 +98,8 @@
 
     //check if key alread exists
-    $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND fKey2='.".$_GET["fKey2"]."'";
+    if (empty($_GET["fKey2"]))
+        $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND ISNULL(fKey2)";
+    else
+        $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND fKey2='.".$_GET["fKey2"]."'";
     $query2.=" AND fCounter=(Select Max(fCounter) from History)";
     if (!$result2=mysqli_query($db_id, $query2))
@@ -158,5 +162,6 @@
         $query0.=", fUser='".$_SERVER['PHP_AUTH_USER']."'";
         $query0.=", fKey1='".$_GET["fKey1"]."'";
-        $query0.=", fKey2='.".$_GET["fKey2"]."'";
+        if (!empty($_GET["fKey2"]))
+            $query0.=", fKey2='.".$_GET["fKey2"]."'";
         $query0.=", fDescription='".$_GET["fDescription"]."'";
         $query0.=", fType='".$_GET["fType"]."'";
Index: /trunk/www/db_po/po.js
===================================================================
--- /trunk/www/db_po/po.js	(revision 11770)
+++ /trunk/www/db_po/po.js	(revision 11771)
@@ -561,9 +561,7 @@
     if (!key1)
         alert("Please insert key1!");
-    if (!key2)
-        alert("Please insert key2!");
     if (!val)
         alert("Please insert value!");
-    if (!val || !descr || !key1 || !key2)
+    if (!val || !descr || !key1)
         return;
     if (index==0)
@@ -650,4 +648,14 @@
         {
             alert("Maximum is not a float.");
+            return;
+        }
+        if (type=='float' && parseFloat(max)<parseFloat(min))
+        {
+            alert("Maximum cannot be smaller than minimum.");
+            return;
+        }
+        if (type=='int' && parseInt(max)<parseInt(min))
+        {
+            alert("Maximum cannot be smaller than minimum.");
             return;
         }
