function slider(id, stay, delay, scrolldelay)
{
	this.ID = document.getElementById(id);
	this.stay = typeof stay == "number" ? stay : 3;
	this.delay = typeof delay == "number" ? delay : 1;
	this.scrolldelay = typeof scrolldelay == "number" ? scrolldelay : 10;
	if(typeof arguments[5] == "number")
	{
		this.MinHeight = arguments[5];
	}
	else
	{
		if(this.ID.style.height)
		{
			this.MinHeight = this.ID.offsetHeight;
		}
		else
		{
			this.MinHeight = 0;
			this.ID.style.height = "0px";
		}
	}
	if(typeof arguments[4] == "number")
	{
		this.MaxHeight = arguments[4];
	}
	else
	{
		var _h = this.ID.offsetHeight;
		var _display = this.ID.style.display;
		this.ID.style.display = '';
		this.ID.style.visibility = 'hidden';
		this.ID.style.height = '';
		this.MaxHeight = this.ID.offsetHeight;
		this.ID.style.visibility = 'visible';
		this.ID.style.display = _display;
		this.ID.style.height = _h + 'px';
	}
	this.before = [];
	this.after = [];
	var intervalId = null;
	var a = this;
	
	function show()
	{
		try{ a.dobefore(); }catch(e){ }
		var h = a.ID.offsetHeight;
		a.ID.style.display = '';
		a.ID.style.height = (h + 10) + "px";
		if(a.ID.offsetHeight >= a.MaxHeight)
		{ 
			setTimeout(shut, a.stay * 1000);
		}
		else
		{
			setTimeout(show, a.scrolldelay); 
		}
	}
	
	function shut()
	{
		var h = a.ID.offsetHeight; 
		a.ID.style.height = (h - 10 < 0 ? 0 : h - 10) + "px";
		if (a.ID.offsetHeight <= a.MinHeight)
		{ 
			if(a.MinHeight == 0) a.ID.style.display = "none";
			try{
				a.doafter();
			}catch(e){
				
			}
		}
		else
		{
			setTimeout(shut, a.scrolldelay); 
		}
	}
	
	this.show = show;
	this.shut = shut;
	setTimeout(show, this.delay * 1000);
}

slider.prototype.addbefore = function(func)
{
	this.before.push(func);
}

slider.prototype.dobefore = function()
{
	for(var i = 0; i < this.before.length; i++)
	{
		this.before[i]();
	}
}

slider.prototype.addafter = function(func)
{
	this.after.push(func);
}

slider.prototype.doafter = function()
{
	for(var i = 0; i < this.after.length; i++)
	{
		this.after[i]();
	}
}
