////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006 - Stefan Mezmer (www.webspace4europe.de)
//
////////////////////////////////////////////////////////////////

function stopError() {
  return true;
}
window.onerror = stopError;
    
///////////////////////////////////
// window positioning
var xi=0;
var yi=0;

function resize() {
  if (navigator.appName == 'Netscape') {xi=20; yi=100;}

  if (document.body)
    window.resizeBy((800 - document.body.clientWidth), 600 - document.body.clientHeight);
  else
    window.resizeTo(840-xi, 730-yi);

  x = (screen.availWidth  > 810) ? ((screen.availWidth - 810) / 2) : 0;
  y = (screen.availHeight > 700) ? ((screen.availHeight - 720) / 2) : 0;
  window.moveTo(x,y);
  self.focus();
  
  get_contentheight();
}

function gotoPage(navSel) {
  if (navSel.options[navSel.selectedIndex].value.length > 4) {
    scrollobj= document.getElementById("maincontent");
    scrollobj.style.top = 0;
    scrollobj.innerHTML = navSel.options[navSel.selectedIndex].value;
    get_contentheight();
  }
}


////////////////////////////////////
// getElementById fuer NC 4 und IE 4 
// Copyright (c) 2001 2002 Kristof Lipfert Duesseldorf All rights reserved kl@

if (!document.getElementById) {
  function getElementById(id_var) { 
    if (document.all) return document.all[id_var];
    else if (document.ids) { 
      if (!getLayerById[id_var]) doLayerArray();
      return getLayerById[id_var];
    }
  }
  
  document.getElementById=window.getElementById;
  
  if (document.ids) {
    var getLayerById=[]; 
    
    function doLayerArray() {
      with ([window.document]) {
        while (length) {
          with (shift()) {
            for (i=0;i<layers.length;i++) {
              getLayerById[layers[i].id]=layers[i].style=layers[i];
              unshift(layers[i].document);
            }
          }
        }
      }
    }
    window.onload=function() {
      doLayerArray();
    }
  }
}


///////////////////////////////////
// scrolling
var speed = 5;
var ns4   = document.layers;

function scrolldown() {
  scrollobj= document.getElementById("maincontent");
  contentheight = scrollobj.offsetHeight;
  if (parseInt(scrollobj.style.top) >= (contentheight * (-1) + 160))
    scrollobj.style.top = parseInt(scrollobj.style.top) - speed;
  scrolldownvar = setTimeout("scrolldown()", 100);
}

function scrollup() {
  scrollobj= document.getElementById("maincontent");
  if (parseInt(scrollobj.style.top) <= 0)
    scrollobj.style.top=parseInt(scrollobj.style.top)+speed;
  scrollupvar=setTimeout("scrollup()",100);
}

function get_contentheight() {
  scrollobj= document.getElementById("maincontent");
  /*
  contentheight = scrollobj.offsetHeight;
  scrollobj.style.top=parseInt(scrollobj.style.top)+3;
  */
  contentheight = scrollobj.innerHTML.length;
  if (contentheight < 400) {
    document.getElementById("btn_up").style.display = 'none';
    document.getElementById("btn_down").style.display = 'none';
  } else {
    document.getElementById("btn_up").style.display = '';
    document.getElementById("btn_down").style.display = '';
  }
}

