--- popups.css
+++ popups.css
@@ -9,7 +9,7 @@
   top: 0;
 }
 #popups-loading {
-  z-index: 10;  
+  z-index: 11;
   opacity: 0.75;
   position: relative;
 }  
diff --git a/sites/all/modules/contrib/popups/popups.js b/sites/all/modules/contrib/popups/popups.js
index 044f205..b581f37 100644
--- popups.js
+++ popups.js
@@ -316,7 +316,7 @@ Drupal.popups.openPath = function(element, options) {
   var href = options.href ? options.href : element.href;
   $(document).trigger('popups_open_path', [element, href]); // Broadcast "Popups Open Path" event.
   
-  var params = {}; 
+  var params = {'popups_header': 'json/popups'};
   // Force the popups to return back to the orignal page when forms are done, unless forceReturn option is set.
   if (!options.forceReturn) { // If forceReturn, requestor wants data from different page.
     href = href.replace(/destination=[^;&]*[;&]?/, ''); // Strip out any existing destination param.
@@ -327,7 +327,6 @@ Drupal.popups.openPath = function(element, options) {
     url: href,
     dataType: 'json',
     data: params,
-    beforeSend: Drupal.popups.beforeSend,
     success: function(json) { 
       Drupal.popups.openContent(json.title, json.messages + json.content, options, element);
       $(document).trigger('popups_open_path_done', [element, href]); // Broadcast "Popups Open Path Done" event.
@@ -379,7 +378,6 @@ Drupal.popups.openContent = function(title, content, options, element) {
   $form.ajaxForm({   
     dataType: 'json',   
     beforeSubmit: Drupal.popups.beforeSubmit,
-    beforeSend: Drupal.popups.beforeSend,
     success: function(response, status) {
       Drupal.popups.formSuccess(response, options, element);
     },
@@ -389,15 +387,10 @@ Drupal.popups.openContent = function(title, content, options, element) {
   });
 };
 
-Drupal.popups.beforeSend = function(xhr) {
-  xhr.setRequestHeader("X-Drupal-Render-Mode", 'json/popups');
-};
-
 /**
  * Do before the form in the popups is submitted.
  */
 Drupal.popups.beforeSubmit = function(formData, $form, options) {
-  Drupal.popups.removePopup(); // Remove just the dialog, but not the overlay.
   Drupal.popups.addLoading();
 };
 
@@ -418,6 +411,9 @@ Drupal.popups.beforeSubmit = function(formData, $form, options) {
  *   A DOM object containing the element that was clicked to initiate the popup. 
  */
 Drupal.popups.formSuccess = function(data, options, element) {  
+  if (typeof data == 'string') {
+    data = eval('(' + data + ')');
+  }
   // Determine if we are at an end point, or just moving from one popups to another.
   var done = (data.path === Drupal.settings.popups.originalPath) || (data.path === options.forceReturn);
   if (!done) { // Not done yet, so show new page in new popups.
@@ -480,6 +476,7 @@ Drupal.popups.formSuccess = function(data, options, element) {
               
       // Done with changes to the original page, remove effects.
       Drupal.popups.removeLoading();
+      Drupal.popups.removePopup(); // Remove just the dialog, but not the overlay.
       if (!showMessage) { 
         // If there is not a messages popups, so remove the overlay.
         Drupal.popups.removeOverlay();
@@ -506,7 +503,6 @@ Drupal.popups.savePage = function(element, options) {
   var ajaxOptions = {
     dataType: 'json',
     beforeSubmit: Drupal.popups.beforeSubmit,   
-    beforeSend: Drupal.popups.beforeSend,
     success: function(response, status) { 
       // Sync up the current page contents with the submit.
       var $c = $(target).html(response.content); // Inject the new content into the page.
diff --git a/sites/all/modules/contrib/popups/popups.module b/sites/all/modules/contrib/popups/popups.module
index 3dba96f..72793b3 100644
--- popups.module
+++ popups.module
@@ -64,8 +64,8 @@ function popups_init() {
   }  
   
   $render_mode = '';
-  if (isset($_SERVER['HTTP_X_DRUPAL_RENDER_MODE'])) {
-    $render_mode = $_SERVER['HTTP_X_DRUPAL_RENDER_MODE'];
+  if (isset($_REQUEST['popups_header'])) {
+    $render_mode = $_REQUEST['popups_header'];
   }
   
   // Check and see if the page_override param is in the URL.
@@ -158,12 +158,25 @@ function popups_form_alter(&$form, $form_state, $form_id) {
  */
 function popups_render_as_json($content) { 
   $path = $_GET['q']; // Get current path from params.
-  return drupal_json(array(
+  $xhr = $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
+  $output = '';
+
+  if (!$xhr) {
+    $output .= "<textarea>\n";
+  }
+
+  $output .= drupal_to_js(array(
     'title' => drupal_get_title(),
     'messages' => theme('status_messages'),
     'path' => $path,
     'content' => $content,
   ));
+
+  if (!$xhr) {
+    $output .= "</textarea>\n";
+  }
+
+  return $output;
 }
 
 /**
