﻿	var multipleOpenAccordion = new Class({
	Extends: Accordion,
	options: {
		openActive: 0,
		alwaysHide: 0
	}, 
	initialize: function(par,togglers,togglees,options){
		this.parent(par,togglers,togglees,options);
		//alert(options.openActive);
	},
	display: function(index){
	
		index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
		if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
		var obj = {};
		//alert(this.options.openActive);
		if(this.options.openActive){
			this.previous = index;
			this.elements.each(function(el, i){
				obj[i] = {};
				var hide = (i != index) && (i != active) || (this.options.alwaysHide && (el.offsetHeight > 0) && (i != active));
				this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
				for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
			}, this);	
		} else {		
			this.previous = index;
			this.elements.each(function(el, i){
				obj[i] = {};
				var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
				this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
				for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
			}, this);		
		}
			return this.start(obj);
	}
});
	

