Index: /trunk/FACT++/www/index.js
===================================================================
--- /trunk/FACT++/www/index.js	(revision 13664)
+++ /trunk/FACT++/www/index.js	(revision 13665)
@@ -242,4 +242,40 @@
 }
 
+function sendCommand(command, debug)
+{
+    var uri = "index.php?";
+    if (debug==true)
+        uri += "debug&";
+    uri += command;
+
+    var xmlCmd = new XMLHttpRequest();
+    xmlCmd.open('POST', uri, true);
+    xmlCmd.onload = function()
+    {
+        if (xmlCmd.status!=200)
+        {
+            alert("ERROR[1] - HTTP request: "+xmlCmd.statusText+" ["+xmlCmd.status+"]");
+            return;
+        }
+
+        if (xmlCmd.responseText.length==0)
+        {
+            alert("No proper acknowledgment of command execution received.");
+            return;
+        }
+
+        var txt = xmlCmd.responseText.split('\n');
+        switch (txt[0])
+        {
+        case "1": alert("dimctrl unreachable."); break;
+        case "2": /*success*/ break;
+        default: alert("Return code '"+txt[0]+"' unknown."); break;
+        }
+        if (txt.length>1)
+            alert(xmlCmd.responseText);
+    };
+    xmlCmd.send(null);
+}
+
 
 function buildPage(name, text, oldz, dz)
@@ -545,5 +581,16 @@
     var H = window.innerHeight;
 
-    var x = parseInt(img.style.height, 10);
+/*
+    if (W==0 || H==0)
+    {
+        var w = $("table"+z).offsetWidth;
+        img.style.width = w+"px";
+        img.style.height= w+"px";
+
+        canv.width  = w;
+        canv.height = w;
+        return;
+    }
+*/
 
     var ih = H - h + parseInt(img.style.height, 10);
@@ -554,4 +601,13 @@
     canv.width  = W;
     canv.height = ih;
+
+    // ------ debug -----
+    if (debug == true)
+    {
+        $('debug'+z).innerHTML = "";
+        $('debug'+z).innerHTML += "|W="+W +"/"+H;
+        $('debug'+z).innerHTML += "|H="+h+"/"+$("table"+z).offsetHeight+"/"+img.offsetHeight;
+        $('debug'+z).innerHTML += "|I="+img.style.height+"+"+H+"-"+h;
+    }
 
     if ($("table"+z).offsetHeight == H || cnt==2)
