function NaviFenster () {
  Navigation = window.open("navigat.htm", "Navigation", "height=200,width=300");
  Navigation.focus();
}

onscroll = function() {
var id = document.getElementById("darkNav");
if (id) {
    document.getElementById("darkNav").style.backgroundImage=document.getElementById("darkNav").style.backgroundImage;
  }
}

	var lastResize = 0;
	var min_width = 1200;
	
	function gettime() {
		var now = new Date();	
		return now.getTime();
	}
	
	function resize_body() {
		// ie loops cause every resize causes a new resize.
		// so this function waits until it starts again.
		if (lastResize + 500 < gettime()) {
		
			var leftDiv = document.getElementById("left"); 
			var rightDiv = document.getElementById("right"); 
			var externalDiv = document.getElementById("external"); 
			
			var bodyHeight = 
				Math.max(
					externalDiv.offsetHeight,
					Math.max(
						parseInt(document.getElementById("tBody").parentNode.scrollHeight),
						parseInt(document.body.clientHeight)
					)
				)
			leftDiv.style.height = "auto"

			var newHeight = 
				String(
					Math.max(
						Math.max(
							leftDiv.offsetHeight,
							rightDiv.offsetHeight
						),
						bodyHeight
					)
				) + "px"
			leftDiv.style.height = newHeight;
			rightDiv.style.height = newHeight;
			externalDiv.style.height = newHeight;
			document.body.style.height = newHeight;
			document.getElementsByTagName("html")[0].style.height = newHeight;

			lastResize = gettime();
		}
	}


	//functions for big popup-versions of content images



// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}


function htmlHeight(){
	return Math.max(pageHeight(), Math.max(parseInt(document.getElementsByTagName("body")[0].scrollHeight), parseInt(document.getElementsByTagName("html")[0].scrollHeight)));}

	function showPopup(content, width, oid) {                    
		var a = document.getElementById("popup");
		var b = document.getElementById("popupBg");
		a.style.width = width + "px";
//		a.style.height = height + "px";
		a.style.visibility = "visible";
		a.style.display = "block";
		a.style.left = (Math.round((parseInt(pageWidth())-width)/2) + "px");
//		a.style.top = Math.round( (parseInt(pageHeight())-height )/2 ) + posTop() + "px";
		a.style.top = String(posTop() + 50) + "px";
		content = content.replace(/\^_\^/, "@")
		content = content.replace(/_\|\^/, "<a style='font-size: 0.8em; color:white;' href='mailto:");
		content = content.replace(/\^\|_/, "' target='_blank'>&raquo;E-Mail</a>");
		var prev = "";
		var next = "";
		var att = "";
		
		if (img_arr.length > 1) {
			// find Position in Array
//alert(oid)
			for (var i= 0; i < img_arr.length; i++) {
				var src = img_arr[i].src.split(/\?/)[0];
//alert(src)
				if (src == oid) {
					var pos = i;
					var prev = i - 1;
					if (prev < 0) {
						prev = 	img_arr.length - 1;
					}
					var next = pos + 1;
					if (next >= img_arr.length){
						next = 0;	
					}
					break;
				} 
			}
			var out = "<a href=\"javascript:clickIt(" + prev + ")\" style=\"float:left; margin-left:5px;\" onfocus=\"blur();\"><strong>&#0171;</strong>&nbsp;voriges&nbsp;Bild</a>";
			out += "<a href=\"javascript:clickIt(" + next + ")\" onclick=\"\" style=\"margin-right:5px;\" onfocus=\"blur();\">n&auml;chstes Bild&nbsp;<strong>&#0187;</strong></a>";
		} else {
			out = "";
		}

		a.innerHTML = "<div class='close'>" + out + "&nbsp;<a href='' onclick='hidePopup(); return false;' onfocus='blur();' >schlie&szlig;en <span>&#0215;</span></a></div>"  + "<div>" + content + "</div>";

		b.style.visibility = "visible";
		b.style.display = "block";
		b.style.height = htmlHeight() + "px";
		b.style.top = "0px";
		b.style.width =  (pageWidth()) + "px";
		
	}
	function clickIt(id) {
		img_arr[id].onclick();	
	}
	
	function hidePopup() {
		document.getElementById("popup").style.display = "none";
		document.getElementById("popupBg").style.display = "none";
		document.getElementById("popup").style.visibility = "hidden";
		document.getElementById("popupBg").style.visibility = "hidden";
	}
	
var img_arr = new Array();

function loadImages() {
	var list = document.getElementsByTagName("img");
	for (var i = 0; i < list.length; i++) {
		if (list[i].getAttribute("name") == "resize") {
			
			new_img = new Object();
			var file = list[i].src.split(/\//);

			new_img["src"] = file[file.length-1];
			
			var element = list[i].parentNode;
			
			// if img is in a-Tag
			if (element.tagName == "A") {
				element = element.parentNode;
			}
			
			// find <div class="resizeText">
			while(element.className != "resizeText") {
				element = element.nextSibling;
			}

			element = element.firstChild;
			while(element.className != "subline") {
				element = element.nextSibling;
			}

			// find resize link
			element = element.firstChild;
			while(element && typeof(element.src) == "undefined") {
				 element = element.nextSibling;
			}
			if (element) {
				new_img["onclick"] = element.onclick;
				img_arr.push(new_img);
			}
		}
	}
}

var glossarEntries = new Object();
var idcatartGlossarById = 4046;



function showGlossar(obj, id) {
	
	if (obj.lastChild.tagName != "DIV") {
//		alert(obj.lastChild.tagName)
		var div = document.createElement("div")
		div.className = "glossar";
		div.id = "glossar";
		div.innerHTML = glossarEntries[id]
		obj.appendChild(div);
//		obj.innerHTML = obj.innerHTML + "<div class='glossar' id='glossar'>" + glossarEntries[id] + "</div>";
	}
}
function hideGlossar() {
//	alert(document.getElementById("glossar").parentNode.className);
	if (document.getElementById("glossar") && document.getElementById("glossar").parentNode) {
		var par = document.getElementById("glossar").parentNode
		var child = par.lastChild;
		par.removeChild(child);
	}
}
function glossarContent(i,id) {
	var myRequest = new Request({
		method: 'get',
		url: 'front_content.php',
		onSuccess: function (responseText, responseXML){
//			alert(responseText);
			glossarEntries[id] = responseText;
			// dont show » in backend.
			if (document.location.href.split(/contenido=/).length<2) {
				glossarLinkList[i].innerHTML = glossarLinkList[i].innerHTML;
			}
			glossarLinkList[i].onmousemove= function (){window["showGlossar"](this, id)};
			glossarLinkList[i].onmouseout= function (){window["hideGlossar"](this)};
			glossarLinkList[i].onfocus = function (){window["blurIt"](this)}; 
			glossarLinkList[i].onclick= function () {
				return false;	
			}
			return true;
		}
	}).send("idcatart=" + idcatartGlossarById + "&glossarId=" + id);
	return false;
}
function blurIt(sender){
	sender.blur()
} 
var glossarLinkList = new Array();

function convertGlossarLinks() {
	glossarLinkList = document.getElementsByTagName("a");
	for (var i = 0; i < glossarLinkList.length; i++) {
		if (glossarLinkList[i].className == "glossar") {
			var id = glossarLinkList[i].href.split(/glossar=/).pop();
			glossarContent(i,id);
		}
	}
}

window.onresize = function() {
	resize_body();
}
window.onload = function() {
//	alert ("Onload in der js-Datei")
	if(typeof(startNewsticker)=='function') {
		startNewsticker();
	}
	if (typeof(resize_body) == 'function') {
		resize_body();
	}
	loadImages();
	convertGlossarLinks();

	
//	alert(img_arr.length);
}

/* MOUSEPOSITION */
/*
// find out if ie runs in quirks mode
//
var docEl = (
             typeof document.compatMode != "undefined" && 
             document.compatMode        != "BackCompat"
            )? "documentElement" : "body";
var y;
// register event
// capture it for nc 4x (ok it's a dino)
//
function init_mousemove() {
    if(document.layers) document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove =	dpl_mouse_pos;
}

function dpl_mouse_pos(e) {

    // position where mousemove fired
    //
    var xPos    =  e? e.pageX : window.event.x;
	var yPos    =  e? e.pageY : window.event.y;

	
	// for ie add scroll position
	//
	if (document.all && !document.captureEvents) {
	    xPos    += document[docEl].scrollLeft;
	    yPos    += document[docEl].scrollTop;
    }
    
    // display position
    //
    //document.feld.ausg.value    =  "Left = " + xPos + " : Top = " + yPos;
    y = yPos - document[docEl].scrollTop;
    // for the dino pass event
    //
    if (document.layers) routeEvent(e);
}*/