$(document).ready(function(){
	$('div.accord-hold').each(function(){
		var _list = $(this).children('div.acc-box');
		_list.each(function(_i){
			var _f = false;				
			var _el = $(this);
			
			this._btn = _el.children('.acc-title');
			this._box = _el.children('.acc-cont').hide();
			if(_el.hasClass('active')){
				this._box.show();
				_f = true;
			}
			this._h = this._box.outerHeight();
			this._btn.click(function(){
				if(_f){
					_f = false;
					_list.eq(_i).removeClass('active');
					_list.get(_i)._box.stop().animate({height: 0}, 500, function(){
						$(this).css({display: 'none', height: 'auto'});
					});
				}
				else{
					_f = true;
					_list.eq(_i).addClass('active');
					if(!_list.get(_i)._box.is(':animated')){
						_list.get(_i)._box.show();
						_list.get(_i)._h = _list.get(_i)._box.height();
						_list.get(_i)._box.height(0);
					}
					_list.get(_i)._box.stop().animate({ height: _list.get(_i)._h}, 500, function(){
						$(this).height('auto');
					});
				}
				return false;
			});
		});
	});
});