// Javascript Objekte und Funktionen


function InitPage()
// dynamische Elemente der Seite initialisieren
{
	TickerInit();

	if ( document.getElementById('holder1') ) {  // nur wenn Scrollen im Inhalt ueberhaupt aktiv
		initScrollLayers();
	}
}// InitPage




function initScrollLayers() {
	var showScrollbar = false;  // default

	// Groesse des Scrollbereiches an Fenstergroesse anpassen
	if ( document.getElementById ) {
		var height = document.getElementById('seitenrahmen').offsetHeight;
		// alert('seitenrahmen=' + height + ', seitenkopf=' + document.getElementById('seitenkopf').offsetHeight + ', seitenkoerper=' + document.getElementById('seitenkoerper').offsetHeight + ', inhalt=' + document.getElementById('inhalt').offsetHeight + ', lyr1=' + document.getElementById('lyr1').offsetHeight);
		height = height - 180;
		document.getElementById('holder1').style.height = height + 'px';
		document.getElementById('scrollbar1').style.height = height + 'px';
		document.getElementById('wn1').style.height = (height-40) + 'px';
		document.getElementById('track1').style.height = (height-30) + 'px';

		if ( height < document.getElementById('lyr1').offsetHeight ) {
			showScrollbar = true;
		}
		// alert(height + ', ' + document.getElementById('lyr1').offsetHeight);
	}

	if ( showScrollbar ) {

  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll,
  // if horizontal scrolling, id of element containing scrolling content (table?)
  	var wndo1 = new dw_scrollObj('wn1', 'lyr1', null);

  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  	wndo1.setUpScrollbar("dragBar1", "track1", "v", 1, 1);

	// Read instructions if your scrolling layers are inside tables

 	  // Scrollbars initially hidden in this example
  	dw_showLayers("scrollbar1"); // , "scrollbar2", "scrollbar3");
	}
}
function dw_showLayers() {
  if ( document.getElementById ) {
    var lyr, i;
    for (i=0; arguments[i]; i++) {
      lyr = document.getElementById( arguments[i] );
      lyr.style.visibility = "visible";
    }
  }
}


function getContentScrollHead() {
	document.write("<div id=\"holder1\"><div id=\"wn1\"><div id=\"lyr1\" class=\"content\">");
}

function getContentScrollTail() {
	document.write('<br /></div></div> \
  		<div id="scrollbar1"> \
    		<div id="up1"><a href="javascript:;" onclick="return false" onmouseover="dw_scrollObj.initScroll(\'wn1\',\'up\')" onmouseout="dw_scrollObj.stopScroll(\'wn1\')" onmousedown="dw_scrollObj.doubleSpeed(\'wn1\')" onmouseup="dw_scrollObj.resetSpeed(\'wn1\')"><img src="/images/scroll-btn-up.gif" width="13" height="14" alt="" border="0"/></a></div> \
    		<div id="track1"> \
    		  <div id="dragBar1"></div> \
    		</div> \
    		<div id="down1"><a href="javascript:;" onclick="return false" onmouseover="dw_scrollObj.initScroll(\'wn1\',\'down\')" onmouseout="dw_scrollObj.stopScroll(\'wn1\')" onmousedown="dw_scrollObj.doubleSpeed(\'wn1\')" onmouseup="dw_scrollObj.resetSpeed(\'wn1\')"><img src="/images/scroll-btn-dn.gif" width="13" height="14" alt="" border="0" /></a></div> \
  		</div> \
		</div>');

}

		// Funktion fuer Newsticker
		userAgent = navigator.userAgent.toLowerCase();
		n4 = document.layers;
		ie = (document.all && userAgent.indexOf("mac")<0);
		// ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
//		n6 = document.getElementById; //  && navigator.userAgent.indexOf("Opera")==-1;
		w3c = document.documentElement;
		dhtml = ((n4 || ie || w3c) &&  userAgent.indexOf("aol")<0);
//		alert("useragent="+userAgent + "\n" + "n4="+n4 + ", n6="+n6 + ", ie="+ie+", w3c="+w3c+", dhtml="+dhtml);
		TickerRun = 1; // default: Ticker bewegt sich

		function Ticker(name, parentId, id, breite){
		     this.name = name;
		     this.breite = breite;
		     this.el = n4? document.layers[parentId].document.layers[id] : ie? document.all[id] : document.getElementById(id);
		     this.css = n4 ? this.el : this.el.style;
		     this.inhaltBreite = n4? this.el.document.width : this.el.offsetWidth;
		     this.inhaltY = 0;
		     this.speed = 1;
		     this.links = TickerLinks;
		     this.stop = TickerStop;
		}

		function TickerLinks() {
  	  	this.stop();
  	  	this.timer = setTimeout(this.name+".links()", 100);
  	  	if (this.inhaltY > (-1 * this.inhaltBreite)) this.inhaltY = this.inhaltY - this.speed;
  	  	else this.inhaltY = this.breite;
//				alert("TickerLinks\n"+"inhaltY="+this.inhaltY+"\ninhaltBreite="+this.inhaltBreite+"\ncss.left="+this.css.left);
  	  	this.css.left =  this.inhaltY + "px"; // this.inhaltY;
		}

		function TickerStop() {
  	   if (this.timer) clearTimeout(this.timer);
		}

		function TickerInit(){
				 if ( TickerRun == 0 ) return;
		     if (!dhtml) return;
				 var id = 'tickerText';
				 if (! ((n4 && document.layers[id]) || (ie && document.all[id]) || document.getElementById(id))) return;
//				 if ( ! document.all['tickerText'] && ! document.getElementById('tickerText') ) return;
				 einTicker = new Ticker("einTicker", "tickerDiv", "tickerText", 200);
				 if ( TickerRun && TickerRun != 0 ) einTicker.links();
		}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function openWindow(url, width, height)  {  // Fenster anzeigen
	if ( ! url ) url = '';
	if (! width ) width = 800;
	if (! height ) height = 600;
	window.open('/layout/blank.html','window','location=0,directories=0,menubar=0,resizable=1,toolbar=0,status=1,scrollbars=1,width='+width+',height='+height+'');
} // openBild

