Integration fixes for result panel and initialization

Change-Id: Iab18de4e8268aaac001f6d8fa12a6e74552dfc8f
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index c08307d..7cfdf3a 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -1359,7 +1359,6 @@
     expect(function () {
       vcClass.create().fromJson(kq)
     }).toThrow(new Error("Unknown value type: string"));
-
   });
 
 
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index f7a136c..21887f3 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -116,7 +116,7 @@
     var matchCount = 0;
 
     for (matchCount = 0; matchCount < inactiveLi.length; matchCount++) {
-      inactiveLi[i].addEventListener('click', function (e) {
+      inactiveLi[matchCount].addEventListener('click', function (e) {
         if (this._match !== undefined)
           this._match.open();
         else {
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index d3eef46..bee0409 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -16,13 +16,13 @@
   loc.SHOW_KQ      = loc.SHOW_KQ      || 'show KoralQuery';
   
   return {
-    create : function (show) {
-      return Object.create(panelClass)._init(['result']).upgradeTo(this)._init(show);
+    create : function (opened) {
+      return Object.create(panelClass)._init(['result']).upgradeTo(this)._init(opened);
     },
 
     // Initialize panel
-    _init : function (show) {
-
+    _init : function (opened) {
+      this._opened = opened;
       return this;
     },
 
@@ -45,15 +45,15 @@
 
         // On close, remove session info on KQ
         this._kq.onClose = function () {
-          delete show['kq'];
+          this._opened['kq'] = undefined;
         };
 
-        show['kq'] = true;
+        this._opened['kq'] = true;
         this.add(this._kq);
       });
 
       // Show KoralQuery in case it's meant to be shown
-      if (show['kq'])
+      if (this._opened['kq'])
         kqButton.click();
     },