/*
Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
*/

//Breite des Tickers
var marqueewidth = "486";

// Hoehe des Tickers
var marqueeheight = "20";

// Tickergeschwindigkeit (groesser enspricht schneller)
var marqueespeed = 1;

// Ticker anhalten bei onMouseover (0=Nein, 1=Ja)?
var pauseit = 1;

// Intervall fuer scrollen (ms)
var scrollinterval = 30;

// Trenner zwischen Feldern des Arrays mit den Meldungen (Leerzeichen escaped)
var concatstring = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;***&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

// Werte aus dem Array + Trenner in einem String zusammenfuehren
var contentstring = concatstring + content.join(concatstring);

// Speed-Faktor für Mac, es wird um macfactor * marqueespeed weitergescrollt, 
// dafuer ist macfactor * scrollinterval Pause zwischen den Scrollaktionen
var macfactor = 1;

if (navigator.appVersion.indexOf("Macintosh") > -1)
{	
	macfactor = 4;
	if (navigator.appVersion.indexOf("MSIE") > -1)
	{
		contentstring = "";		
		marqueeheight = 0;
	}	
}
	
// Die Verdopplung muss sein, damit eine Endlosschleife OHNE Luecke moeglich wird
contentstring += contentstring;

// Inhalt dem Ticker zuweisen. "<nobr>" stellt sicher, dass alles in einer Zeile bleibt
var marqueecontent = "<nobr>" + contentstring + "</nobr>";

marqueespeed = (document.all) ? marqueespeed : Math.max(1, marqueespeed - 1); // slow speed down by 1 for NS
marqueespeed *= macfactor;

var copyspeed = marqueespeed;
var pausespeed = (pauseit == 0) ? copyspeed : 0;
var iedom = document.all || document.getElementById;

if (iedom)
{
	document.write('<span id="nttemp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">' + marqueecontent + '</span>');
}

var actualwidth = "";
var cross_marquee;
var ns_marquee;

function scrollmarquee()
{

	if (iedom) 
	{		
		if (marqueewidth - parseInt(cross_marquee.style.left) <= actualwidth)
		{
			cross_marquee.style.left = parseInt(cross_marquee.style.left) - copyspeed + "px";
		}
		else
		{
			cross_marquee.style.left = marqueewidth - actualwidth / 2 + "px";
		}
	}
	else if (document.layers) 
	{
		if (marqueewidth - ns_marquee.left <= actualwidth)
		{
			ns_marquee.left -= copyspeed;
		}
		else
		{
			ns_marquee.left = marqueewidth - actualwidth / 2;
		}
	}
}

function populate() 
{
	if (contentstring != "")
	{
		if (iedom) 
		{
			cross_marquee = (document.getElementById) ? document.getElementById("iemarquee") : document.all.iemarquee;
			cross_marquee.style.left = "10px";
			actualwidth = document.getElementById("nttemp").offsetWidth;
					
			while (actualwidth / 2 < marqueewidth && actualwidth > 0)
			{
				contentstring += contentstring;
				marqueecontent = '<nobr>' + contentstring + '</nobr>';
				actualwidth += actualwidth;
			}
			cross_marquee.innerHTML = marqueecontent;
		}
		else if (document.layers)
		{
			ns_marquee = document.ns_marquee.document.ns_marquee2;
			ns_marquee.left = 10;
			ns_marquee.document.write(marqueecontent);
			ns_marquee.document.close();
			while (ns_marquee.document.width / 2 < marqueewidth)
			{
				contentstring += contentstring;
				marqueecontent = "<nobr>" + contentstring + "</nobr>";
				ns_marquee.document.write(marqueecontent);
				ns_marquee.document.close();
			}
			actualwidth = ns_marquee.document.width;
		}		
		lefttime = setInterval("scrollmarquee()", parseInt(scrollinterval * macfactor));	
	}
}

window.onload = populate

if (iedom || document.layers) 
{
    with (document) 
    {
        write('<table border="0" cellspacing="0" cellpadding="0"><tr><td>');
        if (iedom) 
        {
            write('<div style="position:relative;width:' + marqueewidth + 'px;height:' + marqueeheight + 'px;overflow:hidden">');
            write('<div style="position:absolute;width:' + marqueewidth + 'px;height:' + marqueeheight + 'px" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">');
            write('<div id="iemarquee" style="position:absolute;left:0px;top:3px"></div>');
            write('</div></div>');
        }
        else if (layers) 
        {
            write('<ilayer width=' + marqueewidth + 'px height=' + marqueeheight + 'px name="ns_marquee">');
            write('<layer name="ns_marquee2" left=0 top=3 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>');
            write('</ilayer>');
        }
       write('</tr></td></table>');
    }
}
