var minHeight = 310;

function moduleClicked (id)
{
	var closed = id;
	var opened = false;
	
	var steps = 10;
	
	var div_top = document.getElementById (closed + "top" );
	var div_top_title = document.getElementById (closed + "title");
	var div_top_content = document.getElementById (closed + "content");
	
	var cch = 0;
	var dch = div_top_content.offsetHeight + div_top_title.offsetHeight;
	
	if( minHeight != null && minHeight > dch )
	{
		dch = minHeight;	
		
		div_top_content.style.height = (minHeight - div_top_title.offsetHeight - 5 ) + 'px';
	}
	
	var sch = dch / steps;
	
	var coh;
	var doh;
	var soh;
	
	var initHeight = div_top_title.offsetHeight;
	
	if (div_top.offsetHeight > initHeight)
	{
		opened = true;	
		
		coh = div_top_content.offsetHeight + div_top_title.offsetHeight;
		doh = initHeight-coh;
		soh = doh / steps;
	}
	
	function doResize (i)
	{
		cch += sch;
		
		var ch = Math.round (cch);
		
		if( opened )
		{
			coh += soh;
			
			var oh = Math.round (coh);
			
			div_top.style.height = oh + 'px';
			div_top.style.top = (initHeight - oh) + 'px';
		}
		else
		{
			div_top.style.height = ch + 'px';
			div_top.style.top = (initHeight - ch) + 'px';
		}
		
		if (i < steps)
		{
			setTimeout (function(){doResize(i+1)}, 10);
		}
	}
	
	doResize (1);
}
