--- popups/popups.js	2008-11-20 16:18:57.000000000 -0500
+++ /var/www/modules/popups/popups.js	2009-03-03 08:43:03.000000000 -0500
@@ -1,4 +1,4 @@
-// $Id: popups.js,v 1.9.2.18 2008/11/20 21:18:57 starbow Exp $
+// $Id: popups.js,v 1.2 2009/03/02 20:34:26 gsally Exp $
 
 /**
  * Popup Modal Dialog API
@@ -46,6 +46,7 @@
   }
   
   Drupal.popups.attach(context, '.popups', {noUpdate: true});  
+  Drupal.popups.attach(context, '.popups-view-pagers', {noUpdate: true});
   Drupal.popups.attach(context, '.popups-form', {}); // ajax reload.
   Drupal.popups.attach(context, '.popups-form-reload', {reloadWhenDone: true}); // whole page reload. 
   Drupal.popups.attach(context, '.popups-form-noupdate', {noUpdate: true});  // no reload at all.
@@ -63,10 +64,17 @@
  */
 Drupal.popups.attach = function(context, selector, options) {
   $(selector, context).not('.popups-processed').each(function() {
+	
+	// special processing this sort of pager item, as it won't be processed
+	if (selector == '.popups-view-pagers' && $(this).parents("#popups-body").length == 0) {
+		return true;	
+	}
+	
+	
     var $element = $(this);
     // Mark the element as attached.    
     var title = $element.attr('title') || '';
-    $element.attr('title', title + Drupal.t('[Popup]')); // Append note to link title.
+    $element.attr('title', title + Drupal.t(' [Popup Window]')); // Append note to link title.
     $element.addClass('popups-processed');
     
     // Attach the on-click popup behavior to the element.
@@ -74,10 +82,10 @@
       var element = this;
 
       // If element is inside of a #popup div, show alert and bail out. 
-      if ($(element).parents('#popups').length) { 
-        alert("Sorry, popup chaining is not supported (yet).");
-        return false;
-      }
+//      if ($(element).parents('#popups').length) { 
+//        alert("Sorry, popup chaining is not supported (yet).");
+//        return false;
+//      }
 
       // If the element contains a on-popups-options attribute, use it instead of options param.
       if ($(element).attr('on-popups-options')) {
@@ -110,6 +118,17 @@
  */
 Drupal.popups.open = function(title, body, buttons, width) {
   Drupal.popups.addOverlay(); // TODO - nonModal option.
+
+  // if there's a popup on the page, replace the contents
+  if ($('#popups').length) {
+	  $('#popups-body').html(body);
+	   this.refocus(); // TODO: capture the focus when it leaves the dialog.
+	   Drupal.popups.removeLoading(); // Remove the loading img.
+	   $('#popups-close').click( Drupal.popups.close );
+	   $('a.popups-close').click( Drupal.popups.close );	   
+	   return false;
+  }
+  else { 
   var $popups = $(Drupal.theme('popupDialog', title, body, buttons));
   // Start with dialog off the side. Making it invisible causes flash in FF2.
   $popups.css('left', '-9999px');
@@ -117,6 +136,7 @@
     $popups.css('width', width);
   }
   $('body').append( $popups ); // Add the popups to the DOM.
+  }
 
   // Adding button functions
   if (buttons) {
