function Ticker(name,id,shiftBy,interval) {
	this.name = name;
	this.id = id;
	this.shiftBy = shiftBy?shiftBy:1;
	this.interval = interval?interval:100;
	this.runId = null;
	this.div = document.getElementById(id);
	var node = this.div.firstChild;
	var next;

	while(node) {
		next = node.nextSibling;
		if (node.nodeType==3) this.div.removeChild(node);
		node = next;
	}
	this.left = 0;
	this.shiftLeftAt = this.div.firstChild.offsetWidth;
	this.div.style.height = this.div.firstChild.offsetHeight;
	this.div.style.width = 2*screen.availWidth;
	this.div.style.visibility = 'visible';
}

function startTicker() {
	this.stop();
	this.left -= this.shiftBy;
	if (this.left<=-this.shiftLeftAt) {
		this.left = 0;
		this.div.appendChild(this.div.firstChild);
		this.shiftLeftAt = this.div.firstChild.offsetWidth;
	}
	this.div.style.left = this.left+'px';
	this.runId = setTimeout(this.name+'.start()',this.interval);
}

function stopTicker() {
	if (this.runId) clearTimeout(this.runId);
	this.runId = null;
}

function changeTickerInterval(newinterval) {
	if (typeof(newinterval) == 'string') newinterval = parseInt('0'+newinterval,10);
	if (typeof(newinterval) == 'number' && newinterval > 0) this.interval = newinterval;
	this.stop();
	this.start();
}

Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
Ticker.prototype.changeInterval = changeTickerInterval;
if (window.tickercolor) {
	var farbe = 'bgcolor="'+tickercolor+'"';
}
else {
	var tickercolor = "#ffffcc";
}
if (window.tickercolor) {
	var farbe = 'bgcolor="'+tickercolor+'"';
}
else {
	var farbe = "";
}

var farbe=tickercolor;
if (window.transparent) {
	if (transparent==1) {
		var farbe="";
	}
	else {
		var farbe=tickercolor;
	}
}
if (rollover_underline==false) {
	var textdecoration_underline = 'none';
}
else {
	var textdecoration_underline = 'underline';
}
if (rollover_underline == null) {
	var rollover_underline=1;
}
if(font_underline==null) {
	var font_underline=0;
}
if(fontbold==null) {
	var fontbold=0;
}
if(rollover_underline==0) {
	var textdecoration_underline='none';
}
else {
	var textdecoration_underline='underline';
}
if(font_underline==1) {
	var font_underline='underline';
}
else {
	var font_underline='none';
}
if (fontbold==1) {
	var textdecoration_fontbold='bold';
}
else {
	var textdecoration_fontbold='normal';
}
document.open();
document.write('<style type=\"text/css\">');
document.write('.shortnews:link { vertical-align:middle; color:'+fontcolor+'; text-decoration:'+font_underline+'; font-weight:'+textdecoration_fontbold+'; font-family:'+font+'; font-size:'+fontsize+'px}');
document.write('.shortnews:visited { vertical-align:middle; color:'+fontcolor+'; text-decoration:'+font_underline+'; font-weight:'+textdecoration_fontbold+'; font-family:'+font+'; font-size:'+fontsize+'px}');
document.write('.shortnews:hover { vertical-align:middle; color:'+rollovercolor+'; font-weight:'+textdecoration_fontbold+'; font-family:'+font+'; font-size:'+fontsize+'px; text-decoration:'+textdecoration_underline+'}');
document.write('.shortnews:active { vertical-align:middle; color:'+fontcolor+'; font-weight:'+textdecoration_fontbold+'; text-decoration:none; font-family:'+font+'; font-size:'+fontsize+'px; text-decoration:'+textdecoration_underline+'}');
document.write('.x1 { vertical-align:middle; color:'+splitcolor+'; font-weight:'+textdecoration_fontbold+'; text-decoration:none; font-family:'+font+'; font-size:'+fontsize+'px}');
document.write('.tickerLabel { font-family:'+font+'; font-weight:bold; vertical-align:middle; font-size:11px; color:'+farbe+'}');
document.write('.container { position:relative; height:20px; width:'+tickerwidth+'px; overflow:hidden; background-color:'+farbe+'}');
document.write('.ticker { position:relative; visibility:hidden; left:0px; top:0px; border-width:0px; border-style:none; font-size:12px; font-weight:bold; width:'+tickerwidth+'px; height:20px; vertical-align:middle}');
document.write('.clstsu { PADDING-RIGHT:2em; PADDING-LEFT:2em; PADDING-BOTTOM:2px; MARGIN:0px; CURSOR:pointer; COLOR:green}');
document.write('.clstsd { PADDING-RIGHT:2em; PADDING-LEFT:2em; PADDING-BOTTOM:2px; MARGIN:0px; CURSOR:pointer; COLOR:red}');
document.write('.clstimg { WIDTH:18px; HEIGHT:12px}');
document.write('</style>');
document.close();

if (fehler==true) {
	news=new Array();
	news[0]="<a class='shortnews' onclick='return false' href='x.htm'>ShortNews wird gewartet, wir bitten um Verständnis.</a>";
	news[1]="<a class='shortnews' onclick='return false' href='x.htm'>Der Newsticker ist in Kürze wieder verfügbar.</a>";
	news[2]="<a class='shortnews' onclick='return false' href='x.htm'>Der Newsticker ist in Kürze wieder verfügbar.</a>";
}

var textcontent;
var i=0;
textcontent="";
for(i=0; i<=15; i++) {
	if(news[i]==null) {
		break;
	}
	textcontent+="<span class='banner'>&nbsp;&nbsp;"+news[i]+"<span class='x1'>&nbsp;&nbsp;&nbsp;+&nbsp;+&nbsp;+&nbsp;</span></span>";
	textcontent+"&nbsp;&nbsp;";
}
textcontent+"";
m=textcontent;
var ticker=null;
var ts=speed*7;
function initSSNTicker() {
	ticker=new Ticker('ticker','tickerID',1,ts);
	ticker.start();
}
document.open();
document.write("<div align='left' class='container'>");
document.write("<div class='ticker' id='tickerID' onMouseOver='ticker.stop();' onMouseOut='ticker.start();'>");
document.write("<nobr>");
document.write(m+m);
document.write("</nobr>");
document.write("</div>");
document.write("</div>");
document.close();

if (window.addEventListener){ 
	window.addEventListener('load', initSSNTicker, false); 
} else if (window.attachEvent) {
	var r = window.attachEvent("onload", initSSNTicker); 
} else { 
	window.onload=initSSNTicker;
} 

