/* TICKER */
//	====================================== Ticker ===================================================
var ns  = (document.layers)? 1:0;
var ie  = (document.all)? 1:0;
var ns6 = (document.getElementById && !ie)? 1:0;
var mac = (navigator.userAgent.indexOf("Mac") != -1);
var contentLay;	//	TeaserLayer
function scrollInit()
{
  //	=========== allg. Vorgaben =============
  speed= 1;				// 	Geschwindigkeit
  visibleArea=13;	//	hoehe des Clipbereichs
  scrollDir=-1;		// 	scrollrichtung 1, -1
  pauseTime=3;		//	wait in seconds
	contiue=null;
	var anzRows=null;
	//	=========== end Vorgaben ===============
	
	aktRow=0;	//	aktuelle Zeile
  contentLay=new layInit();
  layScroll(scrollDir,1);//Start
	window.setInterval("contentLay.scroll()",10);
}

function getAnzRows(){
//alert("anzrows:" + anzRows);
	if(anzRows==null){
		setTimeout('getAnzRows()',10);
	}else{
		anzRows--;//	Anzahl der Zeilen im Ticker - 1
		scrollInit();
	}
}

function layInit()
{	
  if(ns){	this.OBJ=document.layers["clipper"].document.layers["text"];this.end=this.OBJ.document.layers["end"].top;}
  if(ie){	this.OBJ=document.all["text"].style;this.end=document.all["end"].offsetTop;	}
  if(ns6){this.OBJ=document.getElementById("text").style;	this.end=document.getElementById("end").offsetTop;}
  this.yPos=(scrollDir == -1)? 0:-this.end;
  this.dir=scrollDir;	
	this.speed=speed;	
	this.end-=visibleArea;	
	this.end*=-1;  
	this.RowCt=Math.round(this.end/visibleArea);
	this.RowCt+=(this.end%visibleArea >0)? 1:0;
	this.end=this.RowCt*visibleArea;
	this.toScroll=false;	
	this.scroll=scroll;	
	this.pos=pos;
  this.pos();
}
//	================= Methoden =====================
function scroll()
{
  if(this.toScroll)
  {	
	  this.yPos+=this.dir;
	  if(this.yPos %visibleArea==0)pauseScroll();
	  this.pos();
  }
}

function pos(){
	if(ie){	
		if(mac){	this.OBJ.visibility="hidden"; }
		this.OBJ.pixelTop=this.yPos;	
		if(mac){	this.OBJ.visibility="visible"; }
	}
	if(ns || ns6){ document.getElementById("text").style.top = this.yPos + "px"; }
}
//	=============== Funktionen ===========================
function layScroll(dir,onOff){ 
	window.clearInterval(contiue);
	contentLay.dir=dir*contentLay.speed;
	contentLay.toScroll=onOff;
}
function pauseScroll(){
	if(aktRow == anzRows){contentLay.yPos=-visibleArea;}
	layScroll(scrollDir,0);
	contiue=window.setInterval("layScroll("+scrollDir+",1)",pauseTime*1000);
	aktRow++;
	aktRow=(aktRow > anzRows)?	1:aktRow;
}



//	================================================ End Ticker =====================================

// Call the following with your function as the argument
window.onload=getAnzRows;

