//Globale Variable
var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);
var xmlHttp = createXmlHttpRequestObject();
var Webnamefirst = new Array("a","y","c","w","z","x","b","d");
// XMLHttpRequest object belegen
function createXmlHttpRequestObject() 
{	
  var xmlHttp;
  // Internet Explorer
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // Mozilla 
  else
  {
    try 
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // return 
  if (!xmlHttp)
    alert("Fehler beim Erstellen XMLHttpRequest object.");
  else 
    return xmlHttp;
}
//******************************************************************
function MenuSet(Art)
{
var x;
var n;
  for (var i=0;i <Webnamefirst.length;i++)
  {
    n = 'subMenu' + Webnamefirst[i];
    x = document.getElementById(n);
    x.style.display = Art;
  }
}
//***************************************************************** 
function showFilter(obj, visibility) {
var x;
if(ie5 || ns6){
if (visibility == 'visible')
{
MenuSet('block');
}
else
{
MenuSet('none');
}
x = document.getElementById(obj);
x.style.visibility = visibility;
}
}
//***************************************************************** 
function showHide(obj, visibility) {
if(ie5 || ns6){
if (visibility == 'visible')
{
MenuSet('block');
}
else
{
MenuSet('none');
}
x = document.getElementById(obj);
x.style.visibility = visibility;
}
}
//***************************************************************** 
function menuBarInit() {
if(ie5 || ns6){
menu = document.getElementsByTagName("div");
}
}
//*********************************************************
function WinOpen(Seite,Target,Breite,Hoehe)
{
l = (screen.width - Breite) / 2;
t = (screen.height - Hoehe) / 2;
params = 'resizable=yes,' + 'scrollbars=yes,' + 'width=' + Breite + ',height=' + Hoehe + ',left=' + l + ',top=' + t;
z = window.open(Seite,Target,params);
}
//***************************************************************** 
function MakeActive(num) {
if(ie5 || ns6) {
for(i=0;i<lnk.length;i++) {
//lnk[i].style.color = "#FF0000";
//lnk[num].style.color = "#FF0000";
}
}
}
//***************************************************************** 
function makeActiveInit(webname)
{
w = "menuTitle" + webname.substring(0,1);
document.getElementById(w).style.color = "#FF0000";
//document.getElementById(w).style.textDecoration = "underline";
}
//***************************************************************** 
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//*****************************************************************
function FixCookieDate (date) {
  var base = new Date(0);c
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//*****************************************************************
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
//*****************************************************************
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
//*****************************************************************
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
//*****************************************************************************************
function lesen()
  {
     var wert;
     wert = GetCookie("webgen");
     if ( wert == null )
        {
        alert("Kein Wert vorhanden");
        }
     else
        {
        alert(wert);
        }
}
//*****************************************************************************************
// Eigene Funktionen
//*****************************************************************************************
function steuer()
{
if (window.name != 'Steuer')
   {
  window.location.href='Steuer';
   }
}
//*****************************************************************************************
// Eigene Funktionen
//*****************************************************************************************
function steuere()
{
  
if (top.seite.indexOf('.') == -1)
    {
          x = 'A_' + top.seite.charAt(0);
          parent.Steuer.document.getElementById(x).style.color = "#00FF00";
          x = 'A_' + top.seite;
          parent.Steuer.document.getElementById(x).style.color = "#00FF00";
    }
  
}
//********************************************************************************************
function steustart(par1,par2,par3,web)
{
var web='pz3w';
if (top.art == null)
            {
              SetCookie ("steugen",par1);
              SetCookie ("webgen",par2);
              window.location.href='default.htm';
            }
if (top.art == 'Kopf')
            {
               parent.Steuer.document.location.href = par1;
               var e = par1.indexOf('.');
               var a = steu.length;
               top.seite = par1.substring(a,e);
            }
if (top.art == 'Geteilt')
         {
           DeleteCookie ("steugen");
           DeleteCookie ("webgen");
           if (par3 == 'Y')
              {
               parent.SteuerS.document.location.href = par1;
              }
// Link in Ebene1 farblich markieren
  
//  Alle Elemente auf Normal setzen
  for(var i =0; i < parent.Steuer.document.getElementsByTagName('A').length; i++)
   {    
   parent.Steuer.document.getElementsByTagName('A').item(i).style.color = "#405292";
   };
  for(var i =0; i < parent.Steuer.document.getElementsByTagName('TD').length; i++)
   {
      parent.Steuer.document.getElementsByTagName('TD').item(i).style.backgroundColor = "#D2D2D2";
   };
//Ausgewähltes Element auf Aktiv setzen
  var p = web.length;
  x = 'TD_' + par2.charAt(p);
  y = 'A_' + par2.charAt(p);
  parent.Steuer.document.getElementById(y).style.color = "#FF0000";
  parent.Steuer.document.getElementById(x).style.backgroundColor = "#BCBCDE";

          }
}
//********************************************************************************************
function geteilt(par1,par2)
{
if (top.art == null)
            {
              SetCookie ("webgen",par2);
              window.location.href='default.htm';
            }
      else
           {
           parent.SteuerS.document.location.href = par1;
           parent.pz3w.document.location.href = par2;
           }
}
//********************************************************************************************
function geteiltCB(par1,par2)
{
if (top.art == null)
            {
              SetCookie ("webgen",par2);
              window.location.href='default.htm';
            }
      else
           {
           parent.SteuerS.document.location.href = par1;
           parent.pz3w.document.location.href = par2;
           }
}
//********************************************************************************************
function CBGo(Wert)
{
w = Wert.substring(0,1);
if (w == '#')
  {
    w = Wert.substring(1,99);
     window.open(w);
  } 
else 
  {
  parent.pz3w.document.location.href = Wert;
  }
}
//********************************************************************************************
function CBGoOF(Wert)
{
    alert(Wert);
}
//********************************************************************************************
// Aufruf dropdownmen&uuml;. Durch Erweiterung dieser Funktion kann eine
//********************************************************************************************
function drop_down(webname)
{
return true;
}
//********************************************************************************************
// Download einer Datei in die Datenbank schreiben
//********************************************************************************************
function  Downloadmeld(webname, meldung)
{
return true;
}
//********************************************************************************************
// Windowsgröße ändern (onload ereignis)
//********************************************************************************************
function resize(w,h)
   {
     dx = Math.min( w, screen.availWidth  ); 
     dy = Math.min( h, screen.availHeight );
     x = Math.min( ( screen.availWidth - dx ) / 2, 20 );
     y = Math.min( ( screen.availHeight - dy ) / 2, 20 );
     window.moveTo( x, y );
     window.resizeTo( dx, dy );
   }
//************************************************************************************************
// Anzahl Besucher
//************************************************************************************************
function BesucherFunk()
{
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
     xmlHttp.open("GET", "BesucherFunk.php", true);  
    xmlHttp.onreadystatechange = BesucherAntwort;
    xmlHttp.send(null);
  }
  else
    setTimeout('BesucherFunk()', 100);
}
//************************************************************************************************
// Anzahl Besucher
//************************************************************************************************
function BesucherAntwort() 
{
  if (xmlHttp.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHttp.status == 200) 
    {
      xmlResponse = xmlHttp.responseXML;
       xmlDocumentElement = xmlResponse.documentElement;
      BesucherAnz = xmlDocumentElement.firstChild.data;
      document.getElementById("Besucher").innerHTML =    'Besucher: ' + BesucherAnz;
    } 
    else 
    {
       // Problem mit dem Server
        document.getElementById("Besucher").innerHTML =    'Besucher: ??? ' ;
    }
  }
}
//*********************************************************************************************
// Funktion Body Onload
//*********************************************************************************************
function BodyOnload() 
{
var wert=250;
if (wert == 0) 
   return(0);
if (window.innerWidth)
{
// Mozilla
// breite = window.innerWidth;
hoehe = window.innerHeight +20;
}
else
{
// Internet Explorer
// breite = document.body.clientWidth;
hoehe =  document.body.clientHeight;
}
obj = document.getElementById("ANZHOEHE");
if (obj)
   obj.style.height = (hoehe - wert) + "px";
obj = document.getElementById("ANZHOEHEH");
if (obj)
   obj.style.height = (hoehe - wert + 30) + "px";
obj = document.getElementById("ANZHOEHESMH");
if (obj)
   obj.style.height = (hoehe - wert + 15) + "px";
obj = document.getElementById("ANZHOEHESM");
if (obj)
   obj.style.height = (hoehe - wert + 130) + "px";
}
//***********************************************************************************************
// 
//***********************************************************************************************
//var xmlHttp1 = createXmlHttpRequestObject();
function Download(name) 
{
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
   // Funktion muss Synchron aufgerufen werden (firefox bringt sonst Fehler)
    xmlHttp.open("GET", "Downloadphp.php?name=" + name, false); 
    xmlHttp.onreadystatechange = DownloadAntwort;
    xmlHttp.send(null);
  }
  else
    setTimeout('Download(name)', 100);
//return false;
}
//***********************************************************************************************
//
//***********************************************************************************************
function DownloadAntwort()
{
  if (xmlHttp.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHttp.status == 200) 
    {
      xmlResponse = xmlHttp.responseXML;
       xmlDocumentElement = xmlResponse.documentElement;
      Ant = xmlDocumentElement.firstChild.data;
      document.getElementById("Antwort").innerHTML =    'Antwort: ' + Ant;
    } 
    else 
    {
       // Problem mit dem Server
        document.getElementById("Antwort").innerHTML =    'Antwort: ??? ' ;
    }
  }
}
