﻿/* Zweck: 
	Navigations-, Inhalts- und Features-Säule gleich hoch formatieren.
*/
function correct_layout() {
	if(document.getElementById('content').offsetHeight) {		
		var div_heights = new Array(
			document.getElementById('content').offsetHeight,
			document.getElementById('navigation').offsetHeight,
			document.getElementById('features').offsetHeight
		);
		div_heights = div_heights.reverse(div_heights.sort(num_sort));
		var style_height = div_heights[0] + 'px';
		document.getElementById('navigation').style.height = style_height;
		document.getElementById('content').style.height = style_height;
		document.getElementById('features').style.height = style_height;
		// footer position
		var div_footer_top = document.getElementById('navigation').offsetHeight + document.getElementById('navigation').offsetTop;
		document.getElementById('footer').style.top = div_footer_top + 'px';
	}
}

function num_sort(a,b) {
	return a-b;
}

/* Zweck: 
	E-Mail-Adressen entschlüsseln
*/
function UnCryptMailto(s, shift) {
	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-(shift)); 
	}
	return r;
}

function linkTo_UnCryptMailto(s, shift)	{
	location.href=UnCryptMailto(s, shift);
}

function CryptMailto() {
	shift = parseInt(document.forms[0].shiftField.value);
	var n=0;
	var r="";
	var s="mailto:"+document.forms[0].emailField.value;
	for(var i=0;i<s.length;i++) { 
		n=s.charCodeAt(i); 
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n+shift); 
	}
	document.forms[0].cyptedEmailField.value = r;
	document.forms[0].HTMLCyptedEmailField.value = "<a href=\"javascript:linkTo_UnCryptMailto('"+r+"', "+shift+");\">eMail-Link</a>";
}



