var timeoutid = null;

function showid(blockid)
{
	document.getElementById("block" + blockid).style.display = 'block';
	
	if (document.getElementById("link" + blockid).className.indexOf("wasactief") == -1)
	{
		document.getElementById("link" + blockid).className = "actief" + blockid + " " + document.getElementById("link" + blockid).className;
	}
	
	var i = 1;
	while(document.getElementById("block" + i) != null)
	{
		if (i != blockid)
		{
			hideId(i);
		}
		
		i ++;
	}
	
	stoptimer();
}

function hideId(blockid)
{
	document.getElementById("block" + blockid).style.display = 'none';
	
	if (document.getElementById("link" + blockid).className.indexOf("wasactief") == -1)
	{
		document.getElementById("link" + blockid).className = "";
	}
	
	starttimer();
}

function closeAll()
{
	var i = 1;
	while(document.getElementById("block" + i) != null)
	{
		hideId(i);
		
		i ++;
	}
	
	stoptimer();
}

function starttimer()
{
	stoptimer();
	timeoutid = setTimeout('closeAll()', 250);
}

function stoptimer()
{
	if (timeoutid != null)
	{
		clearTimeout(timeoutid);
	}
}