diff --git a/dhtml_menu.js b/dhtml_menu.js
index 806a1f6..a9e1dae 100644
--- a/dhtml_menu.js
+++ b/dhtml_menu.js
@@ -16,6 +16,15 @@ Drupal.dhtmlMenu.animation = {show:{}, hide:{}, count:0};
  */
 Drupal.behaviors.dhtmlMenu = {
   attach: function() {
+      
+    // Do not run this function more than once. Needed for ajaxy things
+      if (Drupal.dhtmlMenu.init) {
+      return;
+    }
+    else {
+      Drupal.dhtmlMenu.init = true;
+    }  
+      
     var settings = Drupal.settings.dhtmlMenu;
 
     // Initialize the animation effects from the settings.
@@ -28,13 +37,13 @@ Drupal.behaviors.dhtmlMenu = {
     }
 
     // Sanitize by removing "expanded" on menus already marked "collapsed".
-    $('li.dhtml-menu.collapsed.expanded').removeClass('expanded');
+    $('li.dhtml-menu.dhtml-collapsed.dhtml-expanded').removeClass('dhtml-expanded');
 
     /* Relevant only on "open-only" menus:
      * The links of expanded items should be marked for emphasis.
      */
     if (settings.nav == 'open') {
-      $('li.dhtml-menu.expanded').addClass('dhtml-menu-open');
+      $('li.dhtml-menu.dhtml-expanded').addClass('dhtml-menu-open');
     }
 
     /* Relevant only when hovering:
@@ -154,7 +163,7 @@ Drupal.behaviors.dhtmlMenu = {
             }
             Drupal.dhtmlMenu.toggleMenu(li, link, ul);
             $('.dhtml-menu-open').removeClass('dhtml-menu-open');
-            $('li.dhtml-menu.expanded').addClass('dhtml-menu-open');
+            $('li.dhtml-menu.dhtml-expanded').addClass('dhtml-menu-open');
             return false;
           });
         }
@@ -194,7 +203,7 @@ Drupal.behaviors.dhtmlMenu = {
  */
 Drupal.dhtmlMenu.toggleMenu = function(li, link, ul) {
   // Make it open if closed, close if open.
-  Drupal.dhtmlMenu.switchMenu(li, link, ul, !li.hasClass('expanded'));
+  Drupal.dhtmlMenu.switchMenu(li, link, ul, !li.hasClass('dhtml-expanded'));
 }
 
 /**
@@ -209,16 +218,18 @@ Drupal.dhtmlMenu.toggleMenu = function(li, link, ul) {
  *   Object. The <ul> element containing the sub-items.
  */
 Drupal.dhtmlMenu.switchMenu = function(li, link, ul, open) {
+        
   // No need for switching. Menu is already in desired state.
-  if (open == li.hasClass('expanded')) {
+  if (open == li.hasClass('dhtml-expanded')) {      
     return;
   }
 
+
   var effects = Drupal.settings.dhtmlMenu.effects;
 
   if (open) {
     Drupal.dhtmlMenu.animate(ul, 'show');
-    li.removeClass('collapsed').addClass('expanded');
+    li.removeClass('dhtml-collapsed').addClass('dhtml-expanded');
 
     // If the siblings effect is on, close all sibling menus.
     if (effects.siblings != 'none') {
@@ -235,14 +246,14 @@ Drupal.dhtmlMenu.switchMenu = function(li, link, ul, open) {
       else {
         var root = $('ul.menu');
       }
-      var siblings = root.find('li.expanded').not('.own-children-temp').not('#' + id);
+      var siblings = root.find('li.dhtml-expanded').not('.own-children-temp').not('#' + id);
 
       // If children should not get closed automatically...
       if (effects.children == 'none') {
         // Remove items that are currently hidden from view (do not close these).
-        $('li.collapsed li.expanded').addClass('sibling-children-temp');
+        $('li.dhtml-collapsed li.dhtml-collapsed').addClass('sibling-children-temp');
         // Only close the top-most open sibling, not its children.
-        siblings.find('li.expanded').addClass('sibling-children-temp');
+        siblings.find('li.dhtml-expanded').addClass('sibling-children-temp');
         siblings = $(siblings).not('.sibling-children-temp');
       }
 
@@ -252,18 +263,18 @@ Drupal.dhtmlMenu.switchMenu = function(li, link, ul, open) {
         .removeClass('sibling-children-temp');
 
       Drupal.dhtmlMenu.animate(siblings.find('ul:first'), 'hide');
-      siblings.removeClass('expanded').addClass('collapsed');
+      siblings.removeClass('dhtml-expanded').addClass('dhtml-collapsed');
     }
   }
   else {
     Drupal.dhtmlMenu.animate(ul, 'hide');
-    li.removeClass('expanded').addClass('collapsed');
+    li.removeClass('dhtml-expanded').addClass('dhtml-collapsed');
 
     // If children are closed automatically, find and close them now.
     if (effects.children == 'close-children') {
       // If a sub-menu closes in the forest and nobody sees it, is animation a waste of performance? Yes.
-      li.find('li.expanded')
-        .removeClass('expanded').addClass('collapsed')
+      li.find('li.dhtml-expanded')
+        .removeClass('dhtml-expanded').addClass('dhtml-collapsed')
         .find('ul:first').css('display', 'none');
     }
   }
@@ -296,7 +307,7 @@ Drupal.dhtmlMenu.animate = function(element, action) {
  */
 Drupal.dhtmlMenu.cookieSet = function() {
   var expanded = new Array();
-  $('li.expanded').each(function() {
+  $('li.dhtml-expanded').each(function() {
     expanded.push(this.id);
   });
   document.cookie = 'dhtml_menu=' + expanded.join(',') + ';path=/';
diff --git a/dhtml_menu.theme.inc b/dhtml_menu.theme.inc
index ef6ae4c..f47c43e 100644
--- a/dhtml_menu.theme.inc
+++ b/dhtml_menu.theme.inc
@@ -45,9 +45,15 @@ function dhtml_menu_preprocess_menu_link(&$variables) {
 
   // If the current item can expand, and is neither saved as open nor in the active trail, close it.
   if ($l['has_children'] && !$l['in_active_trail'] && !in_array($variables['element']['#attributes']['id'], $cookie)) {
-    $variables['element']['#attributes']['class'][] = 'collapsed';
+       
+    $variables['element']['#attributes']['class'][] = 'dhtml-collapsed';    
     $variables['element']['#attributes']['class'][] = 'start-collapsed';
   }
+  
+  if( in_array($variables['element']['#attributes']['id'], $cookie) ) {
+    $variables['element']['#attributes']['class'][] = 'dhtml-expanded';   
+}
+
 }
 
 /**
