function getWindowHeight() {
  var windowHeight = 0;
  if (typeof(window.innerHeight) == 'number') {
    windowHeight = window.innerHeight;
  }
  else {
    if (document.documentElement && document.documentElement.clientHeight) {
      windowHeight = document.documentElement.clientHeight;
    }
    else {
      if (document.body && document.body.clientHeight) {
	windowHeight = document.body.clientHeight;
      }
    }
  }
  return windowHeight;
}
function vertAlignCenter() {
  if (document.getElementById) {
    var windowHeight = getWindowHeight();
    if (windowHeight > 0) {
      var wrapperElement = document.getElementById('wrapper');
      var wrapperHeight = wrapperElement.offsetHeight;
      if (windowHeight - wrapperHeight >= 0) {
	wrapperElement.style.top = ((windowHeight / 2) - (wrapperHeight / 2)) + 'px';
      }
    }
  }
}
// Creating a new window
function winPop(URL,name,features) {
  window.open(URL,name,features);
}
// Function for showing or hiding the submenu for boat types
function doSub(bool) {
  var sub = document.getElementById('submenu');
  if(bool==0) document.getElementById('submenu').style.visibility='hidden';
  if(bool==1) document.getElementById('submenu').style.visibility='visible';
}
// Controlling that required information has been entered into the form
function checkform(lang) {
  var navn = document.forms[0].elements['navn'];
  var e_mail = document.forms[0].elements['e_mail'];
  var msg;
  if(lang=='da') {
    msg1 = "Du har ikke indtastet dit navn";
    msg2 = "Du har ikke indtastet din mailadresse";
  } else if(lang=='de') {
    msg1 = "Du har ikke indtastet noget navn";
    msg2 = "Du har ikke indtastet din mailadresse";
  } else if(lang=='en') {
    msg1 = "You have not entered your name";
    msg2 = "You have not enterede your e-mail address";
  }		
  if(navn.value=='') {
    alert(msg1);
    return false;
  }
  if(e_mail.value=='') {
    alert(msg2);
    return false;
  }
  return true;
}
// Window functions for controlling vertical positioning
window.onload = function() {
  vertAlignCenter();
}
window.onresize = function() {
  vertAlignCenter();
}
