diff -r 57536a4cb500 wiki/htdocs/common/js/common.js
--- a/wiki/htdocs/common/js/common.js	Sun Dec 09 18:16:51 2007 +0100
+++ b/wiki/htdocs/common/js/common.js	Sun Dec 09 19:46:26 2007 +0100
@@ -168,6 +168,7 @@ function show_switch2gui() {
     }
 }
 
+
 function toggleComments() {
     // Toggle visibility of every tag with class == *comment*
     var all = document.getElementsByTagName('*');
@@ -183,6 +184,31 @@ function toggleComments() {
     }
 }
 
+
+function toggle_toggleComments() {
+    // Disable menu item "ToggleComments" if no inline comments exist on a page
+    var all = document.getElementsByTagName('*');
+    var j = 0;
+    for (i = 0; i < all.length; i++){
+        el = all[i];
+        if ( el.className.indexOf('comment') >= 0 ){
+            j++;
+        }
+    }
+    all = document.getElementsByTagName('*');
+    for (i = 0; i < all.length; i++){
+        el = all[i];
+        if ( el.className.indexOf('toggleCommentsButton') >= 0 ){
+            if ( j > 0 ) {
+                el.parentNode.style.display = '';
+            } else {
+                el.parentNode.style.display = 'none';
+            }
+        }
+    }
+}
+
+
 function load() {
     // Do not name this "onload", it does not work with IE :-)
     // TODO: create separate onload for each type of view and set the
@@ -200,6 +226,9 @@ function load() {
     
     // Editor stuff
     show_switch2gui();
+
+    // Disable menu item "ToggleComments" if no inline comments exist
+    toggle_toggleComments();
 }
 
 
