function SetTransparency(obj, transparency)
{
	obj.style.opacity		= transparency;
	obj.style.MozOpacity	= transparency;
	obj.style.filter		= "alpha(opacity=" + transparency * 100 + ")";
}

function GetTransparency(obj)
{
	if (obj.style.opacity != undefined)
		return obj.style.opacity;
	if (obj.style.MozOpacity != undefined)
		return obj.style.MozOpacity;

	return (obj.style.filter.opacity / 100.0);
}

function Fade(obj, end, step, time)
{
	var t 		= GetTransparency(obj);
	var cEnd	= Math.min(1.0, Math.max(0.0, end));
	var newT 	= parseFloat(t) + parseFloat(step);

	if (step == 0.0)				return;
	if ((step > 0.0) && (newT >= end))	return;
	if ((step < 0.0) && (newT <= end))	return;

//	alert(t + " - " + newT + " - " + step);
	SetTransparency(obj, newT);
	setTimeout(function(){ Fade(obj, end, step, time); }, time);
}

