var menuHeight = 0;
var windowHeight = 0;
var origH=window.innerHeight;

$(document).ready(function() {
	
	if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8)
	{
		$('#center').show();
		return;
	}
		
	$('html').addClass('absolute');
	
	menuHeight = $('#menu').height();
	
	$('#center').show();
	if ((!jQuery.browser.msie || parseInt(jQuery.browser.version) >= 7))
	{
		$(window).resize(function() {
			checkWindowHeight();
		});
		checkWindowHeight();
	}
	// Workaround für Opera-ResizeBug!!!
	if (jQuery.browser.opera)
		setInterval("checkresize()",200);
});

function checkWindowHeight()
{
	windowHeight = $(window).height();
	menuHeight = $('#menu').height();
	
	if (windowHeight - menuHeight > 320)
	{
		$('#huepfer').show();
		$('#huepfer img').css('height', '212px');
	}
	else
	{
		h = (windowHeight - menuHeight - 100) / 220 * 212;
		if (h < 100)
		{
			$('html').removeClass('absolute');
			$('#huepfer img').css('height', '212px');
		}
		else
		{
			$('html').addClass('absolute');
			$('#huepfer').show();
			$('#huepfer img').css('height', Math.round(h) + 'px');
		}
	}
	
	/*	
	if ($(window).height() < 550)
		$('#center').height(250 + $('#page').height());
	else
		$('#center').css('height', '100%');
	*/
}



function checkresize() 
{
	if (window.innerHeight != origH)
	{
		if ($('#content').css('bottom') == '15px')
		{
			$('#content').css('bottom', '16px');
			$('#content #wrap').css('bottom', '16px');
			
		}
		else
		{
			$('#content').css('bottom', '15px');
			$('#content #wrap').css('bottom', '15px');
		}
	}
	origH=window.innerHeight;
}



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 linkTo_UnCryptMailto( s )
{
	location.href=UnCryptMailto( s );
}

