var Confection = new Class({

  options: {
  
  },
  
  styles: {
  
  },
  
  initialize: function(code, src)
  {
    this.code = code;
    this.src = src;
  },
  
  render: function(container)
  {
    this.container = container;
  
    var aligner = createElement('div');
    aligner.setStyle('text-align', 'right');
    aligner.setStyle('position', 'relative');
    aligner.setStyle('top', '-2px');
    aligner.setStyle('padding-right', '42px');
    
    var removeLink = createElement('a');
    removeLink.addClass('bottomLink');
    removeLink.href = 'javascript:;';
    removeLink.onmousedown = this.removeItemClick.bind(this);
    removeLink.innerHTML = 'remove item';
    
    aligner.appendChild(removeLink);
    aligner.appendChild(createElement('br'));
    aligner.appendChild(createElement('br'));
    this.container.appendChild(aligner);
  },
  
  getDescription: function()
  {
    return CocoaNymphCart.prototype.descriptions[this.code];
  },
  
  getCartIcon: function()
  {
    return this.src.replace('products/', 'products/tiny/');
  },
  
  getPrice: function()
  {
    if (this.code.indexOf('B') == 0) return 6.00;  // box price
      
    switch(this.code)
    {
      case 'C01': return 15.00; // english toffee
      case 'C02': return 12.00; // maple pecans
      case 'C03': return 12.00; // spiced maple pecans
      case 'C04': return 7.00;  // marshmallows
    }
  },
  
  getProductCode: function()
  {
    return this.code;
  },
  
  isFull: function()
  {
    return true;
  },
  
  removeItemClick: function()
  {
    cart.removeBox(this);
  },
  
  removeChocolate: function(index)
  {
    //this.chocolates.splice(index, 1);
    this.chocolates[index] = false;
  },
  
  persistentData: function()
  {
    // return data that will be stored in the cookie
    return {code: this.code, src: this.src};
  }
  
});