	var first;
	var second;
	var firstHeight;
	var secondHeight, secondMaxHeight;
	var timer;
	var speed=30;
	var old;
	
	function show(i)
	{
		if(cur!=0){
			first=document.getElementById('div'+cur); firstHeight=first.offsetHeight;
		}
		second=document.getElementById('div'+i); secondHeight=second.offsetHeight;
		secondMaxHeight=document.getElementById('table'+i).offsetHeight;
		old=i;
		collapse();
	}
	
	function collapse()
	{
		firstHeight-=speed;
		if(firstHeight>speed)
		{
			timer=setTimeout('collapse()',50) 
			if(cur!=0) first.style.height=firstHeight; 
		}else{ 
			if(cur!=0) first.style.height=0;
			clearTimeout(timer);
			if(cur!=old) { expand(); cur=old; } else {	 cur=0; }
		}
	}
	
	function expand()
	{
		secondHeight+=speed;
		if(secondHeight<secondMaxHeight)
		{
			timer=setTimeout('expand()',50) 
			second.style.height=secondHeight;
		}else{ 
			second.style.height=secondMaxHeight;
			clearTimeout(timer);
		}
	}