var TextExpander = Class.create({
	
	initialize: function(div, content_css, expandable_css){
		this.div = div.down(content_css);
		this.expanded_content = this.div.select(expandable_css);
		if (this.expanded_content.size() > 0) {
			this.div.insert('<div class="expander">Expand to Continue</div>');
			this.button = this.div.down('.expander');
			this.button.observe('click', this.handle_click.bind(this));
			this.expanded_content.invoke('hide');
			this.expanded = false;
		}
	
	},
	
	handle_click: function(e){	
		if (this.expanded == false) {
			this.expanded_content.invoke('appear');
			this.button.update('Collapse').addClassName('active');
			this.expanded = true;
		} else {
			this.expanded_content.invoke('fade');
			this.button.update('Expand to Continue').removeClassName('active');
			this.expanded = false;
		}
		
		Event.stop(e);
	}
	
});