var intFAQ = Array();

function doFAQ(q) {

	var obj = document.getElementById('acon-' + q);

	var item = 0;
	var iobj = null;
	var anim;

	while(iobj = document.getElementById('acon-' + item)) {

		anim = true;
		if(item != q || obj.style.display == 'block') anim = false;

		animFAQ(item, anim);
		item++;

	}

}


function animFAQ(i, show) {

	var goal = 0;
	var aobj = document.getElementById('acon-' + i);
	var height = !isNaN(parseInt(aobj.style.height)) ? parseInt(aobj.style.height) : 0;

	if(show){

		aobj.style.display = 'block';
		goal = aobj.offsetHeight;
		aobj.style.height = 1 + 'px';

	}

	if(height != goal){

		clearInterval(intFAQ[i]);
		intFAQ[i] = setInterval("updateFAQ(" + i + ", " + goal + ")", 50);

	}

}

function updateFAQ(i, goal) {

	var aobj = document.getElementById('acon-' + i);
	var height = parseInt(aobj.style.height);

	aobj.style.height = height + Math.round(0.35 * (goal - height)) + (goal > height ? 1 : -1) + 'px';

	if(Math.abs(parseInt(aobj.style.height) - goal) < 2){

		aobj.style.display = goal > 0 ? 'block' : 'none';
		aobj.style.height = goal == 0 ? null : goal + 'px';
		clearInterval(intFAQ[i]);

	}

}
