var hh=1;
var mh;
var inter;
var status=0;
var id;

function toggle(cid,h){
	id = "tbl"+cid;
	mh = h;
	if(status){
		inter=setInterval("HideBox()",3)
	}else{
		inter=setInterval("ShowBox()",3)
	}
}

//we show the box by setting the visibility of the element and incrementing the height smoothly
function ShowBox()
{
	//Depending on the amount of text, set the maximum height here in pixels
	if(hh==mh)
	{
		clearInterval(inter);
		return;
	}

	obj = document.getElementById(id);
	obj.style.height = hh + 'px';
	obj.style.display = 'block';
	hh+=1;
	status = 1;
}

//same way as above but reversed
function HideBox()
{
	obj = document.getElementById(id);

	if(hh==1)
	{
		obj.style.display = 'none';
		clearInterval(inter);
		return;
	}
	hh-=1;
	obj.style.height = hh + 'px';
	status = 0;
}
