// -----------------------------------
// File: ibps_top_of_page.js
//
// Version: 1.0
// Editor: IBPS-Friedrichs
// Contact: info@ibps-friedrichs.com
//
// Last edit: 17.10.2002
//------------------------------------
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
var siteWidth = 770; // 0 => full usable window width
var tpLinkHeight = 10, tpLinkWidth = 15, tpLinkNS4_offsetX = 5, tpLinkNS4_offsetY = 5, tpLink_offsetX = 0, tpLink_offsetY = 8;
var tpLinkContentBegin = '<DIV ID="tpLink" STYLE="position:absolute; left:1px; top:1px; width:' + tpLinkWidth + 'px; height:' + tpLinkHeight + 'px; z-index:1; visibility: hidden">';
var tpLinkContent = '<A HREF="#top"><IMG SRC="/images/icon_page-up.gif" WIDTH="12" HEIGHT="9" BORDER="0" ALT="Seitenanfang"></A>';
var tpLinkContentEnd = '</DIV>';
tpInit();
window.onload = tpLinkInsert;
window.onresize = tpLinkInsert;
function tpInit() {
 if (window.opera) {
     OP = 1;
 }
 if (document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if (document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
 if (window.netscape && window.screen && !DOM && !OP) {
   DHTML = 1;
   NS = 1;
 }
 if (!NS) { 
   tpLinkContent = tpLinkContentBegin + tpLinkContent + tpLinkContentEnd; 
 }
} // End tpInit

function tpLinkInsert() {
  tpCreateLink();
  tpLinkPositioning();
  setInterval("tpLinkPositioning()",100);
}  // End tpLinkInsert
function tpCreateLink() {
  if (NS) {  // Netscape 4.x
    tpLink = new Layer(0);
    tpLink.left = 1;
    tpLink.top = 1;
    tpLink.zIndex = 1;
    tpLink.document.write(tpLinkContent);
    tpLink.document.close();
    tpLink.visibility = "show";
  }
  if (!DOM && MS) {  // MSIE 4.x
    tpLink.style.visibility = "visible";
  }
  if (DOM) {  // MSIE 5.x/6.x, NS 6.x
    document.getElementById("tpLink").style.visibility = "visible";
  }
}  // End tpCreateLink
function tpLinkPositioning() {
  if (NS) {  // Netscape 4.x
    if (siteWidth != 0) {
      tpLink.left = pageXOffset + siteWidth - tpLink.document.width - tpLinkNS4_offsetX;
    } else {
        tpLink.left = pageXOffset + window.innerWidth - tpLink.document.width - tpLinkNS4_offsetX;
      }
    tpLink.top = pageYOffset + window.innerHeight - tpLink.document.height - tpLinkNS4_offsetY;
  }
  
  if (!DOM && MS) { // MSIE 4.x
    if (siteWidth != 0) {
      tpLink.style.left = siteWidth - tpLink.style.pixelWidth - tpLink_offsetX;
    } else {
        tpLink.style.left = document.body.clientWidth - tpLink.style.pixelWidth - tpLink_offsetX;
      }
    tpLink.style.top = document.body.clientHeight + document.body.scrollTop - tpLink.style.pixelHeight - tpLink_offsetY;
  }
  
  if (DOM) { // MSIE 5.x/6.x, NS 6.x
    if (MS) {
      if (siteWidth == 0) { siteWidth = document.body.clientWidth;}
      siteHeight = document.body.clientHeight + document.body.scrollTop;
    } else {
        if (siteWidth == 0) { siteWidth = window.innerWidth;}
        siteHeight = window.innerHeight + pageYOffset;
      }
    document.getElementById("tpLink").style.left = siteWidth - parseInt(document.getElementById("tpLink").style.width) - tpLink_offsetX;
    document.getElementById("tpLink").style.top =  siteHeight - parseInt(document.getElementById("tpLink").style.height) - tpLink_offsetY;
  }
}  // End tpLinkPositioning