/* displays an alert if browser in Quirks mode. TODO: remove */
//if (document.compatMode != "CSS1Compat")
//	alert("Warning: Browser in Quirks Mode , (" + document.compatMode + ")");

/* may be replaced by ie_rollover.htc (must be referenced in style.css) */
// initializes the suckerfish dropdown navigation for IE < 7
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("fo_nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" fo_over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" fo_over", "");
				}
			}
		}
	}
}
window.onload=startList;


/* 
submenu folding for keyboard usage 
TODO: in development (submenu isn't folded, if navigation area is being left)
*/
/*
var recentSubmenu = null;
function openSubMenu(submenu) {
	if (recentSubmenu != null) {
		// firefox löscht das Leerzeichen von  " fo_over" falls noch keine andere styleClass für das Element angegeben war
		var className = (recentSubmenu.className == "fo_over")? "" : recentSubmenu.className.replace(" fo_over", "");
		recentSubmenu.className = className;
	}
	submenu.className += " fo_over";
	recentSubmenu = submenu;
}
*/

/* Content folding */
var contentFolding = new Object();
contentFolding.currHeader = null;
contentFolding.currTeaser = null;
contentFolding.currContent = null;

contentFolding.show = function(element) {
	//new Effect.Morph(element,{style:'display: block;', duration:0.1});
	// new Effect.SlideDown(this.currTeaser);
	element.className = element.className.replace(" fo_hidden", " fo_visible");
}

contentFolding.hide = function(element) {
	//new Effect.Morph(element,{style:'display: none;', duration:0.1});
	// new Effect.SlideUp(this.currContent);
	element.className = element.className.replace(" fo_visible", " fo_hidden");
}

contentFolding.foldContent = function(header, teaser, content) {
	if (this.currContent != null) {
		this.currHeader.className = "fo_folded";
		this.hide(this.currContent);
		this.show(this.currTeaser);
	}
	if (this.currContent == content) {
		this.currContent = null;
		return;
	}
	
	header.className = "fo_unfolded";
	this.hide(teaser);
	this.show(content);
	
	this.currHeader = header;
	this.currTeaser = teaser;
	this.currContent = content;
}



/* Decryption for E-Mail links (http://jumk.de/nospam/) */
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 - 1 );
    }
    return r;
}

function ltum( s )
{
    location.href=UnCryptMailto( s );
}
