function Basket(_x, _y, _left) {
  this.parent = $("Game");
  this.img = $("Basket");
  this.imgl = $("BasketLeft");
  this.img2 = $("Basket2");
  this.imgl2 = $("BasketLeft2");
  this.x = _x;
  this.y = _y;
  this.left = _left;
  this.basketx = this.baskety = 0;
  var basketwidth;
  var basketopening;
  var background;

  this.draw = function() {
    if (this.left) {
      this.imgl.style.left = this.x + "px"; 
      this.imgl.style.top = this.y + "px";
      this.imgl2.style.left = this.x + "px"; 
      this.imgl2.style.top = this.y + "px";
    }
    else {
      this.img.style.left = this.x + "px"; 
      this.img.style.top = this.y + "px";
      this.img2.style.left = this.x + "px"; 
      this.img2.style.top = this.y + "px";
    }
  }

  this.setXY = function(x, y) {
    this.x = x;
    this.y = y;
    if (this.left)
      this.basketx = x + basketwidth - basketopening;
    else
      this.basketx = x;
    this.baskety = y;
    this.draw();
  }

  if (this.img != null) {
    basketwidth = this.img.width;
  }
  else {
    basketwidth = width;
  }
  basketopening = basketwidth * 4 / 5;
  if (this.left)
    this.setXY(this.x, this.y);
  else
    this.setXY(this.x-basketwidth, this.y);

  this.setLeft = function(left) {
    if (this.imgl != null) {
      this.left = left;
    }
    if (left) {
      this.imgl.style.display = "inline";
      this.img.style.display = "none";
      this.imgl2.style.display = "inline";
      this.img2.style.display = "none";
    }
    else {
      this.imgl.style.display = "none";
      this.img.style.display = "inline";      
      this.imgl2.style.display = "none";
      this.img2.style.display = "inline";      
    }
  }

  this.getBasketOpening = function() {
    return basketopening;
  }

  this.getBasketWidth = function() {
    return basketwidth;
  }

  this.clear = function() {
  }
}