diff --git a/src/main/webapp/xnat-templates/navigations/HeaderIncludes.vm b/src/main/webapp/xnat-templates/navigations/HeaderIncludes.vm
index 9b6ebd7fb3c2371b1eca7212ce49325c740b8ead..9368f855816a9f23c9138b4ca2c45f6bc0bc5d9e 100755
--- a/src/main/webapp/xnat-templates/navigations/HeaderIncludes.vm
+++ b/src/main/webapp/xnat-templates/navigations/HeaderIncludes.vm
@@ -21,7 +21,6 @@
 <!-- set global vars that are used often -->
 <script type="text/javascript">
 
-    var XNAT = {};
     var serverRoot = "$content.getURI('')";
     var csrfToken = "$!data.getSession().getAttribute("XNAT_CSRF")";
     var showReason = typeof $showReason != 'undefined' ? $showReason : null;
diff --git a/src/main/webapp/xnat-templates/navigations/htmlOpen.vm b/src/main/webapp/xnat-templates/navigations/htmlOpen.vm
index fca32d7e51edcf48c19d485d2077fa1399c736ea..1e874a5dded171926a5181a4ee804f6e97f40cb1 100644
--- a/src/main/webapp/xnat-templates/navigations/htmlOpen.vm
+++ b/src/main/webapp/xnat-templates/navigations/htmlOpen.vm
@@ -8,17 +8,15 @@
 ##<!-- the "no-js" class is for Modernizr - are we even using that? -->
 
 <head>
-#if ($themedRedirect) <!-- Reload the appropriate page if a global theme style specifies a redirect -->
-    <script type="text/javascript">
-        window.location = "$content.getURI("")$themedRedirect";
-    </script>
-#end
-
-#if ($theme)
-    <script type="text/javascript">
-        XNAT.theme = "$theme";
-    </script>
-#end
+<script type="text/javascript">
+    var XNAT = {};
+    #if ($themedRedirect) <!-- Reload the appropriate page if a global theme style specifies a redirect -->
+    window.location = "$content.getURI("")$themedRedirect";
+    #end
+    #if ($theme)
+    XNAT.theme = "$theme";
+    #end
+</script>
 
 <!-- path: xnat-templates/navigations/htmlOpen -->
     <title>$!systemName</title>