/*-----------------------------------------------------+
 |  	          author: marc tanner 			|
 +----------------------[Options]----------------------*/
  speed=50; 	// wert in Millisekunden
  stepIE=10; 	// differenz von Schritt zu Schritt [IE]
  stepNS=0.1;	// differenz von Schritt zu Schritt [NS]
		// wert zwischen 0.9 und 0.1
 /*---------------------[/Options]---------------------*/

fadeObjects = new Array();
fadeInTimers = new Array();
fadeOutTimers = new Array();
maxObj = 0;

function fadeIn(object,filterMS,optionsNS)
{
	if (object.id == "")
	{
		maxObj++;
		object.id = maxObj;
	}
	fadeObjects[object.id] = object;

	if(fadeOutTimers[object.id]!=undefined)
	{
		window.clearTimeout(fadeOutTimers[object.id]);
	}
	if(object.style.MozOpacity)
	{
		if(object.style.MozOpacity<optionsNS)
		{
			object.style.MozOpacity=eval(object.style.MozOpacity)+stepNS;
    			fadeInTimers[object.id] = window.setTimeout("fadeIn(fadeObjects["+object.id+"], "+filterMS+", "+optionsNS+")", speed);
		}
		else
		{
			window.clearTimeout(fadeInTimers[object.id]);
		}
	}
	else
	{	
		if(object.filters.alpha.opacity<filterMS)
		{
			object.filters.alpha.opacity+=stepIE;
    			fadeInTimers[object.id] = window.setTimeout("fadeIn(fadeObjects["+object.id+"], "+filterMS+", "+optionsNS+")", speed);
		}
		else
		{
			window.clearTimeout(fadeInTimers[object.id]);
		}
	}
}

function fadeOut(object,filterMS,optionsNS)
{
	if(fadeInTimers[object.id]!=undefined)
	{
		window.clearTimeout(fadeInTimers[object.id]);
	}

	if(object.style.MozOpacity)
	{
		if(object.style.MozOpacity>optionsNS)
		{
			object.style.MozOpacity-=stepNS;
    			fadeOutTimers[object.id] = window.setTimeout("fadeOut(fadeObjects["+object.id+"], "+filterMS+", "+optionsNS+")", speed);
		}
		else
		{
			window.clearTimeout(fadeOutTimers[object.id]);
		}
	}
	else
	{	
		if(object.filters.alpha.opacity>filterMS)
		{
			object.filters.alpha.opacity-=stepIE;
    			fadeOutTimers[object.id] = window.setTimeout("fadeOut(fadeObjects["+object.id+"], "+filterMS+", "+optionsNS+")", speed);
		}
		else
		{	
			window.clearTimeout(fadeOutTimers[object.id]);
		}
	}
}
