Index: trunk/FACT++/www/smartfact/index.js
===================================================================
--- trunk/FACT++/www/smartfact/index.js	(revision 13943)
+++ trunk/FACT++/www/smartfact/index.js	(revision 13949)
@@ -11,5 +11,5 @@
 function trim(str) { return str.replace(/^\s\s*/, "").replace(/\s*\s$/, ""); }
 function valid(str) { if (!str) return false; if (str.length==0) return false; return true;}
-function isSliding() { var z = $("body").getAttribute("data-visible"); return $("table"+z) ? $("table"+z).offsetLeft!=0 : false; }
+function isSliding() { var z = $("body").visiblePage/*getAttribute("data-visible")*/; return $("table"+z) ? $("table"+z).offsetLeft!=0 : false; }
 function htmlDecode(input) { var e = $new('div'); e.innerHTML = input; return e.firstChild ? e.firstChild.nodeValue : input; }
 function setUTC(el, time) { var str = time.toUTCString(); var utc = str.substr(str.length-12, 8); el.innerHTML = "&#8226;&nbsp;"+utc+"&nbsp;UTC&nbsp;&#8226;"; }
@@ -17,8 +17,8 @@
 function cycleCol(el)
 {
-    var col = el.getAttribute("data-color");
+    var col = el.dotColor;//el.getAttribute("data-color");
     col++;
     col %= 31;
-    el.setAttribute("data-color", col);
+    el.dotColor = col; //setAttribute("data-color", col);
     if (col>16)
         col = 31-col;
@@ -45,6 +45,8 @@
         switch (args[i])
         {
-        case "max":     $("body").setAttribute("data-max",     "yes"); continue;
-        case "noslide": $("body").setAttribute("data-noslide", "yes"); continue;
+        //case "max":     $("body").setAttribute("data-max",     "yes"); continue;
+        //case "noslide": $("body").setAttribute("data-noslide", "yes"); continue;
+        case "max":     $("body").displayMax     = true; continue;
+        case "noslide": $("body").displayNoslide = true; continue;
         }
 
@@ -55,6 +57,6 @@
         switch (entry[0])
         {
-        case "w": $("body").setAttribute("data-width",  entry[1]); break;
-        case "h": $("body").setAttribute("data-height", entry[1]); break;
+        case "w": $("body").displayFixedWidth  = entry[1]; break; //setAttribute("data-width",  entry[1]); break;
+        case "h": $("body").displayFixedHeight = entry[1]; break; //setAttribute("data-height", entry[1]); break;
         }
     }
@@ -73,5 +75,5 @@
 function onresize()
 {
-    var z = $("body").getAttribute("data-visible");
+    var z = $("body").visiblePage/*getAttribute("data-visible")*/;
 
     //$("table"+z).style.width="100%";
@@ -100,6 +102,9 @@
         }
 
-        buildPage(name, xmlPage.responseText, z, dz);
-        changePage(z, z+dz);
+        if (!isSliding())
+        {
+            buildPage(name, xmlPage.responseText, z, dz);
+            changePage(z, z+dz);
+        }
 
         //changePage(name, xmlHttp.resposeText);
@@ -168,5 +173,5 @@
 function buildPage(name, text, oldz, dz)
 {
-    var fname = dz==0 ? "fact" : $("table"+oldz).getAttribute("data-file");
+    var fname = dz==0 ? "fact" : $("table"+oldz).pageName;//getAttribute("data-file");
 
     var z = oldz + dz;
@@ -264,6 +269,8 @@
     sp2.id = "rdot" +z;
     sp1.setAttribute("style", "font-size:large;");
-    sp0.setAttribute("data-color", "3");
-    sp2.setAttribute("data-color", "3");
+    //sp0.setAttribute("data-color", "3");
+    //sp2.setAttribute("data-color", "3");
+    sp0.dotColor = 3;
+    sp2.dotColor = 3;
     sp0.appendChild($txt(" \u2022 "));
     sp1.appendChild($txt(title));
@@ -459,7 +466,10 @@
             canv.height = "1";
             //canv.onclick = function () { save(); }
-            canv.setAttribute("data-type", check[0]);
-            canv.setAttribute("data-file", data[0]);
-            canv.setAttribute("data-data", cols[1].substring(check[0].length+data[0].length+2));
+            //canv.setAttribute("data-type", check[0]);
+            //canv.setAttribute("data-file", data[0]);
+            //canv.setAttribute("data-data", cols[1].substring(check[0].length+data[0].length+2));
+            canv.dataType = check[0];
+            canv.fileName = data[0];
+            canv.dataUnit = htmlDecode(cols[1].substring(check[0].length+data[0].length+2));
 //            canv.setAttribute("style", "display:none;");
             td.appendChild(canv);
@@ -478,11 +488,15 @@
         tr.setAttribute("class", "row");
 
-        var cols0 = cols[0];
         if (valid(cols[0]))
-            tr.onclick = function () { this.style.background='#ccb'; loadPage(cols0, z, -1); };
-
-        var cols3 = cols[3];
+        {
+            tr.linkName = cols[0];
+            tr.onclick = function () { this.style.background='#ccb'; loadPage(this.linkName, z, -1); };
+        }
+
         if (valid(cols[3]))
-            tr.onclick = function () { this.style.background='#cbb'; loadPage(cols3, z, +1); };
+        {
+            tr.linkName = cols[3];
+            tr.onclick = function () { this.style.background='#cbb'; loadPage(this.linkName, z, +1); };
+        }
 
         var td0 = $new("td");
@@ -554,5 +568,6 @@
             {
                 cell2.id = "data"+z+"-"+counter;
-                cell2.setAttribute("data-form",  cols[2]);
+                //cell2.setAttribute("data-form",  cols[2]);
+                cell2.dataFormat = cols[2];
                 cell2.appendChild($txt("---"));
                 counter++;
@@ -643,5 +658,5 @@
     // ==================================================================
 
-    table.setAttribute("data-file", name);
+    table.pageName = name;//setAttribute("data-file", name);
     doresize(z);
 }
@@ -668,11 +683,12 @@
     // ===========================================
 
-    var fixedw = $("body").getAttribute("data-width");
-    var fixedh = $("body").getAttribute("data-height");
+    var fixedw = $("body").displayFixedWidth;//getAttribute("data-width");
+    var fixedh = $("body").displayFixedHeight;//getAttribute("data-height");
 
     var W = fixedw>0 ? fixedw : window.innerWidth;
     var H = fixedh>0 ? fixedh : window.innerHeight;
 
-    var max = $("body").getAttribute("data-max")=="yes";
+    //var max = $("body").getAttribute("data-max")=="yes";
+    var max = $("body").displayMax;
 
     var ih = max ? W : H - h + parseInt(img.style.height, 10);
@@ -708,5 +724,5 @@
     {
         $("table"+newz).style.left="0px";
-        $("body").setAttribute("data-visible", newz);
+        $("body").visiblePage = newz; //.setAttribute("data-visible", newz);
 
         doresize(0);
@@ -735,7 +751,7 @@
 
     var W = window.innerWidth;
-    if (W==0 || $("body").getAttribute("data-noslide")=="yes")
-    {
-        $("body").setAttribute("data-visible", newz);
+    if (W==0 || $("body").displayNoslide)//$("body").getAttribute("data-noslide")=="yes")
+    {
+        $("body").visiblePage = newz;//setAttribute("data-visible", newz);
         $("body").removeChild($("table"+oldz));
         $("table"+newz).style.left="0px";
@@ -748,5 +764,5 @@
         $("table"+newz).style.left = (-W-1)+"px";
 
-    $("body").setAttribute("data-visible", newz);
+    $("body").visiblePage = newz;//setAttribute("data-visible", newz);
 
     // This is needed on my mobile to ensure that te browser
@@ -807,7 +823,7 @@
 function refresh_text()
 {
-    var z=$("body").getAttribute("data-visible");
-
-    var fname = $("table"+z).getAttribute("data-file");
+    var z=$("body").visiblePage;//getAttribute("data-visible");
+
+    var fname = $("table"+z).pageName;//getAttribute("data-file");
 
     var is_help = fname.substr(0,5)=="help-";
@@ -852,8 +868,8 @@
 function update_text(fname, result)
 {
-    var z=$("body").getAttribute("data-visible");
+    var z=$("body").visiblePage;//getAttribute("data-visible");
     var table = $("table"+z);
 
-    if (table.getAttribute("data-file") != fname)
+    if (table.pageName/*getAttribute("data-file")*/ != fname)
         return;
 
@@ -915,5 +931,5 @@
             continue;
 
-        var form = e.getAttribute("data-form");
+        var form = e.dataFormat;//getAttribute("data-form");
         if (!form)
             continue;
@@ -947,10 +963,10 @@
 function refresh_graphics()
 {
-    var z = $("body").getAttribute("data-visible");
+    var z = $("body").visiblePage;//getAttribute("data-visible");
 
     var canvas = $("canvas"+z);
 
     // Is sliding or no data file defined?
-    var fname = canvas==null ? "" : canvas.getAttribute("data-file");
+    var fname = canvas==null ? "" : canvas.fileName;//getAttribute("data-file");
     if (isSliding() || !valid(fname))
     {
@@ -1065,5 +1081,5 @@
 function beginDrawCam(scale)
 {
-    var z    = $("body").getAttribute("data-visible");
+    var z    = $("body").visiblePage;//getAttribute("data-visible");
     var canv = $("canvas"+z);
 
@@ -1177,5 +1193,5 @@
 function drawCamLegend(canv, data)
 {
-    var unit = htmlDecode(canv.getAttribute("data-data"));
+    var unit = canv.dataUnit;//htmlDecode(canv.getAttribute("data-data"));
 
     var umin = data[1];
@@ -1220,5 +1236,5 @@
 function drawGraph(canv, vals, data)
 {
-    var unit = htmlDecode(canv.getAttribute("data-data"));//.split("/");
+    var unit = canv.dataUnit;//htmlDecode(canv.getAttribute("data-data"));//.split("/");
 
     var umin = vals[1]+unit;
@@ -1329,10 +1345,10 @@
         return;
 
-    var z = $("body").getAttribute("data-visible");
+    var z = $("body").visiblePage;//getAttribute("data-visible");
     var canv = $("canvas"+z);
     if (!canv)
         return;
 
-    var type = canv.getAttribute("data-type");
+    var type = canv.dataType;//getAttribute("data-type");
 
     var ctx = canv.getContext("2d");
@@ -1373,5 +1389,5 @@
 function save()
 {
-    var z = $("body").getAttribute("data-visible");
+    var z = $("body").visiblePage;//getAttribute("data-visible");
 
     var canvas = $("canvas"+z);
