function vrPopup(pEbenen) {
	if (!pEbenen) return;
	window.open("/wecos/wecos-relaunch.php?version=normal&vorlage=popup-info&sprache=deu&"+pEbenen , "popup", "menubar=no,location=no,status=yes,toolbar=no,directories=no,resizable=yes,scrollbars=yes,width=575,height=500,left=100,top=200");
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

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 BurgFensterPopup(pTarget, pMenue, pWidth, pHeight) {
	if (pMenue == '') { pMenue = 'menubar=no,location=no,status=yes,toolbar=no,directories=no,resizable=yes,scrollbars=no'; }
	
	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 BurgScrollFensterPopup(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 setFontSize(pSize) {
	for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel").indexOf("style") != -1 && a.className!="") {
			a.setAttribute("rel","alternate stylesheet");
			a.disabled = true;
			if (document.getElementById('fonticon_'+a.className)) document.getElementById('fonticon_'+a.className).src=document.getElementById('fonticon_'+a.className).src.replace(/_akt/, "_pas");
			if (a.className == pSize) {
				a.disabled = false;
				if (document.getElementById('fonticon_'+pSize)) document.getElementById('fonticon_'+pSize).src=document.getElementById('fonticon_'+pSize).src.replace(/_pas/, "_akt");
			}
		}
	}
	if (document.getElementById('fonticon_')) document.getElementById('fonticon_').src=document.getElementById('fonticon_').src.replace(/_akt/, "_pas");
	if (pSize == "") if (document.getElementById('fonticon_')) document.getElementById('fonticon_').src=document.getElementById('fonticon_').src.replace(/_pas/, "_akt");
}

function prepareListRows() {
	var dlnull = getElementsByTagAndClassName("dl", "liste");
	for (var i=0 ; i<dlnull.length; i++) {
		dlnull[i].onmouseover = function() {
			this.name=this.className;
			if (this.name.indexOf("dunkel") != -1) {
				this.className="liste_hover dunkelpfeil";
			} else {
				this.className="liste_hover";
			}
		}
		dlnull[i].onmouseout = function() {
			this.className=this.name;
		}
		dlnull[i].onclick = function() {
			if (this.getElementsByTagName("a").length>0) {
				location = this.getElementsByTagName("a")[0].href;
			}
		}
	}
}

function switchDialog(pDialog, pLink) {
	if (pDialog == "") return;
	if (pLink) pLink.blur();
	if (document.getElementById('dialog_'+pDialog)) {
		if (document.getElementById('dialog_'+pDialog).style.display=="" || document.getElementById('dialog_'+pDialog).style.display=="none") {
			document.getElementById('dialog_'+pDialog).style.display = "block";
			var innerinputs = document.getElementById('dialog_'+pDialog).getElementsByTagName("input");
			for (var i=0; i<innerinputs.length; i++) {
				if (innerinputs[i].className.indexOf("focus") != -1) {
					innerinputs[i].focus();
					break;
				}
			}
		} else {
			document.getElementById('dialog_'+pDialog).style.display = "none";
		}
	} else {
		if (pLink) {
			if (pLink.href) location = pLink.href;
		}
	}
}

function loadAjaxReq(url,elementId) {
	if (!ajax) return true;
	ajax.onreadystatechange = function() {
		doAjaxAction(elementId);
	}
	ajax.open("get", url, true);
	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();

window.onload = prepareListRows;




/*
function changeFontSize(pDir) {
	if (document.getElementById('body') && pDir!="") {
		if (document.getElementById('body').style.fontSize == "") {
			if (pDir == "plus") {
				document.getElementById('body').style.fontSize = "90%";
			} else if (pDir == "minus") {
				document.getElementById('body').style.fontSize = "50%";
			} else {
				document.getElementById('body').style.fontSize = "70%";
			}
		} else {
			if (pDir == "plus") {
				document.getElementById('body').style.fontSize = (parseInt(document.getElementById('body').style.fontSize)+20) + "%";
			} else if (pDir == "minus") {
				document.getElementById('body').style.fontSize = (parseInt(document.getElementById('body').style.fontSize)-20) + "%";
			} else {
				document.getElementById('body').style.fontSize = "70%";
			}
		}
	}
}
*/