// Copyright 2006 Peter Michaux
//
// This file is released under the BSD license
//
// more info about using this file
// http://peter.michaux.ca/articles/2006/06/03/yui-better-dragdrop-constructors-2

var original_init = YAHOO.util.DragDrop.prototype.init;

YAHOO.util.DragDrop.prototype.init = function(id, aGroups) {
  
  if (typeof id !== 'string') {
    // id must be a DOM element
    YAHOO.util.Dom.generateId(id); // will not overwrite if existing id
    id = id.id;
  }

  if (!aGroups) {
    original_init.call(this, id);
  } else if (typeof aGroups == 'string') {
    original_init.call(this, id, aGroups);
  } else {
    original_init.call(this, id, aGroups[0]);
    for(var i = 1; i< aGroups.length; i++){
      this.addToGroup(aGroups[i]);
    }
  }

};
