var BagAbsolute = new Class({
	
	Implements: [Events, Options, Chain],

	options: {
	},
	
	status : {
	  opened : false
  },

	
	initialize: function(el, options){
		this.element = $(el);
    this.setOptions(options);
		this.memoryheight = this.element.getStyle('height');
		this.hide();
    this.slide = new Fx.Morph(this.element, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
	},

	effects: function(){
	 
    if(this.status.opened) {

      this.slide.start({
        'height': [this.element.getStyle('height'), 0]
      });
      this.status.opened = false;    

    } else {
      this.slide.start({
        'height': [0, this.memoryheight]
      });
      this.status.opened = true;
    }		//this.fireEvent('onComplete', [this.search.results]);
	},
	
	hide: function(){
    if(this.element)
    this.element.setStyles({
      visibility : 'visible',
      height : 0
    });   
	},
	
	complete: function(){
		this.fireEvent('onComplete', [this.search.results]);
	}
	
});


window.addEvent('domready', function(){
	
  var ajaxBagDetails = new BagAbsolute('ajax-bag-details');
  
  $('top-header-bag').addEvent('click', function(){
  	ajaxBagDetails.effects();
  	//return false; // alternative syntax to stop the event
  });
	
});

