Index: trunk/MagicSoft/Mars/datacenter/db/include.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 8198)
+++ trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 8199)
@@ -430,10 +430,10 @@
     $sigma = array
         (
-         5    => "#FF9900",
-         3    => "#FFFF66",
-         2    => "#33CC00",
-         1    => "#006600",
+         1    => "#33CC00",
+         2    => "#FFFF66",
+         3    => "#FF9900",
+         5    => "#FF0000",
         );
-    $offlimitcolour="#FF0000";
+    $okcolour="#006600";
 
 
@@ -484,6 +484,4 @@
         if ($form)
         {
-//            printf("<td>%s</td>",$row0["Sequ"]."ON");
-//            printf("<td>%s</td>",$row0["Sequ"]."Off");
             CheckBox2($row0["Sequ"], "ON","");
             CheckBox2($row0["Sequ"], "Off","");
@@ -496,4 +494,5 @@
                 printf("  <td align='right'>");
 
+            $colour='#000000';
             //determine color of text in cell
             if (!empty($limitsmean))
@@ -503,17 +502,13 @@
                     $mean=$key2 . "Mean";
                     $rms2=$key2 . "Rms";
-                    if ($key==$alias[$element2] && !empty($_GET[$mean]))
+                    if ($key==$alias[$element2] && !empty($_GET[$mean]) && !empty($_GET[$rms2]))
                     {
-                        if (!empty($_GET[$rms2]))
+                        $colour=$okcolour;
+                        foreach ($sigma as $margin => $newcolour)
                         {
-                            $colour=$offlimitcolour;
-                            foreach ($sigma as $margin => $newcolour)
-                            {
-                                $min=$_GET[$mean] - ($margin * $_GET[$rms2]);
-                                $max=$_GET[$mean] + ($margin * $_GET[$rms2]);
-                                if ($min < $element && $element < $max)
-                                    $colour=$newcolour;
-                            }
-                            printf("<font color='%s' style='font-weight:bold'>", $colour);
+                            $min=$_GET[$mean] - ($margin * $_GET[$rms2]);
+                            $max=$_GET[$mean] + ($margin * $_GET[$rms2]);
+                            if (!($min < $element && $element < $max))
+                                $colour=$newcolour;
                         }
                     }
@@ -528,16 +523,12 @@
                     if ($key==$alias[$element2] && !empty($_GET[$limit1]))
                     {
-                        $colour=$offlimitcolour;
-                        if ($_GET[$limit1] <= $element)
-                            $colour=$sigma[1];
-                        else
-                        {
-                            if (!empty($_GET[$limit2]))
-                            {
-                                if ($_GET[$limit2] <= $element)
-                                    $colour=$sigma[5];
-                            }
-                        }
-                        printf("<font color='%s' style='font-weight:bold'>", $colour);
+                        if ($colour=='#000000')
+                            $colour=$okcolour;
+
+                        if (!empty($_GET[$limit2]) && $_GET[$limit2] > $element)
+                                $colour=$sigma[5];
+
+                        if ($_GET[$limit1] > $element && $_GET[$limit2] <= $element)
+                            $colour=$sigma[3];
                     }
                 }
@@ -552,22 +543,23 @@
                     if ($key==$alias[$element2] && !empty($_GET[$limit1]))
                     {
-                        $colour=$offlimitcolour;
-                        if ($_GET[$limit1] >= $element)
-                            $colour=$sigma[1];
-                        else
-                        {
-                            if (!empty($_GET[$limit2]))
-                            {
-                                if ($_GET[$limit2] >= $element)
-                                    $colour=$sigma[5];
-                            }
-                        }
-                        printf("<font color='%s' style='font-weight:bold'>", $colour);
+                        if ($colour=='#000000')
+                            $colour=$okcolour;
+
+                        if (!empty($_GET[$limit2]) && $_GET[$limit2] < $element)
+                                $colour=$sigma[5];
+
+                        if ($_GET[$limit1] < $element && $_GET[$limit2] >= $element)
+                            $colour=$sigma[3];
                     }
                 }
             }
+            if ($colour!='#000000' && (!empty($limitsmean) || !empty($limitsmin) || !empty($limitsmax)))
+                printf("<font color='%s' style='font-weight:bold'>", $colour);
 
             //fill text in cell
             printf("&nbsp;%s&nbsp;</td>\n", str_replace("&ws;", " ", str_replace(" ", "&nbsp;", $element)));
+
+            if ($colour!='#000000' && (!empty($limitsmean) || !empty($limitsmin) || !empty($limitsmax)))
+                printf("</font>");
         }
         printf(" </tr>\n");
Index: trunk/MagicSoft/Mars/datacenter/db/magicdefs.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/magicdefs.php	(revision 8198)
+++ trunk/MagicSoft/Mars/datacenter/db/magicdefs.php	(revision 8199)
@@ -47,4 +47,5 @@
      "fPulsePosLimit"    => "fMeanPulsePosInner",
      "fRunTimeLimit"     => "fRunTime/60",
+     "fRelTimeMinLimit"  => "fEffOnTime/fRunTime",
     );
 
@@ -56,5 +57,5 @@
      "fIMCLimit"         => "fIsolatedMaxCluster",
      "fMaxHumLimit"      => "fMaxHumidity",
-     "fRelTimeLimit"     => "fEffOnTime/fRunTime",
+     "fRelTimeMaxLimit"  => "fEffOnTime/fRunTime",
     );
 
@@ -297,5 +298,6 @@
      "fZdMinLimit"                      => "ZdMin",
      "fZdMaxLimit"                      => "ZdMax",
-     "fRelTimeLimit"                    => "Rel.Ontime",
+     "fRelTimeMaxLimit"                 => "Rel.Ontime",
+     "fRelTimeMinLimit"                 => "Rel.Ontime",
      "fEMin"                            => "Emin",
      "fEMax"                            => "Emax",
