Index: misc/drupal.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.js,v
retrieving revision 1.40
diff -u -r1.40 drupal.js
--- misc/drupal.js	5 Oct 2007 09:35:08 -0000	1.40
+++ misc/drupal.js	20 Nov 2007 21:42:46 -0000
@@ -273,3 +273,26 @@
     return '<em>' + Drupal.checkPlain(str) + '</em>';
   }
 };
+
+/*
+ *  Called when there is unsaved data on the page
+ *  to warn users leaving (or reloading) page that they would lose their changes.
+ *  onbeforeunload works in FF, IE and Safari, but not in Opera (yet).
+ *  The form of the dialog is controlled by the browers:
+ *  
+ *  Are you sure you want to navigate away from this page?
+ *  Your message here
+ *  Press OK to continue, or Cancel to stay on the current page.
+ */
+Drupal.markPageUnsaved = function(msg) {
+  if(!msg) {
+    msg = Drupal.t("If you continue your unsaved changes will be lost.");
+  }
+  window.onbeforeunload  = function(event) { return msg; };
+  // remove warning if user is clicking a submit or image button.
+  $(':submit,input:image').click( function() {
+    window.onbeforeunload = null;
+  });
+};
+
+
Index: modules/block/block.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.js,v
retrieving revision 1.1
diff -u -r1.1 block.js
--- modules/block/block.js	14 Nov 2007 09:49:30 -0000	1.1
+++ modules/block/block.js	20 Nov 2007 21:42:46 -0000
@@ -17,6 +17,7 @@
 
   // A custom message for the blocks page specifically.
   Drupal.theme.tableDragChangedWarning = function () {
+    Drupal.markPageUnsaved(); //add warning popup to all links
     return '<div class="warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t("The changes to these blocks will not be saved until the <em>Save blocks</em> button is clicked.") + '</div>';
   };
 
