//browsercheck
function lib_bwcheck(){
	this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6||this.ie7||this.ie8
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5)?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=this.ie8||this.ie7|this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5
this.nobw=(!this.dom && !this.ns4 && !this.ie4)?1:0;
return this
}
var bw = new lib_bwcheck();

// correct css resizebug ns4
if (bw.ns4) {
	var iHeight = innerHeight;
	var iWidth = innerWidth;
	
}           
function reloadLocation() {
	if( iWidth != innerWidth || iHeight != innerHeight) {
		layerSize;
		history.go(0);
	}
}
if (bw.ns4) {
	window.onresize = reloadLocation;
}

//preload and swap images in menuebar
var imageCount = 6;
var imagePath = "../10_images/";
if (location.href.indexOf("index.html")>-1) {
	var imagePath = "10_images/";
}

if(document.images) {
	var btn_blau = new Array(imageCount);
	var btn_rot  = new Array(imageCount);
	var btn_akt	 = new Array(imageCount);
}
for (i=1;i<=imageCount;i++ ){
	btn_rot[i-1] = new Image();
	btn_rot[i-1].src = imagePath+i+"_btn_rot.jpg";
	btn_blau[i-1] = new Image();
	btn_blau[i-1].src = imagePath + i +"_btn_blau.jpg";
	btn_akt[i-1] = new Image();
	btn_akt[i-1].src = imagePath + i +"_btn_akt.jpg";
}
function swap_image(buttonNumber,buttonColor) {
	var thisButton = imagePath + buttonNumber +"_btn_"+buttonColor+".jpg";
	var buttonPosition = 'pos' + buttonNumber;
	if (bw.ns4 && location.href.indexOf("00_durchblick.html")<0) {
		if (document.divMenue && buttonPosition != 'pos7') {
			document.divMenue.document.images[buttonPosition].src = thisButton;
		}
		else if (document.divExCont) {
			document.divExCont.document.images[buttonPosition].src = thisButton;
		}
		else document.images[buttonPosition].src = thisButton;
	}
	else document.images[buttonPosition].src = thisButton;
}
//resize layer to inner screenwidth
function layerSize() {
	var px = (bw.ns4 || bw.ie6 || bw.op5)?"":"px";
	var pageWidth = (bw.ns4 || bw.ns6 || bw.op5)?innerWidth:document.body.clientWidth;
	myObj = (bw.dom)?document.getElementById('divMenue').style:(bw.ie4)?document.all['divMenue'].style:(bw.ns4)?document.divMenue:0;
	if (bw.ie || bw.op5) myObj.pixelWidth = pageWidth+px; 
	if (bw.ns4 || bw.ns6) myObj.width = pageWidth-14+px;
}
if (location.href.indexOf('00_durchblick.html')<0) onload = layerSize;
if (!bw.ns4) window.onresize = layerSize;
