// JS function for uncrypting spam-protected emails:

function UnCryptMailto(s) {	//
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(-2));
	}
	return r;
}
  // JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s)	{	//
	location.href=UnCryptMailto(s);
}

// This function is used for the Suckerfish (flyout) menus
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



// menuExpandable.js - implements an expandable menu based on a HTML list
// Author: Dave Lindquist (http://www.gazingus.org)

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

   actuator.parentNode.style.background = "url(../i/arrow-down-sm.gif) 90% 10px no-repeat";
    actuator.onclick = function() {
        var display = menu.style.display;
        this.parentNode.style.background =
            (display == "block") ? "url(../i/arrow-down-sm.gif) 90% 10px no-repeat" : "url(../i/arrow-up-sm.gif) 90% 10px no-repeat";
        menu.style.background = "url(../i/square.gif)";
        menu.style.display = (display == "block") ? "none" : "block";

        return false;
    }
}


// Preload images

function Preload() {
 	var args = simplePreload.arguments;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++) {
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
   }
   
   
function openZoom(name,bu) {
	// pdf direkt öffnen
	var filetyp=name.split(".");
	if (filetyp[1].toLowerCase() == "pdf") {
	     neues_fenster=window.open(name, 'pdf', 'alwaysRaised=1,toolbar=0,status=0,location=0,directories=0,menubar=0,resizable=1,scrollbars=1,width=600,height=600,dependent=yes');
	} else {
	     neues_fenster=window.open('zoom.php?src='+name+'&bu='+bu, 'bild', 'alwaysRaised=1,toolbar=0,status=0,location=0,directories=0,menubar=0,resizable=1,scrollbars=1,width=200,height=100,dependent=yes');
	}
	if (window.moveTo){
		neues_fenster.moveTo(50,50)
	}
	if(window.focus){
		neues_fenster.focus();
	}	 
}   
