
<!--

// Fading must be greater than 3 !

// User-variables
var Speed = 0;
var Loop = true;
var ScrollText = new Array;
var ScrollTextColor = new Array;
var BackgroundColor = '177,202,211';

// Constants
var SpacerX = 10;
var SpacerY = 5;
var LineHeight = 20;
var Fading = 30;
var Timer;

// Dynamic variables
var TextBlockStart = 0;
var TextBlockLimit = 0;
var ParentDivTop = 0;
var ParentDivLeft = 0;
var ParentDivHeight = 0;
var ParentDivWidth = 0;
var ParentDivColor = new Array(3);

var FadingArray = new Array(3);
FadingArray[0] = new Array();
FadingArray[1] = new Array();
FadingArray[2] = new Array();

	

  function DeactivateDiv (Index)
  {
		document.getElementById ('DDScroller_' + Index).style.left = '0px';
		document.getElementById ('DDScroller_' + Index).style.top = '0px';
		document.getElementById ('DDScroller_' + Index).style.visibility = 'hidden';
  }

  

  function CheckForEnd ()
  {
    if (TextBlockStart > TextBlockLimit)
    {
      if (!Loop) window.clearInterval(Timer); else { TextBlockStart = 0; TextBlockLimit = 0; InitializeDiv(0); }
    }
  }

  function FadeOut (Index)
  {
    ColorDummy = document.getElementById ('DDScroller_' + Index).style.color.replace(/rgb/gi, '').replace(/ /gi, '').split (',');
	
    ColorDummy[0] = Math.floor(Number(ColorDummy[0].substr(1, ColorDummy[0].length - 1)) + FadingArray[0][Index]);
    ColorDummy[1] = Math.floor(Number(ColorDummy[1]) + FadingArray[1][Index]);
    ColorDummy[2] = Math.floor(Number(ColorDummy[2].substr(0, ColorDummy[2].length - 1)) + FadingArray[2][Index]);

    if (ColorDummy[0] < 0) ColorDummy[0] = 0;
    if (ColorDummy[1] < 0) ColorDummy[1] = 0;
    if (ColorDummy[2] < 0) ColorDummy[2] = 0;
    if (ColorDummy[0] > 255) ColorDummy[0] = 255;
    if (ColorDummy[1] > 255) ColorDummy[1] = 255;
    if (ColorDummy[2] > 255) ColorDummy[2] = 255;

    document.getElementById ('DDScroller_' + Index).style.color = 'rgb(' + String(ColorDummy[0]) + ',' + String(ColorDummy[1]) + ',' + String(ColorDummy[2]) + ')';
  }

  function FadeInit (Color)
  {
    ColorFadeDummy = Color.split (',');
    FadingArray[0].push ((ParentDivColor[0] - Number(ColorFadeDummy[0])) / Fading);
    FadingArray[1].push ((ParentDivColor[1] - Number(ColorFadeDummy[1])) / Fading);
    FadingArray[2].push ((ParentDivColor[2] - Number(ColorFadeDummy[2])) / Fading);
  }

  function FadeIn (Index)
  {
    ColorDummy = document.getElementById ('DDScroller_' + Index).style.color.replace(/rgb/gi, '').replace(/ /gi, '').split (',');

    ColorDummy[0] = Math.floor(Number(ColorDummy[0].substr(1, ColorDummy[0].length - 1)) - FadingArray[0][Index]);
    ColorDummy[1] = Math.floor(Number(ColorDummy[1]) - FadingArray[1][Index]);
    ColorDummy[2] = Math.floor(Number(ColorDummy[2].substr(0, ColorDummy[2].length - 1)) - FadingArray[2][Index]);

    if (ColorDummy[0] < 0) ColorDummy[0] = 0;
    if (ColorDummy[1] < 0) ColorDummy[1] = 0;
    if (ColorDummy[2] < 0) ColorDummy[2] = 0;
    if (ColorDummy[0] > 255) ColorDummy[0] = 255;
    if (ColorDummy[1] > 255) ColorDummy[1] = 255;
    if (ColorDummy[2] > 255) ColorDummy[2] = 255;

    document.getElementById ('DDScroller_' + Index).style.color = 'rgb(' + String(ColorDummy[0]) + ',' + String(ColorDummy[1]) + ',' + String(ColorDummy[2]) + ')';
  }

	function MoveDIVs ()
	{
    wasHere = false;

    for (Counter = TextBlockStart; Counter <= TextBlockLimit; Counter++)
    {
  		Height = document.getElementById ('DDScroller_' + Counter).style.top;
  		Height = Height.substr (0, Height.length - 2);

      if (Number(Height) <= Number(ParentDivTop) + Number(SpacerY) + Number(Fading)) FadeOut (Counter);
      if (Number(ParentDivTop) + Number(ParentDivHeight) - Number(SpacerY) - Number(LineHeight) - Number(Fading) <= Number(Height)) FadeIn (Counter);
      if ((!wasHere) && (Number(Height) < Number(ParentDivTop) + Number(SpacerY)))
      {
        DeactivateDiv(TextBlockStart);
        TextBlockStart++;
      }
      wasHere = true;
  		document.getElementById ('DDScroller_' + Counter).style.top = (Height - 1) + 'px';
    }
    if (Number(ParentDivTop) + Number(ParentDivHeight) - Number(Height) - Number(SpacerY) - Number(LineHeight) >= Number(LineHeight))
    {
      if (TextBlockLimit != ScrollText.length - 1)
      {
        TextBlockLimit++;
		    InitializeDiv (TextBlockLimit);
      }
    }
    CheckForEnd ();
	}

  function GetParentDivProperties ()
  {
	//ParentDivTop = document.getElementById ('DDScroller').style.top.substr (0, document.getElementById ('DDScroller').style.top.length - 2);
    //ParentDivLeft = document.getElementById ('DDScroller').style.left.substr (0, document.getElementById ('DDScroller').style.left.length - 2);
    
	ParentDivTop = 0;
    ParentDivLeft = 0;
    ParentDivHeight = document.getElementById ('DDScroller').style.height.substr (0, document.getElementById ('DDScroller').style.height.length - 2);
    ParentDivWidth = document.getElementById ('DDScroller').style.width.substr (0, document.getElementById ('DDScroller').style.width.length - 2);

    ColorDummy = document.getElementById ('DDScroller').style.backgroundColor.replace(/rgb/gi, '').replace(/ /gi, '').split (',');

    ParentDivColor[0] = "177";
	ParentDivColor[1] = "202";
	ParentDivColor[2] = "211";
  }

  function SetDefaultProperties (StackSpeed, StackLoop, StackBackgroundColor)
  {
    Speed = StackSpeed;
    Loop = StackLoop;
    BackgroundColor = StackBackgroundColor;
  }
  function AddTextLine (Text, Color)
  {
    ScrollText.push (Text);
    ScrollTextColor.push (Color);
    FadeInit (Color);
  }

	function InitializeFader ()
	{
		SetDefaultProperties (100, true, '177,202,211');
		GetParentDivProperties ();

		AddTextLine ('Willkommen auf unsere Internetseite', '0,0,0');
		AddTextLine ('Auf den folgenden Seiten finden Sie Beschreibungen', '0,0,0');
		AddTextLine ('zu den von mir angebotenen Wattführungen ', '0,0,0');
		AddTextLine ('in den Nationalpark Niedersächsisches Wattenmeer', '0,0,0');
		AddTextLine ('Aktuell werden fünf verschiedene Wattwanderungen', '0,0,0');
		AddTextLine ('mit unterschiedlichen Themenschwerpunkten', '0,0,0');
		AddTextLine ('und unterschiedlicher Dauer angeboten.', '0,0,0');
		AddTextLine ('', '0,0,0');
		AddTextLine ('www.wattwanderung.de', '147,0,0');
		AddTextLine ('', '0,0,0');
		AddTextLine ('', '0,0,0');
		AddTextLine ('WATTENMEER-FERIEN.DE - Ferien beim Wattführer ab 19 Euro', '0,0,0');
		AddTextLine ('Neben interessanten und preiswerten Wattwanderungen', '0,0,0');
		AddTextLine ('gibt es auch gleich die passenden Ferienwohnungen dazu', '0,0,0');
		AddTextLine (' ', '147,147,255');
		AddTextLine ('zentral gelegen und trotzdem absolut ruhig', '0,0,0');
		AddTextLine ('viel Platz zum Toben und Spielen', '0,0,0');
		AddTextLine ('... und wann dürfen wir Sie begrüssen?', '0,0,0');
		AddTextLine ('', '0,0,0');
		AddTextLine ('www.wattenmeer-ferien.de', '147,0,0');

		TextBlockStart = 0;
		TextBlockLimit = 0;

		CreateTextDIVs();
		InitializeDiv(0);
		Timer = window.setInterval ('MoveDIVs()', Speed);
	}
	function CreateTextDIVs ()
	{
		DummyNodeBody = document.getElementById('DDScroller');
		for (Counter = 0; Counter < ScrollText.length; Counter++)
		{
			DummyNode = document.createElement("div");

			DummyNode.id = 'DDScroller_' + Counter;
			DummyNode.style.visibility = 'hidden';
			DummyNode.style.position = 'absolute';
			DummyNode.style.fontSize = '9pt';
			DummyNode.style.fontFamily = 'Arial';
			DummyNode.style.fontWeight = 'bold';
			DummyNode.style.overflow = 'hidden';

			DummyNodeText = document.createTextNode(ScrollText[Counter]);
			DummyNode.appendChild(DummyNodeText);
			DummyNodeBody.appendChild (DummyNode);
		}
	}
	function InitializeDiv (Index)
	{
		document.getElementById ('DDScroller_' + Index).style.left = String(Number(ParentDivLeft) + Number(SpacerX)) + 'px';
		document.getElementById ('DDScroller_' + Index).style.width = '100%';
		document.getElementById ('DDScroller_' + Index).style.top = String(Number(ParentDivTop) + Number(ParentDivHeight) - Number(SpacerY) - Number(LineHeight)) + 'px';
		document.getElementById ('DDScroller_' + Index).style.color = 'rgb(' + BackgroundColor + ')';
		document.getElementById ('DDScroller_' + Index).style.visibility = 'visible';
	}
  
//-->
function MarkNavigation(object)
{
	for(counter = 0; counter < 11; counter++) { document.getElementById('Nav' + counter).className = ""; }
	object.className = "MarkNavigation";
  }
    

