	/* Allgemeine Funktion fuer zentriertes Popup, idealerweise schreibt man aber eine eigene Wrapper-function fuer explizite Anwendung, siehe unten */
	function popupCenter(url, name, attributes, width, height) {
		topx = (screen.height - height) / 2;
		leftx = (screen.width - width) / 2;
		if (attributes.length > 0)
			if (attributes.substr(attributes.length-1,1) != ',')
				attributes += ','
		var w = window.open(url, name, attributes + 'width='+width+',height='+height+',screenx='+leftx+',screeny='+topx+',top='+topx+',left='+leftx+',status=yes,resizable=yes,scrollbars=yes');
		w.focus();
	}

	function popupBild(url, width, height) {
		popupCenter(url, 'popupbild', '', width, height);
		return false;
	}
	function popupDesign(url) {
		popupCenter(url, 'popupdesgin', '', 400,250);
		return false;
	}
	function TsAutoHover() {
		if (!document.getElementsByTagName) {
			return;
		}
		var imgs = document.getElementsByTagName('img');
		var i, l = imgs.length;
		var j, m;
		var reSwapme = /autoswap|auto-swap/;
		var reIsActive = /_a\.[a-z]+/;
		var reFileParts = /(.*)\.([a-z]+$)/;
		var srcParts;
		for (i = 0; i < l; i++) {
			if (reSwapme.test(imgs[i].className) && !reIsActive.test(imgs[i].src)) {
				srcParts = imgs[i].src.match(reFileParts)
				imgs[i]._srcNormal = imgs[i].src;
				imgs[i]._srcActive = srcParts[1] + '_a.' + srcParts[2];
				imgs[i].onmouseover = function() {
					this.src = this._srcActive;
				}
				imgs[i].onmouseout = function() {
					this.src = this._srcNormal;
				}
			}
		}

		// Zusatzeinbau: Auch Images für Submit Buttons berücksichtigen.
		var inputs = document.getElementsByTagName('input');
		l = inputs.length;
		for (i = 0; i < l; i++) {
			if (reSwapme.test(inputs[i].className) && !reIsActive.test(inputs[i].src)) {
				srcParts = inputs[i].src.match(reFileParts)
				inputs[i]._srcNormal = inputs[i].src;
				inputs[i]._srcActive = srcParts[1] + '_a.' + srcParts[2];
				inputs[i].onmouseover = function() {
					this.src = this._srcActive;
				}
				inputs[i].onmouseout = function() {
					this.src = this._srcNormal;
				}
			}
		}

		if (window.oldOnload) {
			oldOnload();
		}
	}

	function TsAutoHoverInstall() {
		if (window.addEventListener) {
			window.addEventListener('load', TsAutoHover, true);
		} else if (window.attachEvent) {
			window.attachEvent('onload', TsAutoHover);
		} else {
			if (window.onload) {
				window.oldOnload = window.onload;
			}
			window.onload = TsAutoHover;
		}
	}
	function highlightMenu(id) {
				var ul = document.getElementById(id);
				var li = ul.getElementsByTagName('li');
				for (var i = 0, l = li.length; i < l; i++) {
					var a = li[i].getElementsByTagName('a');
					if (a.length > 0) {
						li[i]._normal = li[i].className;
						li[i]._href = a[0].href;
						li[i].onmouseover = function() {
							this.className = 'li-a';

						}
						li[i].onmouseout = function() {
							this.className = this._normal;
						}
						li[i].onclick = function() {
							window.location.href = this._href;
						}
					}
				}
			}
