Index: trunk/FACT++/www/smartfact/index.js
===================================================================
--- trunk/FACT++/www/smartfact/index.js	(revision 13924)
+++ trunk/FACT++/www/smartfact/index.js	(revision 13925)
@@ -1,2 +1,4 @@
+"use strict";
+
 var debug = false;
 
@@ -163,7 +165,7 @@
 function $txt(txt) { return document.createTextNode(txt); }
 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 valid(str) { if (str===undefined) 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 htmlDecode(input) { var e = $new('div'); e.innerHTML = input; return e.firstChild==undefined ? input : e.firstChild.nodeValue; }
+function htmlDecode(input) { var e = $new('div'); e.innerHTML = input; return e.firstChild===undefined ? input : e.firstChild.nodeValue; }
 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;"; }
 
@@ -193,5 +195,5 @@
 function onload()
 {
-    try { new XMLHttpRequest(); }
+    try { var dummy = new XMLHttpRequest(); }
     catch(e)
     {
@@ -289,5 +291,5 @@
     var xmlCmd = new XMLHttpRequest();
     xmlCmd.open('POST', uri, true);
-    xmlCmd.onload = function()
+    xmlCmd.onload = function ()
     {
         if (xmlCmd.status!=200)
@@ -356,5 +358,5 @@
 
     var table = $("table"+z);
-    if (table != undefined)
+    if (table)
         $("body").removeChild(table);
 
@@ -427,6 +429,6 @@
     div2.setAttribute("style", "background-position:-396px 50%;");
     div4.setAttribute("style", "display:none;background-position:-12px -12px;");
-    div2.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage(fname,   z, -dz); }
-    div4.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('error', z,  +1); }
+    div2.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage(fname,   z, -dz); }
+    div4.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('error', z,  +1); }
 
     if (name=="fact")
@@ -439,5 +441,5 @@
         div3.setAttribute("class", "icon_white");
         div3.setAttribute("style", "background-position:-575px 50%;");
-        div3.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('fact',  z,  -1); }
+        div3.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('fact',  z,  -1); }
     }
 
@@ -456,10 +458,10 @@
     if (is_cmd)
     {
-        sp1.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(name); this.style.backgroundColor=''; }
+        sp1.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(name); this.style.backgroundColor=''; }
     }
     else
     {
         if (name!='control')
-            sp1.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.15)'; loadPage('control', z, +1); }
+            sp1.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.15)'; loadPage('control', z, +1); }
     }
 
@@ -468,5 +470,5 @@
     div1.appendChild($txt("---"));
 
-    div1.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; sendCommand('stop'); this.style.backgroundColor=''; }
+    div1.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; sendCommand('stop'); this.style.backgroundColor=''; }
 
     htd0.appendChild(sp0);
@@ -535,13 +537,13 @@
     fdiv3.setAttribute("class", "icon_white");
     fdiv2.setAttribute("style", "background-position:-72px 50%;");
-    fdiv2.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; sendCommand('stop'); this.style.backgroundColor=''; }
+    fdiv2.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; sendCommand('stop'); this.style.backgroundColor=''; }
     if (is_cmd)
     {
-        fdiv3.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(name); this.style.backgroundColor=''; }
+        fdiv3.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(name); this.style.backgroundColor=''; }
         fdiv3.setAttribute("style", "background-position:-109px 50%;");
     }
     else
     {
-        fdiv3.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('control', z,  +1); }
+        fdiv3.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('control', z,  +1); }
         fdiv3.setAttribute("style", "background-position:-288px 50%;");
     }
@@ -557,5 +559,5 @@
         fdivH.setAttribute("class", "icon_white");
         fdivH.setAttribute("style", "background-position:-611px 50%;");
-        fdivH.onclick = function() { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('help-'+name, z, +1); }
+        fdivH.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('help-'+name, z, +1); }
     }
 
@@ -634,5 +636,5 @@
             canv.width = "1";
             canv.height = "1";
-            //canv.onclick = function() { save(); }
+            //canv.onclick = function () { save(); }
             canv.setAttribute("data-type", check[0]);
             canv.setAttribute("data-file", data[0]);
@@ -809,5 +811,5 @@
     var img  = $("image"+z);
     var canv = $("canvas"+z);
-    if (img == undefined || canv == undefined)
+    if (img === undefined || canv === undefined)
         return;
 
@@ -920,5 +922,5 @@
     $("table"+oldz).style.position="fixed";
 
-    intervalSlide = setInterval(function(){doShift(oldz,newz)}, 75);
+    intervalSlide = setInterval(function (){doShift(oldz,newz);}, 75);
 }
 
@@ -1077,9 +1079,9 @@
 
         var e = $("data"+z+"-"+line);
-        if (e == undefined)
+        if (e === undefined)
             continue;
 
         var form = e.getAttribute("data-form");
-        if (form==undefined)
+        if (form===undefined)
             continue;
 
@@ -1127,5 +1129,5 @@
     var xmlGfx = new XMLHttpRequest();
     xmlGfx.open('POST', "data/"+fname, true);
-    xmlGfx.onload = function()
+    xmlGfx.onload = function ()
     {
         if (xmlGfx.status!=200)
@@ -1247,5 +1249,5 @@
  * @constructor
  */
-function position(s, ring, i)
+function Position(s, ring, i)
 {
     switch (s)
@@ -1258,5 +1260,5 @@
     case 0: this.x =  ring*0.5 + i*0.5;  this.y = -ring + i; break;
     }
-    this.d = function() { return this.x*this.x + this.y*this.y*3/4; }
+    this.d = (function () { return this.x*this.x + this.y*this.y*3/4; })
 }
 
@@ -1287,5 +1289,5 @@
             for (var i=1; i<=ring; i++)
             {
-                var pos = new position(s, ring, i);
+                var pos = new Position(s, ring, i);
                 if (pos.d() - pos.x > 395.75)
                     continue;
@@ -1320,5 +1322,5 @@
             for (var i=1; i<=ring; i++)
             {
-                var pos = new position(s, ring, i);
+                var pos = new Position(s, ring, i);
                 if (pos.d() > 44)
                     continue;
@@ -1496,5 +1498,5 @@
     var z = $("body").getAttribute("data-visible");
     var canv = $("canvas"+z);
-    if (canv == undefined)
+    if (canv === undefined)
         return;
 
