var screenH;
var screenW;
var lang;
var ThisContLyr;
var ThisObJ;
var PosX;
var PosY;
var firstLoad;
var OldTop;

if (parseFloat(navigator.appVersion)<5 && parseFloat(navigator.appVersion.substr((navigator.appVersion.indexOf("MSIE")+5),3)) < 5 ){
		window.location.href = "NoDOM.htm";
	}
	


var lightback = new Image();
lightback.src ="images/tablightcell.jpg"
var darkback = new Image();
darkback.src ="images/tabbluecell.jpg"
function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.koq = (agent.indexOf('konqueror') != -1);
    this.saf = (agent.indexOf('safari')!=-1);
	this.iphone = (agent.indexOf('iphone')!= -1);
    this.ko3 = (this.koq && (this.minor >= 3.0));
    this.ns  = ((agent.indexOf('opera') == -1) && (agent.indexOf('mozilla')!=-1) && (agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4) && (this.major < 5));
    this.ie   = (agent.indexOf('opera') == -1 && agent.indexOf('msie') != -1);
    this.ie3  = (this.ie && (this.major == 2));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ied = (this.ie4 || this.ie5);
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
	this.ieD = (this.ie55 || this.ie6);
    this.win98 = (this.ie && (this.major >= 4) && (this.major < 5) && (agent.indexOf('98') != -1));
    this.dom  = ((this.ns && (this.major >= 5))||(this.ko3 && (this.major >= 5)));
    this.op3 = (agent.indexOf('opera') != -1);
    this.op6 = (this.op3 && (this.major >= 4));
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}
var is = new Is();

if(is.iphone){
	window.location.href = "mobile/mobile.htm";
}
		

var Weite=0;
var Hoehe=0;

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.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}
Weite = Fensterweite();
Hoehe = Fensterhoehe();
 
if (!window.alteWeite && window.innerWidth) {
	
	window.onresize = neuAufbau; 
}

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

if(is.ns4) {
    doc = "document";
    sty = "";
    htm = ".document";
    
}
if(is.ie4 || is.op6) {
    doc = "document.all";
    sty = ".style";
    htm = "";
}
if(is.dom) {
	doc = "document.getElementById(";
	sty = ").style";
	htm = ")";
}

/*function SizeRight(){
	var DocHeight;
	var ScreenHeight;
		ScreenHeight = parseInt(self.screen.availHeight);
		if(is.ie){DocHeight = parseInt(window.document.body.scrollHeight)+40}
		else if(is.op6 || is.ns || is.saf || is.koq){DocHeight = parseInt(window.document.body.offsetHeight)+50}
		//alert(DocHeight);
		if(DocHeight > ScreenHeight ){
			DocHeight = ScreenHeight ;
			if(is.ie){document.body.scroll="yes"}
			window.resizeTo(540,parseInt(DocHeight));
		}else {
			window.resizeTo(540,parseInt(DocHeight));
		}	
}*/


function window_onload() {
	var lang;
	firstLoad = 0;
	ThisContLyr = null;
	if(is.ns){lang = navigator.language}
	else if(is.ie){lang = window.navigator.userLanguage}
	if(lang != "de" && lang != "de-DE"){
		lang = "deutsch";
		//window.location.href = "english.htm";
	}
	screenH = self.screen.availHeight;
	screenW = self.screen.availWidth;
	if(Weite < 1050 || Hoehe < 700){
		window.resizeTo(1050,800);
	}
	document.getElementById('menuDiv').style.width = Fensterweite() - 250;
}

function LayerPos(Ereignis){
 	if (is.ns){	
		PosX = Ereignis.pageX;
  		PosY = Ereignis.pageY;
	}else if(is.koq){
		PosX = Ereignis.clientX;
		PosY = Ereignis.clientY;
	}
}
if(is.ns || is.koq){document.onmousemove = LayerPos}

function Inhalt(elementID) {
	window.status=elementID;
}

function oldOff(){
	if (ThisContLyr != null){
		ThisContLyr.style.visibility = 'hidden';
		}
	}
function allOff(){
	var ThisBotLyr;
	if (ThisContLyr != null){ThisContLyr.style.visibility = 'hidden'}
}
	
function overMenu(elementID,xdist){
	var ThisCell;
	var ThisLyr;
	ThisCell = 'Cell' + elementID;
	ThisLyr = 'lyr-' + elementID;
	ThisObj = document.getElementById(ThisCell);
	ThisContLyr = document.getElementById(ThisLyr);
	ThisObj.style.backgroundImage = 'url(images/tablightcell.jpg)'
	if (ThisContLyr != null) {
		var LPos = PosX - parseInt(xdist);
		if(LPos < 280){LPos = 280;}
		if(is.ns || is.koq){
			ThisContLyr.style.left = LPos;
			ThisContLyr.style.top = 250;
		}
		if(is.ie ){
			LPos = window.event.clientX - parseInt(xdist);
			if(LPos < 280){LPos = 280;}
			ThisContLyr.style.left = LPos;
			//ThisContLyr.style.top = window.event.clientY + document.body.scrollTop + 50;
			ThisContLyr.style.top = 250;
		}
		ThisContLyr.style.visibility = 'visible';
	}
	window.status = elementID;
} 

function outMenu(elementID){
	ThisObj.style.backgroundImage = 'url(images/tabbluecell.jpg)';
	//ThisObj.style.backgroundImage = darkback;
	window.status = elementID;
}	


