//
// *** Projekt Gartenreich.com ***
// Javascript Bibliothek
// Source: lib/js/gartenreich.js
// Autor: Tobias Stoeber <stoeber@softclick-it.de>
//

// empty function
function empty() {}

// change visibility of objects
function changeVisibility(objID) {

  if ( document.getElementById(objID).style.visibility == "visible" )
  {
    // alert(objID + ' is visible');
    document.getElementById(objID).style.visibility = "hidden";
    document.getElementById(objID).style.display = "none";
  }
  else
  {
    // alert(objID + ' is hidden');
    document.getElementById(objID).style.visibility = "visible";
    document.getElementById(objID).style.display = "inline";
  }
}

// change visibility of objects
function changeVisibilityEvent(objID) {

  if ( document.getElementById(objID).style.visibility == "visible" )
  {
    // alert(objID + ' is visible');
    document.getElementById(objID).style.visibility = "hidden";
    document.getElementById(objID).style.display = "none";
    document.getElementById('td1' + objID).style.backgroundColor = "#F5F8F1";
    document.getElementById('td2' + objID).style.backgroundColor = "#F5F8F1";
    document.getElementById('td3' + objID).style.backgroundColor = "#F5F8F1";

  }
  else
  {
    // alert(objID + ' is hidden');
    document.getElementById(objID).style.visibility = "visible";
    document.getElementById(objID).style.display = "inline";
    document.getElementById('td1' + objID).style.backgroundColor = "#E9F3DB";
    document.getElementById('td2' + objID).style.backgroundColor = "#E9F3DB";
    document.getElementById('td3' + objID).style.backgroundColor = "#E9F3DB";
  }
}

// show and hide navigation Level 2 (Ebene 3)
var navTimer = new Array();

function hideAllNav() {
  var objID;

  for ( i = 0; i < 99; i++ )
  {
    objID = "nav" + i;

    if ( document.getElementById(objID) && document.getElementById(objID).style.visibility == "visible" )
    {
      document.getElementById(objID).style.visibility = "hidden";
      document.getElementById(objID).style.display = "none";
    }
  }
}

function hideNav(ID) {
  navTimer[ID] = window.setTimeout("changeVisibilityNav(" + ID +",'h',0);", 3000);
}

function hideNavStop(ID) {
  if ( navTimer[ID] )
  {
    window.clearTimeout(navTimer[ID]);
  }
}

function changeVisibilityNav(ID, status, xOff) {

  var objID = 'nav' + ID;

  var Height = (document.body ? document.body.clientHeight : window.innerHeight)
  var Width  = (document.body ? document.body.clientWidth : window.innerWidth)

  // Arial, 10pt: fac 5.75
  var xOffPx = Math.round(xOff * 5.69) + 1;
  var LR = (Width - 770) / 2;
  var posLeft = LR + xOffPx;
  var posTop = 253;

  var clipping;

  document.getElementById(objID).style.left = posLeft;
  document.getElementById(objID).style.top = posTop;

  if ( document.getElementById(objID).style.visibility == "visible" )
  {
    if ( status == 'h' )
    {
      document.getElementById(objID).style.visibility = "hidden";
      document.getElementById(objID).style.display = "none";
    }
  }
  else
  {
    if ( status == 's' )
    {
      document.getElementById(objID).style.visibility = "visible";
      document.getElementById(objID).style.display = "inline";
    }
  }
}

// experimental: move object
function moveObj(objID,heading) {

  var left = parseInt(document.getElementById(objID).style.left);
  if ( isNaN(left) )
    left = 0;

  if ( heading == 'l' )
  {
    left = left - 10;
  }
  else if ( heading == 'r' )
  {
    left = left + 10;
  }

  document.getElementById(objID).style.left = left;
}

// Javascript-Funktion zu Oeffnen eines Popupfenster
// (C) 2000-2002 T. Stoeber <tobi@to-st.de>
//
// Fenster ohne MenuBar, Toolbar, Groesse aendernbar, zentriert
// NS ab 4.x, MSIE ab 4.x, andere Mozilla compatible ab 4.x
//
// Parameter:
// URL der zu oeffnenden Seite
// Breie des Fensters (Aussen) in px
// Hoehe des Fenster (Aussen) in px

function PopWin(URL,winName,BX,BY)
{
  var PopWnd;

  if ((navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName == 'Netscape') ||
      (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName.substring(0,9) == 'Microsoft') ||
      (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appCodeName == 'Mozilla'))
  {
    if ( PopWnd && PopWnd.closed == false )
    {
      PopWnd.document.location.href = URL;
      PopWnd.moveTo( (screen.width - BX) / 2, (screen.height - BY) / 2);
      PopWnd.focus();
    }
    else
    {
       var AFR = "width=" + BX + ",height=" + BY + ",menubar=no,resizable=yes,toolbar=no,scrollbars=yes,status=yes,dependent=yes";
       PopWnd = window.open(URL, winName, AFR);
       PopWnd.moveTo( (screen.width - BX) / 2, (screen.height - BY) / 2);
       PopWnd.focus();
    }
  }
  else
  {
    // aeltere und andere Browser minimale Variante,
    PopWnd = window.open(URL, winName, "width=" + BX + ",height=" + BY);
  }
}

function PopWinImgShop(URL,winName,BX,BY)
{
  var PopWndImg;

  if ((navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName == 'Netscape') ||
      (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName.substring(0,9) == 'Microsoft') ||
      (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appCodeName == 'Mozilla'))
  {
    if ( PopWndImg && PopWndImg.closed == false )
    {
      PopWndImg.focus();
      PopWndImg.resizeBy(10,10);;
      PopWndImg.moveTo( (screen.width - BX) / 2, (screen.height - BY) / 2);

      PopWndImg.document.getElementById('image').src = URL;
    }
    else
    {
       var AFR = "width=" + BX + ",height=" + BY + ",menubar=no,resizable=yes,toolbar=no,scrollbars=no,status=no,dependent=yes";
       PopWndImg = window.open('about:blank', winName, AFR);
       PopWndImg.moveTo( (screen.width - BX) / 2, (screen.height - BY) / 2);
       PopWndImg.focus();

       PopWndImg.document.open();
       PopWndImg.document.write('<body style="margin:0px;bgcolor:#ACACAC;">');
       PopWndImg.document.write('<div style="height:' + BY + 'px;width:' + BX + 'px;text-align:center;vertical-align:middle;">');
       PopWndImg.document.write('<img src="' + URL + '" id="image" onClick="self.close();">');
       PopWndImg.document.write('</div>');
       PopWndImg.document.write('</body>');
       PopWndImg.document.close();
    }
  }
  else
  {
    // aeltere und andere Browser minimale Variante,
    PopWndImg = window.open('about:blank', winName, "width=" + BX + ",height=" + BY);

    PopWndImg.document.open();
    PopWndImg.document.write('<body style="margin:0px;bgcolor:#ACACAC;">');
    PopWndImg.document.write('<div style="height:' + BY + 'px;width:' + BX + 'px;text-align:center;vertical-align:middle;">');
    PopWndImg.document.write('<img src="' + URL + '" id=\"image\">');
    PopWndImg.document.write('</div>');
    PopWndImg.document.write('</body>');
    PopWndImg.document.close();
  }
}




// function to change statusline

function changeStatusLine(lineText)
{
  // alert(lineText);
  window.status = lineText;
  // window.defaultStatus = '';
  return true;
}

// class Page

function Page()
{
  // Properties
  // has no properties
  // Methods

  this.Height = function()
  {
    var Height = window.innerHeight;
    Height = (isNaN(Height) ? document.body.clientHeight : Height) - 4;
    return Height;
  }

  this.Width = function()
  {
    var Width = window.innerWidth;
    Width = (isNaN(Width) ? document.body.clientWidth : Width) - 4;
    return Width;
  }

  this.Top = function()
  {
    var Top = window.pageYOffset;
    Top = (isNaN(Top) ? document.body.scrollTop: Top);
    return Top;
  }

  this.Left = function()
  {
    var Left = window.pageXOffset;
    Left = (isNaN(Left) ? document.body.scrollLeft: Left);
    return Left;
  }
}
