Index: /trunk/FACT++/www/index.html
===================================================================
--- /trunk/FACT++/www/index.html	(revision 13567)
+++ /trunk/FACT++/www/index.html	(revision 13568)
@@ -1,4 +1,2 @@
-<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional"
-       "http://www.w3.org/TR/html4/loose.dtd">-->
 <!DOCTYPE HTML>
 <html>
@@ -11,54 +9,4 @@
 </head>
 
-<body id="body" onload="onload();" onresize="onresize();" data-visible='0'>
-
-<table id="table0" border="0" cellspacing="0" cellpadding="6" class="tborder" width="100%" style="overflow:hidden;position:fixed;top:0;left:0;display:none;" >
-  <thead>
-    <tr>
-      <td class="thead" colspan="3" width="100%">
-      <table width="100%"><tr>
-          <td class="tcell1"><font size="+2"><span id="ldot0" data-col="3">&#8226;</span>&nbsp;<a href="forumdisplay.php?fid=1" id="title0">FACT</a>&nbsp;<span id="rdot0" data-col="3">&#8226;</span></font></td>
-          <td class="tcell2"><font size="-2" id="reporttime0">---</font></td>
-        </tr></table>
-      </td>
-    </tr>
-  </thead>
-  <tbody></tbody>
-  <tfoot>
-    <tr>
-      <td class="tfoot" width="100%" colspan="3">
-       <table width="100%"><tr>
-          <td class="tcell1"><font size="+2"><A HREF="/logbook">logbook</A></font></td>
-          <td class="tcell2"><font size="-2" id="localtime0">booting...</font></td>
-        </tr></table>
-      </td>
-    </tr>
-  </tfoot>
-</table>
-
-<table id="table1" border="0" cellspacing="0" cellpadding="6" class="tborder" width="100%" style="overflow:hidden;position:fixed;top:0;left:0;display:none;" >
-  <thead>
-    <tr>
-      <td class="thead" colspan="3" width="100%">
-      <table width="100%"><tr>
-          <td class="tcell1"><font size="+2"><span id="ldot1" data-col="3">&#8226;</span>&nbsp;<a href="forumdisplay.php?fid=1" id="title1">FACT</a>&nbsp;<span id="rdot1" data-col="3">&#8226;</span></font></td>
-          <td class="tcell2"><font size="-2" id="reporttime1">---</font></td>
-        </tr></table>
-      </td>
-    </tr>
-  </thead>
-  <tbody></tbody>
-  <tfoot>
-    <tr>
-      <td class="tfoot" width="100%" colspan="3">
-       <table width="100%"><tr>
-          <td class="tcell1"><font size="+2"><A HREF="/logbook">logbook</A></font></td>
-          <td class="tcell2"><font size="-2" id="localtime1">booting...</font></td>
-        </tr></table>
-      </td>
-    </tr>
-  </tfoot>
-</table>
-
-</body>
+<body id="body" onload="onload();" onresize="onresize();"/>
 </html>
Index: /trunk/FACT++/www/index.js
===================================================================
--- /trunk/FACT++/www/index.js	(revision 13567)
+++ /trunk/FACT++/www/index.js	(revision 13568)
@@ -1,29 +1,13 @@
-/*
-    try { xmlHttp = new XMLHttpRequest(); }
-    catch(e)
-    {
-        try { xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP"); }
-        catch(e)
-        {
-            try { xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP"); }
-            catch(e)
-            {
-                alert("Your browser doesn't support dynamic reload.");
-                return;
-            }
-        }
-    }
-    */
-
 function $(id) { return document.getElementById(id); }
 function trim(str) { return str.replace("/^\s\s*/", '').replace("/\s\s*$/", ''); }
 function valid(str) { if (str==undefined) return false; if (str.length==0) return false; return true;}
-function isSliding(){ return $("table0").offsetLeft!=0 && $("table1").offsetLeft!=0; }
+function isSliding() { var z = $("body").getAttribute("data-visible"); return $("table"+z).offsetLeft!=0; }
+
 function cycleCol(el)
 {
-    var col = el.getAttribute("data-col");
+    var col = el.getAttribute("data-color");
     col++;
     col %= 31;
-    el.setAttribute("data-col", col);
+    el.setAttribute("data-color", col);
     if (col>16)
         col = 31-col;
@@ -48,5 +32,5 @@
           "4 -- "+navigator.userAgent);
           */
-    loadPage("fact", 0);
+    loadPage("fact", 0, 0);
 }
 
@@ -57,5 +41,5 @@
 }
 
-function loadPage(name, z)
+function loadPage(name, z, dz)
 {
     var xmlHttp = new XMLHttpRequest();
@@ -71,6 +55,6 @@
         }
 
-        buildPage(name, xmlHttp.responseText, (z+1)%2);
-        changePage(z);
+        buildPage(name, xmlHttp.responseText, z, dz);
+        changePage(z, z+dz);
 
         //changePage(name, xmlHttp.resposeText);
@@ -84,34 +68,148 @@
 
 
-function buildPage(name, text, z)
-{
+function buildPage(name, text, oldz, dz)
+{
+    var fname = dz==0 ? "fact" : $("table"+oldz).getAttribute("data-file");
+
+    var z = oldz + dz;
+
+    var lines = text.split('\n');
+
     var table = $("table"+z);
-    var p = table.tBodies.length==3 ? 1 : 0;
-
-    var tbody = $("table"+z).tBodies[p];
-
-    while (tbody.hasChildNodes())
-        tbody.removeChild(tbody.lastChild);
-
-    var lines = text.split('\n');
-
-    if (lines.length>0)
-    {
-        /*
-        var newe = document.createElement("span");
-        newe.innerHTML = lines[0];
-        var title = $("table"+z).tHead.rows[0].cells[0].childNodes[0].childNodes[1];
-        title.replaceChild(newe, title.lastChild);
-        */
-
-        //var x = title.lastChild;
-        //title.removeChild(title.lastChild);
-        //title.appendChild(newe);
-
-        var newe = document.createElement("span");
-        newe.innerHTML = lines[0];
-        var title = $("title"+z);//.innerHtml = lines[0];
-        title.replaceChild(newe, title.lastChild);
-    }
+    if (table != undefined)
+        $("body").removeChild(table);
+
+    table = document.createElement("table");
+    table.setAttribute("class",       "tborder");
+    table.setAttribute("id",          "table"+z);
+    table.setAttribute("border",      "0");
+    table.setAttribute("cellspacing", "0");
+    table.setAttribute("cellpadding", "6");
+    table.setAttribute("width",       "100%");
+    table.setAttribute("style",       "overflow:hidden;position:fixed;top:0px;left:"+window.innerWidth+"px;");
+
+    // -----------------------------------------------------
+
+    var th = document.createElement("thead");
+    th.setAttribute("colspan", "3");
+    th.setAttribute("width",   "100%");
+    table.appendChild(th);
+
+    var htr = document.createElement("tr");
+    th.appendChild(htr);
+
+    var htd = document.createElement("td");
+    htd.setAttribute("class",   "thead");
+    htd.setAttribute("colspan", "3");
+    htd.setAttribute("width",   "100%");
+    htr.appendChild(htd);
+
+    // -------------
+
+    var htab = document.createElement("table");
+    htab.setAttribute("width", "100%");
+    htd.appendChild(htab);
+
+    var hhtr = document.createElement("tr");
+    htab.appendChild(hhtr);
+
+    var htd0 = document.createElement("td");
+    var htd1 = document.createElement("td");
+    var htd2 = document.createElement("td");
+    var htd3 = document.createElement("td");
+    htd0.setAttribute("class", "tcell1");
+    htd1.setAttribute("class", "tcell2");
+    htd2.setAttribute("class", "tcell1");
+    htd2.setAttribute("width", "1px");
+    htd3.setAttribute("class", "tcell1");
+    htd3.setAttribute("width", "1px");
+    hhtr.appendChild(htd0);
+    hhtr.appendChild(htd1);
+    hhtr.appendChild(htd2);
+    hhtr.appendChild(htd3);
+
+    var div0 = document.createElement("div");
+    var div1 = document.createElement("div");
+    var div2 = document.createElement("div");
+    var div3 = document.createElement("div");
+    div0.setAttribute("style", "font-size:x-large;");
+    div2.setAttribute("class", "icon_white");
+    div2.setAttribute("onclick","this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('"+fname+"',"+z+","+(-dz)+");");
+    div2.setAttribute("style", "background-position:-396px 50%;");
+    div3.setAttribute("class", "icon_white");
+    div3.setAttribute("onclick","this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('fact',"+z+","+(-z)+");");
+    div3.setAttribute("style", "background-position:-575px 50%;");
+
+    var sp0 = document.createElement("span");
+    var sp1 = document.createElement("span");
+    var sp2 = document.createElement("span");
+    sp0.setAttribute("id", "ldot" +z);
+    sp1.setAttribute("id", "title"+z);
+    sp2.setAttribute("id", "rdot" +z);
+    sp0.setAttribute("data-color", "3");
+    sp2.setAttribute("data-color", "3");
+    sp0.appendChild(document.createTextNode(" \u2022 "));
+    sp1.appendChild(document.createTextNode(lines.length>0?lines[0]:"n/a"));
+    sp2.appendChild(document.createTextNode(" \u2022 "));
+
+    div0.appendChild(sp0);
+    div0.appendChild(sp1);
+    div0.appendChild(sp2);
+
+    div1.setAttribute("style", "font-size:small;");
+    div1.setAttribute("id", "reporttime"+z);
+    div1.appendChild(document.createTextNode("---"));
+
+    htd0.appendChild(div0);
+    htd1.appendChild(div1);
+    htd2.appendChild(div2);
+    htd3.appendChild(div3);
+
+    // -----------------------------------------------------
+
+    var tbody = document.createElement("tbody");
+    table.appendChild(tbody);
+
+    // -----------------------------------------------------
+
+    var tf = document.createElement("tfoot");
+    table.appendChild(tf);
+
+    var ftr = document.createElement("tr");
+    tf.appendChild(ftr);
+
+    var ftd = document.createElement("td");
+    ftd.setAttribute("class",   "tfoot");
+    ftd.setAttribute("width",   "100%");
+    ftd.setAttribute("colspan", "3");
+    ftr.appendChild(ftd);
+
+    var ftab = document.createElement("table");
+    ftab.setAttribute("width", "100%");
+    ftd.appendChild(ftab);
+
+    var ftd0 = document.createElement("td");
+    var ftd1 = document.createElement("td");
+
+    ftd0.setAttribute("class", "tcell1");
+    ftd1.setAttribute("class", "tcell2");
+
+    ftab.appendChild(ftd0);
+    ftab.appendChild(ftd1);
+
+    var fdiv0 = document.createElement("div");
+    var fdiv1 = document.createElement("div");
+
+    fdiv0.setAttribute("style", "font-size:x-large;");
+    fdiv1.setAttribute("style", "font-size:small;");
+    fdiv1.setAttribute("id",    "localtime"+z);
+
+    fdiv0.appendChild(document.createTextNode("logbook"));
+    fdiv1.appendChild(document.createTextNode("loading..."));
+
+    ftd0.appendChild(fdiv0);
+    ftd1.appendChild(fdiv1);
+
+    $("body").appendChild(table);
 
     var counter = 1;
@@ -130,30 +228,4 @@
         }
 
-        /*
-         <span class="ui-icon ui-icon-arrow-r ui-icon-shadow">
-    -webkit-box-shadow: rgba(255, 255, 255, 0.398438) 0px 1px 0px 0px;
-background-attachment: scroll;
-background-clip: border-box;
-background-color: rgba(0, 0, 0, 0.398438);
-background-image: url(http://code.jquery.com/mobile/1.1.0/images/icons-18-white.png);
-background-origin: padding-box;
-background-position: -60px 50%;
-background-repeat: no-repeat;
-box-shadow: rgba(255, 255, 255, 0.398438) 0px 1px 0px 0px;
-margin-bottom: 0px;
-margin-left: 0px;
-margin-right: 0px;
-margin-top: -9px;
-padding: 0;
-position: absolute;
-right: 10px;
-top: 50%;
-white-space: nowrap;
-width: 18px;
-height: 18px;
-zoom: 1;
-         </span>
-         */
-
         var check = cols[1].split("=");
 
@@ -164,5 +236,5 @@
             var tr = document.createElement("tr");
             tr.setAttribute("class", "row");
-            tr.setAttribute("style", "margin:0;padding:0;");
+            //tr.setAttribute("style", "margin:0;padding:0;");
 
             var td = document.createElement("td");
@@ -184,7 +256,7 @@
 
             var img = document.createElement("img");
-            img.setAttribute("id",     "image"+z);
-            img.setAttribute("width",  "1");
-            img.setAttribute("height", "1");
+            img.src = "dummy.png";//needed in firefox
+            img.setAttribute("id",    "image"+z);
+            img.setAttribute("style", "width:1px;height:1px;");
             td.appendChild(img);
 
@@ -196,7 +268,7 @@
         tr.setAttribute("class", "row");
         if (valid(cols[0]))
-            tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[0]+"',"+z+");");
+            tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[0]+"',"+z+",-1);");
         if (valid(cols[3]))
-            tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[3]+"',"+z+");");
+            tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[3]+"',"+z+",+1);");
         //tr.setAttribute("id",    cols[0]+"_row");
 
@@ -204,5 +276,10 @@
         td0.setAttribute("class", "tcol0");
         if (valid(cols[0]))
-            td0.appendChild(document.createTextNode("<"));
+        {
+            var sp = document.createElement("div");
+            sp.setAttribute("class", "icon_gray");
+            sp.setAttribute("style", "background-position: -144px 50%;");
+            td0.appendChild(sp);
+        }
         tr.appendChild(td0);
 
@@ -214,6 +291,12 @@
         var td2 = document.createElement("td");
         td2.setAttribute("class", "tcol2");
+        td2.setAttribute("width", "18px");
         if (valid(cols[3]))
-            td2.appendChild(document.createTextNode(">"));
+        {
+            var sp = document.createElement("div");
+            sp.setAttribute("class", "icon_gray");
+            sp.setAttribute("style", "background-position: -108px 50%;");
+            td2.appendChild(sp);
+        }
         tr.appendChild(td2);
 
@@ -276,5 +359,5 @@
     var H = window.innerHeight;
 
-    var ih = img.height + H - h;
+    var ih = H - h + parseInt(img.style.height, 10);
 
     img.style.width = W +"px";
@@ -285,26 +368,22 @@
 
     // ------ debug -----
+
     $('debug').innerHTML = "";
     $('debug').innerHTML += "|W="+W +"/"+H;
-    $('debug').innerHTML += "|H="+h+"/"+$("table"+z).offsetHeight;
-    $('debug').innerHTML += "|I="+ih;
+    $('debug').innerHTML += "|H="+h+"/"+$("table"+z).offsetHeight+"/"+img.offsetHeight;
+    $('debug').innerHTML += "|I="+img.style.height+"+"+H+"-"+h;
 }
 
 var intervalSlide = null;
 
-function changePage(z)
+function changePage(oldz, newz)
 {
     // No page displayed yet
-    if ($("table0").style.display=="none" && $("table1").style.display=="none")
-    {
-        $("table0").style.display="";
-        $("table1").style.display="";
-
-        $("table0").style.left=window.innerWidth+"px";
-        $("table1").style.left="0px";
-
-        $("body").setAttribute("data-visible", "1");
-
-        doresize(1);
+    if (oldz==newz)
+    {
+        $("table"+newz).style.left="0px";
+        $("body").setAttribute("data-visible", newz);
+
+        doresize(0);
 
         //setInterval(refresh_text, 1000);
@@ -330,48 +409,45 @@
     //intervalSlide = setInterval("doSlide("+z+",1)", 50);
 
-    $("body").setAttribute("data-visible", (z+1)%2);
-    intervalSlide = setInterval(doShift, 75, z);
-}
-
-function doShift(z)
+    if (newz>oldz)
+        $("table"+newz).style.left=window.innerWidth+"px";
+    else
+        $("table"+newz).style.left=(-window.innerWidth-1)+"px";
+
+    $("body").setAttribute("data-visible", newz);
+    intervalSlide = setInterval(doShift, 75, oldz, newz);
+}
+
+function doShift(oldz, newz)
 {
     var W = window.innerWidth;
 
-    var t0 = $("table0");
-    var t1 = $("table1");
+    var t0 = $("table"+oldz);
+    var t1 = $("table"+newz);
 
     var x0 = t0.offsetLeft;
     var x1 = t1.offsetLeft;
 
-    if (/*x1<0 && x0>=0 &&*/ z==0)
+    if (newz<oldz)
     {
         x0 += W/5;
         x1 += W/5;
-
-        if (x1>=0)
-        {
-            x0 = W;
-            x1 = 0;
-
-            clearInterval(intervalSlide);
-        }
-    }
-
-    if (/*x0>0 && x1<=0 &&*/ z==1)
+    }
+
+    if (newz>oldz)
     {
         x0 -= W/5;
         x1 -= W/5;
-
-        if (x0<=0)
-        {
-            x0 = 0;
-            x1 = -W-1;
-
-            clearInterval(intervalSlide);
-        }
-    }
-
-    t0.style.left = parseInt(x0, 10)+"px";
-    t1.style.left = parseInt(x1, 10)+"px";
+    }
+
+    if ((newz<oldz && x1>=0) || (newz>oldz && x1<=0))
+    {
+        clearInterval(intervalSlide);
+        $("body").removeChild(t0);
+        t1.style.left = "0px";
+        return;
+    }
+
+    t0.style.left = x0+"px";
+    t1.style.left = x1+"px";
 }
 
@@ -574,8 +650,10 @@
     date0 = date2;
 
+    var utc = date0.toUTCString();
+
     time.innerHTML =
-        "&#8226;&nbsp;"+date0.toUTCString()+"&nbsp;&#8226;";//getUTCFullYear()+"/"+date0.getUTCMonth()+"/"+date0.getUTCDate()+" "+date0.getUTCHours()+":"+date0.getUTCMinutes()+":"+date0.getUTCSeconds()+"."+date0.getUTCMilliseconds();
+        "&#8226;&nbsp;"+utc.substr(utc.length-12, 8)+"&nbsp;UTC&nbsp;&#8226;"
     ltime.innerHTML =
-        "&#8226;&nbsp;"+date1.toLocaleString()+"&nbsp;&#8226;";//ISOlocalDateStr();//ltoString();
+        "&#8226;&nbsp;"+date1.toLocaleString()+"&nbsp;&#8226;";
 
     // ----------------------------------------------------
@@ -780,4 +858,5 @@
     var ctx = beginDrawCam(80.5);
     ctx.rotate(Math.PI/2);
+
     ctx.scale(1, Math.sqrt(3)/2);
 
@@ -843,6 +922,4 @@
 function drawCamLegend(canv)
 {
-    //alert(canv.getAttribute("data-data"));
-
     var vals = canv.getAttribute("data-data").split("/");
     var diff = vals[1]-vals[0];
@@ -862,28 +939,4 @@
         ctx.strokeText((vals[1]-diff*i/8)+vals[2], cw-5, 135-i*15);
     }
-    /*
-    ctx.strokeStyle = "#"+color(16);
-    ctx.strokeText("-1.5V", cw-5, 120);
-
-    ctx.strokeStyle = "#"+color(32);
-    ctx.strokeText("-1.0V", cw-5, 105);
-
-    ctx.strokeStyle = "#"+color(48);
-    ctx.strokeText("-0.5V", cw-5, 90);
-
-    ctx.strokeStyle = "#"+color(64);
-    ctx.strokeText("0V", cw-5, 70);
-
-    ctx.strokeStyle = "#"+color(80);
-    ctx.strokeText("0.5V", cw-5, 50);
-
-    ctx.strokeStyle = "#"+color(86);
-    ctx.strokeText("1.0V", cw-5, 35);
-
-    ctx.strokeStyle = "#"+color(102);
-    ctx.strokeText("1.5V", cw-5, 20);
-
-    ctx.strokeStyle = "#"+color(127);
-    ctx.strokeText("2.0V", cw-5, 5); */
 }
 
@@ -939,5 +992,4 @@
     ctx.stroke();
     ctx.closePath();
-
 }
 
