// bei Resize überprüfen, ob subnavi noch zu lesen
var ver = navigator.appVersion;
var agent = navigator.userAgent;
var dom = document.getElementById?1:0;
var opera5 = agent.indexOf("Opera 5")>-1;
var ie5 = (ver.indexOf("MSIE 5") > -1 && dom && !opera5) ? 1 : 0;
var ie6=(ver.indexOf("MSIE 6")>-1 && dom && !opera5)?1:0;
var ns4=(document.layers && !dom)?1:0;

onresize = doResize;

var fs_universal = "/fs_univ.php";
var std_height = 376;

function doResize () {
  var cont_win_height;
  var sub_win_height;
  var footer_win_height;
  if (ie5 || ie6) {
    sub_win_height = window.subnavi.document.body.offsetHeight;
    cont_win_height = window.content.document.body.offsetHeight;
    footer_win_height = window.footer.document.body.offsetHeight;
  }
  else if (window.subnavi.innerHeight) {
    sub_win_height = window.subnavi.innerHeight;
    cont_win_height = window.content.innerHeight;
    footer_win_height = window.footer.innerHeight;
  }

  var new_height;
  if (cont_win_height && sub_win_height < 12) {
    new_height = cont_win_height;
  }
  else if (cont_win_height && (cont_win_height + 20) < std_height && footer_win_height > 20) {
    new_height = cont_win_height + footer_win_height;
    if (new_height > std_height)
      new_height = std_height;
  }

  if (new_height != null) {
    var new_url;
    if (!ns4 && !ie5)
      new_url = fs_universal + "?height=" + new_height + "&sub=" + 
                encodeURIComponent(window.subnavi.location) +
                "&cont=" + encodeURIComponent(window.content.location);
    else
      new_url = fs_universal + "?height=" + new_height + "&sub=" + 
                window.subnavi.location + "&cont=" + window.content.location;
    location.href = new_url;
  }
}

