function GetDay(intDay){
var DayArray = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
return DayArray[intDay];
}
function actdate(){
var today = new Date();
day=today.getDate();
if(day<10) day = "0" + day;
month=today.getMonth()+1;
if(month<10) month= "0" + month;
var year = today.getYear();
if(year<1000) year+=1900;
var todayStr = GetDay(today.getDay()) + ", " + day + "." + month + "." + year;
return todayStr;
}

function getWindowHeight(){
if (window.innerHeight) {
  return window.innerHeight;
}
else {
  if (window.document.documentElement && window.document.documentElement.clientHeight) {
    return window.document.documentElement.clientHeight;
  }
  return window.document.body.offsetHeight;
}
}
function bestContentHeight(){
var s1=0,s2=0,s3=0,s4=0,s5=0,s6=0,bestheight=0;
if (document.getElementById('Navigationsleiste1LYR')) s1=document.getElementById('Navigationsleiste1LYR').scrollHeight+document.getElementById('Navigationsleiste1LYR').offsetTop;
if (document.getElementById('Navigationsleiste2LYR')) s2=document.getElementById('Navigationsleiste2LYR').scrollHeight+document.getElementById('Navigationsleiste2LYR').offsetTop;
if (document.getElementById('Navigationsleiste3LYR')) s3=document.getElementById('Navigationsleiste3LYR').scrollHeight+document.getElementById('Navigationsleiste3LYR').offsetTop;
if (document.getElementById('Navigationsleiste4LYR')) s4=document.getElementById('Navigationsleiste4LYR').scrollHeight+document.getElementById('Navigationsleiste4LYR').offsetTop;
if (document.getElementById('maincontentLYR')) s5=document.getElementById('maincontentLYR').scrollHeight+document.getElementById('maincontentLYR').offsetTop;
s6=getWindowHeight();
bestheight=Math.max(s1,bestheight);
bestheight=Math.max(s2,bestheight);
bestheight=Math.max(s3,bestheight);
bestheight=Math.max(s4,bestheight);
bestheight=Math.max(s5,bestheight);
bestheight=Math.max(s6,bestheight);
return (bestheight);
}

$(document).ready(function(){
$('div#Navigationsleiste1LYR').css('z-index','600');
$('div#Navigationsleiste2LYR').css('z-index','700');
$('div#Navigationsleiste3LYR').css('z-index','800');
$('div#Navigationsleiste4LYR').css('z-index','900');
$.fn.nofNavBarOptions({ navBarId: "Navigationsleiste1", delay: 300 });
$.fn.nofNavBarOptions({ navBarId: "Navigationsleiste2", delay: 300 });
$.fn.nofNavBarOptions({ navBarId: "Navigationsleiste3", delay: 300 });
$.fn.nofNavBarOptions({ navBarId: "Navigationsleiste4", delay: 300 });

$('div#LayoutLYR').css('height',bestContentHeight());

$(window).resize(function() {
$('div#LayoutLYR').css('height',bestContentHeight());
});

newhtml='<form name="Sprachwahl">\n<select class="langselect" name="Sprache" onChange="nziel=document.Sprachwahl.Sprache.options[document.Sprachwahl.Sprache.selectedIndex].value;if (nziel != \'#void_\') location=nziel;">\n';
thisurl=window.location.href;
$("#LanguageLYR a").each(function(){
  url=$(this).attr("href");
  if (url.indexOf("void_")>0) newhtml=newhtml + '<option selected value="#void_">Language</option>\n';
  else if (url.indexOf("/ru/")>0) newhtml=newhtml + '<option value="' + url +'">Russian</option>\n';
  else newhtml=newhtml + '<option value="#void_">German</option>\n';
});
newhtml=newhtml + '</select>\n</form>';
$('#LanguageLYR').html(newhtml);

})
