// acc-slider 
function accslider(items, first, options) {
	var active = first;		
	var onClick = options && options.onClick || function(){};
	var onShow = options && options.onShow || function(){$(this).removeClass('default').addClass('current');};
	var onHide = options && options.onHide || function(){$(this).removeClass('current').addClass('default');};
	var showSpeed = options && options.showSpeed || 'slow';
	var hideSpeed = options && options.hideSpeed || 'fast';
	var showIt = function(){$(this).slideDown(showSpeed, function(){ });};
	var hideIt = function(){$(this).slideUp(hideSpeed, function(){ });};
	var typ = options && options.typ || 'accopenclose';

	$(items).not(active).children('div').hide();
	$(items).not(active).each(onHide);
	$(items).each(function(index) {
		$(this).attr("id",'accitem'+ index);
		var _accitem = '#accitem'+ index;
		var _accrel = $('#accitem'+ index +' h3').addClass('accrel'+ index);
		var _acccontent = $('#accitem'+ index +' h3').next('div');

		if(active==_accitem) {
			$(active).each(onShow);
			_acccontent.each(showIt);
		}

  _accrel.unbind();

	_accrel.bind('click', function(){
			if(typ=="openclose")
			{
				active = _accitem;
				if(!_acccontent.is(":hidden")) {
					_acccontent.each(hideIt);
					$(active).each(onHide);
				} else {
					_acccontent.each(showIt);
					$(active).each(onShow);
				}
			} 
			else if(typ=="openoneway")
			{
				_acccontent.each(showIt);
				active = _accitem;
				$(active).each(onShow);
			}
			else
			{
				if(typ=="accopenclose") {
					if(active==_accitem) {
						$(active).children('div').not(':hidden').each(hideIt);
						$(active).each(onHide);
						active = 0;
					} else {
						$(active).children('div').not(':hidden').each(hideIt);
						_acccontent.each(showIt);
						$(active).each(onHide);
						active = _accitem;
						$(active).each(onShow);
					}
				} else {
					if(!_acccontent.is(":hidden")) return false;
					$(active).children('div').not(':hidden').each(hideIt);
					_acccontent.each(showIt);
					$(active).each(onHide);
					active = _accitem;
					$(active).each(onShow);
				}
			}
			return false;
		});
	});
};

$(document).ready(function(){
  $(".acc_container").hide();
	accslider(".list2 li", "REX_SLICE_ID", {showSpeed:250,hideSpeed:550});
});
