function NewsBlock(containerid, messageArray)
{
	this.msgs = messageArray;
	this.msgid=0;

	this.nbScrollW='100%'; //Scroll-Breite
	this.nbScrollH=130; //Scroll-Höhe
	this.BlockDelay = 3000;
	this.MoveDelay = 150;
	
	var self = this;
	this.MoveIE1 = function() { fnMoveIE1(self); };

	if (document.getElementById)
	{
		var container = document.getElementById(containerid);

		if (container.style)
		{
			container.style.position ='relative';
			container.style.width = this.nbScrollW;
			container.style.height = this.nbScrollH + 'px';
			container.style.overflow='hidden';
//			container.style.backgroundColor='transparent';
			container.style.display = 'block';
		}

		var containerinnerhtml;
		containerinnerhtml = '<div style="position:absolute;width:'+this.nbScrollW+';height:'+this.nbScrollH+';clip:rect(0 '+this.nbScrollW+' '+this.nbScrollH+' 0);left:0;top:0">\n';
		containerinnerhtml += '<div id="'+containerid+'_divIE1" style="position:absolute;width:'+this.nbScrollW+';left:0;top:1;">' + this.BuildContent() + '</div>\n';
		containerinnerhtml += '<div id="'+containerid+'_divIE2" style="position:absolute;width:'+this.nbScrollW+';left:0;top:0;visibility:hidden">' + this.BuildContent() + '</div>\n';
		containerinnerhtml += '</div>\n';
		
		container.innerHTML = containerinnerhtml;

		this.divIE1 = document.getElementById(containerid + '_divIE1');
		this.divIE2 = document.getElementById(containerid + '_divIE2');

		this.Start();
	}
}

NewsBlock.prototype.Start = fnStart;
NewsBlock.prototype.BuildContent = fnBuildContent;

function fnMoveIE1(self)
{
	var divIE1 = self.divIE1;
	var divIE2 = self.divIE2;
	var pixelTop = parseInt(divIE1.style['top']);
	var pixelTop2 = parseInt(divIE2.style['top']);

	if (pixelTop > 0 && pixelTop <= 5)
	{
		divIE1.style['top'] = '0px';
		divIE2.style['top'] = self.nbScrollH + 'px';
		setTimeout(self.MoveIE1, self.BlockDelay);
		return;
	}
	
	if (pixelTop >= divIE1.offsetHeight*-1)
	{
		divIE1.style['top'] = (pixelTop-5) + 'px';
		divIE2.style['top'] = (pixelTop2-5) + 'px';
	}
	else
	{
		divIE1.style['top'] = (self.nbScrollH + pixelTop2) + 'px';
		divIE1.innerHTML = self.BuildContent();

		self.divIE1 = divIE2;
		self.divIE2 = divIE1;
	}

	setTimeout(self.MoveIE1, self.MoveDelay);
}

function fnStart()
{
	if (document.getElementById)
	{
		fnMoveIE1(this);
		this.divIE2.style['top'] = this.nbScrollH + 'px';
		this.divIE2.style.visibility = 'visible';
	}
}

function fnBuildContent() {
	var msg = this.msgs[this.msgid];
	if (++this.msgid >= this.msgs.length)
		this.msgid=0;
	if (msg) {
		var teile=msg.split("|");
		var ct;
		ct="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"modTickerWindow\"><tr><td valign=top class=modTickerText><a href='" + teile[3] + "'><p class=modTickerTitel>" + teile[0] + "</p><p>" + teile[1] + "</p><p class=modTickerDatum>Meldung vom " + teile[2] + "</p></a></td></tr></table>"
		return ct;
	}
}
