function printIt() {
	self.print();
}
var menuOpen = false;
var sitemap = false;

function closeNavi() {
	document.getElementById('mcatch').style.display = "none";
	document.getElementById('s2').style.display = "none";
	document.getElementById('s3').style.display = "none";
	document.getElementById('s4').style.display = "none";
}
function attachNavi() {
	//for lt ie 7
	var m2 = (typeof document.getElementById('m2') != 'undefined') ?  document.getElementById('m2') : false ;
	var m3 = (typeof document.getElementById('m3') != 'undefined') ?  document.getElementById('m3') : false ;
	var m4 = (typeof document.getElementById('m4') != 'undefined') ?  document.getElementById('m4') : false ;
	var m5 = (typeof document.getElementById('m5') != 'undefined') ?  document.getElementById('m5') : false ;

	if (m2) m2.onmouseover = function() {
		switchNavi('');
		return true;
	}
	if (m2) m2.onmouseover = function() {
		switchNavi(this.id);
		return false;
	}
	if (m3) m3.onmouseover = function() {
		switchNavi(this.id);
		return false;
	}
	if (m4) m4.onmouseover = function() {
		switchNavi(this.id);
		return false;
	}
	if (m5) m5.onmouseover = function() {
		switchNavi(this.id);
		return false;
	}
	if (m5) m5.onmouseover = function() {
		switchNavi('');
		return true;
	}
}
function switchNavi(which) {
	if (which == 'none') { 
		//window.setTimeout('closeNavi()', 500);
		closeNavi();
		menuOpen == false;
	} else if (which == '')  {
		closeNavi();
		menuOpen == false;
	} else if (which != 'none' && sitemap == false ) {
		var toShow = 's' + which.substr(1, which.length);
		var myObj = document.getElementById(toShow).style;
		if ( myObj.display != 'block' ) {
			 closeNavi();
			 myObj.display = 'block';
			 document.getElementById('mcatch').style.display = "block";
			 menuOpen = true;
		} else {
			 closeNavi();
			 myObj.display = 'none';
			 menuOpen == false;
		}
	}
}

function getFooterLinks(lang) {
	if (lang == 'de') {
		document.writeln('<a href="#" onClick="history.back();return false">ZURÜCK</a>  |  ');
		document.writeln('<a href="#" onClick="self.print();return false">SEITE DRUCKEN</a>');
	} else {
		document.writeln('<a href="#" onClick="history.back();return false">BACK</a>  |  ');
		document.writeln('<a href="#" onClick="self.print();return false">PRINT PAGE</a>');
	}
}

function switchOpacity(opac) {
		myWrapper.opacity = (opac / 100);
    	myWrapper.MozOpacity = (opac / 100);
    	myWrapper.KhtmlOpacity = (opac / 100);
    	myWrapper.filter = "alpha(opacity=" + opac + ")";
}

function showSitemap() {
	if (sitemap == false) {
		sitemap = true;
		document.getElementById('mcatch').style.display = "none";
		document.getElementById('s2').style.display = "block";
		document.getElementById('s3').style.display = "block";
		document.getElementById('s4').style.display = "block";
	} else {
		sitemap = false;
		document.getElementById('mcatch').style.display = "none";
		document.getElementById('s2').style.display = "none";
		document.getElementById('s3').style.display = "none";
		document.getElementById('s4').style.display = "none";
	}
}

	
function init() {
	if(document.all && !window.XMLHttpRequest) {
		attachNavi();
	}
	document.getElementById('mcatch').onmouseover = function() {
		switchNavi('none');
		//var closeEvent = window.setTimeout('closeNavi()', 500);
	}
	myObj 	  = document.getElementById('c').style;
	myWrapper = document.getElementById('wrapper').style;
	menuOffset = 173;
	wrapperOffset = 326;
	agent = navigator.userAgent.toLowerCase();
	
	if (window.innerHeight) {
		myObj.minHeight = ( window.innerHeight - menuOffset ) + 'px';
		myWrapper.minHeight = ( window.innerHeight - wrapperOffset ) + 'px';
	} else if (document.documentElement.clientHeight) {
		if ( agent.indexOf('msie 6') != -1 ) {
			myObj.height = ( document.documentElement.clientHeight - menuOffset ) + 'px';
			myWrapper.height = ( document.documentElement.clientHeight - wrapperOffset ) + 'px';
		} else {
			myObj.minHeight = ( document.documentElement.clientHeight - menuOffset ) + 'px';
			myWrapper.minHeight = ( document.documentElement.clientHeight - wrapperOffset ) + 'px';
		}
	} else if (document.body.clientHeight) {
		myObj.height = ( document.body.clientHeight - menuOffset ) + 'px';
		myWrapper.height = ( document.body.clientHeight - wrapperOffset ) + 'px';
	}
	// opscon popup
	winLeft = (screen.width >= '1024') ? (screen.width - 950) / 2 : (screen.width - 790) / 2;
	winTop = (screen.height >= '768') ? (screen.height - 660) / 2 : (screen.height - 530) / 2;
	winFeatures = (screen.width >= '1024') ? 'width=950,height=660,left=' + winLeft + ',top=' + winTop : 'width=790,height=530,left=' + winLeft + ',top=' + winTop;	
}

function linkTo_UnCryptMailto(s)	{
	location.href=UnCryptMailto(s);
}

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-3);
	}
	return r;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0 // modifiziert
    // window.open(theURL,winName,features);
 	var theHtmlUrl = 'popup.php?'+theURL;
	window.open(theHtmlUrl,'bildergalerie',features);
}

window.onload = init;
window.onresize = init;