function popupOpen() {		// parameter.reihenfolge: URL, WIDTH, HEIGHT
	var w,h,url,aw,ah;
	var a=popupOpen.arguments;
	if (a.length==0) return;
	url=a[0];
	if (a.length>1) {
		w=a[1]; h=a[2];
	}
	else {
		w=500; h=400
	}
	win=window.open(url,'win_front','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+w+',height='+h);
	if (screen) {
		aw=screen.availWidth;
		ah=screen.availHeight;
		win.moveTo(((aw/2)-(w/2)),((ah/2)-(h/2)));
	}
	win.focus();
}

function openPicture() {		// parameter.reihenfolge: URL, WIDTH, HEIGHT
	var w,h,url,aw,ah;
	var a=openPicture.arguments;
	if (a.length==0) return;
	url=a[0];
	if (a.length>1) {
		w=a[1]; h=a[2];
	}
	else {
		w=500; h=400
	}
	win_pic=window.open(url,'win_pic','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+w+',height='+h);
	if (screen) {
		aw=screen.availWidth;
		ah=screen.availHeight;
		win_pic.moveTo(((aw/2)-(w/2)),((ah/2)-(h/2)));
	}
	win_pic.focus();
}
// Flash-Detection
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion() {
	var version, axo, e;
	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {}

	if (!version){
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");

		} catch (e) {	}
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {}
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) { }
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	if (version && version!=-1) {
		if( /([^ ]*) ([0-9]*),(.*)/.exec(version) ) {
			version=parseInt(RegExp.$2);
		}
	}	
	return version;
}
function GetSwfVer(){
	var flashVer = -1;	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var descArray = navigator.plugins["Shockwave Flash" + swVer2].description.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var flashVer = tempArrayMajor[0];
		}
	}
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
/// ADB-Navigation
var adb_nav_activ_id;
function showADBNav( ul_id ) {
	if (adb_nav_activ_id && adb_nav_activ_id != ul_id) {
		document.getElementById(adb_nav_activ_id).style.display='none';
		adb_nav_activ_id=false;
	}
	if (ul_id && ul_id != adb_nav_activ_id) {
		document.getElementById( ul_id ).style.display='block';
		adb_nav_activ_id = ul_id;
	}
}
/// Galery
function changeGalleryPic(l,g,url) {
	if (typeof old_g_link == "undefined") old_g_link="g_"+g+"_0";
	if (old_g_link==l.id) return true;
	document.getElementById(old_g_link).className="gal";
	l.className="gal_sel";
	old_g_link=l.id;	
	document.getElementById("gallery_"+g).src=url;
} 


/// AJAX
var http_request = false;
var reload_url = location.href;

function BrowserIsCompatible() {
	if (!window.RegExp) return false;
	var AGENTS = ["opera","msie","safari","firefox","netscape","mozilla"];
	var agent = navigator.userAgent.toLowerCase();
	for (var i = 0; i < AGENTS.length; i++) {
		var agentStr = AGENTS[i];
		if (agent.indexOf(agentStr) != -1) {
			var versionExpr = new RegExp(agentStr + "[ \/]?([0-9]+(\.[0-9]+)?)");
			var version = 0;
			if (versionExpr.exec(agent) != null) {
				version = parseFloat(RegExp.$1);
			}
			if (agentStr == "opera") return version >= 9;

			if (agentStr == "safari") return version >= 125;
			if (agentStr == "msie") return (version >= 5.5 &&agent.indexOf("powerpc") == -1);
			if (agentStr == "netscape") return version > 7;
		}
	}
	return document.getElementById;
}
function requestObject(){
	try{
		if(typeof ActiveXObject!="undefined"){
			return new ActiveXObject("Microsoft.XMLHTTP")
		}
		else if (window.XMLHttpRequest){
			var out=new XMLHttpRequest();
			out.overrideMimeType('text/xml');
			return out;
		}
	}
	catch(a){ }return null
}
function makeGetRequest(url) {
	http_request = requestObject();
	http_request.onreadystatechange = alertContents;
	http_request.open('GET', url, true);
	http_request.send(null);
}
function alertContents() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var alert_box=false;
			try {
				if (http_request.responseText.indexOf("id='alert_box'") != -1) {
					var rt=http_request.responseText;
					var p1=rt.indexOf('>', rt.indexOf("id='alert_box'"));
					var p2=rt.indexOf('</div>');
					var t=rt.substring(p1,p2)
					alert(t.replace("<([^<>\s]*)(\s[^<>]*)?>"," "));
					
				}
				//debug(http_request.responseText);
			}
			catch(e) {
				alert("fehler: "+e);
			}
			
			if (alert_box) {
				debug(alert_box);
			}
			location.href = reload_url;
			//document.getElementById('container').innerHTML = http_request.responseText;
		}
		else if (http_request.status == 0) {
			// IE: abfangen
		}
		else {
			alert('Anforderung konnte nicht verarbeitet werden, HTTP-Fehler '+http_request.status);
		}
	}
}

function debug(msg) {
	if (typeof w == "undefined") {
		w=window.open('','w','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=640,height=400');
	}
	w.document.write(msg+"<br>");
}
function trace(o) {
	var out="";
	for (z in o) {
		try {
		if (o[z]!="" && o[z]!=null)
			if (z=="innerHTML" || z=="outerHTML") out+=z+" = [..HTML-Code..]; <br>\n";
			else out+=z+" = "+o[z]+"; <br>";
		}
		catch (e) {
			out+= z+" = ERROR: "+e+"; <br>";
		}
	}
	debug(out)
}

