﻿function Fensterweite()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function Fensterhoehe()
{
 if (window.innerHeight) return window.innerWidth;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}


function neuAufbau()
{
 if (Weite != Fensterweite() || Hoehe != Fensterhoehe())
 window.history.go(0);
}

/*Überwachung von Netscape initialisieren*/
if(!window.Weite && window.innerWidth)
  {
   window.onresize = neuAufbau;
   Weite = Fensterweite();
   Hoehe = Fensterhoehe();
  }


var clipLeft = 0;
var clipHeight = 230;
var clipRight = 100;
var leftper = 0;
var lyrWidth = 0;
var time,theWidth,DHTML;

function prepLyr()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	if(document.all) {
		clipRight = document.body.clientWidth;
		docHeight = document.body.clientHeight;
	}
	else {
		clipRight = window.innerWidth + 2;
		docHeight = window.innerHeight;
	}
	var topper = Math.round((docHeight - clipHeight) / 100 * 37);
	var x = new getObj('example');
	var y = new getObj('nav');
	
	if (document.layers) {
		lyrWidth = x.style.clip.right;
		lyrWidth += 20;
		x.style.top = topper;
		x.style.clip.top = 0;
		x.style.clip.right = clipRight;
		x.style.clip.bottom = clipHeight;
		x.style.clip.left = clipLeft;
		y.style.top = (topper + 240);
		y.style.left = (clipRight / 2 - 55);
		vis('visible');
	}
	else if (document.all && !document.getElementById) {
		lyrWidth = x.obj.offsetWidth;
		x.style.pixelTop = topper;
		x.style.clip = 'rect('+0+' '+clipRight+' '+clipHeight+' '+clipLeft+')';
		y.style.pixelTop = (topper + 240);
		y.style.pixelLeft = (clipRight / 2 - 55);
		vis('visible');
	}
	else if (document.getElementById) {
		lyrWidth = x.obj.offsetWidth;
		x.style.top = topper + "px";
		x.style.clip = 'rect('+0+' '+clipRight+' '+clipHeight+' '+clipLeft+')';
		y.style.top = (topper + 240) + "px";
		y.style.left = (clipRight / 2 - 55) + "px";
		vis('visible');
	}
}

function scrollayer(amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj('example');
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function realscroll()
{
	if (!DHTML) return;
	clipLeft += amount;
	clipRight += amount;
	leftper -= amount;
	if (clipLeft < 0 || clipRight > lyrWidth) {
		clipLeft -= amount;
		clipRight -= amount;
		leftper += amount;
		return;
	}
	if (document.getElementById || document.all) {
		clipstring = 'rect('+0+' '+clipRight+' '+clipHeight+' '+clipLeft+')'
		thelayer.style.clip = clipstring;
		thelayer.style.left = leftper;
	}
	else if (document.layers) {
		thelayer.style.clip.left = clipLeft;
		thelayer.style.clip.right = clipRight;
		thelayer.style.left = leftper;
	}
	time = setTimeout('realscroll()',theTime);
}

function anfang() {

	if (!DHTML) return;
	thelayer = new getObj('example');
	if (!thelayer) return;
	leftper = 0;
	clipLeft = 0;
	if(document.all) {
		clipRight = document.body.clientWidth;
	}
	else {
		clipRight = window.innerWidth + 2;
	}
	if (document.getElementById || document.all){
		clipstring = 'rect('+0+' '+clipRight+' '+clipHeight+' '+clipLeft+')';
		thelayer.style.clip = clipstring;
		thelayer.style.left = leftper;
	}
	else if (document.layers){
		thelayer.style.left = leftper;
		thelayer.style.clip.left = clipLeft;
		thelayer.style.clip.right = clipRight;
	}
}

function ende() {

	if (!DHTML) return;
	thelayer = new getObj('example');
	if (!thelayer) return;
	if(document.all) {
		clipRight = document.body.clientWidth;
	}
	else {
		clipRight = window.innerWidth + 2;
	}
	leftper = clipRight - lyrWidth;
	clipLeft = lyrWidth - clipRight;
	clipRight = lyrWidth;
	if (document.getElementById || document.all){
		clipstring = 'rect('+0+' '+clipRight+' '+clipHeight+' '+clipLeft+')';
		thelayer.style.clip = clipstring;
		thelayer.style.left = leftper;
	}
	else if (document.layers){
		thelayer.style.left = leftper;
		thelayer.style.clip.left = clipLeft;
		thelayer.style.clip.right = clipRight;
	}
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('example');
	var g = new getObj('nav');
	f.style.visibility = val;
	g.style.visibility = val;
}

function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
    this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
 {
	if (document.layers[name])
	{
    	this.obj = document.layers[name];
    	this.style = document.layers[name];
	}
	else if (document.layers.length)
	{
		for (i=0;i<document.layers.length;i++)
		{
			if (document.layers[i].document.layers[name])
			{
		    	this.obj = document.layers[i].document.layers[name];
		    	this.style = document.layers[i].document.layers[name];
				return;
			}
		}
	}
  }
}
