$(document).ready(function(){
	_holder = $('div.item-container')
	_holder .each(function(){
		var _this = $(this);
		var _opener = $('a.close', _this);
		var _slide = $('div.slide', _this);
		_opener.click(function(){
			if (_slide.css('display') == 'none') {
				_slide.slideDown(500);
				_this.removeClass('closed');
				$(this).html('close');
			} else {
				_slide.slideUp(500);
				_this.addClass('closed');
				$(this).html('open');
			}
			return false;
		});
	});
	$('a.btn-open-close').click(function(){
		var _btn = $(this);
		var _action = true;
		_holder.each(function(){
			var _this = $(this)
			var _slide = $('div.slide', _this);
			var _opener = $('a.close', _this);
			if (!_this.hasClass('closed')) {
				_action = false;
				_this.addClass('closed');
				_slide.slideUp(500);
				_opener.html('open');
				_btn.addClass('btn-open-close-closed');
			}
		});
		if (_action) {
			_holder.each(function(){
				var _this = $(this)
				var _slide = $('div.slide', _this);
				var _opener = $('a.close', _this);
				_slide.slideDown(500);
				_this.removeClass('closed');
				_opener.html('close');
				_btn.removeClass('btn-open-close-closed');
				
			});
		}
		return false;
	});
})

