
function slideFx(id,options)
{
	var divs = $(id).style;
	if(divs.getPropertyValue('overflow') != 'hidden')
		divs.setProperty('overflow', 'hidden', '');
	if(divs.getPropertyValue('min-height') != '')
		divs.removeProperty('min-height');
	var frames;
	if(typeof options=='undefined')
		options = {};
	if(options.duration)
		duration = options.duration;
	else
		duration = 100;
	if(options.fps)
		frames = options.fps;
	else
		frames = 40;

	var currentHeight = $(id).offsetHeight;
	var originalHeight = $(id).scrollHeight;

	duration = duration / 1000;
	var NHeight; var OHeight;
	var c = 0;
	var frame = new Array();

	tInterval = 1000 / frames;
	frames = frames * duration;

	var slide = function(frame)
			{
				divs.setProperty('height', frame[c] + "px", "");
				c++;
				if(c<=frames)
					window.setTimeout(slide, tInterval, frame);
				else
				{
					if(NHeight==0)
						divs.setProperty('height', 0, "");
					else
						divs.removeProperty('height');
					if(options.onComplete)
						window.setTimeout(options.onComplete, tInterval)
				}
			}

	if(currentHeight == originalHeight)
	{
		NHeight = 0;
		OHeight = currentHeight;
		for(i=0;i<=frames;i++)
		{
			a = (2*i)/frames;
			if(i<frames/2)
				frame[i] = OHeight - (OHeight/2)*(a)*(a);
			else
				frame[i] = OHeight - (-OHeight/2)*(((a-1) * (a-3)) - 1);
		}
		slide(frame);
	}

	else if(currentHeight == 0)
	{
		NHeight = originalHeight;
		for(i=0;i<=frames;i++)
		{
			a = (2*i)/frames;
			if(i<frames/2)
				frame[i] = (NHeight/2)*(a)*(a);
			else
				frame[i] = (-NHeight/2)*(((a-1) * (a-3)) - 1);
		}
		slide(frame);
	}
}

function $(el){return document.getElementById(el)}

