function detect(){
	window.inited=true;
	window.bs="egal";
	if (navigator.userAgent.indexOf("Windows")>-1){
		if(window.navigator.userAgent.indexOf("Windows NT 5.1")>-1){
			bs="xp";
		}else{
			window.bs="windows";
		}
	}else if(navigator.userAgent.indexOf("OS X")>-1){
		window.bs="osx";
	}else if(navigator.userAgent.indexOf("Macintosh")>-1 || navigator.userAgent.indexOf("Mac_PowerPC")>-1){
		window.bs="mac";
	}
	window.browser="ie";
	if(navigator.userAgent.indexOf("Gecko")>-1){ //neuer Mozilla oder kompatible
		if(navigator.userAgent.indexOf("Netscape")>-1){
			window.browser="netscape";
		}else if(navigator.userAgent.indexOf("Safari")>-1){
			window.browser="safari";
		}else if(navigator.userAgent.indexOf("Firefox")>-1){
			window.browser="firefox";
		}else if(navigator.userAgent.indexOf("Camino")>-1){
			window.browser="camino";
		}else if(navigator.userAgent.indexOf("Chimera")>-1){
			window.browser="chimera";
		}else{
			window.browser="mozilla";
		}
	}else if(navigator.userAgent.indexOf("Opera")>-1){ //ohje
		window.browser="opera";
	}else if(navigator.userAgent.indexOf("MSIE")>-1){ // Explorer oder Kopie wie OmniWeb
		if(bs=="mac"){
			if(navigator.userAgent.indexOf("MSIE 5.2")>-1){
				window.bs="osx";
			}
		}
	}else if(navigator.userAgent.indexOf("iCab")>-1){
		window.browser="icab";
	}else if(navigator.appName.indexOf("Netscape")>-1){
		window.browser="netscape_alt";
	}
	window.randy=0;
	window.randx=0;
	window.ies=0;
	window.h_add=0;
	window.b_add=0;
	if(window.bs=="osx"){
		window.randx=0; //linker offset
		window.ies=50;
		switch(window.browser){
		case "safari":	window.randx=0;
						window.randy=23;
						window.h_add=1;
						window.b_add=0;
						break;
		case "firefox":	window.randx=0;
						window.randy=0;
						window.h_add=3;
						break;
		case "icab":	window.randx=1;
						window.randy=23;
						break;
		case "camino":
		case "chimera": window.randx=0;
						window.randy=23;
						window.h_add=3;
						break;
		default:		window.randx=0; //mozilla
						window.randy=0;
						window.h_add=3;
						break;
		}
	}else{
		switch(window.browser){
		case "firefox":	window.randx=0;
						window.randy=0;
						break;
		case "mozilla":	window.randx=0;
						window.randy=0;
						break;
		default:		window.randx=0;
						window.randy=0;
		}
	}
	if(window.bs=="xp"){
		window.randx+=1;
		window.randy+=6;
	}						
}

function popup(link, titelname, id, breite, hoehe, xoff, yoff, scroll){
	if(!window.inited){detect();};
	pars="width="+(breite+window.b_add)+", height="+(hoehe+window.h_add)+", resizable=yes, scrollbars="+scroll+", toolbar=no, status=no, left="+(xoff+window.randx)+", top="+(yoff+window.randy);
	link="bildansicht.php?titel="+titelname+"&pfad="+link;
	window.open(link, id, pars);
}
function picswap(ident,bild,alttext){
	document.getElementById(ident).src=bild;
	document.getElementById(ident).alt=alttext;
}
//IE hover-Ersatzfunktionen
function dotit(id,ord){
	if(window.browser=="ie" || ord){
		var boxitem=document.getElementById(id);
		boxitem.className="logoboxh";
		//boxitem.style.margin="0px";
		//boxitem.style.borderWidth="1px";
	}
}
function undotit(id, ord){
	if(window.browser=="ie" || ord){
		var boxitem=document.getElementById(id);
		boxitem.className="logobox";
		//boxitem.style.margin="1px";
		//boxitem.style.borderWidth="0px";
	}
}
//Classchange
function chKlasse(id,klasse){
	var boxitem=document.getElementById(id);
	boxitem.className=klasse;
}
function chBild(id,bild){
	var boxitem=document.getElementById(id);
	boxitem.src=bild;
}
function chBg(id,bild){
	var boxitem=document.getElementById(id);
	boxitem.style.backgroundImage='url('+bild+')';
}
function leeren(feldId,wert){
	if (document.getElementById(feldId).value == wert) document.getElementById(feldId).value = '';
}
function fuellen(feldId,wert){
	if (document.getElementById(feldId).value == '') document.getElementById(feldId).value = wert;
}
function vorladen(url){
	var bild=new Image;
	bild.src=url;
	bilder.push(bild);
}
//init:
var bilder=[];
detect();
