function TacticaFader()
{
	this.elem = null;
	this.elemBack = null;
	this.elemFore = null;
	this.id = arguments[0];
	this.itemDelay = 2000;
	this.itemIndex = 0;
	this.items = new Array();
	this.stepCount = 0;
	this.stepDelay = 40;
	this.stepMax = 30;
	this.timer = null;
	this.width = arguments[1];
	
	this.addItem = function(text)
	{
		this.items[this.items.length] = text;
	}
	
// function setContent
//-----------------------
	if (document.all)
	{
		this.elem = document.all[this.id];
		this.setContent = function(text)
		{
			var temp = this.elemBack;
			
			this.elemBack = this.elemFore;
			this.elemFore = document.createElement("div");
			this.elemFore.style.left = "0px";
			this.elemFore.style.position = "absolute";
			this.elemFore.style.top = "0px";
			this.elemFore.style.width = "100%";
			this.elemFore.innerHTML = text;
			this.setOpacity(this.elemFore, 0);
			this.elem.appendChild(this.elemFore);

			if (temp != null)
			{
				this.elem.removeChild(temp);
			}
		}
	}
	else if (document.getElementById)
	{
		this.elem = document.getElementById(this.id);
		this.setContent = function(text)
		{
			var temp = this.elemBack;
			
			this.elemBack = this.elemFore;
			
			this.elemFore = document.createElement("div");
			this.elemFore.style.left = "0px";
			this.elemFore.style.position = "absolute";
			this.elemFore.style.top = "0px";
			this.elemFore.innerHTML = text;
			this.setOpacity(this.elemFore, 0);
			this.elem.appendChild(this.elemFore);

			if (temp != null)
			{
				this.elem.removeChild(temp);
			}
		}
	}
	
// function setOpacity
//-----------------------
	if (document.all)
	{
		this.setOpacity = function(element, value)
		{
			if (value <= 0.0) value = 0.000;
			if (value >= 1.0) value = 0.999;

			element.style.width = element.offsetWidth + "px";
			element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (100 * value) + ")";
		}
	}
	else if (document.getElementById)
	{
		this.setOpacity = function(element, value)
		{
			if (value <= 0.0) value = 0.000;
			if (value >= 1.0) value = 0.999;

			element.style.MozOpacity = value;
		}
	}
	
	this.setTimeout = function(f, t)
	{
		window.setTimeout("window.faders." + this.id + "." + f, t);
	}
	
	// fades in the next item
	this.fade = function()
	{
		if (this.stepCount < this.stepMax)
		{
			this.stepCount++;
			this.setOpacity(this.elemFore, this.stepCount / this.stepMax);
			this.setTimeout("fade()", this.stepDelay);
		}
		else
		{
			this.stepCount = 0;
			this.setTimeout("switchContent()", this.itemDelay);
		}
	}
	
	this.init = function()
	{
		if (window.faders == null) window.faders = new Object();
		eval("window.faders." + this.id + " = this");
		this.switchContent();
	}
	
	// switches to the next content item
	this.switchContent = function()
	{
		this.setContent(this.items[this.itemIndex]);
		this.itemIndex++;
		
		if (this.itemIndex > this.items.length - 1)
		{
			this.itemIndex = 0;
		}

		this.setTimeout("fade()", this.stepDelay);
	}
}
