diff --git a/gui/html/chronoshare-navigation.js b/gui/html/chronoshare-navigation.js
index 8856ec0..8fdd12b 100644
--- a/gui/html/chronoshare-navigation.js
+++ b/gui/html/chronoshare-navigation.js
@@ -1,83 +1,81 @@
 var CHRONOSHARE;
 
 var PAGE; // no default page anymore (no reason to have)
-var PARAMS = [ ];
+var PARAMS = [];
 var URIPARAMS = "";
 
-function nav_anchor (aurl) {
-    aurl = aurl.split('#');
-    if (aurl[1])
-    {
-        aurl_split = aurl[1].split ('&');
-        page = aurl_split[0];
+function nav_anchor(aurl)
+{
+  aurl = aurl.split('#');
+  if (aurl[1]) {
+    aurl_split = aurl[1].split('&');
+    page = aurl_split[0];
 
-        vars = [ ];
-        for (var i = 1; i < aurl_split.length; i++)
-        {
-            hash = aurl_split[i].split('=');
-            vars.push(hash[0]);
-            // there is strange double-encoding problem...
-            vars[hash[0]] = decodeURIComponent (decodeURIComponent (hash[1]));
-        }
-
-        // if (page != PAGE)
-        // {
-        //     PAGE = page;
-        //     PARAMS = vars;
-        //     URIPARAMS = aurl[1];
-
-        //     if (CHRONOSHARE) {
-        //         CHRONOSHARE.run ();
-        //     }
-        // }
-        // else if (aurl[1] != URIPARAMS)
-        // {
-        //     PARAMS = vars;
-        //     URIPARAMS = aurl[1];
-
-        //     if (CHRONOSHARE) {
-        //         CHRONOSHARE.run ();
-        //     }
-        // }
-
-        // this way we can reload by just clicking on the same link
-        PAGE = page;
-        PARAMS = vars;
-        URIPARAMS = aurl[1];
-
-        if (CHRONOSHARE) {
-            CHRONOSHARE.run ();
-        }
+    vars = [];
+    for (var i = 1; i < aurl_split.length; i++) {
+      hash = aurl_split[i].split('=');
+      vars.push(hash[0]);
+      // there is strange double-encoding problem...
+      vars[hash[0]] = decodeURIComponent(decodeURIComponent(hash[1]));
     }
+
+    // if (page != PAGE)
+    // {
+    //     PAGE = page;
+    //     PARAMS = vars;
+    //     URIPARAMS = aurl[1];
+
+    //     if (CHRONOSHARE) {
+    //         CHRONOSHARE.run ();
+    //     }
+    // }
+    // else if (aurl[1] != URIPARAMS)
+    // {
+    //     PARAMS = vars;
+    //     URIPARAMS = aurl[1];
+
+    //     if (CHRONOSHARE) {
+    //         CHRONOSHARE.run ();
+    //     }
+    // }
+
+    // this way we can reload by just clicking on the same link
+    PAGE = page;
+    PARAMS = vars;
+    URIPARAMS = aurl[1];
+
+    if (CHRONOSHARE) {
+      CHRONOSHARE.run();
+    }
+  }
 }
 
-$(document).ready (function () {
-    nav_anchor (window.location.href);
+$(document).ready(function() {
+  nav_anchor(window.location.href);
 
-    if (!PARAMS.user || !PARAMS.folder)
-    {
-        $("#error").html ("user and folder must be be specified in the URL");
-        $("#error").removeClass ("hidden");
-        return;
-    }
-    else {
-        // update in-page URLs
-        $(".needs-get-url").each (function (index,element) {
-            this.href += "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user))
-                + "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder));
-        });
-        $(".needs-get-url").removeClass ("needs-get-url");
-    }
-
-    CHRONOSHARE = new ChronoShare (PARAMS.user, PARAMS.folder);
-    CHRONOSHARE.run ();
-
-    $(window).on('hashchange', function() {
-        nav_anchor (window.location.href);
+  if (!PARAMS.user || !PARAMS.folder) {
+    $("#error").html("user and folder must be be specified in the URL");
+    $("#error").removeClass("hidden");
+    return;
+  }
+  else {
+    // update in-page URLs
+    $(".needs-get-url").each(function(index, element) {
+      this.href +=
+        "&user=" + encodeURIComponent(encodeURIComponent(PARAMS.user)) +
+        "&folder=" + encodeURIComponent(encodeURIComponent(PARAMS.folder));
     });
+    $(".needs-get-url").removeClass("needs-get-url");
+  }
 
-    $("#reload-button").click (function() {
-        nav_anchor (window.location.href);
-    });
+  CHRONOSHARE = new ChronoShare(PARAMS.user, PARAMS.folder);
+  CHRONOSHARE.run();
+
+  $(window).on('hashchange', function() {
+    nav_anchor(window.location.href);
+  });
+
+  $("#reload-button").click(function() {
+    nav_anchor(window.location.href);
+  });
 });
-
