var Timers = new Array (-99,-99,-99,-99,-99,-99,-99,-99,-99,-99);
	
	function GetEmptyTimer()
	{
		var i = 0;
		while ((Timers[i] != -99) && (i < 9)) i++;
		return ((Timers[i] == -99) ? i : -99);
	}

  function ShowMsgBox(MsgID, left, top, width, height, txt, color, BorderColor, delay)
	{
		var element = document.getElementById(MsgID);
		element.style.left = left+'px';
		element.style.top = top+'px';
		element.style.width = width+'px';
		element.style.height = height+'px';
		element.style.color = color;
		element.style.borderColor = BorderColor;
		element.innerHTML = txt;
		
		var TimerID = GetEmptyTimer ();
		
		if ((TimerID != -99) && (element.style.display != "block")) 
		{
			element.style.display = 'block';
			element.style.opacity = 0;
			element.style.MozOpacity = 0;
			element.style.filter = 'alpha(opacity=0)';
			Timers[TimerID] = setInterval("FadeIn('"+MsgID+"','"+TimerID+"','"+delay+"')", 15);
		}
		
		return TimerID;
	}
  function HideMsgBox(MsgID, TimerID)
	{
		document.getElementById(MsgID).style.display='none';
		if (TimerID != -99) {clearTimeout(Timers[TimerID]);	Timers[TimerID] = -99;}
	}
	
	function FadeIn(MsgID, TimerID, delay)
	{
		var element = document.getElementById(MsgID);
		element.style.opacity = parseFloat(element.style.opacity)+parseFloat(0.02);
		element.style.MozOpacity = parseFloat(element.style.MozOpacity)+parseFloat(0.02);

		element.style.filter = 'alpha(opacity='+parseInt(element.style.opacity*100)+')';
		if (element.style.opacity >= 0.85) 
			{
					clearTimeout(Timers[TimerID]); 
					if (delay > 0) Timers[TimerID]=setTimeout("StartFadeOut('"+MsgID+"','"+TimerID+"')", delay);
			}
	}
	
	function StartFadeOut (MsgID, TimerID)
	{
		clearTimeout(Timers[TimerID]);
		Timers[TimerID] = setInterval("FadeOut('"+MsgID+"','"+TimerID+"')",15);
	}
	
	function FadeOut(MsgID, TimerID)
	{
		var element = document.getElementById(MsgID);
		element.style.opacity = parseFloat(element.style.opacity)-parseFloat(0.02);
		element.style.MozOpacity = parseFloat(element.style.MozOpacity)-parseFloat(0.02);

		element.style.filter = 'alpha(opacity='+parseInt(element.style.opacity*100)+')';
		if (element.style.opacity <=0.03) HideMsgBox(MsgID, TimerID);
	}
