Index: /trunk/FACT++/www/viewer/index.html
===================================================================
--- /trunk/FACT++/www/viewer/index.html	(revision 17772)
+++ /trunk/FACT++/www/viewer/index.html	(revision 17773)
@@ -40,5 +40,4 @@
     <script src="flot-0.8.3/jquery.flot.symbol.min.js"></script>
     <script src="flot-0.8.3/jquery.flot.resize.js"></script>
-
     <script src="jshint.js"></script>
     <script src="index.js"></script>
@@ -49,5 +48,5 @@
 <body>
 
-<div id='tooltip' style="position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
+<div id='tooltip' style="z-index:1000;position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
 
 <div class="myaccordion" id="accordion5">
@@ -87,7 +86,7 @@
 for (var p=0; p<$.event.numPix; p++)
 {
-    var max = 0;
-    var idx = 0;
-    for (var s=5; s<$.event.numRoi-50; s++)
+    var max =  0;
+    var idx = -1;
+    for (var s=5; s<$.event.numRoi-60; s++)
     {
         // spike suppression
@@ -100,6 +99,6 @@
         }
     }
-    rc[0][p]=max;
-    rc[1][p]=idx;
+    rc[0][p]=idx<0 ? null : max;
+    rc[1][p]=idx<0 ? null : idx;
 }
 
@@ -135,5 +134,7 @@
    <input id="submit"  type="button" onclick="onSubmit();" value="Submit"></input>
    <span style="float:right;white-space:nowrap;">
-      Run file: 
+      Cal:
+      <input id="calibrated" type="checkbox" onclick="onSubmit();"></input>
+      Run: 
       <input id="file" style="width:100px"></input>
    </span>
@@ -164,5 +165,4 @@
 </div>
 <div id="cameracontainer" class="ui-widget-content">
-
    <table width="100%">
       <colgroup>
@@ -208,14 +208,14 @@
       <tr style="margin:0;padding:0;">
          <td style="margin:0;padding:0;">
-	    <table id="col1" border="0" style="margin:0;padding:0;">
-	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="cont1"></tr>
-	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="cont3"><canvas id="camera3" width="1" height="1"></canvas></td></tr>
+	    <table border="0" style="margin:0;padding:0;">
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera1"></tr>
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera3"><canvas id="camera3" width="1" height="1"></canvas></td></tr>
             </table>
 	 </td>
-	 <td style="margin:0;padding:0;" id="center"><canvas id="camera1" width="1" height="1"></canvas></td>
+	 <td style="margin:0;padding:0;" id="centercamera"><canvas id="camera1" width="1" height="1"></canvas></td>
 	 <td style="margin:0;padding:0;">
-	    <table id="col3" border="0" style="margin:0;padding:0;">
-	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="cont2"><canvas id="camera2" width="1" height="1"></canvas></td></tr>
-	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="cont4"><canvas id="camera4" width="1" height="1"></canvas></td></tr>
+	    <table border="0" style="margin:0;padding:0;">
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera2"><canvas id="camera2" width="1" height="1"></canvas></td></tr>
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera4"><canvas id="camera4" width="1" height="1"></canvas></td></tr>
 	    </table>
 	 </td>
@@ -259,4 +259,108 @@
                <input id="cameramax4"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(4);"  value="0" disabled="true"></input>
                <input id="cameramaxon4" type="checkbox" onclick="onCameraMinMaxOn(4);" checked="true"></input>
+            </span>
+         </td>
+      </tr>
+   </table>
+</div>
+
+<div class="myaccordion" id="accordion7">
+   <h3><a href="#">Histograms</a></h3>
+</div>
+<div id="histcontainer" class="ui-widget-content">
+   <table width="100%">
+      <colgroup>
+         <col style="width:40%;">
+         <col style="width:20%;">
+         <col style="width:40%;">
+      </colgroup>
+      <tr>
+         <td>
+            <span style="white-space:nowrap">
+               Min: 
+               <input id="histmin1"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(1);"  value="0" disabled="true"></input>
+               <input id="histminon1" type="checkbox" onclick="onHistMinMaxOn(1);" checked="true"></input>
+            </span>
+            &nbsp;
+            <span style="white-space:nowrap">
+               Max: 
+               <input id="histmax1"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(1);"  value="0" disabled="true"></input>
+               <input id="histmaxon1" type="checkbox" onclick="onHistMinMaxOn(1);" checked="true"></input>
+            </span>
+         </td>
+         <td style="text-align:center" id="eventinfo">
+         </td>
+         <td style="text-align:right">
+            <span style="white-space:nowrap">
+               Min: 
+               <input id="histmin2"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(2);"  value="0" disabled="true"></input>
+               <input id="histminon2" type="checkbox" onclick="onHistMinMaxOn(2);" checked="true"></input>
+            </span>
+            <span style="white-space:nowrap">
+               &nbsp;
+               Max: 
+               <input id="histmax2"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(2);"  value="0" disabled="true"></input>
+               <input id="histmaxon2" type="checkbox" onclick="onHistMinMaxOn(2);" checked="true"></input>
+            </span>
+         </td>
+         <td>
+         </td>
+      </tr>
+   </table>
+
+   <table id="table" width="100%" border="0" style="border:0;margin:0;padding:0;">
+      <tr style="margin:0;padding:0;">
+         <td style="margin:0;padding:0;">
+	    <table border="0" style="margin:0;padding:0;">
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist1"></tr>
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist3"><div style="width:1px;height:1px;" id="hist3"></div></td></tr>
+            </table>
+	 </td>
+	 <td style="margin:0;padding:0;" id="centerhist"><div style="width:1px;height:1px;" id="hist1"></div></td>
+	 <td style="margin:0;padding:0;">
+	    <table border="0" style="margin:0;padding:0;">
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist2"><div style="width:1px;height:1px;" id="hist2"></div></td></tr>
+	       <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist4"><div style="width:1px;height:1px;" id="hist4"></div></td></tr>
+	    </table>
+	 </td>
+      </tr>
+   </table>
+
+   <table width="100%">
+      <colgroup>
+         <col style="width:40%;">
+         <col style="width:20%;">
+         <col style="width:40%;">
+      </colgroup>
+      <tr>
+         <td>
+            <span style="white-space:nowrap">
+               Min: 
+               <input id="histmin3"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(3);"  value="0" disabled="true"></input>
+               <input id="histminon3" type="checkbox" onclick="onHistMinMaxOn(3);" checked="true"></input>
+            </span>
+            &nbsp;
+            <span style="white-space:nowrap">
+               Max: 
+               <input id="histmax3"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(3);"  value="0" disabled="true"></input>
+               <input id="histmaxon3" type="checkbox" onclick="onHistMinMaxOn(3);" checked="true"></input>
+            </span>
+         </td>
+         <td style="text-align:center;">
+	    <!--<input id="marker" type="checkbox" checked="true" onclick="onMarker();">Show pixel marker</input>-->
+            <!--Pixel value: 
+            <input id="value" type="text" readonly="true"  value="0" style="text-align:right;width:100px"></input>-->
+         </td>
+         <td style="text-align:right">
+            <span style="white-space:nowrap">
+               Min: 
+               <input id="histmin4"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(4);"  value="0" disabled="true"></input>
+               <input id="histminon4" type="checkbox" onclick="onHistMinMaxOn(4);" checked="true"></input>
+            </span>
+            <span style="white-space:nowrap">
+               &nbsp;
+               Max: 
+               <input id="histmax4"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(4);"  value="0" disabled="true"></input>
+               <input id="histmaxon4" type="checkbox" onclick="onHistMinMaxOn(4);" checked="true"></input>
             </span>
          </td>
