--- popups.css
+++ popups.css
@@ -9,7 +9,7 @@
   top: 0;
 }
 #popups-loading {
-  z-index: 10;  
+  z-index: 11;
   opacity: 0.75;
   position: relative;
 }  
--- 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,7 @@ Drupal.popups.openContent = function(title, content, options, element) {
   $form.ajaxForm({   
     dataType: 'json',   
     beforeSubmit: Drupal.popups.beforeSubmit,
-    beforeSend: Drupal.popups.beforeSend,
+    iframe: true,
     success: function(response, status) {
       Drupal.popups.formSuccess(response, options, element);
     },
@@ -389,15 +388,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,10 +412,14 @@ 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.
     Drupal.popups.removeLoading();
+    Drupal.popups.removePopup();
     Drupal.popups.openContent(data.title, data.messages + data.content, options, element);
   }
   else { // Done.
@@ -480,6 +478,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 +505,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..3d52957 100644
--- popups.module
+++ popups.module
@@ -64,30 +64,17 @@ function popups_init() {
   }  
   
   $render_mode = '';
-  if (isset($_SERVER['HTTP_X_DRUPAL_RENDER_MODE'])) {
-    $render_mode = $_SERVER['HTTP_X_DRUPAL_RENDER_MODE'];
-  }
-  
-  // Check and see if the page_override param is in the URL.
-  // Note - the magic happens here.
-  // Need to cache the page_override flag in the session, so it will effect
-  // the results page that follows a form submission.
-  if ($render_mode == 'json/popups') {
-    $_SESSION['page_override'] = TRUE;
+  if (isset($_REQUEST['popups_header'])) {
+    $render_mode = $_REQUEST['popups_header'];
   }
 
   // Move the page_override flag back out of the session.
-  if (isset($_SESSION['page_override'])) {
+  if ($render_mode == 'json/popups') {
     // This call will not return on form submission.
     $content = menu_execute_active_handler();
     
-    // The call did return, so it wasn't a form request, 
-    // so we are returning a result, so clear the session flag.
-    $override = $_SESSION['page_override'];
-    unset($_SESSION['page_override']);
-       
     // Menu status constants are integers; page content is a string.
-    if (isset($content) && !is_int($content) && isset($override)) {
+    if (isset($content) && !is_int($content)) {
       print popups_render_as_json($content); 
       exit;  // Do not continue processing request in index.html.
     }    
@@ -158,12 +145,19 @@ 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(
+
+  $output = "<textarea>\n";
+
+  $output .= drupal_to_js(array(
     'title' => drupal_get_title(),
     'messages' => theme('status_messages'),
     'path' => $path,
     'content' => $content,
   ));
+
+  $output .= "</textarea>\n";
+
+  return $output;
 }
 
 /**
