Index: session_favorites.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/session_favorites/session_favorites.js,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 session_favorites.js
--- session_favorites.js	30 Dec 2008 17:21:13 -0000	1.1.2.2
+++ session_favorites.js	15 Jan 2009 21:58:20 -0000
@@ -12,6 +12,31 @@ Drupal.sessionFavorites = function() {
     $('a.session-favorites-add, a.session-favorites-remove')
       .after(newDiv)
       .click(function () { return Drupal.sessionFavoritesAjax(this); });
+  
+    $('a.session-favorites-add, a.session-favorites-remove')
+	.each(function () { return Drupal.sessionFavoritesInit(this); });
+}
+
+/**
+ * Update the links at page load if necessary.
+ */
+Drupal.sessionFavoritesInit = function(link) {
+
+    var getUrl = link.href.replace(/add|remove/, 'js/get');
+
+    $.ajax({
+      type: 'GET',
+      url: getUrl,
+      data: '',
+      dataType: 'json',
+      success: function (data) {
+	Drupal.sessionFavoritesChangeLink(link, data);          
+	return;
+      },
+      error: function (xmlhttp) {
+	alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ element.href);
+      }
+    });
 }
 
 Drupal.sessionFavoritesAjax = function(link) {
@@ -54,7 +79,7 @@ Drupal.sessionFavoritesChangeLink = func
 	$(link).next('.session-favorites-message').attr('innerHTML',data.content);
     }
     else {
-      alert('An error has occurred.');
+	alert('Deze camper staat al op de parkeerplaats of is zojuist daarvan verwijderd.');
     }
 
 }
Index: session_favorites.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/session_favorites/session_favorites.module,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 session_favorites.module
--- session_favorites.module	24 Jul 2008 22:23:57 -0000	1.1.2.4
+++ session_favorites.module	15 Jan 2009 21:58:21 -0000
@@ -72,6 +72,10 @@ function session_favorites_menu($may_cac
           break;
         case 'remove' :
           $callback = '_session_favorites_js_remove';
+          break;
+        case 'get' :
+          $callback = '_session_favorites_js_get';
+          break;
         default :
       }
       if ($callback) {
@@ -113,7 +117,7 @@ function session_favorites_link($type, $
         $links[] = array(
           'title' => t('In favorites'),
           'href' => variable_get('session_favorites_path', 'session-favorites'),
-          'attributes' => array('class' => 'session-favorites'),
+          'attributes' => array('class' => 'session-favorites session-favorites'),
         );
         // add a remove link
         $links[] = array(
@@ -249,6 +253,7 @@ function session_favorites_settings_subm
  * Menu Callback: Session Favorites Page
  */
 function _session_favorites_page() {
+  $GLOBALS['conf']['cache'] = FALSE;
   // check if viewing own page
   if (!session_favorites_viewing_own_list()) {
     if (!user_access('view session favorites lists of other users')) {
@@ -404,7 +409,46 @@ function _session_favorites_js_remove($n
   );
   exit;
 }
+
+function _session_favorites_js_get($nid) {
+g  if (session_favorites_node_check($nid)) {
+    // get messages
+    $content = theme('status_messages');
+  
+    // new link text
+    $new_link = t('Remove from favorites');
   
+    // output json
+    print drupal_to_js(
+      array(
+        'content' => $content, 
+        'status' => TRUE,
+        'newLinkText' => $new_link,
+        'oldLinkTarget' => 'add',
+        'newLinkTarget' => 'remove',
+      )
+    );
+    exit;
+  }
+  else {
+    // get messages
+    $content = theme('status_messages');
+  
+    // new link text
+    $new_link = t('Add to favorites');
+    // output json
+    print drupal_to_js(
+      array(
+        'content' => $content, 
+        'status' => TRUE,
+        'newLinkText' => $new_link,
+        'oldLinkTarget' => 'remove',
+        'newLinkTarget' => 'add',
+      )
+    );
+    exit;
+  }
+}
 
 /**
  * Add a node ID to the list
