
function BurgFensterPopup(pTarget, pMenue, pWidth, pHeight) {
	if (pMenue == '') { pMenue = 'menubar=no,location=no,status=yes,toolbar=no,directories=no,resizable=yes,scrollbars=yes'; }
	
	if ((pWidth == '') && (pHeight == '')) return;
			
	win = window.open('', pTarget , pMenue + ',width=' + pWidth + ',height=' + pHeight); 
	if (!document.all) pHeight = parseInt(pHeight)+4;
	win.resizeTo(pWidth, pHeight);
	win.moveTo(0, 0);
}

function BurgDruckPopup(pTarget, pMenue, pWidth, pHeight) {
	if (pMenue == '') { pMenue = 'top=0,left=0,menubar=yes,location=no,status=yes,toolbar=no,directories=no,resizable=yes,scrollbars=yes'; }
	
	if ((pWidth == '') && (pHeight == '')) return;
	if (pHeight == '') {
		pHeight = screen.availHeight - 10;
		if (document.all) pHeight = pHeight - 20;
	}
	
	winDruck = window.open('', pTarget , pMenue + ',width=' + pWidth + ',height=' + pHeight); 
	winDruck.resizeTo(pWidth, pHeight);
}

function BurgFensterPopupUrl(pUrl, pTarget, pMenue, pWidth, pHeight) {
	if (pMenue == '') { pMenue = 'menubar=no,location=no,status=yes,toolbar=no,directories=no,resizable=yes,scrollbars=yes'; }
	
	if ((pWidth == '') && (pHeight == '')) return;
			
	win = window.open(pUrl, pTarget , pMenue + ',width=' + pWidth + ',height=' + pHeight); 
	if (!document.all) pHeight = parseInt(pHeight)+4;
	win.resizeTo(pWidth, pHeight);
	win.moveTo(0, 0);
}

function standortAjax(pHref) {
	if (!pHref) return;
	loadAjaxReq(pHref.replace(/#karte/,'')+'&vorlage=ajax','einrichtung');
	window.scrollTo(0,370);
	return false;
}

function loadAjaxReq(url,elementId) {
	if (!ajax) return true;
	ajax.onreadystatechange = function() {
		doAjaxAction(elementId);
	}
	ajax.open("get", url, true);
	ajax.setRequestHeader('Content-Type','text/xml; charset=ISO-8859-1');
	if (ajax.overrideMimeType) {
		ajax.overrideMimeType('text/xml; charset=ISO-8859-1');
	}
	ajax.send(null);
	return true;
}

function doAjaxAction(elementId) {
	if (ajax.readyState != 4) return;
	if (ajax.status ==200) document.getElementById(elementId).innerHTML = ajax.responseText;
	ajax = getHTTPObject();
}

function getHTTPObject() {
	try {
		var ajaxhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			var ajaxhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			try {
				var ajaxhttp = new XMLHttpRequest();
			} catch (e) {
				var ajaxhttp = false;
			}
		}
	}
	return ajaxhttp;
}

var ajax = getHTTPObject();

function getElementsByTagAndClassName(tagname, classname) {
	var results = new Array();
	var elems = document.getElementsByTagName(tagname);
	for (var i=0; i<elems.length; i++) {
		if (elems[i].className.indexOf(classname) != -1) {
			results[results.length] = elems[i];
		}
	}
	return results;
}

function leistungenSuchen(pFormobj) {
	if (!pFormobj) return false;
	var tmp_suchstring = "";
	var checknoxen = getElementsByTagAndClassName("input", "leistung-ausstattung");
	for (var i=0 ; i<checknoxen.length; i++) {
		checknoxen[i].name = "";
		if (checknoxen[i].checked) {
			tmp_suchstring = tmp_suchstring + " "+ checknoxen[i].value;
		}
	}
	if (document.getElementById("suchstring")) tmp_suchstring = tmp_suchstring + " " + document.getElementById("suchstring").value;
	if (document.getElementById("ebene4")) document.getElementById("ebene4").value = tmp_suchstring;
	pFormobj.submit();
}

