var slidingcontainer = {
	Implements: [Events, Options],
	options: {
		arrowUpUrl: '/inf/scripts?resource=images/arrow_up.png',
		arrowDownUrl: '/inf/scripts?resource=images/arrow_down.png',
		hideOnLoad: true
	},
	initialize: function(element, options) {
		this.setOptions(options);
		this.fireEvent('onInit');
		this.element = element;
		this.containerElement = $(element.id+'_container');
		this.containerEffect = new Fx.Slide(this.containerElement, {duration: 500, transition: Fx.Transitions.linear});
		this.linkElement = $(element.id+'_link');
		this.linkElement.addEvent('click', this.toggleDiv.bind(this));
		this.linkElement.style.background =  'url("'+this.options.arrowDownUrl+'") no-repeat center right';
		this.linkElement.style.display = 'block';
		this.maxElementHeight = this.containerElement.clientHeight;

		this.containerElement.setStyle('height', this.maxElementHeight);
		this.hidden = this.options.hideOnLoad;
		if (this.hidden)
			this.containerEffect.hide();
	},
	toggleDiv: function() {
		
		if (this.hidden)
		{
			this.showDiv();
		}
		else 
		{
			this.hideDiv();
		}
	},
	showDiv: function() {	
		//alert(this.containerElement.getStyle('height'));
		this.linkElement.style.background = 'url("'+this.options.arrowUpUrl+'") no-repeat center right';
		this.containerEffect.toggle();
		this.hidden = false;
	},
	hideDiv: function() {
		this.linkElement.style.background = 'url("'+this.options.arrowDownUrl+'") no-repeat center right';
		//alert(this.containerElement.getStyle('height'));
		this.containerEffect.toggle();
		this.hidden = true;
	}
};

slidingcontainer = new Class(slidingcontainer);


