# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -16,6 +16,18 @@
  */
 Drupal.behaviors.dhtmlMenu = {
   attach: function() {
+      
+      
+   // Do not run this function more than once.
+   //This is needed that code is not run twice when using ajax (like views ajax pager)
+  if (Drupal.dhtmlMenu.init) {
+    return;
+  }
+  else {
+    Drupal.dhtmlMenu.init = true;
+  }  
+      
+      
     var settings = Drupal.settings.dhtmlMenu;
 
     // Initialize the animation effects from the settings.
@@ -28,13 +40,13 @@
     }
 
     // Sanitize by removing "expanded" on menus already marked "collapsed".
-    $('li.dhtml-menu.collapsed.expanded').removeClass('expanded');
+    $('li.dhtml-menu.collapsed-dhtml.expanded-dhtml').removeClass('expanded-dhtml');
 
     /* 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.expanded-dhtml').addClass('dhtml-menu-open');
     }
 
     /* Relevant only when hovering:
@@ -154,7 +166,7 @@
             }
             Drupal.dhtmlMenu.toggleMenu(li, link, ul);
             $('.dhtml-menu-open').removeClass('dhtml-menu-open');
-            $('li.dhtml-menu.expanded').addClass('dhtml-menu-open');
+            $('li.dhtml-menu.expanded-dhtml').addClass('dhtml-menu-open');
             return false;
           });
         }
@@ -197,7 +209,7 @@
  */
 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('expanded-dhtml'));
 }
 
 /**
@@ -212,16 +224,18 @@
  *   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('expanded-dhtml')) {      
     return;
   }
 
+
   var effects = Drupal.settings.dhtmlMenu.effects;
 
   if (open) {
     Drupal.dhtmlMenu.animate(ul, 'show');
-    li.removeClass('collapsed').addClass('expanded');
+    li.removeClass('collapsed-dhtml').addClass('expanded-dhtml');
 
     // If the siblings effect is on, close all sibling menus.
     if (effects.siblings != 'none') {
@@ -238,14 +252,14 @@
       else {
         var root = $('ul.menu');
       }
-      var siblings = root.find('li.expanded').not('.own-children-temp').not('#' + id);
+      var siblings = root.find('li.expanded-dhtml').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.collapsed-dhtml li.expanded-dhtml').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.expanded-dhtml').addClass('sibling-children-temp');
         siblings = $(siblings).not('.sibling-children-temp');
       }
 
@@ -255,18 +269,18 @@
         .removeClass('sibling-children-temp');
 
       Drupal.dhtmlMenu.animate(siblings.find('ul:first'), 'hide');
-      siblings.removeClass('expanded').addClass('collapsed');
+      siblings.removeClass('expanded-dhtml').addClass('collapsed-dhtml');
     }
   }
   else {
     Drupal.dhtmlMenu.animate(ul, 'hide');
-    li.removeClass('expanded').addClass('collapsed');
+    li.removeClass('expanded-dhtml').addClass('collapsed-dhtml');
 
     // 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.expanded-dhtml')
+        .removeClass('expanded-dhtml').addClass('collapsed-dhtml')
         .find('ul:first').css('display', 'none');
     }
   }
@@ -299,7 +313,7 @@
  */
 Drupal.dhtmlMenu.cookieSet = function() {
   var expanded = new Array();
-  $('li.expanded').each(function() {
+  $('li.expanded-dhtml').each(function() {
     expanded.push(this.id);
   });
   document.cookie = 'dhtml_menu=' + expanded.join(',') + ';path=/';
