function Slider()
{
	var slideObj = null;
	var currentHeight = 0;
	var maxHeight = 0;
	var handler = null;
	this.hiddenClass = "hidden";
	this.visibleClass = "shown";
	this.step = 20;
	this.timeout = 50;
	var me = this;
	this.doBranch = function(obj)
	{
		slideObj = typeof(obj) == 'string' ? document.getElementById(obj) : obj;
		if(slideObj.className == this.hiddenClass)
		{
			slideObj.className = this.visibleClass;
			currentHeight = 0;
			maxHeight = slideObj.scrollHeight;
			handler = setInterval(me.openBranch,this.timeout);
		}
		else
		{
			currentHeight = slideObj.scrollHeight;
			maxHeight = 0;
			handler = setInterval(me.closeBranch,this.timeout);
		}
	}
	this.openBranch = function()
	{
		currentHeight += me.step;
		if(currentHeight >= maxHeight)
		{	
			currentHeight = maxHeight;
			clearInterval(handler);
		}
		slideObj.style.height = currentHeight + "px";
	}
	this.closeBranch = function()
	{
		currentHeight -= me.step;
		if(currentHeight <= maxHeight)
		{	
			currentHeight = 0;
			clearInterval(handler);
			slideObj.className = me.hiddenClass;
			//if(func) func();
		}
		else slideObj.style.height = currentHeight + "px";
	}
}

var slider = new Slider();
