function animate_open(who, next, maxHeight)
{
	next += 5;
	
	if (next < maxHeight)
	{
		who.style.height = next+'px';
		setTimeout(function(){animate_open(who, next, maxHeight)}, 20);
	}
	else
		who.style.height = maxHeight+'px';
}

function animate_close(who, next)
{
	next -= 5;
	
	if (next > 0)
	{
		who.style.height = next+'px';
		setTimeout(function(){animate_close(who, next)}, 20);
	}
	else
	{
		who.style.height = '0px';
		who.style.display = 'none';
	}
}

function showhide_next(baseNode)
{
	var div = baseNode.nextSibling;
	if ('block' == div.style.display)
	{
		setTimeout(function(){animate_close(div, div.offsetHeight)}, 20);
	}
	else
	{
		close_all(baseNode.parentNode.parentNode);
		
		var maxHeight;
		div.style.display = 'block';
		div.style.height = '100%';
		div.style.overflow = 'hidden';
		maxHeight = div.offsetHeight;

		div.style.height = '0px';
		
		setTimeout(function(){animate_open(div, 0, maxHeight)}, 20);
	}
}

function close_all(mylist)
{
	var div;
	for( var n=0; n < mylist.childNodes.length; n++ )
	{
		if (mylist.childNodes[n].nodeType == 1)
		{
			div = mylist.childNodes[n].firstChild.nextSibling;
			if ('block' == div.style.display)
			{			
				//alert( mylist.childNodes[n].firstChild.nextSibling.nodeName + ' display ' + div.style.display + ' height ' +div.offsetHeight);
				if (isMSIE)
					setTimeout(new function(_div){animate_close(_div, _div.offsetHeight);}(div), 20);
				else
					setTimeout(animate_close, 20, div, div.offsetHeight);
			}
		}
	}
}

var isMSIE = navigator.userAgent.indexOf('MSIE') > 0;
