diff -urp old/fbssc/fbssc.css new/fbssc/fbssc.css
--- old/fbssc/fbssc.css	2010-03-19 04:09:52.000000000 +0100
+++ new/fbssc/fbssc.css	2010-10-22 03:40:46.924657788 +0200
@@ -4,14 +4,18 @@
   padding: 0.75em;
 }
 
+.fbssc_form {
+  display: none;
+}
+
 .fbssc_comment {
   border-bottom: 1px solid #E0E0E0;
   margin: 0.5em 0;
   padding: 0.5em 0.25em 0.75em;
+  text-align: left;
 }
 
 .fbssc .first {
-  margin: 0 0 0.5em;
   padding: 0.25em 0.25em 0.75em;
 }
 
@@ -58,22 +62,29 @@
 /* The "Comment" link. */
 .fbssc_show_comment_form {
   display: inline;
-  font-size: 90%;
+  font-size: 10px;
   margin-left: 0.5em;
 }
 .fbssc_show_comment_form_inner {
   display: inline;
-  font-size: 90%;
+  font-size: 10px;
   margin-left: 2.25em;
 }
 
+.fbssc_overlap {
+  float: right;
+}
+
 /* The "Show all comments" link. */
 .fbssc_show_comments_link {
   border-bottom :1px solid #E0E0E0;
   display: block;
   font-size: 90%;
   padding-bottom: 0.5em;
+  text-align: left;
 }
 
 /* The "Show all comments" link when it expands instead of redirecting. */
-.fbssc_show_comments {}
\ No newline at end of file
+.fbssc_show_comments {
+  
+}
\ No newline at end of file
diff -urp old/fbssc/fbssc.js new/fbssc/fbssc.js
--- old/fbssc/fbssc.js	2010-03-19 03:52:25.000000000 +0100
+++ new/fbssc/fbssc.js	2010-10-24 13:29:19.793447920 +0200
@@ -1,18 +1,62 @@
 // $Id$
+function addCommentBehavior(element) {
+    var commentForm = $('div#'+ element.id).parent().find('.fbssc_form');
+    $('.fbssc_form').each(function() {
+        $(this).hide();
+    });
+    commentForm.show();
+    if(typeof($.scrollTo) != "undefined") {
+      $.scrollTo(commentForm, 'slow',  {offset : { top: -200}});
+    }
+}
+
+function refreshCommentForm(sid) {
+    Popups.restorePage();
+    var refreshId = '#' + $('#fbssc_replace_' + sid +' input.form-submit').attr('id');
+    var buildId = $(refreshId).parents('form').find('input[name=form_build_id]').val();
+    var token = $(refreshId).parents('form').find('input[name=form_token]').val();
+    // Fake a comment submission to retrieve updated form state
+    $.ajax({
+      type: 'POST',
+      url: 'fbssc/js/refresh',
+      data: { 'form_build_id': buildId, 'form_token' : token, 'form_id' : 'fbssc_box', 'op' : '' },
+      success: function(response, status) {
+       if(status) {
+         // Attach updated comments and behaviors
+         response = Drupal.parseJson(response);
+         var new_content = $('<div></div>').html(response.data);
+         new_content = $(new_content).find('.fbssc');
+         $('#fbssc_replace_' + sid + ' .fbssc').replaceWith(new_content);
+         Drupal.attachBehaviors($('#fbssc_replace_' + sid).parents('form'));
+         // CSS fix when comments count pass from 4 (folded) to 3 (list all)
+         if ($('#fbssc_replace_' + sid + ' #fbssc_comment_toggle_' + sid).length == 0) {
+           $('#fbssc_toggle_' + sid).removeClass("fbssc_overlap");
+         }
+       }
+      }
+    });
+}
+
+
 Drupal.behaviors.fbssc = function (context) {
-  $('.fbssc_show_comment_form').one('click', function() {
-    $(this).hide();
-    $('#'+ this.id +' + div').show();
+  $('.fbssc_show_comment_form').click( function() {
+    addCommentBehavior(this);
     return false;
   });
-  $('.fbssc_show_comment_form_inner').one('click', function() {
-    $(this).hide();
-    $('#'+ this.id +' + div').show();
+  $('.fbssc_show_comment_form_inner').click( function() {
+    addCommentBehavior(this);
     return false;
   });
-  $('a.fbssc_show_comments').one('click', function() {
-    $(this).hide();
-    $('#'+ this.id +' ~ div.fbssc_hide').show();
+  $('a.fbssc_show_comments').click( function() {
+    if(typeof ($(this).attr('oldText')) != "undefined" &&
+       $(this).attr('oldText') != '') {
+      $(this).html($(this).attr('oldText'));
+      $(this).attr('oldText', '');
+    } else {
+      $(this).attr('oldText', $(this).html());
+      $(this).html(Drupal.t('Hide'));
+    }
+    $('#'+ this.id +' ~ div.fbssc_hide').toggle();
     return false;
   });
 }
\ No newline at end of file
diff -urp old/fbssc/fbssc.module new/fbssc/fbssc.module
--- old/fbssc/fbssc.module	2010-06-05 17:49:30.000000000 +0200
+++ new/fbssc/fbssc.module	2010-10-24 14:56:08.648287039 +0200
@@ -12,7 +12,6 @@
  *       + userpoints
  *       + devel generate
  *       + appbar
- *       + popups api
  *       + sms framework
  *       + views bulk operations
  *   - Document API and add README.txt.
@@ -63,6 +62,13 @@ function fbssc_menu() {
     'access arguments' => array('post status comment'),
     'type' => MENU_CALLBACK,
   );
+  $items['fbssc/popup/%'] = array(
+    'title' => 'Perform fbssc updates using popups',
+    'page callback' => 'fbssc_update_js',
+    'page arguments' => array(2),
+    'access arguments' => array('post status comment'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -76,6 +82,29 @@ function fbssc_user($op, &$edit, &$accou
 }
 
 /**
+ * Implementation of hook_form alter().
+ */
+function fbssc_form_alter(&$form, $form_state, $form_id) {
+  switch ($form_id) {
+    case "fbssc_edit" :
+    case "fbssc_delete" :
+    	if(module_exists("popups")) {
+	    	// Redefine "Undo" action
+	      unset($form['back']);
+	      $form['actions']['cancel']['#value'] = "<a class='popups-cancel' href='#' onclick='Popups.close(); return false;'>".t('Undo')."</a>";
+	      // Add comment sid to url
+	      if(!empty($form['#cid'])) {
+	        $suffix = "/".$form['#parameters'][2]->sid;
+	      }
+	      // Hijack destination toward fbssc popups handler
+	      $form['#action'] = substr($form['#action'], 0, strpos($form['#action'], "?destination"));
+	      $form['#action'] .= "?destination=fbssc/popup".$suffix;
+    	}
+      break;
+  }
+}
+
+/**
  * Implementation of hook_perm().
  */
 function fbssc_perm() {
@@ -144,29 +173,41 @@ function theme_fbssc_item($comment, $cla
   array_unshift($classes, 'fbssc_comment');
   $classes = implode(' ', $classes);
   $output = '<div class="'. $classes .'">';
-  $output .= '<div class="fbssc_author">'. theme('username', user_load(array('uid' => $comment->uid))) .'</div>';
+  $owner = user_load(array('uid' => $comment->uid));
+  $output .= '<div class="fbssc_author"><span>'. theme('user_picture', $owner).theme('username', $owner) .'</span></div>';
   $comment_text = _facebook_status_run_filter($comment->comment);
   $comment_text = nl2br($comment_text);
   $output .= '<div class="fbssc_text">'. $comment_text .'</div>';
   $output .= '<div class="fbssc_closure">';
   $output .= '<span class="fbssc_time">'. theme('facebook_status_time', $comment->comment_time) .'</span>';
-  $q = $_GET['q'];
-  if ($destination) {
-    $q = $destination;
-  }
-  elseif (strpos($q, 'fbssc/js') !== FALSE) {
-    $q = '<front>';
-  }
-  if (fbssc_can_edit($comment)) {
-    $output .= '<span class="fbssc_edit_delete">'.
-      l(t('Edit'), 'statuses/comment/'. $comment->cid .'/edit', array('query' => array('destination' => $q)))
-      .'</span>';
-  }
-  if (fbssc_can_delete($comment)) {
-    $output .= '<span class="fbssc_edit_delete">'.
-      l(t('Delete'), 'statuses/comment/'. $comment->cid .'/delete', array('query' => array('destination' => $q)))
-      .'</span>';
-  }
+
+  if (module_exists("popups")) {
+	  if (fbssc_can_edit($comment)) {
+	    $output .= "<span><a class='fbssc_edit_delete popups' href='#' on-popups-options= \"{'href': '".base_path().'statuses/comment/'. $comment->cid .'/edit'."', 'updateMethod':'reload'}\">".t("Edit")."</a></span>";
+	  }
+	  if (fbssc_can_delete($comment)) {
+	    $output .= "<span><a class='fbssc_edit_delete popups' href='#' on-popups-options= \"{'href': '".base_path().'statuses/comment/'. $comment->cid .'/delete'."', 'updateMethod':'reload'}\">".t("Delete")."</a></span>";
+	  }
+  } else {
+    $q = $_GET['q'];
+	  if ($destination) {
+	    $q = $destination;
+	  }
+	  elseif (strpos($q, 'fbssc/js') !== FALSE) {
+	    $q = '<front>';
+	  }
+	  if (fbssc_can_edit($comment)) {
+	    $output .= '<span class="fbssc_edit_delete">'.
+	      l(t('Edit'), 'statuses/comment/'. $comment->cid .'/edit', array('query' => array('destination' => $q)))
+	      .'</span>';
+	  }
+	  if (fbssc_can_delete($comment)) {
+	    $output .= '<span class="fbssc_edit_delete">'.
+	      l(t('Delete'), 'statuses/comment/'. $comment->cid .'/delete', array('query' => array('destination' => $q)))
+	      .'</span>';
+	  }
+	}
+  $output .= '<div class="clear-block"></div>';
   $output .= '</div></div>';
   //Invokes hook_fbssc_render_alter(&$output, $comment).
   drupal_alter('fbssc_render', $output, $comment);
@@ -200,7 +241,7 @@ function theme_fbssc_items($comments, $d
   drupal_add_js($path .'/fbssc.js');
   $output = '<div class="fbssc">';
   if ($count > 3 && $delay_load) {
-    $options = array('attributes' => array('class' => 'fbssc_show_comments_link fbssc_show_comments', 'id' => 'fbssc_toggle_'. $comments[0]->sid));
+    $options = array('attributes' => array('class' => 'fbssc_show_comments_link fbssc_show_comments', 'id' => 'fbssc_comment_toggle_'. $comments[0]->sid));
     if ($count > 9) {
       $options['attributes']['class'] = 'fbssc_show_comments_link';
     }
@@ -253,19 +294,18 @@ function theme_fbssc_items($comments, $d
  * @return
  *   Themed HTML for the status form.
  */
-function theme_fbssc_form_display($sid, $delay_load_form = TRUE, $delay_load_comments = TRUE) {
-  if (fbssc_can_post(facebook_status_load($sid))) {
+function theme_fbssc_form_display($sid, $delay_load_form = TRUE, $delay_load_comments = TRUE, $form = NULL) {
+  global $user;
+	if (fbssc_can_post(facebook_status_load($sid)) || user_access('view all status comments', $user)) {
     $path = drupal_get_path('module', 'fbssc');
     drupal_add_js($path .'/fbssc.js');
-    $output = '';
-    if ($delay_load_form && !fbssc_count_comments($sid)) {
-      $output = '<div class="fbssc_show_comment_form" id="fbssc_toggle_'. $sid .'">'.
-        l(t('Comment'), 'statuses/'. $sid, array('attributes' => array('class' => 'fbssc_show_comment_form_link')))
-        .'</div>';
-        return $output .'<div class="fbssc_hide fbssc_form">'. drupal_get_form('fbssc_box', $sid, $delay_load_comments) .'</div>';
+    if($form) {
+    	$output .= drupal_render($form);
+    } else {
+      $output .= drupal_get_form('fbssc_box', $sid, $delay_load_comments);
     }
-    return '<div class="fbssc_form">'. drupal_get_form('fbssc_box', $sid, $delay_load_comments) .'</div>';
   }
+  return $output;
 }
 
 //==============
@@ -496,6 +536,7 @@ function _fbssc_get_thread_author($sid) 
  *   will not be used.
  */
 function fbssc_box($form_state, $sid, $delay_load = TRUE) {
+	static $boxes_count = 0;
   $path = drupal_get_path('module', 'fbssc');
   drupal_add_css($path .'/fbssc.css');
   $form = array();
@@ -506,32 +547,47 @@ function fbssc_box($form_state, $sid, $d
     $form['#qu'] = $form_state['fbssc']['q'];
   }
   $comments = fbssc_get_comments($sid);
-  $form['before'] = array('#value' => '<div id="fbssc_replace_'. $sid .'">');
-  $form['comments'] = array('#value' => theme('fbssc_items', $comments, $delay_load, $form['#qu']));
-  if (count($comments)) {
-    $form['start-hide'] = array('#value' => '<div class="fbssc_show_comment_form_inner" id="fbssc_inner_toggle_'. $sid .'">'.
-      l(t('Comment'), 'statuses/'. $sid, array('attributes' => array('class' => 'fbssc_show_comment_inner_form_link')))
-      .'</div><div class="fbssc_hide fbssc_replace_inner_'. $sid .'">');
-  }
-  $form['status-comment'] = array(
-    '#type' => 'textarea',
-    '#rows' => 1,
-    '#required' => TRUE,
-  );
-  $form['save'] = array(
-    '#type' => 'submit',
-    '#value' => t('Comment'),
-    '#ahah' => array(
-      'path' => 'fbssc/js/refresh',
-      'wrapper' => 'fbssc_replace_'. $sid,
-      'effect' => 'fade',
-      'method' => 'replace',
-    ),
+  $form['replace-start'] = array(
+    '#value' => '<div id="fbssc_replace_'. $sid .'">'
   );
-  if (count($comments)) {
-    $form['end-hide'] = array('#value' => '</div>');
+  if (user_access('post status comment', $GLOBALS['user'])) {
+  	$overlap = count($comments) > 3 ? 'fbssc_overlap' : '';
+  	$form['start-hide'] = array(
+      '#value' => '<div class="fbssc_show_comment_form '.$overlap.'" id="fbssc_toggle_'. $sid .'">'.
+        l(t('Add new comment'), 'statuses/'. $sid, array('attributes' => array('class' => 'fbssc_show_comment_form_link')))
+        .'</div>'
+    );
+  	$form['comments'] = array(
+	    '#value' => theme('fbssc_items', $comments, $delay_load, $form['#qu']),
+	  );
+  	$form['status-comment'] = array(
+	    '#type' => 'textarea',
+	    '#rows' => 1,
+	    '#required' => TRUE,
+	    '#prefix' => '<div class="fbssc_form">'
+	  );
+	  $form['save'] = array(
+	    '#id' => 'save-'.(++$boxes_count),
+	    '#type' => 'submit',
+	    '#value' => t('Comment'),
+	    '#ahah' => array(
+	      'path' => 'fbssc/js/refresh',
+	      'wrapper' => 'fbssc_replace_'. $sid,
+	      'effect' => 'fade',
+	      'method' => 'replace',
+	    ),
+	    '#suffix' => '</div>'
+	  );
+  } else {
+  	// Only show comment list
+  	$form['comments'] = array(
+      '#value' => theme('fbssc_items', $comments, $delay_load, $form['#qu']),
+    );
   }
-  $form['after'] = array('#value' => '</div>');
+  $form['replace-end'] = array(
+    '#value' => '</div>'
+  );
+
   $form['#sid'] = $sid;
   if ($form_state['fbssc']['sid']) {
     $form['#sid'] = $form_state['fbssc']['sid'];
@@ -566,16 +622,48 @@ function fbssc_save_js() {
       'Someone tried to access the JavaScript processing page for Facebook-style Statuses Comments directly.', array(), WATCHDOG_DEBUG);
     return;
   }
+
+  $sid = $form['#sid'];
+  $comments = fbssc_get_comments($sid);
+
   $form_id = array_shift($args);
   drupal_process_form($form_id, $form, $form_state);
   $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
-  //Get HTML for the replacement form. Only these elements will be AHAH-refreshed.
+  // Get HTML for the replacement form. Only these elements will be AHAH-refreshed.
   $new_form['comments']       = $form['comments'];
+  $new_form['start-hide']     = $form['start-hide'];
   $new_form['status-comment'] = $form['status-comment'];
   $new_form['save']           = $form['save'];
-  $output = theme('status_messages') . drupal_render($new_form);
+
+  $output = theme('status_messages');
+  if(count($comments) == 0) {
+  	$javascript = array();
+    form_set_error(NULL, '', TRUE);
+  } else {
+  	// Retrieve the new settings
+    $javascript = drupal_add_js(NULL, NULL, 'header');
+  }
+  $output .= theme('fbssc_form_display', $sid, TRUE, TRUE, $new_form);
   //Return the results.
-  drupal_json(array('status' => TRUE, 'data' => $output));
+  if(!empty($javascript)) {
+    drupal_json(array('status' => TRUE, 'data' => $output, 'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),));
+  } else {
+  	// This case updating settings is avoided, so ahah behavior is not broken
+  	drupal_json(array('status' => TRUE, 'data' => $output));
+  }
+}
+
+/**
+ * Update status comments via AJAX.
+ */
+function fbssc_update_js($sid) {
+  $content = "<div class='container-inline'>
+                <input type='button' class='form-submit' value='".t("Continue")."' onclick='Popups.close(); return false;'/>
+              </div>
+              <script type='text/javascript'>
+                refreshCommentForm($sid);
+              </script>";
+  return $content;
 }
 
 //=============
