--- nodequeue_dragdrop.js	2010-12-10 11:47:30.000000000 -0500
+++ nodequeue_dragdrop.js	2010-12-10 15:25:54.000000000 -0500
@@ -1,113 +1,126 @@
 // $Id: nodequeue_dragdrop.js,v 1.4 2010/10/07 02:50:35 ezrag Exp $
+(function ($) {
 
-Drupal.behaviors.nodequeueDrag = function(context) {
-  var tableDrag = Drupal.tableDrag['nodequeue-dragdrop'];
+Drupal.behaviors.nodequeueDrag = {
+  attach: function (context, settings) {
+    var tableDrag = Drupal.tableDrag['nodequeue-dragdrop'];
+
+    tableDrag.onDrop = function() {
+      $('td.position').each(function(i){
+        $(this).html(i + 1);
+      });
+    }
+  }  
+}
+
+Drupal.behaviors.nodequeueReverse = {
+  attach: function (context, settings) {
+    $('#edit-reverse').click(function(){
+      // reverse table rows...
+      $('tr.draggable').each(function(i){
+        $('.nodequeue-dragdrop tbody').prepend(this);
+      });
+
+      // ...and update node positions
+      var size = $('.node-position').size();
+      $('.node-position').each(function(i){
+        var val = $(this).val();
+        $(this).val(size - val + 1);
+      });
 
-  tableDrag.onDrop = function() {
-    $('td.position').each(function(i){
-      $(this).html(i + 1);
-    });
-  }
-}
+      nodequeueInsertChangedWarning();
+      nodequeueRestripeTable();
 
-Drupal.behaviors.nodequeueReverse = function(context) {
-  $('#edit-reverse').click(function(){
-    // reverse table rows...
-    $('tr.draggable').each(function(i){
-      $('.nodequeue-dragdrop tbody').prepend(this);
+      return false;
     });
-
-    // ...and update node positions
-    var size = $('.node-position').size();
-    $('.node-position').each(function(i){
-      var val = $(this).val();
-      $(this).val(size - val + 1);
-    });
-
-    nodequeueInsertChangedWarning();
-    nodequeueRestripeTable();
-
-    return false;
-  });
+  }
 };
 
-Drupal.behaviors.nodequeueShuffle = function(context) {
-  $('#edit-shuffle').click(function(){
-    // randomize table rows...
-    var rows = $('table.nodequeue-dragdrop tbody tr:not(:hidden)').get();
-    rows.sort(function(){return (Math.round(Math.random())-0.5);});
-    $.each(rows, function(i, row) {
-      $('.nodequeue-dragdrop tbody').prepend(this);
-    });
+Drupal.behaviors.nodequeueShuffle = {
+  attach: function (context, settings) {
+    $('#edit-shuffle').click(function(){
+      // randomize table rows...
+      var rows = $('table.nodequeue-dragdrop tbody tr:not(:hidden)').get();
+      rows.sort(function(){return (Math.round(Math.random())-0.5);});
+      $.each(rows, function(i, row) {
+        $('.nodequeue-dragdrop tbody').prepend(this);
+      });
 
-    var reverse = Drupal.settings.nodequeue.reverse;
+      var reverse = Drupal.settings.nodequeue.reverse;
  
-    // ...and update node positions
-    var size = reverse ? $('.node-position').size() : 1;
-    $('.node-position').each(function(i){
-      var val = $(this).val();
-      $(this).val(size);
-      reverse ? size-- : size++;
-    });
+      // ...and update node positions
+      var size = reverse ? $('.node-position').size() : 1;
+      $('.node-position').each(function(i){
+        var val = $(this).val();
+        $(this).val(size);
+        reverse ? size-- : size++;
+      });
 
-    nodequeueInsertChangedWarning();
-    nodequeueRestripeTable();
+      nodequeueInsertChangedWarning();
+      nodequeueRestripeTable();
 
-    return false;
-  });
+      return false;
+    });
+  }
 };
 
-Drupal.behaviors.nodequeueClear = function(context) {
-  $('#edit-clear').click(function(){
-    // mark nodes for removal
-    $('.node-position').each(function(i){
-      $(this).val('r');
-    });
+Drupal.behaviors.nodequeueClear = {
+  attach: function (context, settings) {
+    $('#edit-clear').click(function(){
+      // mark nodes for removal
+      $('.node-position').each(function(i){
+        $(this).val('r');
+      });
 
-    // remove table rows...
-    rows = $('table.nodequeue-dragdrop tbody tr:not(:hidden)').hide();
+      // remove table rows...
+      rows = $('table.nodequeue-dragdrop tbody tr:not(:hidden)').hide();
 
-    nodequeuePrependEmptyMessage();
-    nodequeueInsertChangedWarning();
+      nodequeuePrependEmptyMessage();
+      nodequeueInsertChangedWarning();
 
-    return false;
-  });
+      return false;
+    });
+  }
 };
 
-Drupal.behaviors.nodequeueRemoveNode = function(context) {
-  $('a.nodequeue-remove').css('display', 'block');
-  $('a.nodequeue-remove').click(function() {
-    a = $(this).attr('id');
-    a = '#' + a.replace('nodequeue-remove-', 'edit-') + '-position';
-    $(a).val('r');
-
-    // hide the current row
-    $(this).parent().parent().fadeOut('fast', function(){
-      if ($('table.nodequeue-dragdrop tbody tr:not(:hidden)').size() == 0) {
-        nodequeuePrependEmptyMessage();
-      }
-      else {
-        nodequeueRestripeTable()
-        nodequeueInsertChangedWarning();
-      }
-    });
+Drupal.behaviors.nodequeueRemoveNode = {
+  attach: function (context, settings) {
+    $('a.nodequeue-remove').css('display', 'block');
+    $('a.nodequeue-remove').click(function() {
+      a = $(this).attr('id');
+      a = '#' + a.replace('nodequeue-remove-', 'edit-') + '-position';
+      $(a).val('r');
+
+      // hide the current row
+      $(this).parent().parent().fadeOut('fast', function(){
+        if ($('table.nodequeue-dragdrop tbody tr:not(:hidden)').size() == 0) {
+          nodequeuePrependEmptyMessage();
+        }
+        else {
+          nodequeueRestripeTable()
+          nodequeueInsertChangedWarning();
+        }
+      });
 
-    return false;
-  });
+      return false;
+    });
+  }
 }
 
-Drupal.behaviors.nodequeueClearTitle = function(context) {
-  $('#edit-add-nid').focus(function(){
-    if (this.value == this.defaultValue) {
-			this.value = '';
-      $(this).css('color', '#000');
-		}
-  }).blur(function(){
-    if (!this.value.length) {
-      $(this).css('color', '#999');
-			this.value = this.defaultValue;
-		}
-  });
+Drupal.behaviors.nodequeueClearTitle = {
+  attach: function (context, settings) {
+    $('#edit-add-nid').focus(function(){
+      if (this.value == this.defaultValue) {
+	    this.value = '';
+        $(this).css('color', '#000');
+      }
+    }).blur(function(){
+      if (!this.value.length) {
+        $(this).css('color', '#999');
+	    this.value = this.defaultValue;
+	   }
+    });
+  }
 }
 
 /**
@@ -144,3 +157,4 @@ function nodequeueInsertChangedWarning()
     Drupal.tableDrag['nodequeue-dragdrop'].changed = true;
   }
 }
+})(jQuery);
\ No newline at end of file
