document.addEvent('domready', function() {
	var elems = $$('.openclosebox');
	for(var i=0; i<elems.length; i++) {
		var elem = elems[i];
		elem.set('tween', {duration: 'short', property: 'height'});
		var myheight = elem.getStyle('height').toInt();
		elem.opened = (myheight != 0);
		elem.openBox = function() {
			var fc = this.firstChild;
			var h = fc.offsetTop + fc.offsetHeight;
			this.tween(h);
			this.opened = true;
		}
		elem.closeBox = function() {
			this.tween('0px');
			this.opened = false;
		}
		elem.toggleBox = function() {
			if (this.opened) this.closeBox();
			else this.openBox();
		}
		elem.quickClose = function() {
			this.setStyle('height', '0px');
			this.opened = false;
		}
	}
});
