/*!
 * Expand collapse UI object
 * Dependencies: jQuery 1.4.2+ and jQueryUI 1.8
 * @author Ethan Gardner
 * @version 0.9
 */
var ExpandCollapse = function(handles, elements, options){
	this.handles = handles;
	this.elements = elements;
	this.elementsJQ = $(elements);
	this.options = options;
	this.init();
}

ExpandCollapse.prototype = {
	showAll : function(){
		var self = this;
		return $('#show-all').button({
			icons : {
				primary : 'ui-icon-plus'
			}
		}).click(function(e){
			self.elementsJQ.show();
		});;
	},
	hideAll : function(){
		var self = this;
		return $('#collapse-all').button({
			icons : {
				primary : 'ui-icon-minus'
			}
		}).click(function(e){
			self.elementsJQ.hide();
		});;
	},
	init : function(){
		var self = this;
		this.showAll();
		this.hideAll();
		this.handles.addClass('pseudolink');
		this.elementsJQ.hide();
		this.handles.click(function(e){
			$(this).parent().nextAll(self.elements).toggle("350");
		});
	}
}
