// browser check
//
function brchk() {
	this.ver   = navigator.appVersion;
	this.agent = navigator.userAgent;
	this.dom   = document.getElementById ? 1:0;
	this.op = ((this.agent.indexOf("Opera") >- 1) && ((this.ver.indexOf("6") >- 1) || (this.ver.indexOf("7") >- 1) ||
				(this.ver.indexOf("8") >- 1) || (this.ver.indexOf("9") >- 1))) ? 1:0;
	this.ie = (((this.ver.indexOf("MSIE 5.0") >- 1) || (this.ver.indexOf("MSIE 5.5") >- 1) || (this.ver.indexOf("MSIE 6") >- 1)) &&
				this.dom && !this.op) ? 1:0;
	this.ie4 = (document.all && !this.dom && !this.op) ? 1:0;
	this.mac = this.agent.indexOf("Mac") >- 1;
	this.ns6 = (this.agent.indexOf("Netscape") >- 1 && this.dom && parseInt(this.ver) >= 5) ? 1:0; 
	this.ns4 = (document.layers && !this.dom) ? 1:0;
	this.ns3 = (this.ver.indexOf("3") >-1 && this.agent.indexOf("Mozilla")) ? 1:0;
	this.mo = ((this.agent.indexOf("Gecko") >- 1) && !this.op) && this.dom ? 1:0;
	this.ff = ((this.agent.indexOf("Firefox") >- 1) && !this.op) && this.dom ? 1:0;
	this.of = (this.op || this.ff);
	this.br = (this.ie || this.ie4 || this.ns4 || this.ns6 || this.op || this.ff || this.mo);
	return this;
}
var br = new brchk();
// for debug
// alert(navigator.userAgent+"\n"+navigator.appVersion);
//alert("Opera: "+br.op+"\nMSIE 5-6: "+br.ie+"\nMSIE 4: "+br.ie4+"\nFirefox: "+br.ff+"\nMozilla: "+br.mo+"\nNetscape 6-7: "+br.ns6+"\nNetscape 3: "+br.ns3);

// reload on resize Opera
//
function ResizeFix(a) {
	if(!br.of) { return; }
	if(!document.pEoprX) {
		document.pEoprY=window.innerWidth;
		document.pEoprX=window.innerHeight;
		document.onmousemove=ResizeFix;
	}
	else {
		if(document.pEoprX) {
			var k=document.pEoprX - window.innerHeight;
			var j=document.pEoprY - window.innerWidth;
			if(k>1 || j>1 || k<-1 || j<-1) {
				document.pEoprY=window.innerWidth;
				document.pEoprX=window.innerHeight;
				location.reload();
			}
		}
	}
}

// reload on resize Netscape 4
//
function regenerate() {
	top.location.reload();
}

function regenerate2() {
	var br = new brchk();
	if(br.ns4 || br.ff); { setTimeout("window.onresize = regenerate",400); }
}

// fenstergroesse check
//
function xychk() {
	var br = new brchk();
	if(br.ns4 || br.ns6 || br.op) { xi = window.innerWidth; yi = window.innerHeight; }
	if(br.ie && document.body) { xi = document.body.clientWidth; yi = document.body.clientHeight; }
}

function TopImage(img) {
	var thisTop, thisLeft;
	if(location.href.indexOf("sites") != -1) { imgsrc = "../images/tlo_top_06.gif"; }
	else { imgsrc = "images/tlo_top_06.gif"; }
	if((br.ff == 1) || (br.ns6 == 1)) { x = 1; }
	else { x = 5; }
	thisTop = (getTop(img) + 2);
	thisLeft = (getLeft(img) - (180 - x));
	if((thisTop != 0) && (thisLeft != 0)) {
		document.write('<div id="wau" style="position:absolute; left:'+(thisLeft)+'; top:'+(thisTop)+'; width:180; height:135;">');
		document.write('<img src="'+imgsrc+'" alt="Hunde" width="180" height="135" border="0"></div>');
	}
}
// position left/top title image
function getLeft(img) {
	var xPos, parentObj;
	xPos = 0; parentObj = img;
	while(parentObj.offsetParent != null) {
		xPos		+= parentObj.offsetLeft;
		parentObj	= parentObj.offsetParent
	}
	xPos += parentObj.offsetLeft;
	return xPos;
}

function getTop(img) {
	var yPos, parentObj;
	yPos = 0; parentObj = img;
	while(parentObj.offsetParent != null) {
		yPos += parentObj.offsetTop;
		parentObj = parentObj.offsetParent;
	}
	yPos += parentObj.offsetTop;
	return yPos;
}
