var acc_stretchers, acc_toggles, acc_fx, acc_state;
// acc_starter controls which stretcher is open when the page is loaded
//   set to -1 for none; otherwise indicates number of stretcher,
//   starting with 0 for the first. DO NOT set this here; this is only
//   the default value. Elsewhere in the page, put:
//     acc_starter = <stretcher_number>;
var acc_starter = -1;
function acc_init(){

	acc_stretchers = document.getElementsByClassName('stretcher'); //div that stretches
	acc_toggles = document.getElementsByClassName('display'); //h3s where I click on
	if (acc_stretchers.length > 0) {
		acc_state = new Array(acc_stretchers.length);
		acc_fx = new Array(acc_stretchers.length);

		acc_stretchers.each(function(node, i) {
			acc_fx[i] = new fx.Combo(acc_stretchers[i], {height: true, opacity: true, onComplete: function() {
				acc_state[i] = 0 - acc_state[i];
			}});
			if (i != acc_starter) {
				acc_fx[i].hide();
				acc_state[i] = -1;
			} else acc_state[i] = 1;
		});
	}	
}
function acc_stretch(idx) {
	if (acc_stretchers.length > 0) {
		acc_stretchers.each(function(node, i) {
			if (idx == i) acc_fx[idx].toggle();
			else if (acc_state[i] == 1) acc_fx[i].toggle();
			else acc_fx[i].hide();
		});
	}
}
