function Apple(id, sGroup) {
  Apple.superclass.call(this, id, sGroup);
  this.isTarget = false;
}
// The extend function is defined in the extend.js file
extend(Apple, YAHOO.util.DDProxy);

Apple.prototype.cacheRegion = function() {
  this._region = YAHOO.util.Dom.getRegion(this.getEl());  
};

Apple.prototype.getCachedRegion = function() {
  return this._region;  
};

// Methods to override DDProxy (superclass) methods ---------------------------

// If we want anything to happen in the Baskets then we must
// manually call the hooks from these interesting moments.
// In Yahoo! UI dragdrop the dragged item is the focus of 
// all events and the target is basically inactive. This is ok.
// This way we control the order of interaction between
// the dragged item and the target at an interesting moment.

Apple.prototype.onMouseDown = function(e) {
  YAHOO.util.Dom.addClass(this.getEl(), 'selected');
};

Apple.prototype.startDrag = function(e) {
  Basket.startDrag(this);
};

Apple.prototype.onDragEnter = function(e, id) {
  YAHOO.util.DragDropMgr.getDDById(id).onDragEnter();
};

Apple.prototype.onDragOver = function(e, id) {
  YAHOO.util.DragDropMgr.getDDById(id).onDragOver(e);
};

Apple.prototype.onDragOut = function(e, id) {
  YAHOO.util.DragDropMgr.getDDById(id).onDragOut();
};

Apple.prototype.onDragDrop = function(e, id) {
  YAHOO.util.DragDropMgr.getDDById(id).onDragDrop(e, this);
};

Apple.prototype.endDrag = function(e) {};

Apple.prototype.onMouseUp = function(e) {
  YAHOO.util.Dom.removeClass(this.getEl(), 'selected');
};

Apple.prototype.showFrame = function(x, y) {
  this.getDragEl().style.visibility = "";
};

Apple.prototype.setDragElPos = function(x, y) {
  var proxy = this.getDragEl();
  var r = YAHOO.util.Dom.getRegion(proxy);
  YAHOO.util.Dom.setXY(proxy, [x-((r.right-r.left)/2),
                               y-((r.bottom-r.top)/2)]);
};
