function opacity(id, opacStart, opacEnd, millisec) 
{
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	if	(!window.opacRecord)
	{ window.opacRecord = new Array(); }

	if	(document.getElementById(id).style.opacity)
	{ opacStart = (document.getElementById(id).style.opacity*100); }

	//determine the direction for the blending, if start and end are the same nothing happens
	if	(opacStart > opacEnd) 
	{ clearTimeout(window.opacRecord[id]); window.opacRecord[id] = setTimeout("changeOpac('" + id + "', '"+opacStart+"', '"+opacEnd+"', 'negative')", (timer * speed)); timer++; }
	else if	(opacStart < opacEnd) 
	{ clearTimeout(window.opacRecord[id]); window.opacRecord[id] = setTimeout("changeOpac('" + id + "', '"+opacStart+"', '"+opacEnd+"', 'positive')", (timer * speed)); }
}

//change the opacity for different browsers
function changeOpac(id, current, end_value, direction, timing) 
{
	if	(direction == 'negative' && Math.round(current) > end_value)
	{ var continue_var = true; }
	else if	(direction == 'positive' && Math.round(current) < end_value)
	{ var continue_var = true; }
	
	if	(continue_var)
	{
		var object = document.getElementById(id).style; 
		
		if		(direction == 'negative')
		{ current = (Math.round(current)-1); }
		else if	(direction == 'positive')
		{ current = (Math.round(current)+1); }
		
		object.opacity = (current / 100);
		object.MozOpacity = (current / 100);
		object.KhtmlOpacity = (current / 100);
		object.filter = "alpha(opacity=" + current + ")";
		
		window.opacRecord[id] =  setTimeout("changeOpac('" + id + "', '"+current+"', '"+end_value+"', '"+direction+"', '"+timing+"')", timing);
	}
}