dynamicanimAttr = "mydynamicanimation";
animateElements = new Array();
currentElement = 0;
speed = 50;
stepsZoom = 8;
stepsWord = 8;
stepsFly = 12;
stepsSpiral = 16;
steps = stepsZoom;
step = 0;
outString = "";
CSInit = new Array;
CSAg = window.navigator.userAgent;
CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
CSIm = new Object();

function set_style(wahl)
{
	document.getElementById("verdienen").style.display = "none";
	document.getElementById("investieren").style.display = "none";
	document.getElementById("erdgas").style.display = "none";
	document.getElementById("highlights").style.display = "none";
	document.getElementById("sicherheit").style.display = "none";
	document.getElementById("anlagen").style.display = "none";
	if (wahl == 1)
		document.getElementById("verdienen").style.display = "inline";
	if (wahl == 2)
		document.getElementById("investieren").style.display = "inline";
	if (wahl == 3)
		document.getElementById("erdgas").style.display = "inline";
	if (wahl == 4)
		document.getElementById("highlights").style.display = "inline";
	if (wahl == 5)
		document.getElementById("sicherheit").style.display = "inline";
	if (wahl == 6)
		document.getElementById("anlagen").style.display = "inline";
}

function IsIE()
{
	return CSAg.indexOf("MSIE") > 0;
}

function CSIEStyl(s)
{
	return document.all.tags("div")[s].style;
}

function CSNSStyl(s) 
{ 
	return CSFindElement(s,0); 
}

function button_ink(num)
{
	if(document.images == null)
		return false;
	document.Forderung.src="Rollover/button_forderung"+num+".gif";
	return true;
}

function button_roh(num)
{
	if(document.images == null)
		return false;
	document.Rohstoffe.src="Rollover/button_roh"+num+".gif";
	return true;
}

function button_krise(num)
{
	if(document.images == null)
		return false;
	document.Krise.src="Rollover/button_krise"+num+".gif";
	return true;
}

function button_metall(num)
{
	if(document.images == null)
		return false;
	document.Metalle.src="Rollover/button_industrie"+num+".gif";
	return true;
}

function button_fphilo(num)
{
	if(document.images == null)
		return false;
	document.F_Philo.src="Rollover/button_philo"+num+".gif";
	return true;
}

function button_wphilo(num)
{
	if(document.images == null)
		return false;
	document.W_Philo.src="Rollover/button_philo"+num+".gif";
	return true;
}

function button_rphilo(num)
{
	if(document.images == null)
		return false;
	document.R_Philo.src="Rollover/button_philo"+num+".gif";
	return true;
}

function button_kphilo(num)
{
	if(document.images == null)
		return false;
	document.K_Philo.src="Rollover/button_philo"+num+".gif";
	return true;
}

function button_agb(num)
{
	if(document.images == null)
		return false;
	document.AGB.src="Rollover/button_agb"+num+".gif";
	return true;
}

function button_kontakt(num)
{
	if(document.images == null)
		return false;
	document.Kontakt.src="Rollover/button_kontakt"+num+".gif";
	return true;
}

function button_imp(num)
{
	if(document.images == null)
		return false;
	document.Impressum.src="Rollover/button_impressum"+num+".gif";
	return true;
}

function button_home(num)
{
	if(document.images == null)
		return false;
	document.Home.src="Rollover/button_home"+num+".gif";
	return true;
}

function button_index(num)
{
	if(document.images == null)
		return false;
	document.Index.src="Rollover/button_index"+num+".gif";
	return true;
}

function CSIShow(n,i)
{
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}

function CSILoad(action)
{
	im = action[1];
	if (document.images)
	{
		CSIm[im] = new Object();
		for (var i=2;i<5;i++)
		{
			if (action[i] != '')
			{
				CSIm[im][i-2] = new Image();
				CSIm[im][i-2].src = action[i];
			}
			else
				CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}

function CSFindElement(n,ly)
{
	if (CSBVers < 4)
		return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem)
	{
		for (var i=0;i<curDoc.layers.length;i++)
		{
			elem = CSFindElement(n,curDoc.layers[i]);
			if (elem)
				return elem;
		}
	}
	return elem;
}

function CSClickReturn ()
{
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // dont follow link
	else return false; // dont follow link
}

function CSButtonReturn ()
{
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}

function CSScriptInit()
{
	if(typeof(skipPage) != "undefined")
	{
		if(skipPage)
			return;
	}
	idxArray = new Array;
	for(var i=0;i<CSInit.length;i++)
		idxArray[i] = i;
	CSAction2(CSInit, idxArray);
}

function CSAction(array)
{ 
	return CSAction2(CSAct, array);
}

function CSAction2(fct, array)
{ 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		if(actArray == null) return false; 
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}

function CSSetStatus(action)
{
	self.status = action[1];
}

function CSSetBackColor(action)
{
	document.bgColor = action[1];
}

  function mydynAnimation()
  {
    i = 0;
    for (index=1; index < document.all.length; index++)
    {
      el = document.all[index];
      animation = el.getAttribute(dynamicanimAttr, 0);
      if (null != animation)
      {
        animateElements[i++] = el;
      }
    }
    window.setTimeout("animate();", speed);
  }
  function animate()
  {
    el = animateElements[currentElement];
    animation = el.getAttribute(dynamicanimAttr, 0);
    step++;
    if(animation == "zoomIn")
    {
      steps = stepsZoom;
      el.style.fontSize = Math.ceil(50+50*step/steps) + "%";
      el.style.left = 0;
    }
      if (step >= steps) 
      {
        el.style.left = 0;
        el.style.top = 0;
        currentElement++;
        step = 0;
      }
    if(currentElement < animateElements.length)
      window.setTimeout("animate();", speed);
  }
  function offsetLeft(el)
  {
    x = el.offsetLeft;
    for (e = el.offsetParent; e; e = e.offsetParent)
      x += e.offsetLeft;
    return x;
  } 
  function offsetTop(el)
  {
    y = el.offsetTop;
    for (e = el.offsetParent; e; e = e.offsetParent)
      y += e.offsetTop;
    return y;
  } 
  function startWord(ih, i)
  {
    for(tag = false; i < ih.length; i++)
    {
      c = ih.charAt(i);
      if(c == '<')
        tag = true;
      if(!tag)
        return i;
      if(c == '>')
        tag = false;
    }
    return -1;
  }
  function endWord(ih, i)
  {
    nonSpace = false;
    space = false;
    while(i < ih.length)
    {
      c = ih.charAt(i);
      if(c != ' ')
        nonSpace = true;
      if(nonSpace && c == ' ')
        space = true;
      if(c == '<')
        return i;
      if(space && c != ' ')
        return i;
      i++;
    }
    return -1;
  }
  function outWord(ih, i1, i2, dyn, anim)
  {
    if(dyn)
      outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">";
    outString += ih.substring(i1, i2);
    if(dyn)
      outString += "</SPAN>";
  }

